libduvet/model/rest

Types

pub type Application {
  Application(
    id: String,
    team_id: String,
    name: String,
    description: option.Option(String),
    icon: option.Option(String),
    public: Bool,
    bot_user_id: option.Option(String),
    bot_token_hash: option.Option(String),
    created_at: timestamp.Timestamp,
    updated_at: timestamp.Timestamp,
  )
}

Constructors

A chat command an application registers.

pub type ApplicationCommand {
  ApplicationCommand(
    id: String,
    type_: Int,
    application_id: String,
    name: String,
    description: String,
    options: List(CommandOption),
    version: String,
  )
}

Constructors

  • ApplicationCommand(
      id: String,
      type_: Int,
      application_id: String,
      name: String,
      description: String,
      options: List(CommandOption),
      version: String,
    )

    Arguments

    type_

    1, a chat command.

What creating or updating a storage bucket takes.

pub type BucketPayload {
  BucketPayload(
    name: String,
    endpoint: String,
    region: option.Option(String),
    bucket_name: String,
    access_key_id: String,
    secret_access_key: String,
    use_path_style: option.Option(Bool),
    max_bytes: option.Option(Int),
    upload_limit_bytes: option.Option(Int),
  )
}

Constructors

  • BucketPayload(
      name: String,
      endpoint: String,
      region: option.Option(String),
      bucket_name: String,
      access_key_id: String,
      secret_access_key: String,
      use_path_style: option.Option(Bool),
      max_bytes: option.Option(Int),
      upload_limit_bytes: option.Option(Int),
    )
pub type CommandChoice {
  CommandChoice(name: String, value: json_value.JsonValue)
}

Constructors

What a command takes; the required ones come first.

pub type CommandOption {
  CommandOption(
    type_: Int,
    name: String,
    description: String,
    required: Bool,
    choices: option.Option(List(CommandChoice)),
    min_value: option.Option(Float),
    max_value: option.Option(Float),
    min_length: option.Option(Int),
    max_length: option.Option(Int),
    room_types: option.Option(List(room_type.RoomType)),
  )
}

Constructors

What a person sends about the command they used.

pub type CommandUse {
  CommandUse(id: String, name: String, options: List(UsedOption))
}

Constructors

  • CommandUse(id: String, name: String, options: List(UsedOption))

What a person sends about the component of a bot’s message they used.

pub type ComponentUse {
  ComponentUse(
    custom_id: String,
    component_type: Int,
    values: option.Option(List(String)),
  )
}

Constructors

  • ComponentUse(
      custom_id: String,
      component_type: Int,
      values: option.Option(List(String)),
    )

    Arguments

    values

    What a select’s choice was: its options’ values, or the IDs of the members, roles or rooms.

What creating a space answers: the space, and the rooms the API makes with it (a text and a voice room).

pub type CreatedSpace {
  CreatedSpace(
    space: space.GatewaySpace,
    rooms: List(space.GatewayRoom),
  )
}

Constructors

What a person’s interaction answers: the type of the bot’s first response and, when the bot opened a modal, the modal and the application its submit goes to.

pub type InteractionReply {
  InteractionReply(
    type_: Int,
    modal: option.Option(dict.Dict(String, dynamic.Dynamic)),
    application_id: option.Option(String),
  )
}

Constructors

  • InteractionReply(
      type_: Int,
      modal: option.Option(dict.Dict(String, dynamic.Dynamic)),
      application_id: option.Option(String),
    )

    Arguments

    type_

    An [interaction_callback_type] value.

    modal

    The modal, as the API sends it: its custom_id, title and components.

    application_id

    The application whose bot opened the modal.

pub type InviteInfo {
  InviteInfo(
    code: String,
    space_id: String,
    space_name: String,
    description: String,
    member_count: Int,
  )
}

Constructors

  • InviteInfo(
      code: String,
      space_id: String,
      space_name: String,
      description: String,
      member_count: Int,
    )
pub type InviteLink {
  InviteLink(
    id: String,
    code: String,
    room_id: String,
    created_by: String,
    created_at: timestamp.Timestamp,
    updated_at: timestamp.Timestamp,
    expires_at: option.Option(timestamp.Timestamp),
  )
}

