XmtpElixirSdk (xmtp_elixir_sdk v0.1.2)

Copy Markdown

The main entrypoint for the XMTP Elixir SDK.

If you are new to the SDK, start here. A typical flow looks like this:

  1. Start a runtime with start_runtime/1.
  2. Create or build a client with create_client/3 or build_client/3.
  3. Open or create conversations through XmtpElixirSdk.Conversations.
  4. Send and read messages through XmtpElixirSdk.Messages.
  5. Manage group state through XmtpElixirSdk.Groups.

The SDK is split into small modules on purpose:

Summary

Functions

api_urls()

@spec api_urls() :: %{optional(XmtpElixirSdk.Types.env()) => String.t()}

See XmtpElixirSdk.Constants.api_urls/0.

build_client(runtime, identifier, opts \\ [])

can_message(runtime, identifiers)

@spec can_message(XmtpElixirSdk.Runtime.t() | atom(), [
  XmtpElixirSdk.Types.Identifier.t()
]) ::
  {:ok, map()} | {:error, XmtpElixirSdk.Error.t()}

create_client(runtime, identifier, opts \\ [])

generate_inbox_id(identifier, kind, nonce \\ 1)

@spec generate_inbox_id(
  XmtpElixirSdk.Types.Identifier.t(),
  non_neg_integer(),
  non_neg_integer()
) ::
  {:ok, String.t()}

get_inbox_id_for_identifier(runtime, identifier)

@spec get_inbox_id_for_identifier(
  XmtpElixirSdk.Runtime.t() | atom(),
  XmtpElixirSdk.Types.Identifier.t()
) :: {:ok, String.t() | nil} | {:error, XmtpElixirSdk.Error.t()}

history_sync_urls()

@spec history_sync_urls() :: %{optional(XmtpElixirSdk.Types.env()) => String.t()}

See XmtpElixirSdk.Constants.history_sync_urls/0.

metadata_field_from_name(name)

@spec metadata_field_from_name(String.t()) ::
  {:ok, XmtpElixirSdk.Types.metadata_field()}
  | {:error, XmtpElixirSdk.Error.t()}

See XmtpElixirSdk.Constants.metadata_field_from_name/1.

metadata_field_name(field)

@spec metadata_field_name(XmtpElixirSdk.Types.metadata_field()) :: String.t()

See XmtpElixirSdk.Constants.metadata_field_name/1.

ns_to_datetime(ns)

@spec ns_to_datetime(non_neg_integer()) :: DateTime.t()

See XmtpElixirSdk.Date.ns_to_datetime/1.

runtime(name)

@spec runtime(atom()) :: XmtpElixirSdk.Runtime.t()

start_runtime(opts)

@spec start_runtime(keyword()) :: Supervisor.on_start()

to_safe_conversation(conversation)

See XmtpElixirSdk.Conversions.to_safe_conversation/1.