Search documentation of ExStreamClient

# ExStreamClient.Operations.Users (ExStreamClient v0.1.10)

View Source

Modules for interacting with the `users` 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
- `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

## Types

shared_opts()

## Functions

block_users(payload, opts \\ [])

Block users

deactivate_user(user_id, payload, opts \\ [])

Deactivates user with possibility to activate it back

deactivate_users(payload, opts \\ [])

Deactivate users in batches

delete_users(payload, opts \\ [])

Deletes users and optionally all their belongings asynchronously.

export_user(user_id, opts \\ [])

Exports the user's profile, reactions and messages. Raises an error if a user has more than 10k messages or reactions

get_blocked_users(opts \\ [])

Get list of blocked Users

query_users(opts \\ [])

Find and filter users

reactivate_user(user_id, payload, opts \\ [])

Activates user who's been deactivated previously

reactivate_users(payload, opts \\ [])

Reactivate users in batches

restore_users(payload, opts \\ [])

Restore soft deleted users

unblock_users(payload, opts \\ [])

Unblock users

update_users(payload, opts \\ [])

Update or create users in bulk

update_users_partial(payload, opts \\ [])

Updates certain fields of the user

# Types

# shared_opts()

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

# Functions

# block_users(payload, opts \\ [])

    @spec block_users(ExStreamClient.Model.BlockUsersRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.BlockUsersResponse.t()} | {:error, any()}

Block users

### Required Arguments:

- `payload`: `Elixir.ExStreamClient.Model.BlockUsersRequest`

### Optional Arguments:

- All options from Shared Options are supported.

# deactivate_user(user_id, payload, opts \\ [])

    @spec deactivate_user(
      String.t(),
      ExStreamClient.Model.DeactivateUserRequest.t(),
      shared_opts()
    ) ::
      {:ok, ExStreamClient.Model.DeactivateUserResponse.t()} | {:error, any()}

Deactivates user with possibility to activate it back

### Sends events:

- `user.deactivated`

### Required Arguments:

- `user_id`
- `payload`: `Elixir.ExStreamClient.Model.DeactivateUserRequest`

### Optional Arguments:

- All options from Shared Options are supported.

# deactivate_users(payload, opts \\ [])

    @spec deactivate_users(ExStreamClient.Model.DeactivateUsersRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.DeactivateUsersResponse.t()} | {:error, any()}

Deactivate users in batches

### Sends events:

- `user.deactivated`

### Required Arguments:

- `payload`: `Elixir.ExStreamClient.Model.DeactivateUsersRequest`

### Optional Arguments:

- All options from Shared Options are supported.

# delete_users(payload, opts \\ [])

    @spec delete_users(ExStreamClient.Model.DeleteUsersRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.DeleteUsersResponse.t()} | {:error, any()}

Deletes users and optionally all their belongings asynchronously.

### Sends events:

- `channel.deleted`
- `user.deleted`

### Required Arguments:

- `payload`: `Elixir.ExStreamClient.Model.DeleteUsersRequest`

### Optional Arguments:

- All options from Shared Options are supported.

# export_user(user_id, opts \\ [])

    @spec export_user(String.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.ExportUserResponse.t()} | {:error, any()}

Exports the user's profile, reactions and messages. Raises an error if a user has more than 10k messages or reactions

### Required Arguments:

- `user_id`

### Optional Arguments:

- All options from Shared Options are supported.

# get_blocked_users(opts \\ [])

    @spec get_blocked_users([{:user_id, String.t()} | shared_opts()]) ::
      {:ok, ExStreamClient.Model.GetBlockedUsersResponse.t()} | {:error, any()}

Get list of blocked Users

### Optional Arguments:

- `user_id`
- All options from Shared Options are supported.

# query_users(opts \\ [])

    @spec query_users([
      {:payload, ExStreamClient.Model.QueryUsersPayload.t()} | shared_opts()
    ]) ::
      {:ok, ExStreamClient.Model.QueryUsersResponse.t()} | {:error, any()}

Find and filter users

### Optional Arguments:

- `payload`: `Elixir.ExStreamClient.Model.QueryUsersPayload`
- All options from Shared Options are supported.

# reactivate_user(user_id, payload, opts \\ [])

    @spec reactivate_user(
      String.t(),
      ExStreamClient.Model.ReactivateUserRequest.t(),
      shared_opts()
    ) ::
      {:ok, ExStreamClient.Model.ReactivateUserResponse.t()} | {:error, any()}

Activates user who's been deactivated previously

### Sends events:

- `user.reactivated`

### Required Arguments:

- `user_id`
- `payload`: `Elixir.ExStreamClient.Model.ReactivateUserRequest`

### Optional Arguments:

- All options from Shared Options are supported.

# reactivate_users(payload, opts \\ [])

    @spec reactivate_users(ExStreamClient.Model.ReactivateUsersRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.ReactivateUsersResponse.t()} | {:error, any()}

Reactivate users in batches

### Sends events:

- `user.reactivated`
- `user.reactivated`

### Required Arguments:

- `payload`: `Elixir.ExStreamClient.Model.ReactivateUsersRequest`

### Optional Arguments:

- All options from Shared Options are supported.

# restore_users(payload, opts \\ [])

    @spec restore_users(ExStreamClient.Model.RestoreUsersRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.Response.t()} | {:error, any()}

Restore soft deleted users

### Required Arguments:

- `payload`: `Elixir.ExStreamClient.Model.RestoreUsersRequest`

### Optional Arguments:

- All options from Shared Options are supported.

# unblock_users(payload, opts \\ [])

    @spec unblock_users(ExStreamClient.Model.UnblockUsersRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.UnblockUsersResponse.t()} | {:error, any()}

Unblock users

### Required Arguments:

- `payload`: `Elixir.ExStreamClient.Model.UnblockUsersRequest`

### Optional Arguments:

- All options from Shared Options are supported.

# update_users(payload, opts \\ [])

    @spec update_users(ExStreamClient.Model.UpdateUsersRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.UpdateUsersResponse.t()} | {:error, any()}

Update or create users in bulk

### Sends events:

- `user.updated`

### Required Arguments:

- `payload`: `Elixir.ExStreamClient.Model.UpdateUsersRequest`

### Optional Arguments:

- All options from Shared Options are supported.

# update_users_partial(payload, opts \\ [])

    @spec update_users_partial(
      ExStreamClient.Model.UpdateUsersPartialRequest.t(),
      shared_opts()
    ) ::
      {:ok, ExStreamClient.Model.UpdateUsersResponse.t()} | {:error, any()}

Updates certain fields of the user

### Sends events:

- `user.presence.changed`
- `user.updated`
- `user.presence.changed`

### Required Arguments:

- `payload`: `Elixir.ExStreamClient.Model.UpdateUsersPartialRequest`

### Optional Arguments:

- All options from Shared Options are supported.