libduvet/model/event

Types

pub type CallEndedEvent {
  CallEndedEvent(conversation_id: String)
}

Constructors

  • CallEndedEvent(conversation_id: String)
pub type CallIncomingEvent {
  CallIncomingEvent(
    conversation_id: String,
    initiator_id: String,
    initiator_name: String,
    initiator_avatar: option.Option(String),
  )
}

Constructors

  • CallIncomingEvent(
      conversation_id: String,
      initiator_id: String,
      initiator_name: String,
      initiator_avatar: option.Option(String),
    )

CALL_ONGOING: a call goes on in one of the user’s conversations without ringing them.

pub type CallOngoingEvent {
  CallOngoingEvent(
    conversation_id: String,
    initiator_id: String,
    voice_states: option.Option(List(ready.CallVoiceState)),
  )
}

Constructors

  • CallOngoingEvent(
      conversation_id: String,
      initiator_id: String,
      voice_states: option.Option(List(ready.CallVoiceState)),
    )

    Arguments

    voice_states

    Who is in the call’s voice: None while nobody is.

CALL_OUTGOING: a call the user started, sent to each of their sessions.

pub type CallOutgoingEvent {
  CallOutgoingEvent(conversation_id: String)
}

Constructors

  • CallOutgoingEvent(conversation_id: String)
pub type CallResponseEvent {
  CallResponseEvent(conversation_id: String, user_id: String)
}

Constructors

  • CallResponseEvent(conversation_id: String, user_id: String)
pub type ConversationDeleteEvent {
  ConversationDeleteEvent(id: String)
}

Constructors

  • ConversationDeleteEvent(id: String)
pub type ConversationMemberAddEvent {
  ConversationMemberAddEvent(
    conversation_id: String,
    user_id: String,
    member_id: String,
    username: option.Option(String),
    alias: option.Option(String),
    avatar: option.Option(String),
    banner: option.Option(String),
    status_id: option.Option(user_status.UserStatus),
    user: option.Option(user.GatewayUser),
    client_status: option.Option(client_status.ClientStatus),
  )
}

Constructors

pub type ConversationMemberRemoveEvent {
  ConversationMemberRemoveEvent(
    conversation_id: String,
    user_id: String,
  )
}

Constructors

  • ConversationMemberRemoveEvent(
      conversation_id: String,
      user_id: String,
    )

CONVERSATION_UPDATE: a group’s name and owner as they are now.

pub type ConversationUpdateEvent {
  ConversationUpdateEvent(
    id: String,
    name: option.Option(String),
    owner_id: option.Option(String),
  )
}

Constructors

  • ConversationUpdateEvent(
      id: String,
      name: option.Option(String),
      owner_id: option.Option(String),
    )

    Arguments

    owner_id

    The member who took over, when a group’s owner left. None from an API before it.

DM_MENTION_CREATE: the user was mentioned in a message of a conversation.

pub type DMMentionCreateEvent {
  DMMentionCreateEvent(
    message_id: String,
    conversation_id: String,
    author_id: String,
  )
}

Constructors

  • DMMentionCreateEvent(
      message_id: String,
      conversation_id: String,
      author_id: String,
    )

    Arguments

    author_id

    Who wrote the message.

pub type DMMessageDeleteEvent {
  DMMessageDeleteEvent(id: String, conversation_id: String)
}

Constructors

  • DMMessageDeleteEvent(id: String, conversation_id: String)

DM_MESSAGE_PIN_UPDATE: a message of a conversation was pinned or unpinned.

pub type DMMessagePinUpdateEvent {
  DMMessagePinUpdateEvent(
    id: String,
    conversation_id: String,
    pinned_at: option.Option(timestamp.Timestamp),
  )
}

Constructors

  • DMMessagePinUpdateEvent(
      id: String,
      conversation_id: String,
      pinned_at: option.Option(timestamp.Timestamp),
    )

    Arguments

    pinned_at

    When it was pinned; None once it’s unpinned.

pub type DMTypingEvent {
  DMTypingEvent(
    conversation_id: String,
    user_id: String,
    username: String,
    alias: option.Option(String),
    avatar: option.Option(String),
  )
}

Constructors

  • DMTypingEvent(
      conversation_id: String,
      user_id: String,
      username: String,
      alias: option.Option(String),
      avatar: option.Option(String),
    )
pub type FriendRemoveEvent {
  FriendRemoveEvent(user_id: String)
}

Constructors

  • FriendRemoveEvent(user_id: String)

FRIEND_REQUEST_REJECT: the request, rejected by its recipient or cancelled by its sender.

