Spatio.Api.DirectMessages (spatio_sdk v0.0.2)

API calls for all endpoints tagged DirectMessages.

Summary

Functions

Attach a file/image/etc. to an existing DM message.

Enriched DM conversation list with unread + pin + draft state. Native fast-path. Returns conversations augmented with the DM-feature state (unread counts, pinned/muted flags, saved drafts) the renderer's DM UI consumes. The shape is provider-specific and treated as opaque.

List 1:1 and group DM conversations. Returns DM-type conversations only (type: im | mpim). Channel-type conversations are surfaced via /v1/channels.

List messages in a DM conversation.

Discover the action catalog for DirectMessages.

List pinned messages in a DM conversation.

List chat users (DM contacts) across connected accounts.

Mute a DM conversation (until a time, or forever).

Pin a DM conversation to the top of the sidebar.

Parameters

  • connection (Spatio.Connection): Connection to server
  • org (String.t):
  • workspace (String.t):
  • request_body (%{optional(String.t) => any()}):
  • opts (keyword): Optional parameters

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

Parameters

  • connection (Spatio.Connection): Connection to server
  • org (String.t):
  • workspace (String.t):
  • id (String.t):
  • opts (keyword): Optional parameters

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

Parameters

  • connection (Spatio.Connection): Connection to server
  • org (String.t):
  • workspace (String.t):
  • opts (keyword): Optional parameters

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

Parameters

  • connection (Spatio.Connection): Connection to server
  • org (String.t):
  • workspace (String.t):
  • opts (keyword): Optional parameters

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

Parameters

  • connection (Spatio.Connection): Connection to server
  • org (String.t):
  • workspace (String.t):
  • opts (keyword): Optional parameters

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

Parameters

  • connection (Spatio.Connection): Connection to server
  • org (String.t):
  • workspace (String.t):
  • opts (keyword): Optional parameters

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

Parameters

  • connection (Spatio.Connection): Connection to server
  • org (String.t):
  • workspace (String.t):
  • opts (keyword): Optional parameters

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

Parameters

  • connection (Spatio.Connection): Connection to server
  • org (String.t):
  • workspace (String.t):
  • request_body (%{optional(String.t) => any()}):
  • opts (keyword): Optional parameters

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

Functions

add_dm_reaction(connection, message_id, dm_reaction_request, opts \\ [])

React to a DM message.

Parameters

  • connection (Spatio.Connection): Connection to server
  • message_id (String.t): Chat-message id.
  • dm_reaction_request (DmReactionRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Spatio.Model.DmReactionResponse.t} on success
  • {:error, Tesla.Env.t} on failure

attach_to_dm_message(connection, message_id, dm_attach_request, opts \\ [])

@spec attach_to_dm_message(
  Tesla.Env.client(),
  String.t(),
  Spatio.Model.DmAttachRequest.t(),
  keyword()
) ::
  {:ok, Spatio.Model.DmMessageEnvelope.t()}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

Attach a file/image/etc. to an existing DM message.

Parameters

  • connection (Spatio.Connection): Connection to server
  • message_id (String.t): Chat-message id.
  • dm_attach_request (DmAttachRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Spatio.Model.DmMessageEnvelope.t} on success
  • {:error, Tesla.Env.t} on failure

execute_dm_action(connection, execute_chat_action_request, opts \\ [])

Dispatch a DM action by id.

Parameters

  • connection (Spatio.Connection): Connection to server
  • execute_chat_action_request (ExecuteChatActionRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Spatio.Model.ExecuteChatActionResponse.t} on success
  • {:error, Tesla.Env.t} on failure

forward_dm_message(connection, message_id, dm_forward_request, opts \\ [])

Forward a DM message to another DM or channel.

Parameters

  • connection (Spatio.Connection): Connection to server
  • message_id (String.t): Chat-message id.
  • dm_forward_request (DmForwardRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Spatio.Model.DmMessageEnvelope.t} on success
  • {:error, Tesla.Env.t} on failure

get_dm_user(connection, id, opts \\ [])

@spec get_dm_user(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Spatio.Model.GetChatUserResponse.t()}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

Fetch one chat user.

Parameters

  • connection (Spatio.Connection): Connection to server
  • id (String.t): Chat-user id (provider-scoped).
  • opts (keyword): Optional parameters
    • :accountId (String.t):

Returns

  • {:ok, Spatio.Model.GetChatUserResponse.t} on success
  • {:error, Tesla.Env.t} on failure

list_direct_conversations_enriched(connection, opts \\ [])

@spec list_direct_conversations_enriched(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, %{optional(String.t()) => any()}}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