Constructors

A message search. The values of each list are alternatives; different filters must all match.

pub type MessageSearch {
  MessageSearch(
    query: option.Option(String),
    author_ids: List(String),
    mentions: List(String),
    room_ids: List(String),
    has: List(String),
    pinned: option.Option(Bool),
    before: option.Option(timestamp.Timestamp),
    after: option.Option(timestamp.Timestamp),
    cursor: option.Option(String),
  )
}

Constructors

pub type MessageSearchResponse(t) {
  MessageSearchResponse(total_results: Int, messages: List(t))
}

Constructors

  • MessageSearchResponse(total_results: Int, messages: List(t))

    Arguments

    total_results

    All the pages’ messages, counted up to 1000.

    messages

    This page, newest first.

pub type SpaceCommandApplication {
  SpaceCommandApplication(
    id: String,
    name: String,
    bot: user.InteractionUser,
  )
}

Constructors

The commands a member can use in a space: those of the applications whose bots are in it.

pub type SpaceCommands {
  SpaceCommands(
    applications: List(SpaceCommandApplication),
    commands: List(ApplicationCommand),
  )
}

Constructors

pub type SpaceMemberWithUser {
  SpaceMemberWithUser(
    id: String,
    space_id: String,
    user_id: String,
    alias: option.Option(String),
    created_at: timestamp.Timestamp,
    updated_at: timestamp.Timestamp,
    deleted_at: option.Option(timestamp.Timestamp),
    user: user.GatewayUser,
    max_pos: option.Option(Int),
  )
}

Constructors

An S3-compatible bucket a user or a space keeps its files in.

pub type StorageBucket {
  StorageBucket(
    id: String,
    owner_id: String,
    name: String,
    endpoint: String,
    region: String,
    bucket_name: String,
    access_key_id: String,
    is_active: Bool,
    is_default: Bool,
    use_path_style: Bool,
    max_bytes: option.Option(Int),
    upload_limit_bytes: option.Option(Int),
    used_bytes: Int,
    created_at: timestamp.Timestamp,
    updated_at: timestamp.Timestamp,
  )
}

Constructors

  • StorageBucket(
      id: String,
      owner_id: String,
      name: String,
      endpoint: String,
      region: String,
      bucket_name: String,
      access_key_id: String,
      is_active: Bool,
      is_default: Bool,
      use_path_style: Bool,
      max_bytes: option.Option(Int),
      upload_limit_bytes: option.Option(Int),
      used_bytes: Int,
      created_at: timestamp.Timestamp,
      updated_at: timestamp.Timestamp,
    )
pub type StorageStatus {
  StorageStatus(
    used_bytes: Int,
    max_bytes: Int,
    upload_limit_bytes: Int,
    percentage_used: Float,
  )
}

Constructors

  • StorageStatus(
      used_bytes: Int,
      max_bytes: Int,
      upload_limit_bytes: Int,
      percentage_used: Float,
    )

A move of a user’s or a space’s files from one of its storages to another.

pub type StorageTransfer {
  StorageTransfer(
    id: String,
    owner_id: String,
    started_by: String,
    source_bucket_id: option.Option(String),
    target_bucket_id: option.Option(String),
    keep_source: Bool,
    same_bucket: Bool,
    status: Int,
    error: option.Option(String),
    total_files: Int,
    total_bytes: Int,
    moved_files: Int,
    moved_bytes: Int,
    skipped_files: Int,
    failed_files: Int,
    created_at: timestamp.Timestamp,
    started_at: option.Option(timestamp.Timestamp),
    finished_at: option.Option(timestamp.Timestamp),
    updated_at: timestamp.Timestamp,
  )
}

