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

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

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

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

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

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

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

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

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
✨ Search Document