Search documentation of ExStreamClient

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

View Source

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

ban(payload, opts \\ [])

Ban a user from a channel or the entire app

bulk_image_moderation(payload, opts \\ [])

Moderate multiple images in bulk using a CSV file

check(payload, opts \\ [])

Run moderation checks on the provided content

custom_check(payload, opts \\ [])

Custom check, add your own AI model reports to the review queue

delete_config(key, opts \\ [])

Delete a specific moderation policy by its name

flag(payload, opts \\ [])

Flag any type of content (messages, users, channels, activities) for moderation review. Supports custom content types and additional metadata for flagged content.

get_config(key, opts \\ [])

Retrieve a specific moderation configuration by its key and team. This configuration contains settings for various moderation features like toxicity detection, AI analysis, and filtering rules.

get_review_queue_item(id, opts \\ [])

Retrieve a specific review queue item by its ID

mute(payload, opts \\ [])

Mute a user. Mutes are generally not visible to the user you mute, while block is something you notice.

query_moderation_configs(payload, opts \\ [])

Search and filter moderation configurations across your application. This endpoint is designed for building moderation dashboards and managing multiple configuration sets.

query_moderation_flags(payload, opts \\ [])

Query flags associated with moderation items. This is used for building a moderation dashboard.

query_moderation_logs(payload, opts \\ [])

Search and filter moderation action logs with support for pagination. View the history of moderation actions taken, including who performed them and when.

query_review_queue(payload, opts \\ [])

Query review queue items allows you to filter the review queue items. This is used for building a moderation dashboard.

submit_action(payload, opts \\ [])

Take action on flagged content, such as marking content as safe, deleting content, banning users, or executing custom moderation actions. Supports various action types with configurable parameters.

unban(target_user_id, payload, opts \\ [])

Unban a user from a channel or globally.

unmute(payload, opts \\ [])

Unmute a user

upsert_config(payload, opts \\ [])

Create a new moderation configuration or update an existing one. Configure settings for content filtering, AI analysis, toxicity detection, and other moderation features.

v2_delete_template(opts \\ [])

Delete a specific moderation template by its name

v2_query_templates(opts \\ [])

Retrieve a list of feed moderation templates that define preset moderation rules and configurations. Limited to 100 templates per request.

v2_upsert_template(payload, opts \\ [])

Upsert feeds template for moderation

# Types

# shared_opts()

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

# Functions

# ban(payload, opts \\ [])

    @spec ban(ExStreamClient.Model.BanRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.BanResponse.t()} | {:error, any()}

Ban a user from a channel or the entire app

### Required Arguments:

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

### Optional Arguments:

- All options from Shared Options are supported.

# bulk_image_moderation(payload, opts \\ [])

    @spec bulk_image_moderation(
      ExStreamClient.Model.BulkImageModerationRequest.t(),
      shared_opts()
    ) ::
      {:ok, ExStreamClient.Model.BulkImageModerationResponse.t()} | {:error, any()}

Moderate multiple images in bulk using a CSV file

### Required Arguments:

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

### Optional Arguments:

- All options from Shared Options are supported.

# check(payload, opts \\ [])

    @spec check(ExStreamClient.Model.CheckRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.CheckResponse.t()} | {:error, any()}

Run moderation checks on the provided content

### Required Arguments:

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

### Optional Arguments:

- All options from Shared Options are supported.

# custom_check(payload, opts \\ [])

    @spec custom_check(ExStreamClient.Model.CustomCheckRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.CustomCheckResponse.t()} | {:error, any()}

Custom check, add your own AI model reports to the review queue

### Required Arguments:

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

### Optional Arguments:

- All options from Shared Options are supported.

# delete_config(key, opts \\ [])

    @spec delete_config(String.t(), [{:team, String.t()} | shared_opts()]) ::
      {:ok, ExStreamClient.Model.DeleteModerationConfigResponse.t()}
      | {:error, any()}

Delete a specific moderation policy by its name

### Required Arguments:

- `key`

### Optional Arguments:

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

# flag(payload, opts \\ [])

    @spec flag(ExStreamClient.Model.FlagRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.FlagResponse.t()} | {:error, any()}

Flag any type of content (messages, users, channels, activities) for moderation review. Supports custom content types and additional metadata for flagged content.

### Required Arguments:

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

### Optional Arguments:

- All options from Shared Options are supported.

# get_config(key, opts \\ [])

    @spec get_config(String.t(), [{:team, String.t()} | shared_opts()]) ::
      {:ok, ExStreamClient.Model.GetConfigResponse.t()} | {:error, any()}

Retrieve a specific moderation configuration by its key and team. This configuration contains settings for various moderation features like toxicity detection, AI analysis, and filtering rules.

### Required Arguments:

- `key`

### Optional Arguments:

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

# get_review_queue_item(id, opts \\ [])

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

Retrieve a specific review queue item by its ID

### Required Arguments:

- `id`

### Optional Arguments:

- All options from Shared Options are supported.

