libduvet/model/conversation
Types
What a call notice ([message_type.call]) says about its call: who was in it, and when.
pub type CallNotice {
CallNotice(
participants: List(String),
started_at: timestamp.Timestamp,
ended_at: timestamp.Timestamp,
)
}
Constructors
-
CallNotice( participants: List(String), started_at: timestamp.Timestamp, ended_at: timestamp.Timestamp, )Arguments
- participants
-
Who was in the call, by user ID: its caller first, whether or not they joined its voice, then each member who joined its voice, once.
- started_at
-
When the call started: when it began to ring.
- ended_at
-
When the call ended.
pub type Conversation {
Conversation(
id: String,
type_: conversation_type.ConversationType,
name: option.Option(String),
owner_id: String,
created_at: timestamp.Timestamp,
updated_at: timestamp.Timestamp,
deleted_at: option.Option(timestamp.Timestamp),
members: List(ConversationMember),
)
}
Constructors
-
Conversation( id: String, type_: conversation_type.ConversationType, name: option.Option(String), owner_id: String, created_at: timestamp.Timestamp, updated_at: timestamp.Timestamp, deleted_at: option.Option(timestamp.Timestamp), members: List(ConversationMember), )
pub type ConversationMember {
ConversationMember(
id: String,
conversation_id: String,
user_id: String,
created_at: timestamp.Timestamp,
updated_at: timestamp.Timestamp,
client_status: option.Option(client_status.ClientStatus),
user: option.Option(ConversationUser),
status_id: option.Option(user_status.UserStatus),
)
}
Constructors
-
ConversationMember( id: String, conversation_id: String, user_id: String, created_at: timestamp.Timestamp, updated_at: timestamp.Timestamp, client_status: option.Option(client_status.ClientStatus), user: option.Option(ConversationUser), status_id: option.Option(user_status.UserStatus), )Arguments
- client_status
-
The platforms the member is connected on, with their status. None while they’re offline, and from a server before client statuses.
- user
-
None in the member that adding one answers when the conversation’s list doesn’t have them yet.
- status_id
-
The member’s status when the API handed them out. None where the API leaves it out.
The user that conversation members and DMs carry: the API’s public user.
pub type ConversationUser {
ConversationUser(
id: String,
username: String,
alias: option.Option(String),
avatar: option.Option(String),
banner: option.Option(String),
badges: option.Option(Int),
is_bot: Bool,
custom: String,
flags: Int,
email_verified: option.Option(Bool),
created_at: option.Option(timestamp.Timestamp),
updated_at: option.Option(timestamp.Timestamp),
deleted_at: option.Option(timestamp.Timestamp),
)
}
Constructors
-
ConversationUser( id: String, username: String, alias: option.Option(String), avatar: option.Option(String), banner: option.Option(String), badges: option.Option(Int), is_bot: Bool, custom: String, flags: Int, email_verified: option.Option(Bool), created_at: option.Option(timestamp.Timestamp), updated_at: option.Option(timestamp.Timestamp), deleted_at: option.Option(timestamp.Timestamp), )Arguments
- custom
-
The bio, empty when there’s none.
- created_at
-
When the account was made and last changed: None only in a user built without them, as the API always sends them.
- deleted_at
-
When the account was deleted; None while it isn’t.
pub type DirectMessage {
DirectMessage(
id: String,
conversation_id: option.Option(String),
author_id: String,
content: option.Option(String),
type_: message_type.MessageType,
created_at: timestamp.Timestamp,
updated_at: timestamp.Timestamp,
nonce: option.Option(String),
user: option.Option(ConversationUser),
referenced_message: option.Option(message.ReferencedMessage),
embeds: option.Option(List(embed.Embed)),
attachments: option.Option(List(attachment.Attachment)),
reactions: option.Option(List(message.MessageReaction)),
sticker_attachment_id: option.Option(String),
pinned_at: option.Option(timestamp.Timestamp),
call: option.Option(CallNotice),
)
}
Constructors
-
DirectMessage( id: String, conversation_id: option.Option(String), author_id: String, content: option.Option(String), type_: message_type.MessageType, created_at: timestamp.Timestamp, updated_at: timestamp.Timestamp, nonce: option.Option(String), user: option.Option(ConversationUser), referenced_message: option.Option(message.ReferencedMessage), embeds: option.Option(List(embed.Embed)), attachments: option.Option(List(attachment.Attachment)), reactions: option.Option(List(message.MessageReaction)), sticker_attachment_id: option.Option(String), pinned_at: option.Option(timestamp.Timestamp), call: option.Option(CallNotice), )Arguments
- author_id
-
Always set for a DM: the API’s type allows null only because webhook room messages share the table.
- pinned_at
-
When it was pinned; None while it isn’t.
- call
-
What a call notice says about its call; None on every other message.
pub type Friend {
Friend(
id: String,
request_id: String,
sender_id: String,
recipient_id: String,
user_username: String,
user_alias: option.Option(String),
user_avatar: option.Option(String),
user_banner: option.Option(String),
user: option.Option(user.GatewayUser),
status_id: option.Option(user_status.UserStatus),
client_status: option.Option(client_status.ClientStatus),
)
}
Constructors
-
Friend( id: String, request_id: String, sender_id: String, recipient_id: String, user_username: String, user_alias: option.Option(String), user_avatar: option.Option(String), user_banner: option.Option(String), user: option.Option(user.GatewayUser), status_id: option.Option(user_status.UserStatus), client_status: option.Option(client_status.ClientStatus), )
A friend request, with the other user’s details. The request that sending one answers is the bare request, without them.
pub type FriendRequest {
FriendRequest(
id: String,
sender_id: String,
recipient_id: String,
created_at: timestamp.Timestamp,
updated_at: timestamp.Timestamp,
user_username: option.Option(String),
user_alias: option.Option(String),
user_avatar: option.Option(String),
user_banner: option.Option(String),
user: option.Option(user.GatewayUser),
)
}
Constructors
-
FriendRequest( id: String, sender_id: String, recipient_id: String, created_at: timestamp.Timestamp, updated_at: timestamp.Timestamp, user_username: option.Option(String), user_alias: option.Option(String), user_avatar: option.Option(String), user_banner: option.Option(String), user: option.Option(user.GatewayUser), )
FRIEND_REQUEST_ACCEPT: the friendship the request made.
pub type FriendRequestAcceptEvent {
FriendRequestAcceptEvent(
id: String,
request_id: String,
sender_id: String,
recipient_id: String,
user: option.Option(user.GatewayUser),
status_id: option.Option(user_status.UserStatus),
client_status: option.Option(client_status.ClientStatus),
)
}
Constructors
-
FriendRequestAcceptEvent( id: String, request_id: String, sender_id: String, recipient_id: String, user: option.Option(user.GatewayUser), status_id: option.Option(user_status.UserStatus), client_status: option.Option(client_status.ClientStatus), )Arguments
- status_id
-
The status the user shows. None from an API before it.
- client_status
-
The platforms the user is connected on, with their status.
FRIEND_REQUEST_CREATE: a friend request was sent. Both sides get it.
pub type FriendRequestCreateEvent {
FriendRequestCreateEvent(
id: String,
sender_id: String,
recipient_id: option.Option(String),
username: String,
alias: option.Option(String),
avatar: option.Option(String),
banner: option.Option(String),
user: option.Option(user.GatewayUser),
)
}
Constructors
-
FriendRequestCreateEvent( id: String, sender_id: String, recipient_id: option.Option(String), username: String, alias: option.Option(String), avatar: option.Option(String), banner: option.Option(String), user: option.Option(user.GatewayUser), )Arguments
- recipient_id
-
The user the request was sent to. None from an API before it.
- user
-
The other side’s public profile.
Values
pub fn call_notice_duration(
notice: CallNotice,
) -> duration.Duration
How long the call lasted, ringing included.
pub fn call_notice_from_json(
object: dict.Dict(String, dynamic.Dynamic),
) -> CallNotice
pub fn conversation_from_json(
object: dict.Dict(String, dynamic.Dynamic),
) -> Conversation
pub fn conversation_member_from_json(
object: dict.Dict(String, dynamic.Dynamic),
) -> ConversationMember
pub fn conversation_user_from_json(
object: dict.Dict(String, dynamic.Dynamic),
) -> ConversationUser
pub fn direct_message_from_json(
object: dict.Dict(String, dynamic.Dynamic),
) -> DirectMessage
pub fn friend_from_json(
object: dict.Dict(String, dynamic.Dynamic),
) -> Friend
pub fn friend_request_accept_event_from_json(
object: dict.Dict(String, dynamic.Dynamic),
) -> FriendRequestAcceptEvent
pub fn friend_request_create_event_from_json(
object: dict.Dict(String, dynamic.Dynamic),
) -> FriendRequestCreateEvent
pub fn friend_request_from_json(
object: dict.Dict(String, dynamic.Dynamic),
) -> FriendRequest