Bonfire.API.MastoCompat.Schemas.Conversation (Bonfire v1.0.1-social-alpha.28)

View Source

Mastodon Conversation entity schema definition.

Based on the Mastodon API OpenAPI spec (mastodon-openapi.yaml lines 2482-2505). Represents a conversation with "direct message" visibility.

Summary

Functions

Returns the default values for all Conversation fields.

Returns a new Conversation map with default values. Can optionally merge custom values via the overrides parameter.

List of required fields per the Mastodon OpenAPI specification.

Validates that all required fields are present and non-nil. Returns {:ok, conversation} or {:error, {:missing_fields, fields}}.

Functions

defaults()

Returns the default values for all Conversation fields.

Required fields (per Mastodon OpenAPI spec):

  • id: Local database ID of the conversation
  • accounts: Participants in the conversation
  • unread: Is the conversation currently marked as unread?

Optional fields:

  • last_status: The most recent status in the conversation

new(overrides \\ %{})

Returns a new Conversation map with default values. Can optionally merge custom values via the overrides parameter.

Examples

iex> Conversation.new(%{"id" => "123", "accounts" => [account]})
%{"id" => "123", "accounts" => [account], "unread" => false, ...}

required_fields()

List of required fields per the Mastodon OpenAPI specification.

validate(conversation)

Validates that all required fields are present and non-nil. Returns {:ok, conversation} or {:error, {:missing_fields, fields}}.