Slackblocks.Blocks.Image (slackblocks v2.8.0)

View Source

A standalone image with alternative text and an optional title.

Slack reference: https://docs.slack.dev/reference/block-kit/blocks/image-block

Fields

  • image_url — Sets the publicly accessible URL of the image. Cannot be combined with a Slack file. Optional; nil omits the field.
  • slack_file — Sets a file hosted in Slack as the image source. Cannot be combined with an image URL. Optional; nil omits the field.
  • alt_text — Sets a plain-text summary of the image or video for assistive technology. Required.
  • title — Sets the title shown above the image. Optional; nil omits the field.
  • block_id — Sets a unique identifier for this block. Slack returns it in interaction payloads, so use a stable value when you need to find the block again. Optional; nil omits the field.

Summary

Functions

Atomically replaces supplied fields; omitted fields retain their values.

Constructs and validates a value. Text conveniences apply to keyword input.

Constructs a value or raises Slackblocks.ValidationError.

Types

t()

@type t() :: %Slackblocks.Blocks.Image{
  alt_text: binary(),
  block_id: binary() | nil,
  image_url: binary() | nil,
  slack_file: Slackblocks.Objects.SlackFile.t() | nil,
  title: Slackblocks.Objects.PlainText.t() | nil
}

Functions

change(value, options)

@spec change(
  t(),
  keyword()
) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}

Atomically replaces supplied fields; omitted fields retain their values.

change!(value, options)

@spec change!(
  t(),
  keyword()
) :: t()

Replaces fields or raises Slackblocks.ValidationError.

new(options)

@spec new(keyword()) :: {:ok, t()} | {:error, Slackblocks.ValidationError.t()}

Constructs and validates a value. Text conveniences apply to keyword input.

new!(options)

@spec new!(keyword()) :: t()

Constructs a value or raises Slackblocks.ValidationError.