pub type FriendRequestRejectEvent {
  FriendRequestRejectEvent(id: String)
}

Constructors

  • FriendRequestRejectEvent(id: String)
pub type GatewayMessageDelete {
  GatewayMessageDelete(id: String, room_id: String)
}

Constructors

  • GatewayMessageDelete(id: String, room_id: String)
pub type GatewaySpaceCreatePayload {
  GatewaySpaceCreatePayload(
    space: space.GatewaySpace,
    rooms: dict.Dict(String, space.GatewayRoom),
    roles_permissions: dict.Dict(String, space.GatewayRole),
    member_roles: dict.Dict(String, List(String)),
    overwrites: option.Option(
      dict.Dict(String, List(space.GatewayRoomOverwrite)),
    ),
    owner_id: String,
    voice_states: option.Option(List(space.GatewayVoiceState)),
    member_statuses: dict.Dict(String, user_status.UserStatus),
    member_client_status: dict.Dict(
      String,
      client_status.ClientStatus,
    ),
    activities: dict.Dict(String, List(activity.Activity)),
    read_states: dict.Dict(String, space.RoomReadState),
  )
}

Constructors

pub type GatewayUserStatusUpdate {
  GatewayUserStatusUpdate(
    user_id: String,
    status_id: user_status.UserStatus,
    space_id: option.Option(String),
    client_status: option.Option(client_status.ClientStatus),
  )
}

Constructors

  • GatewayUserStatusUpdate(
      user_id: String,
      status_id: user_status.UserStatus,
      space_id: option.Option(String),
      client_status: option.Option(client_status.ClientStatus),
    )

    Arguments

    space_id

    The space this status is for: a bot also has one per space. None for a status that holds everywhere: a person’s, or a bot’s overall one.

    client_status

    The platforms the user is connected on now, with their status.

pub type GuildMemberAddEvent {
  GuildMemberAddEvent(
    space_id: String,
    user_id: String,
    member_id: String,
    user: option.Option(user.GatewayUser),
  )
}

Constructors

pub type GuildMemberRemoveEvent {
  GuildMemberRemoveEvent(
    space_id: String,
    user_id: String,
    member_id: String,
  )
}

Constructors

  • GuildMemberRemoveEvent(
      space_id: String,
      user_id: String,
      member_id: String,
    )

WEBRTC_ICE_CANDIDATE: one of the gateway’s ICE candidates.

pub type IceCandidateEvent {
  IceCandidateEvent(room_id: String, candidate: IceCandidateInit)
}

Constructors

An ICE candidate, as RTCIceCandidateInit (and pion’s ICECandidateInit) write it.

pub type IceCandidateInit {
  IceCandidateInit(
    candidate: String,
    sdp_mid: option.Option(String),
    sdp_m_line_index: option.Option(Int),
    username_fragment: option.Option(String),
  )
}

Constructors

  • IceCandidateInit(
      candidate: String,
      sdp_mid: option.Option(String),
      sdp_m_line_index: option.Option(Int),
      username_fragment: option.Option(String),
    )

    Arguments

    candidate

    The candidate: attribute line.

pub type MemberRoleEvent {
  MemberRoleEvent(
    member_id: String,
    role_id: String,
    space_id: option.Option(String),
  )
}

Constructors

  • MemberRoleEvent(
      member_id: String,
      role_id: String,
      space_id: option.Option(String),
    )

    Arguments

    space_id

    None in MEMBER_ROLE_REMOVE, which doesn’t carry it.

MENTION_CREATE: the user was mentioned in a message of a room.

pub type MentionCreateEvent {
  MentionCreateEvent(
    message_id: String,
    room_id: String,
    author_id: String,
    conversation_id: option.Option(String),
  )
}

Constructors

  • MentionCreateEvent(
      message_id: String,
      room_id: String,
      author_id: String,
      conversation_id: option.Option(String),
    )

    Arguments

    author_id

    Who wrote the message.

    conversation_id

    Never set by the API: a conversation’s mentions come as DM_MENTION_CREATE.

MESSAGE_PIN_UPDATE: a message of a room was pinned or unpinned.

pub type MessagePinUpdateEvent {
  MessagePinUpdateEvent(
    id: String,
    room_id: String,
    pinned_at: option.Option(timestamp.Timestamp),
  )
}

Constructors

  • MessagePinUpdateEvent(
      id: String,
      room_id: String,
      pinned_at: option.Option(timestamp.Timestamp),
    )

    Arguments

    pinned_at

    When it was pinned; None once it’s unpinned.

