ExStreamClient.Operations.Usergroups (ExStreamClient v0.2.0)

Copy Markdown View Source

Modules for interacting with the usergroups group of Stream APIs

API Reference: https://getstream.github.io/protocol/?urls.primaryName=Chat%20v2

Shared options

All functions in this module accept the following optional parameters:

  • api_key - API key to use. If not provided, the default key from config will be used
  • authenticate_as_user - User id to authenticate. If not provided, the server key will be used
  • api_key_secret - API key secret to use. If not provided, the default secret from config will be used
  • endpoint - endpoint to use. If not provided, the default endpoint from config will be used
  • client - HTTP client to use. Must implement ExStreamClient.Http.Behavior. Defaults to ExStreamClient.Http
  • req_opts - all of these options will be forwarded to req. See Req.new/1 for available options

Summary

Functions

Adds members to a user group. All user IDs must exist. The operation is all-or-nothing.

Creates a new user group, optionally with initial members

Deletes a user group and all its members

Gets a user group by ID, including its members

Lists user groups with cursor-based pagination

Removes members from a user group. Users already not in the group are silently ignored.

Searches user groups by name prefix for autocomplete

Updates a user group's name and/or description. team_id is immutable.

Types

shared_opts()

@type shared_opts() :: [
  api_key: String.t(),
  api_key_secret: String.t(),
  authenticate_as_user: String.t(),
  client: module(),
  endpoint: String.t(),
  req_opts: keyword()
]

Functions

add_user_group_members(id, payload, opts \\ [])

Adds members to a user group. All user IDs must exist. The operation is all-or-nothing.

Required Arguments:

Optional Arguments:

create_user_group(payload, opts \\ [])

Creates a new user group, optionally with initial members

Required Arguments:

Optional Arguments:

delete_user_group(id, opts \\ [])

@spec delete_user_group(String.t(), [{:team_id, String.t()} | shared_opts()]) ::
  {:ok, ExStreamClient.Model.Response.t()} | {:error, any()}

Deletes a user group and all its members

Required Arguments:

  • id

Optional Arguments:

get_user_group(id, opts \\ [])

@spec get_user_group(String.t(), [{:team_id, String.t()} | shared_opts()]) ::
  {:ok, ExStreamClient.Model.GetUserGroupResponse.t()} | {:error, any()}

Gets a user group by ID, including its members

Required Arguments:

  • id

Optional Arguments:

list_user_groups(opts \\ [])

@spec list_user_groups([
  ({:team_id, String.t()}
   | {:created_at_gt, String.t()}
   | {:id_gt, String.t()}
   | {:limit, integer()})
  | shared_opts()
]) :: {:ok, ExStreamClient.Model.ListUserGroupsResponse.t()} | {:error, any()}

Lists user groups with cursor-based pagination

Optional Arguments:

  • created_at_gt
  • id_gt
  • limit
  • team_id
  • All options from Shared Options are supported.

remove_user_group_members(id, payload, opts \\ [])

Removes members from a user group. Users already not in the group are silently ignored.

Required Arguments:

Optional Arguments:

search_user_groups(query, opts \\ [])

@spec search_user_groups(String.t(), [
  ({:team_id, String.t()}
   | {:id_gt, String.t()}
   | {:name_gt, String.t()}
   | {:limit, integer()})
  | shared_opts()
]) :: {:ok, ExStreamClient.Model.SearchUserGroupsResponse.t()} | {:error, any()}

Searches user groups by name prefix for autocomplete

Required Arguments:

  • query

Optional Arguments:

  • id_gt
  • limit
  • name_gt
  • team_id
  • All options from Shared Options are supported.

update_user_group(id, payload, opts \\ [])

Updates a user group's name and/or description. team_id is immutable.

Required Arguments:

Optional Arguments: