Spatio.Api.DirectMessages (spatio_sdk v0.0.2)
API calls for all endpoints tagged DirectMessages.
Summary
Functions
React to a DM message.
Attach a file/image/etc. to an existing DM message.
Dispatch a DM action by id.
Forward a DM message to another DM or channel.
Fetch one chat user.
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 replies in a DM message thread.
List chat users (DM contacts) across connected accounts.
Mark a DM message read.
Mute a DM conversation (until a time, or forever).
Pin a DM conversation to the top of the sidebar.
Pin a DM message.
Reply in a DM message thread.
Remove a DM message reaction.
Search across DM messages.
Save the unsent draft text for a DM.
Unpin a DM conversation.
Unpin a DM message.
Parameters
connection(Spatio.Connection): Connection to serverorg(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 serverorg(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 serverorg(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 serverorg(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 serverorg(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 serverorg(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 serverorg(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 serverorg(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
@spec add_dm_reaction( Tesla.Env.client(), String.t(), Spatio.Model.DmReactionRequest.t(), keyword() ) :: {:ok, Spatio.Model.DmReactionResponse.t()} | {:ok, Spatio.Model.ApiError.t()} | {:error, Tesla.Env.t()}
React to a DM message.
Parameters
connection(Spatio.Connection): Connection to servermessage_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
@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 servermessage_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
@spec execute_dm_action( Tesla.Env.client(), Spatio.Model.ExecuteChatActionRequest.t(), keyword() ) :: {:ok, Spatio.Model.ExecuteChatActionResponse.t()} | {:ok, Spatio.Model.ApiError.t()} | {:error, Tesla.Env.t()}
Dispatch a DM action by id.
Parameters
connection(Spatio.Connection): Connection to serverexecute_chat_action_request(ExecuteChatActionRequest):opts(keyword): Optional parameters
Returns
{:ok, Spatio.Model.ExecuteChatActionResponse.t}on success{:error, Tesla.Env.t}on failure
@spec forward_dm_message( Tesla.Env.client(), String.t(), Spatio.Model.DmForwardRequest.t(), keyword() ) :: {:ok, Spatio.Model.DmMessageEnvelope.t()} | {:ok, Spatio.Model.ApiError.t()} | {:error, Tesla.Env.t()}
Forward a DM message to another DM or channel.
Parameters
connection(Spatio.Connection): Connection to servermessage_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
@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 serverid(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
@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 serveropts(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
@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 serveropts(keyword): Optional parameters:accountIds([String.t]): Repeatable. Restrict to these connected-account row ids. Mutually orthogonal toproviders— 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
@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 serverchannel(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 toproviders— 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
@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 serveropts(keyword): Optional parameters
Returns
{:ok, Spatio.Model.ChatActionsList.t}on success{:error, Tesla.Env.t}on failure
@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 serverdm_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
@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 serverdm_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
@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 serveropts(keyword): Optional parameters:accountIds([String.t]): Repeatable. Restrict to these connected-account row ids. Mutually orthogonal toproviders— 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
@spec mark_dm_read( Tesla.Env.client(), String.t(), Spatio.Model.DmMarkReadRequest.t(), keyword() ) :: {:ok, Spatio.Model.ApiError.t()} | {:ok, Spatio.Model.SuccessFlag.t()} | {:error, Tesla.Env.t()}
Mark a DM message read.
Parameters
connection(Spatio.Connection): Connection to serverdm_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
@spec mute_dm( Tesla.Env.client(), String.t(), Spatio.Model.DmMuteRequest.t(), keyword() ) :: {:ok, Spatio.Model.DmMuteResponse.t()} | {:ok, Spatio.Model.ApiError.t()} | {:error, Tesla.Env.t()}
Mute a DM conversation (until a time, or forever).
Parameters
connection(Spatio.Connection): Connection to serverdm_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
@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 serverdm_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
@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 servermessage_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
@spec post_dm_thread_reply( Tesla.Env.client(), String.t(), String.t(), Spatio.Model.DmThreadReplyRequest.t(), keyword() ) :: {:ok, Spatio.Model.DmMessageEnvelope.t()} | {:ok, Spatio.Model.ApiError.t()} | {:error, Tesla.Env.t()}
Reply in a DM message thread.
Parameters
connection(Spatio.Connection): Connection to serverdm_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
@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 servermessage_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
@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 serverq(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
@spec send_direct_message( Tesla.Env.client(), Spatio.Model.SendChatMessageRequest.t(), keyword() ) :: {:ok, Spatio.Model.SendChatMessageResponse.t()} | {:ok, Spatio.Model.ApiError.t()} | {:error, Tesla.Env.t()}
Send a DM.
Parameters
connection(Spatio.Connection): Connection to serversend_chat_message_request(SendChatMessageRequest):opts(keyword): Optional parameters
Returns
{:ok, Spatio.Model.SendChatMessageResponse.t}on success{:error, Tesla.Env.t}on failure
@spec set_dm_draft( Tesla.Env.client(), String.t(), Spatio.Model.DmSetDraftRequest.t(), keyword() ) :: {:ok, Spatio.Model.ApiError.t()} | {:ok, Spatio.Model.SuccessFlag.t()} | {:error, Tesla.Env.t()}
Save the unsent draft text for a DM.
Parameters
connection(Spatio.Connection): Connection to serverdm_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
@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 serverdm_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
@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 servermessage_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
@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 serverorg(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
@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 serverorg(String.t):workspace(String.t):id(String.t):opts(keyword): Optional parameters
Returns
{:ok, %{}}on success{:error, Tesla.Env.t}on failure
@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 serverorg(String.t):workspace(String.t):opts(keyword): Optional parameters
Returns
{:ok, %{}}on success{:error, Tesla.Env.t}on failure
@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 serverorg(String.t):workspace(String.t):opts(keyword): Optional parameters
Returns
{:ok, %{}}on success{:error, Tesla.Env.t}on failure
@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 serverorg(String.t):workspace(String.t):opts(keyword): Optional parameters
Returns
{:ok, %{}}on success{:error, Tesla.Env.t}on failure
@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 serverorg(String.t):workspace(String.t):opts(keyword): Optional parameters
Returns
{:ok, %{}}on success{:error, Tesla.Env.t}on failure
@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 serverorg(String.t):workspace(String.t):opts(keyword): Optional parameters
Returns
{:ok, %{}}on success{:error, Tesla.Env.t}on failure
@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 serverorg(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