# mute(payload, opts \\ [])

    @spec mute(ExStreamClient.Model.MuteRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.MuteResponse.t()} | {:error, any()}

Mute a user. Mutes are generally not visible to the user you mute, while block is something you notice.

### Required Arguments:

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

### Optional Arguments:

- All options from Shared Options are supported.

# query_moderation_configs(payload, opts \\ [])

    @spec query_moderation_configs(
      ExStreamClient.Model.QueryModerationConfigsRequest.t(),
      shared_opts()
    ) ::
      {:ok, ExStreamClient.Model.QueryModerationConfigsResponse.t()}
      | {:error, any()}

Search and filter moderation configurations across your application. This endpoint is designed for building moderation dashboards and managing multiple configuration sets.

### Required Arguments:

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

### Optional Arguments:

- All options from Shared Options are supported.

# query_moderation_flags(payload, opts \\ [])

    @spec query_moderation_flags(
      ExStreamClient.Model.QueryModerationFlagsRequest.t(),
      shared_opts()
    ) ::
      {:ok, ExStreamClient.Model.QueryModerationFlagsResponse.t()} | {:error, any()}

Query flags associated with moderation items. This is used for building a moderation dashboard.

### Required Arguments:

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

### Optional Arguments:

- All options from Shared Options are supported.

# query_moderation_logs(payload, opts \\ [])

    @spec query_moderation_logs(
      ExStreamClient.Model.QueryModerationLogsRequest.t(),
      shared_opts()
    ) ::
      {:ok, ExStreamClient.Model.QueryModerationLogsResponse.t()} | {:error, any()}

Search and filter moderation action logs with support for pagination. View the history of moderation actions taken, including who performed them and when.

### Required Arguments:

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

### Optional Arguments:

- All options from Shared Options are supported.

# query_review_queue(payload, opts \\ [])

    @spec query_review_queue(
      ExStreamClient.Model.QueryReviewQueueRequest.t(),
      shared_opts()
    ) ::
      {:ok, ExStreamClient.Model.QueryReviewQueueResponse.t()} | {:error, any()}

Query review queue items allows you to filter the review queue items. This is used for building a moderation dashboard.

### Required Arguments:

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

### Optional Arguments:

- All options from Shared Options are supported.

# submit_action(payload, opts \\ [])

    @spec submit_action(ExStreamClient.Model.SubmitActionRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.SubmitActionResponse.t()} | {:error, any()}

Take action on flagged content, such as marking content as safe, deleting content, banning users, or executing custom moderation actions. Supports various action types with configurable parameters.

### Required Arguments:

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

### Optional Arguments:

- All options from Shared Options are supported.

# unban(target_user_id, payload, opts \\ [])

    @spec unban(String.t(), ExStreamClient.Model.UnbanRequest.t(), [
      ({:created_by, String.t()} | {:channel_cid, String.t()}) | shared_opts()
    ]) :: {:ok, ExStreamClient.Model.UnbanResponse.t()} | {:error, any()}

Unban a user from a channel or globally.

### Required Arguments:

- `target_user_id`
- `payload`: `Elixir.ExStreamClient.Model.UnbanRequest`

### Optional Arguments:

- `channel_cid`
- `created_by`
- All options from Shared Options are supported.

# unmute(payload, opts \\ [])

    @spec unmute(ExStreamClient.Model.UnmuteRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.UnmuteResponse.t()} | {:error, any()}

Unmute a user

### Required Arguments:

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

### Optional Arguments:

- All options from Shared Options are supported.

# upsert_config(payload, opts \\ [])

    @spec upsert_config(ExStreamClient.Model.UpsertConfigRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.UpsertConfigResponse.t()} | {:error, any()}

Create a new moderation configuration or update an existing one. Configure settings for content filtering, AI analysis, toxicity detection, and other moderation features.

### Required Arguments:

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

### Optional Arguments:

- All options from Shared Options are supported.

# v2_delete_template(opts \\ [])

    @spec v2_delete_template(shared_opts()) ::
      {:ok, ExStreamClient.Model.DeleteModerationTemplateResponse.t()}
      | {:error, any()}

Delete a specific moderation template by its name

### Optional Arguments:

- All options from Shared Options are supported.

# v2_query_templates(opts \\ [])

    @spec v2_query_templates(shared_opts()) ::
      {:ok, ExStreamClient.Model.QueryFeedModerationTemplatesResponse.t()}
      | {:error, any()}

Retrieve a list of feed moderation templates that define preset moderation rules and configurations. Limited to 100 templates per request.

### Optional Arguments:

- All options from Shared Options are supported.

# v2_upsert_template(payload, opts \\ [])

    @spec v2_upsert_template(
      ExStreamClient.Model.UpsertModerationTemplateRequest.t(),
      shared_opts()
    ) ::
      {:ok, ExStreamClient.Model.UpsertModerationTemplateResponse.t()}
      | {:error, any()}

Upsert feeds template for moderation

### Required Arguments:

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

### Optional Arguments:

- All options from Shared Options are supported.