lib/spatio/model/block_content.ex

# NOTE: This file is auto generated by OpenAPI Generator 7.22.0 (https://openapi-generator.tech).
# Do not edit this file manually.

defmodule Spatio.Model.BlockContent do
  @moduledoc """
  Type-specific payload for a block. Fields populated depend on `Block.type`. All fields are optional at the schema level; the runtime enforces the per-type contract.  Note: this object uses snake_case keys to match the JSON the Go `providers.BlockContent` struct emits and accepts. Other parts of the SpatioAPI use camelCase; blocks are the exception because the block model is shared with external Notion-like providers whose canonical wire format is snake_case. 
  """

  @derive JSON.Encoder
  defstruct [
    :rich_text,
    :language,
    :checked,
    :icon,
    :color,
    :url,
    :caption,
    :alt_text,
    :embed_url,
    :cells,
    :expression
  ]

  @type t :: %__MODULE__{
    :rich_text => [Spatio.Model.RichTextObject.t] | nil,
    :language => String.t | nil,
    :checked => boolean() | nil,
    :icon => String.t | nil,
    :color => String.t | nil,
    :url => Uri | nil,
    :caption => String.t | nil,
    :alt_text => String.t | nil,
    :embed_url => Uri | nil,
    :cells => [[Spatio.Model.RichTextObject.t]] | nil,
    :expression => String.t | nil
  }

  alias Spatio.Deserializer

  def decode(value) do
    value
     |> Deserializer.deserialize(:rich_text, :list, Spatio.Model.RichTextObject)
     |> Deserializer.deserialize(:url, :struct, Spatio.Model.Uri)
     |> Deserializer.deserialize(:embed_url, :struct, Spatio.Model.Uri)
  end
end