pub type OverwriteDeleteEvent {
  OverwriteDeleteEvent(room_id: String, target_id: String)
}

Constructors

  • OverwriteDeleteEvent(room_id: String, target_id: String)
pub type ReactionEvent {
  ReactionEvent(
    message_id: String,
    user_id: String,
    emoji_name: String,
    emoji_id: option.Option(String),
  )
}

Constructors

  • ReactionEvent(
      message_id: String,
      user_id: String,
      emoji_name: String,
      emoji_id: option.Option(String),
    )
pub type ReactionRemoveEvent {
  ReactionRemoveEvent(
    message_id: String,
    user_id: String,
    emoji_name: String,
  )
}

Constructors

  • ReactionRemoveEvent(
      message_id: String,
      user_id: String,
      emoji_name: String,
    )

WEBRTC_RENEGOTIATE_ANSWER: the gateway’s answer to the client’s own renegotiation.

pub type RenegotiateAnswerEvent {
  RenegotiateAnswerEvent(
    room_id: String,
    answer: option.Option(SessionDescription),
  )
}

Constructors

WEBRTC_RENEGOTIATE: the gateway’s offer for a room’s or call’s peer connection.

pub type RenegotiateOfferEvent {
  RenegotiateOfferEvent(
    room_id: String,
    offer: SessionDescription,
  )
}

Constructors

pub type RoleDeleteEvent {
  RoleDeleteEvent(id: String, space_id: String)
}

Constructors

  • RoleDeleteEvent(id: String, space_id: String)
pub type RoomDeleteEvent {
  RoomDeleteEvent(id: String, space_id: String)
}

Constructors

  • RoomDeleteEvent(id: String, space_id: String)

ROOM_REORDER: every room of a space, with its position and parent, after one of them moved.

pub type RoomReorderEvent {
  RoomReorderEvent(rooms: List(space.GatewayRoom))
}

Constructors

A WebRTC session description: an offer or an answer.

pub type SessionDescription {
  SessionDescription(type_: String, sdp: String)
}

Constructors

  • SessionDescription(type_: String, sdp: String)

    Arguments

    type_

    “offer”, “pranswer”, “answer” or “rollback”.

pub type SpaceAssetDeleteEvent {
  SpaceAssetDeleteEvent(id: String, space_id: String)
}

Constructors

  • SpaceAssetDeleteEvent(id: String, space_id: String)
pub type SpaceDeleteEvent {
  SpaceDeleteEvent(id: String)
}

Constructors

  • SpaceDeleteEvent(id: String)

SPACE_MEMBER_ADD and SPACE_MEMBER_REMOVE: someone joined or left a space.

pub type SpaceMemberEvent {
  SpaceMemberEvent(
    member_id: String,
    space_id: String,
    user_id: option.Option(String),
    status_id: option.Option(user_status.UserStatus),
    client_status: option.Option(client_status.ClientStatus),
    user: option.Option(user.GatewayUser),
  )
}

Constructors

pub type TypingEvent {
  TypingEvent(
    user_id: String,
    username: String,
    alias: option.Option(String),
    avatar: option.Option(String),
    room_id: String,
  )
}

Constructors

USER_ACTIVITY_UPDATE: a user’s activities changed.

pub type UserActivityUpdateEvent {
  UserActivityUpdateEvent(
    user_id: String,
    activities: List(activity.Activity),
  )
}

Constructors

  • UserActivityUpdateEvent(
      user_id: String,
      activities: List(activity.Activity),
    )

    Arguments

    activities

    Empty when they cleared them.

pub type UserUpdateEvent {
  UserUpdateEvent(
    id: String,
    username: String,
    alias: option.Option(String),
    avatar: option.Option(String),
    banner: option.Option(String),
    custom: option.Option(String),
    flags: option.Option(Int),
    badges: option.Option(Int),
  )
}

Constructors

  • UserUpdateEvent(
      id: String,
      username: String,
      alias: option.Option(String),
      avatar: option.Option(String),
      banner: option.Option(String),
      custom: option.Option(String),
      flags: option.Option(Int),
      badges: option.Option(Int),
    )

    Arguments

    custom

    The bio, empty when there’s none. None from an API from before bios.

    flags

    The flags and badges as they are now. None from an API that leaves them out.

VOICE_JOINED: the gateway’s answer to joining a voice room or a call.

pub type VoiceJoinedEvent {
  VoiceJoinedEvent(
    room_id: String,
    answer: option.Option(SessionDescription),
  )
}

Constructors

