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

Copy Markdown View Source

Provides authenticated user profile, preferences, and capability state.

Summary

Functions

Starts a window of up to 15 minutes with all currently assigned protected roles. During an active window, a retry keeps the stored selection and deadline, even if all selected roles have been revoked. Deactivate to change the selection. Returns FAILED_PRECONDITION for a bot or when starting a new activation without any assigned protected roles.

Activates the selected protected roles for up to 15 minutes. Each request, including a retry, returns FAILED_PRECONDITION for a bot or a caller with no assigned protected roles. Otherwise an empty selection returns INVALID_ARGUMENT, and an unavailable role returns PERMISSION_DENIED. During an active window, a retry with the same eligible selection keeps the deadline. A different eligible selection returns INVALID_ARGUMENT. Deactivate before changing the selection. A rejected retry preserves the selection and deadline.

Deactivates the selected protected roles immediately. Returns FAILED_PRECONDITION when the caller is a bot.

Returns the current authenticated viewer. This RPC requires a logged-in user; unauthenticated callers receive an UNAUTHENTICATED error.

Functions

activate_privileged_mode(client, request)

@spec activate_privileged_mode(
  Req.Request.t(),
  Chatto.Api.V1.ActivatePrivilegedModeRequest.t()
) ::
  {:ok, Chatto.Api.V1.ActivatePrivilegedModeResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Starts a window of up to 15 minutes with all currently assigned protected roles. During an active window, a retry keeps the stored selection and deadline, even if all selected roles have been revoked. Deactivate to change the selection. Returns FAILED_PRECONDITION for a bot or when starting a new activation without any assigned protected roles.

activate_privileged_roles(client, request)

@spec activate_privileged_roles(
  Req.Request.t(),
  Chatto.Api.V1.ActivatePrivilegedRolesRequest.t()
) ::
  {:ok, Chatto.Api.V1.ActivatePrivilegedRolesResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Activates the selected protected roles for up to 15 minutes. Each request, including a retry, returns FAILED_PRECONDITION for a bot or a caller with no assigned protected roles. Otherwise an empty selection returns INVALID_ARGUMENT, and an unavailable role returns PERMISSION_DENIED. During an active window, a retry with the same eligible selection keeps the deadline. A different eligible selection returns INVALID_ARGUMENT. Deactivate before changing the selection. A rejected retry preserves the selection and deadline.

deactivate_privileged_mode(client, request)

@spec deactivate_privileged_mode(
  Req.Request.t(),
  Chatto.Api.V1.DeactivatePrivilegedModeRequest.t()
) ::
  {:ok, Chatto.Api.V1.DeactivatePrivilegedModeResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Deactivates the selected protected roles immediately. Returns FAILED_PRECONDITION when the caller is a bot.

get_viewer(client, request)

@spec get_viewer(Req.Request.t(), Chatto.Api.V1.GetViewerRequest.t()) ::
  {:ok, Chatto.Api.V1.GetViewerResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Returns the current authenticated viewer. This RPC requires a logged-in user; unauthenticated callers receive an UNAUTHENTICATED error.