Chatto.Api.V1.ThreadService (chatto v0.1.0)

Copy Markdown View Source

Manages thread follow state for the current user.

Summary

Functions

Reads up to 100 states under the same authorization as GetThreadReadState. Missing and inaccessible resources are omitted; duplicates use first-seen order.

Follows a thread for the current user. Room membership plus message.read or an active relationship with message.read-interactions are required. Followed threads can be surfaced in clients and can participate in thread notification behavior.

Returns one page of events in a message thread. Room membership is required. Reads also require message.read or an active relationship with message.read-interactions. Initial pages include the thread root message; cursor pages return replies in the requested direction.

Returns a thread timeline window centered around a specific event. Use this to open a reply from a notification or search result in context. Returns NOT_FOUND when the thread root or anchor event is missing or hidden. Returns PERMISSION_DENIED when room membership is missing, both read modes are missing, or an interaction-scoped account has no relationship with the thread.

Reads the current viewer's stored marker without changing it. Requires the same membership and read access as MarkThreadAsRead. Missing resources return NOT_FOUND; inaccessible resources return PERMISSION_DENIED.

Returns followed threads in rooms where the current user is a member. All threads also require message.read or an active relationship with message.read-interactions. Direct-message threads are returned only when include_direct_message_threads is true. The result includes enough root and latest-reply data for clients to render the list without extra per-thread fetches. Activity can reorder the live result between offset pages. After a thread activity update, clients must restart paging at offset zero.

Lists distinct authors of non-retracted replies, excluding erased users. Each author appears once. Requires the same membership and message-read access as GetThreadEvents.

Marks a thread timeline as read through the supplied event without changing the room-level read marker. Room membership plus message.read or an active relationship with message.read-interactions are required.

Stops following a thread for the current user. Room membership plus message.read or an active relationship with message.read-interactions are required. The response reports the resulting follow state so clients can update local UI immediately.

Functions

batch_get_thread_read_states(client, request)

@spec batch_get_thread_read_states(
  Req.Request.t(),
  Chatto.Api.V1.BatchGetThreadReadStatesRequest.t()
) ::
  {:ok, Chatto.Api.V1.BatchGetThreadReadStatesResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Reads up to 100 states under the same authorization as GetThreadReadState. Missing and inaccessible resources are omitted; duplicates use first-seen order.

follow_thread(client, request)

@spec follow_thread(Req.Request.t(), Chatto.Api.V1.FollowThreadRequest.t()) ::
  {:ok, Chatto.Api.V1.FollowThreadResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Follows a thread for the current user. Room membership plus message.read or an active relationship with message.read-interactions are required. Followed threads can be surfaced in clients and can participate in thread notification behavior.

get_thread_events(client, request)

@spec get_thread_events(Req.Request.t(), Chatto.Api.V1.GetThreadEventsRequest.t()) ::
  {:ok, Chatto.Api.V1.GetThreadEventsResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Returns one page of events in a message thread. Room membership is required. Reads also require message.read or an active relationship with message.read-interactions. Initial pages include the thread root message; cursor pages return replies in the requested direction.

get_thread_events_around(client, request)

@spec get_thread_events_around(
  Req.Request.t(),
  Chatto.Api.V1.GetThreadEventsAroundRequest.t()
) ::
  {:ok, Chatto.Api.V1.GetThreadEventsAroundResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Returns a thread timeline window centered around a specific event. Use this to open a reply from a notification or search result in context. Returns NOT_FOUND when the thread root or anchor event is missing or hidden. Returns PERMISSION_DENIED when room membership is missing, both read modes are missing, or an interaction-scoped account has no relationship with the thread.

get_thread_read_state(client, request)

@spec get_thread_read_state(
  Req.Request.t(),
  Chatto.Api.V1.GetThreadReadStateRequest.t()
) ::
  {:ok, Chatto.Api.V1.GetThreadReadStateResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Reads the current viewer's stored marker without changing it. Requires the same membership and read access as MarkThreadAsRead. Missing resources return NOT_FOUND; inaccessible resources return PERMISSION_DENIED.

list_followed_threads(client, request)

@spec list_followed_threads(
  Req.Request.t(),
  Chatto.Api.V1.ListFollowedThreadsRequest.t()
) ::
  {:ok, Chatto.Api.V1.ListFollowedThreadsResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Returns followed threads in rooms where the current user is a member. All threads also require message.read or an active relationship with message.read-interactions. Direct-message threads are returned only when include_direct_message_threads is true. The result includes enough root and latest-reply data for clients to render the list without extra per-thread fetches. Activity can reorder the live result between offset pages. After a thread activity update, clients must restart paging at offset zero.

list_thread_participants(client, request)

@spec list_thread_participants(
  Req.Request.t(),
  Chatto.Api.V1.ListThreadParticipantsRequest.t()
) ::
  {:ok, Chatto.Api.V1.ListThreadParticipantsResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Lists distinct authors of non-retracted replies, excluding erased users. Each author appears once. Requires the same membership and message-read access as GetThreadEvents.

mark_thread_as_read(client, request)

@spec mark_thread_as_read(Req.Request.t(), Chatto.Api.V1.MarkThreadAsReadRequest.t()) ::
  {:ok, Chatto.Api.V1.MarkThreadAsReadResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Marks a thread timeline as read through the supplied event without changing the room-level read marker. Room membership plus message.read or an active relationship with message.read-interactions are required.

unfollow_thread(client, request)

@spec unfollow_thread(Req.Request.t(), Chatto.Api.V1.UnfollowThreadRequest.t()) ::
  {:ok, Chatto.Api.V1.UnfollowThreadResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Stops following a thread for the current user. Room membership plus message.read or an active relationship with message.read-interactions are required. The response reports the resulting follow state so clients can update local UI immediately.