VOICE_SESSION_REPLACED: this session is no longer in a room or call’s voice.

pub type VoiceSessionReplacedEvent {
  VoiceSessionReplacedEvent(
    room_id: String,
    reason: option.Option(String),
  )
}

Constructors

  • VoiceSessionReplacedEvent(
      room_id: String,
      reason: option.Option(String),
    )

    Arguments

    reason

    None when another device of the user’s joined it.

VOICE_STATE_UPDATE: a user’s whole voice state in a space’s voice room or a conversation’s call, or that they left it (joined false).

pub type VoiceStateEvent {
  VoiceStateEvent(
    room_id: String,
    user_id: String,
    joined: Bool,
    muted: Bool,
    deafened: Bool,
    screen_sharing: Bool,
    camera: Bool,
    version: Int,
  )
}

Constructors

  • VoiceStateEvent(
      room_id: String,
      user_id: String,
      joined: Bool,
      muted: Bool,
      deafened: Bool,
      screen_sharing: Bool,
      camera: Bool,
      version: Int,
    )

    Arguments

    camera

    Their camera is on.

VOICE_VIDEO_REFUSED: the gateway refused or stopped one of the user’s videos.

pub type VoiceVideoRefusedEvent {
  VoiceVideoRefusedEvent(
    room_id: String,
    kind: String,
    reason: String,
    limit: option.Option(Int),
  )
}

Constructors

  • VoiceVideoRefusedEvent(
      room_id: String,
      kind: String,
      reason: String,
      limit: option.Option(Int),
    )

    Arguments

    kind

    “camera” or “screen”.

    limit

    How many cameras the room can have on: with “limit” only.

Values

pub fn call_ended_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> CallEndedEvent
pub fn call_incoming_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> CallIncomingEvent
pub fn call_ongoing_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> CallOngoingEvent
pub fn call_outgoing_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> CallOutgoingEvent
pub fn call_response_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> CallResponseEvent
pub fn conversation_delete_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> ConversationDeleteEvent
pub fn conversation_member_add_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> ConversationMemberAddEvent
pub fn conversation_member_remove_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> ConversationMemberRemoveEvent
pub fn conversation_update_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> ConversationUpdateEvent
pub fn dm_mention_create_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> DMMentionCreateEvent
pub fn dm_message_delete_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> DMMessageDeleteEvent
pub fn dm_message_pin_update_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> DMMessagePinUpdateEvent
pub fn dm_typing_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> DMTypingEvent
pub fn friend_remove_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> FriendRemoveEvent
pub fn friend_request_reject_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> FriendRequestRejectEvent
pub fn guild_member_add_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> GuildMemberAddEvent
pub fn guild_member_remove_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> GuildMemberRemoveEvent
pub fn ice_candidate_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> IceCandidateEvent
pub fn ice_candidate_init_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> IceCandidateInit
pub fn ice_candidate_init_to_json(
  candidate: IceCandidateInit,
) -> json.Json
pub fn member_role_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> MemberRoleEvent
pub fn mention_create_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> MentionCreateEvent
pub fn message_delete_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> GatewayMessageDelete
pub fn message_pin_update_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> MessagePinUpdateEvent
pub fn overwrite_delete_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> OverwriteDeleteEvent
pub fn reaction_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> ReactionEvent
pub fn reaction_remove_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> ReactionRemoveEvent
pub fn renegotiate_answer_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> RenegotiateAnswerEvent
pub fn renegotiate_offer_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> RenegotiateOfferEvent
pub fn role_delete_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> RoleDeleteEvent
pub fn room_delete_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> RoomDeleteEvent
pub fn room_reorder_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> RoomReorderEvent
pub fn session_description_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> SessionDescription
pub fn session_description_to_json(
  description: SessionDescription,
) -> json.Json
pub fn space_asset_delete_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> SpaceAssetDeleteEvent
pub fn space_create_payload_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> GatewaySpaceCreatePayload
pub fn space_delete_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> SpaceDeleteEvent
pub fn space_member_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> SpaceMemberEvent
pub fn typing_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> TypingEvent
pub fn user_activity_update_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> UserActivityUpdateEvent
pub fn user_status_update_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> GatewayUserStatusUpdate
pub fn user_update_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> UserUpdateEvent
pub fn voice_joined_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> VoiceJoinedEvent
pub fn voice_session_replaced_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> VoiceSessionReplacedEvent
pub fn voice_state_update_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> VoiceStateEvent
pub fn voice_video_refused_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> VoiceVideoRefusedEvent
✨ Search Document