slackline/attachment

This module is generated by gleam run -m slackline_codegen/generate. Do not edit it by hand.

Legacy secondary message attachments.

Slack recommends Block Kit instead. Attachments are still the only way to get a colored side bar, and you can put blocks inside them. Apps mostly read attachments from the messages of other apps, so every field is optional.

Reference: https://docs.slack.dev/legacy/legacy-messaging/legacy-secondary-message-attachments

Types

A legacy secondary attachment.

pub type Attachment {
  Attachment(
    blocks: option.Option(List(block.Block)),
    color: option.Option(String),
    fallback: option.Option(String),
    callback_id: option.Option(String),
    actions: option.Option(List(AttachmentAction)),
    attachment_type: option.Option(String),
    author_name: option.Option(String),
    author_link: option.Option(String),
    author_icon: option.Option(String),
    title: option.Option(String),
    title_link: option.Option(String),
    pretext: option.Option(String),
    text: option.Option(String),
    fields: option.Option(List(AttachmentField)),
    image_url: option.Option(String),
    thumb_url: option.Option(String),
    footer: option.Option(String),
    footer_icon: option.Option(String),
    ts: option.Option(AttachmentTs),
    mrkdwn_in: option.Option(List(String)),
    id: option.Option(Int),
    thumb_width: option.Option(Int),
    thumb_height: option.Option(Int),
    service_name: option.Option(String),
  )
}

Constructors

  • Attachment(
      blocks: option.Option(List(block.Block)),
      color: option.Option(String),
      fallback: option.Option(String),
      callback_id: option.Option(String),
      actions: option.Option(List(AttachmentAction)),
      attachment_type: option.Option(String),
      author_name: option.Option(String),
      author_link: option.Option(String),
      author_icon: option.Option(String),
      title: option.Option(String),
      title_link: option.Option(String),
      pretext: option.Option(String),
      text: option.Option(String),
      fields: option.Option(List(AttachmentField)),
      image_url: option.Option(String),
      thumb_url: option.Option(String),
      footer: option.Option(String),
      footer_icon: option.Option(String),
      ts: option.Option(AttachmentTs),
      mrkdwn_in: option.Option(List(String)),
      id: option.Option(Int),
      thumb_width: option.Option(Int),
      thumb_height: option.Option(Int),
      service_name: option.Option(String),
    )

    Arguments

    blocks

    Blocks to show inside the attachment.

    color

    Side bar color: good, warning, danger or a hex code like #439FE0.

    fallback

    A plain-text summary for clients that cannot show attachments.

    callback_id

    Identifies the attachment’s buttons. Required when using actions.

    actions

    Up to 5 buttons or menus.

    attachment_type

    Always default.

    author_name

    Small text with the author’s name.

    author_link

    A URL that links the author_name.

    author_icon

    A 16x16 image shown left of author_name.

    title

    Large title text.

    title_link

    A URL that links the title.

    pretext

    Text above the attachment.

    text

    The main body text.

    fields

    Fields shown in a table.

    image_url

    An image shown at the bottom. Cannot be used with thumb_url.

    thumb_url

    A thumbnail shown on the right.

    footer

    Brief text in the footer. Up to 300 characters.

    footer_icon

    A 16x16 image shown beside the footer.

    ts

    A Unix timestamp shown in the footer.

    mrkdwn_in

    Field names formatted with mrkdwn: pretext, text, fields.

    id

    The attachment index Slack assigns.

    thumb_width

    Thumbnail width Slack reports.

    thumb_height

    Thumbnail height Slack reports.

    service_name

    The unfurled service’s name.

A legacy message button or menu. https://docs.slack.dev/legacy/legacy-messaging/legacy-interactive-message-field-guide#action_fields

pub type AttachmentAction {
  AttachmentAction(
    action_type: AttachmentActionType,
    name: option.Option(String),
    text: option.Option(String),
    value: option.Option(String),
    id: option.Option(String),
    confirm: option.Option(AttachmentConfirmation),
    style: option.Option(AttachmentActionStyle),
    options: option.Option(List(AttachmentOption)),
    option_groups: option.Option(List(AttachmentOptionGroup)),
    data_source: option.Option(AttachmentDataSource),
    selected_options: option.Option(List(AttachmentOption)),
    min_query_length: option.Option(Int),
    url: option.Option(String),
  )
}

Constructors

Styles of legacy message buttons.

pub type AttachmentActionStyle {
  ActionDefault
  ActionPrimary
  ActionDanger
  UnknownAttachmentActionStyle(String)
}

Constructors

  • ActionDefault

    default

  • ActionPrimary

    primary

  • ActionDanger

    danger

  • UnknownAttachmentActionStyle(String)

    A value that this version of slackline does not know.

Kinds of legacy attachment actions.

pub type AttachmentActionType {
  Button
  Select
  UnknownAttachmentActionType(String)
}

Constructors

  • Button

    A message button.

  • Select

    A message menu.

  • UnknownAttachmentActionType(String)

    A value that this version of slackline does not know.

A legacy confirmation dialog for attachment actions.

pub type AttachmentConfirmation {
  AttachmentConfirmation(
    title: option.Option(String),
    text: String,
    ok_text: option.Option(String),
    dismiss_text: option.Option(String),
  )
}

Constructors

  • AttachmentConfirmation(
      title: option.Option(String),
      text: String,
      ok_text: option.Option(String),
      dismiss_text: option.Option(String),
    )

    Arguments

    title

    Title of the pop up window.

    text

    The consequences of the action.

    ok_text

    The continue button label. Defaults to Okay.

    dismiss_text

    The cancel button label. Defaults to Cancel.