Constructors

  • StorageTransfer(
      id: String,
      owner_id: String,
      started_by: String,
      source_bucket_id: option.Option(String),
      target_bucket_id: option.Option(String),
      keep_source: Bool,
      same_bucket: Bool,
      status: Int,
      error: option.Option(String),
      total_files: Int,
      total_bytes: Int,
      moved_files: Int,
      moved_bytes: Int,
      skipped_files: Int,
      failed_files: Int,
      created_at: timestamp.Timestamp,
      started_at: option.Option(timestamp.Timestamp),
      finished_at: option.Option(timestamp.Timestamp),
      updated_at: timestamp.Timestamp,
    )

    Arguments

    owner_id

    The user or the space whose files move.

    started_by

    Who started it: the only one its STORAGE_TRANSFER_UPDATEs reach.

    keep_source

    The originals stay in the source.

    same_bucket

    The source and the target are one bucket under two configurations.

    status

    A [storage_transfer_status] value.

    error

    Why it failed; None otherwise.

    skipped_files

    Left where they were: deleted meanwhile, moved by something else, or too large for the target.

pub type Team {
  Team(
    id: String,
    name: String,
    owner_id: String,
    created_at: timestamp.Timestamp,
    updated_at: timestamp.Timestamp,
  )
}

Constructors

pub type TeamInvite {
  TeamInvite(
    id: String,
    team_id: String,
    user_id: String,
    invited_by: String,
    created_at: timestamp.Timestamp,
    team_name: String,
    invited_by_username: String,
  )
}

Constructors

  • TeamInvite(
      id: String,
      team_id: String,
      user_id: String,
      invited_by: String,
      created_at: timestamp.Timestamp,
      team_name: String,
      invited_by_username: String,
    )
pub type TeamMember {
  TeamMember(
    team_id: String,
    user_id: String,
    role: Int,
    username: String,
    avatar: option.Option(String),
  )
}

Constructors

  • TeamMember(
      team_id: String,
      user_id: String,
      role: Int,
      username: String,
      avatar: option.Option(String),
    )

    Arguments

    role

    A [team_role] value.

A command option’s value, as it is sent.

pub type UsedOption {
  UsedOption(
    name: String,
    type_: Int,
    value: json_value.JsonValue,
  )
}

Constructors

  • UsedOption(name: String, type_: Int, value: json_value.JsonValue)

    Arguments

    type_

    A [command_option_type] value.

    value

    A string, a number or a bool.

pub type Webhook {
  Webhook(
    id: String,
    room_id: String,
    username: String,
    avatar: option.Option(String),
    created_at: timestamp.Timestamp,
    updated_at: timestamp.Timestamp,
  )
}

Constructors

pub type WebhookCreateResponse {
  WebhookCreateResponse(webhook: Webhook, token: String)
}

Constructors

  • WebhookCreateResponse(webhook: Webhook, token: String)

Values

pub fn application_command_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> ApplicationCommand
pub fn application_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> Application
pub fn bucket_payload_to_json(
  payload: BucketPayload,
) -> json.Json
pub fn command_choice_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> CommandChoice
pub fn command_option_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> CommandOption
pub fn command_use_to_json(command: CommandUse) -> json.Json
pub fn component_use_to_json(
  component: ComponentUse,
) -> json.Json
pub fn created_space_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> CreatedSpace
pub fn created_space_id(created: CreatedSpace) -> String

The space’s ID.

pub fn empty_message_search() -> MessageSearch
pub fn interaction_reply_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> InteractionReply
pub fn interaction_reply_is_modal(
  reply: InteractionReply,
) -> Bool

Whether the bot opened a modal: then modal and application_id are set.

pub fn invite_info_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> InviteInfo
pub fn invite_link_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> InviteLink
pub fn message_search_query(
  search: MessageSearch,
) -> List(#(String, String))

The search’s query parameters: each list’s values repeat its key.

pub fn message_search_response_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
  read: fn(dict.Dict(String, dynamic.Dynamic)) -> t,
) -> MessageSearchResponse(t)
pub fn space_command_application_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> SpaceCommandApplication
pub fn space_commands_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> SpaceCommands
pub fn space_member_with_user_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> SpaceMemberWithUser
pub fn storage_bucket_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> StorageBucket
pub fn storage_status_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> StorageStatus
pub fn storage_transfer_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> StorageTransfer
pub fn team_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> Team
pub fn team_invite_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> TeamInvite
pub fn team_member_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> TeamMember
pub fn used_option_to_json(option: UsedOption) -> json.Json
pub fn webhook_create_response_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> WebhookCreateResponse
pub fn webhook_from_json(
  object: dict.Dict(String, dynamic.Dynamic),
) -> Webhook
✨ Search Document