Enriched DM conversation list with unread + pin + draft state. Native fast-path. Returns conversations augmented with the DM-feature state (unread counts, pinned/muted flags, saved drafts) the renderer's DM UI consumes. The shape is provider-specific and treated as opaque.

Parameters

  • connection (Spatio.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :accountId (String.t):
    • :"X-Workspace-ID" (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

list_direct_message_conversations(connection, opts \\ [])

@spec list_direct_message_conversations(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Spatio.Model.ListChannelsResponse.t()}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

List 1:1 and group DM conversations. Returns DM-type conversations only (type: im | mpim). Channel-type conversations are surfaced via /v1/channels.

Parameters

  • connection (Spatio.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :accountIds ([String.t]): Repeatable. Restrict to these connected-account row ids. Mutually orthogonal to providers — when both are set the intersection is used.
    • :providers ([String.t]): Repeatable. Restrict to these provider ids (gmail, outlook).
    • :"X-Workspace-ID" (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
    • :limit (integer()):
    • :cursor (String.t):
    • :includeArchived (boolean()):

Returns

  • {:ok, Spatio.Model.ListChannelsResponse.t} on success
  • {:error, Tesla.Env.t} on failure

list_direct_messages(connection, channel, opts \\ [])

@spec list_direct_messages(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Spatio.Model.ListMessagesResponse.t()}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

List messages in a DM conversation.

Parameters

  • connection (Spatio.Connection): Connection to server
  • channel (String.t): DM conversation id.
  • opts (keyword): Optional parameters
    • :accountId (String.t):
    • :accountIds ([String.t]): Repeatable. Restrict to these connected-account row ids. Mutually orthogonal to providers — when both are set the intersection is used.
    • :providers ([String.t]): Repeatable. Restrict to these provider ids (gmail, outlook).
    • :"X-Workspace-ID" (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
    • :limit (integer()):
    • :cursor (String.t):
    • :oldestFirst (boolean()):

Returns

  • {:ok, Spatio.Model.ListMessagesResponse.t} on success
  • {:error, Tesla.Env.t} on failure

list_dm_actions(connection, opts \\ [])

@spec list_dm_actions(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Spatio.Model.ChatActionsList.t()}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

Discover the action catalog for DirectMessages.

Parameters

  • connection (Spatio.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, Spatio.Model.ChatActionsList.t} on success
  • {:error, Tesla.Env.t} on failure

list_dm_pinned_messages(connection, dm_id, opts \\ [])

@spec list_dm_pinned_messages(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Spatio.Model.DmPinnedList.t()}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

List pinned messages in a DM conversation.

Parameters

  • connection (Spatio.Connection): Connection to server
  • dm_id (String.t): Direct-message conversation id.
  • opts (keyword): Optional parameters
    • :accountId (String.t):

Returns

  • {:ok, Spatio.Model.DmPinnedList.t} on success
  • {:error, Tesla.Env.t} on failure

list_dm_thread_replies(connection, dm_id, message_id, opts \\ [])

@spec list_dm_thread_replies(Tesla.Env.client(), String.t(), String.t(), keyword()) ::
  {:ok, %{optional(String.t()) => any()}}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

List replies in a DM message thread.

Parameters

  • connection (Spatio.Connection): Connection to server
  • dm_id (String.t): Direct-message conversation id.
  • message_id (String.t): Chat-message id.
  • opts (keyword): Optional parameters
    • :accountId (String.t):

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

list_dm_users(connection, opts \\ [])

@spec list_dm_users(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Spatio.Model.ApiError.t()}
  | {:ok, Spatio.Model.ListChatUsersResponse.t()}
  | {:error, Tesla.Env.t()}

List chat users (DM contacts) across connected accounts.

Parameters

  • connection (Spatio.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :accountIds ([String.t]): Repeatable. Restrict to these connected-account row ids. Mutually orthogonal to providers — when both are set the intersection is used.
    • :providers ([String.t]): Repeatable. Restrict to these provider ids (gmail, outlook).
    • :"X-Workspace-ID" (String.t): Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.
    • :limit (integer()):
    • :cursor (String.t):

Returns

  • {:ok, Spatio.Model.ListChatUsersResponse.t} on success
  • {:error, Tesla.Env.t} on failure

mark_dm_read(connection, dm_id, dm_mark_read_request, opts \\ [])

Mark a DM message read.

Parameters

  • connection (Spatio.Connection): Connection to server
  • dm_id (String.t): Direct-message conversation id.
  • dm_mark_read_request (DmMarkReadRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Spatio.Model.SuccessFlag.t} on success
  • {:error, Tesla.Env.t} on failure

mute_dm(connection, dm_id, dm_mute_request, opts \\ [])

Mute a DM conversation (until a time, or forever).

Parameters

  • connection (Spatio.Connection): Connection to server
  • dm_id (String.t): Direct-message conversation id.
  • dm_mute_request (DmMuteRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Spatio.Model.DmMuteResponse.t} on success
  • {:error, Tesla.Env.t} on failure

pin_dm_conversation(connection, dm_id, opts \\ [])

@spec pin_dm_conversation(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Spatio.Model.ApiError.t()}
  | {:ok, Spatio.Model.SuccessFlag.t()}
  | {:error, Tesla.Env.t()}

Pin a DM conversation to the top of the sidebar.

Parameters

  • connection (Spatio.Connection): Connection to server
  • dm_id (String.t): Direct-message conversation id.
  • opts (keyword): Optional parameters
    • :accountId (String.t):

Returns

  • {:ok, Spatio.Model.SuccessFlag.t} on success
  • {:error, Tesla.Env.t} on failure

pin_dm_message(connection, message_id, opts \\ [])

@spec pin_dm_message(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Spatio.Model.ApiError.t()}
  | {:ok, Spatio.Model.SuccessFlag.t()}
  | {:error, Tesla.Env.t()}

Pin a DM message.

Parameters

  • connection (Spatio.Connection): Connection to server
  • message_id (String.t): Chat-message id.
  • opts (keyword): Optional parameters
    • :body (ChannelMembershipRequest):

Returns

  • {:ok, Spatio.Model.SuccessFlag.t} on success
  • {:error, Tesla.Env.t} on failure

post_dm_thread_reply(connection, dm_id, message_id, dm_thread_reply_request, opts \\ [])

Reply in a DM message thread.

Parameters

  • connection (Spatio.Connection): Connection to server
  • dm_id (String.t): Direct-message conversation id.
  • message_id (String.t): Chat-message id.
  • dm_thread_reply_request (DmThreadReplyRequest):
  • opts (keyword): Optional parameters
    • :accountId (String.t):

Returns

  • {:ok, Spatio.Model.DmMessageEnvelope.t} on success
  • {:error, Tesla.Env.t} on failure

remove_dm_reaction(connection, message_id, emoji, opts \\ [])

@spec remove_dm_reaction(Tesla.Env.client(), String.t(), String.t(), keyword()) ::
  {:ok, Spatio.Model.DmReactionResponse.t()}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

Remove a DM message reaction.

Parameters

  • connection (Spatio.Connection): Connection to server
  • message_id (String.t): Chat-message id.
  • emoji (String.t): Reaction emoji (e.g. +1, eyes, pepper).
  • opts (keyword): Optional parameters
    • :accountId (String.t):

Returns

  • {:ok, Spatio.Model.DmReactionResponse.t} on success
  • {:error, Tesla.Env.t} on failure

search_direct_messages(connection, q, opts \\ [])

@spec search_direct_messages(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Spatio.Model.DmSearchResults.t()}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

Search across DM messages.

Parameters

  • connection (Spatio.Connection): Connection to server
  • q (String.t): Free-form query string.
  • opts (keyword): Optional parameters
    • :limit (integer()):
    • :dmId (String.t): Restrict to one conversation.
    • :user (String.t): Restrict to messages from this user id.
    • :accountId (String.t):

Returns

  • {:ok, Spatio.Model.DmSearchResults.t} on success
  • {:error, Tesla.Env.t} on failure

send_direct_message(connection, send_chat_message_request, opts \\ [])

Send a DM.

Parameters

  • connection (Spatio.Connection): Connection to server
  • send_chat_message_request (SendChatMessageRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Spatio.Model.SendChatMessageResponse.t} on success
  • {:error, Tesla.Env.t} on failure

set_dm_draft(connection, dm_id, dm_set_draft_request, opts \\ [])

Save the unsent draft text for a DM.

Parameters

  • connection (Spatio.Connection): Connection to server
  • dm_id (String.t): Direct-message conversation id.
  • dm_set_draft_request (DmSetDraftRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Spatio.Model.SuccessFlag.t} on success
  • {:error, Tesla.Env.t} on failure

unpin_dm_conversation(connection, dm_id, opts \\ [])

@spec unpin_dm_conversation(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Spatio.Model.ApiError.t()}
  | {:ok, Spatio.Model.SuccessFlag.t()}
  | {:error, Tesla.Env.t()}

Unpin a DM conversation.

Parameters

  • connection (Spatio.Connection): Connection to server
  • dm_id (String.t): Direct-message conversation id.
  • opts (keyword): Optional parameters
    • :accountId (String.t):

Returns

  • {:ok, Spatio.Model.SuccessFlag.t} on success
  • {:error, Tesla.Env.t} on failure

unpin_dm_message(connection, message_id, opts \\ [])

@spec unpin_dm_message(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Spatio.Model.ApiError.t()}
  | {:ok, Spatio.Model.SuccessFlag.t()}
  | {:error, Tesla.Env.t()}

Unpin a DM message.

Parameters

  • connection (Spatio.Connection): Connection to server
  • message_id (String.t): Chat-message id.
  • opts (keyword): Optional parameters
    • :accountId (String.t):

Returns

  • {:ok, Spatio.Model.SuccessFlag.t} on success
  • {:error, Tesla.Env.t} on failure

workspace_execute_dm_action(connection, org, workspace, request_body, opts \\ [])

@spec workspace_execute_dm_action(
  Tesla.Env.client(),
  String.t(),
  String.t(),
  %{optional(String.t()) => any()},
  keyword()
) ::
  {:ok, %{optional(String.t()) => any()}}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

Parameters

  • connection (Spatio.Connection): Connection to server
  • org (String.t):
  • workspace (String.t):
  • request_body (%{optional(String.t) => any()}):
  • opts (keyword): Optional parameters

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

workspace_get_dm_user(connection, org, workspace, id, opts \\ [])

@spec workspace_get_dm_user(
  Tesla.Env.client(),
  String.t(),
  String.t(),
  String.t(),
  keyword()
) ::
  {:ok, %{optional(String.t()) => any()}}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

Parameters

  • connection (Spatio.Connection): Connection to server
  • org (String.t):
  • workspace (String.t):
  • id (String.t):
  • opts (keyword): Optional parameters

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

workspace_list_direct_messages(connection, org, workspace, opts \\ [])

@spec workspace_list_direct_messages(
  Tesla.Env.client(),
  String.t(),
  String.t(),
  keyword()
) ::
  {:ok, %{optional(String.t()) => any()}}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

Parameters

  • connection (Spatio.Connection): Connection to server
  • org (String.t):
  • workspace (String.t):
  • opts (keyword): Optional parameters

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

workspace_list_dm_actions(connection, org, workspace, opts \\ [])

@spec workspace_list_dm_actions(Tesla.Env.client(), String.t(), String.t(), keyword()) ::
  {:ok, %{optional(String.t()) => any()}}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

Parameters

  • connection (Spatio.Connection): Connection to server
  • org (String.t):
  • workspace (String.t):
  • opts (keyword): Optional parameters

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

workspace_list_dm_conversations(connection, org, workspace, opts \\ [])

@spec workspace_list_dm_conversations(
  Tesla.Env.client(),
  String.t(),
  String.t(),
  keyword()
) ::
  {:ok, %{optional(String.t()) => any()}}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

Parameters

  • connection (Spatio.Connection): Connection to server
  • org (String.t):
  • workspace (String.t):
  • opts (keyword): Optional parameters

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

workspace_list_dm_messages(connection, org, workspace, opts \\ [])

@spec workspace_list_dm_messages(
  Tesla.Env.client(),
  String.t(),
  String.t(),
  keyword()
) ::
  {:ok, %{optional(String.t()) => any()}}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

Parameters

  • connection (Spatio.Connection): Connection to server
  • org (String.t):
  • workspace (String.t):
  • opts (keyword): Optional parameters

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

workspace_list_dm_users(connection, org, workspace, opts \\ [])

@spec workspace_list_dm_users(Tesla.Env.client(), String.t(), String.t(), keyword()) ::
  {:ok, %{optional(String.t()) => any()}}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

Parameters

  • connection (Spatio.Connection): Connection to server
  • org (String.t):
  • workspace (String.t):
  • opts (keyword): Optional parameters

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure

workspace_send_direct_message(connection, org, workspace, request_body, opts \\ [])

@spec workspace_send_direct_message(
  Tesla.Env.client(),
  String.t(),
  String.t(),
  %{optional(String.t()) => any()},
  keyword()
) ::
  {:ok, %{optional(String.t()) => any()}}
  | {:ok, Spatio.Model.ApiError.t()}
  | {:error, Tesla.Env.t()}

Parameters

  • connection (Spatio.Connection): Connection to server
  • org (String.t):
  • workspace (String.t):
  • request_body (%{optional(String.t) => any()}):
  • opts (keyword): Optional parameters

Returns

  • {:ok, %{}} on success
  • {:error, Tesla.Env.t} on failure