Store
Models
Users
The Users model type is used to store all chat users.
Name | Data type | Description |
---|---|---|
byId | { [userId: string]: User } | A map of all fetched users by ID |
fetching | boolean | True if currently fetching users |
current | IUser | The current logged in chat user |
User
The User model type defines a single instance of a user
Name | Data type | Description |
---|---|---|
id | string | The unique user id |
username | string | User’s username |
display_name | string|undefined | User’s display name |
description | string|undefined | User’s bio and/or details |
created_at | Date | The date the user was created |
updated_at | Date | The date the user was last updated |
image | string|undefined | URL or base64 encoded string of the user’s avatar |
last_seen | Date | The last time a user was active |
status | OnlineStatus | The current status of the user |
Chats
The Chats model type is used to store all the chats: DMs and Channels
Name | Data type | Description |
---|---|---|
byId | { [chatId: string]: Chat } | A map of all fetched chats by ID |
fetching | boolean | True if currently fetching chats |
Chat
The Chat model type is used to define a specific chat, whether DM or channel
Name | Data type | Description |
---|---|---|
id | string | The unique chat id |
created_at | Date | The date the chat was created |
updated_at | Date | The date the chat was last updated |
members | Member[] | A list of members that belong to the chat |
kind | ChatType | The type of chat |
name | string|undefined | The name of chat |
description | string|undefined | The description of chat |
image | string|undefined | URL or base64 encoded string of the chat |
_private | boolean | True if a private chat. If false, any user can join the channel. |
last_message | Message|undefined | The last sent message of the chat |
joining | boolean|undefined | True if current user is in the process of joining the chat |
unread_count | number | The number of unread messages by the user of this chat |
users_typing | User[] | The users that are currently typing |
messages | MessageList | List of messages |
outgoing | Message[]|undefined | Messages that are currently being sent |
invites | User[]|undefined | Users that have been invited to the channel, but not yet joined |
Messages
The Messages model type is used to store all the messages
Name | Data type | Description |
---|---|---|
byId | { [chatId: string]: Message } | A map of all fetched messages by ID |
fetching | boolean | True if currently fetching messages |
Message
The Message model type is used to define a specific message
Name | Data type | Description |
---|---|---|
id | string | The unique message id |
created_at | Date | The date the message was created |
updated_at | Date | The date the message was last updated |
text | string|undefined | The textual portion of the message |
user | User | The sender |
parent_id | string|undefined | The id of the parent message in the event this message is within a thread |
chat_id | string | Id of the chat |
replies | Message[]|undefined | The array of replies to this message |
reply_count | number | Number of replies |
reactions | string[]|undefined | Message reactions and the users they belong to |
attachments | Attachment[]|undefined | The attachments sent with the message |
mentions | Mention[]|undefined | The message mentions |
status | string|undefined | sending or sent |
favorite | boolean | True if current user marked as favorite |
system | SystemMessageType|undefined | System message type |