Where a legacy message menu gets its options.

pub type AttachmentDataSource {
  SourceStatic
  SourceUsers
  SourceChannels
  SourceConversations
  SourceExternal
  SourceDefault
  UnknownAttachmentDataSource(String)
}

Constructors

  • SourceStatic

    static

  • SourceUsers

    users

  • SourceChannels

    channels

  • SourceConversations

    conversations

  • SourceExternal

    external

  • SourceDefault

    default

  • UnknownAttachmentDataSource(String)

    A value that this version of slackline does not know.

A field shown in the table of an attachment.

pub type AttachmentField {
  AttachmentField(
    title: option.Option(String),
    value: option.Option(String),
    short: option.Option(Bool),
  )
}

Constructors

  • AttachmentField(
      title: option.Option(String),
      value: option.Option(String),
      short: option.Option(Bool),
    )

    Arguments

    title

    A bold heading. Cannot contain markup.

    value

    The value. Uses mrkdwn when fields is listed in mrkdwn_in.

    short

    Whether the field is short enough to sit side by side with others. Defaults to false.

An option of a legacy message menu.

pub type AttachmentOption {
  AttachmentOption(
    text: String,
    value: String,
    description: option.Option(String),
  )
}

Constructors

  • AttachmentOption(
      text: String,
      value: String,
      description: option.Option(String),
    )

    Arguments

    text

    The user-facing label.

    value

    The value sent to your Action URL.

    description

    More details about the option.

A group of options of a legacy message menu.

pub type AttachmentOptionGroup {
  AttachmentOptionGroup(
    text: String,
    options: List(AttachmentOption),
  )
}

Constructors

  • AttachmentOptionGroup(
      text: String,
      options: List(AttachmentOption),
    )

    Arguments

    text

    The group label.

A timestamp. The docs use an integer, but Slack also sends strings.

pub type AttachmentTs {
  IntTs(Int)
  StringTs(String)
}

Constructors

  • IntTs(Int)
  • StringTs(String)

Values

pub fn attachment_action_decoder() -> decode.Decoder(
  AttachmentAction,
)

Decodes AttachmentAction from json.

pub fn attachment_action_style_decoder() -> decode.Decoder(
  AttachmentActionStyle,
)

Decodes AttachmentActionStyle from a json string.

pub fn attachment_action_style_from_string(
  string: String,
) -> AttachmentActionStyle

Parses AttachmentActionStyle from its json string.

pub fn attachment_action_style_to_json(
  it: AttachmentActionStyle,
) -> json.Json

Encodes AttachmentActionStyle as a json string.

pub fn attachment_action_style_to_string(
  it: AttachmentActionStyle,
) -> String

The json string of AttachmentActionStyle.

pub fn attachment_action_to_json(
  it: AttachmentAction,
) -> json.Json

Encodes AttachmentAction as json.

pub fn attachment_action_type_decoder() -> decode.Decoder(
  AttachmentActionType,
)

Decodes AttachmentActionType from a json string.

pub fn attachment_action_type_from_string(
  string: String,
) -> AttachmentActionType

Parses AttachmentActionType from its json string.

pub fn attachment_action_type_to_json(
  it: AttachmentActionType,
) -> json.Json

Encodes AttachmentActionType as a json string.

pub fn attachment_action_type_to_string(
  it: AttachmentActionType,
) -> String

The json string of AttachmentActionType.

pub fn attachment_confirmation_decoder() -> decode.Decoder(
  AttachmentConfirmation,
)

Decodes AttachmentConfirmation from json.

pub fn attachment_confirmation_to_json(
  it: AttachmentConfirmation,
) -> json.Json

Encodes AttachmentConfirmation as json.

pub fn attachment_data_source_decoder() -> decode.Decoder(
  AttachmentDataSource,
)

Decodes AttachmentDataSource from a json string.

pub fn attachment_data_source_from_string(
  string: String,
) -> AttachmentDataSource

Parses AttachmentDataSource from its json string.

pub fn attachment_data_source_to_json(
  it: AttachmentDataSource,
) -> json.Json

Encodes AttachmentDataSource as a json string.

pub fn attachment_data_source_to_string(
  it: AttachmentDataSource,
) -> String

The json string of AttachmentDataSource.

pub fn attachment_decoder() -> decode.Decoder(Attachment)

Decodes Attachment from json.

pub fn attachment_field_decoder() -> decode.Decoder(
  AttachmentField,
)

Decodes AttachmentField from json.

pub fn attachment_field_to_json(it: AttachmentField) -> json.Json

Encodes AttachmentField as json.

pub fn attachment_option_decoder() -> decode.Decoder(
  AttachmentOption,
)

Decodes AttachmentOption from json.

pub fn attachment_option_group_decoder() -> decode.Decoder(
  AttachmentOptionGroup,
)

Decodes AttachmentOptionGroup from json.

pub fn attachment_option_group_to_json(
  it: AttachmentOptionGroup,
) -> json.Json

Encodes AttachmentOptionGroup as json.

pub fn attachment_option_to_json(
  it: AttachmentOption,
) -> json.Json

Encodes AttachmentOption as json.

pub fn attachment_to_json(it: Attachment) -> json.Json

Encodes Attachment as json.

pub fn attachment_ts_decoder() -> decode.Decoder(AttachmentTs)

Decodes AttachmentTs from json. It tries each alternative in order.

pub fn attachment_ts_to_json(it: AttachmentTs) -> json.Json

Encodes AttachmentTs as json.

✨ Search Document