Search documentation of ExStreamClient

# ExStreamClient.Operations.Chat.Polls (ExStreamClient v0.1.10)

View Source

Modules for interacting with the `chat/polls` 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

create_poll(payload, opts \\ [])

Creates a new poll

create_poll_option(poll_id, payload, opts \\ [])

Creates a poll option

delete_poll(poll_id, opts \\ [])

Deletes a poll

delete_poll_option(poll_id, option_id, opts \\ [])

Deletes a poll option

get_poll(poll_id, opts \\ [])

Retrieves a poll

get_poll_option(poll_id, option_id, opts \\ [])

Retrieves a poll option

query_poll_votes(poll_id, payload, opts \\ [])

Queries votes

query_polls(payload, opts \\ [])

Queries polls

update_poll(payload, opts \\ [])

Updates a poll

update_poll_option(poll_id, payload, opts \\ [])

Updates a poll option

update_poll_partial(poll_id, payload, opts \\ [])

Updates a poll partially

# Types

# shared_opts()

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

# Functions

# create_poll(payload, opts \\ [])

    @spec create_poll(ExStreamClient.Model.CreatePollRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.PollResponse.t()} | {:error, any()}

Creates a new poll

### Required Arguments:

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

### Optional Arguments:

- All options from Shared Options are supported.

# create_poll_option(poll_id, payload, opts \\ [])

    @spec create_poll_option(
      String.t(),
      ExStreamClient.Model.CreatePollOptionRequest.t(),
      shared_opts()
    ) :: {:ok, ExStreamClient.Model.PollOptionResponse.t()} | {:error, any()}

Creates a poll option

### Sends events:

- `poll.updated`

### Required Arguments:

- `poll_id`
- `payload`: `Elixir.ExStreamClient.Model.CreatePollOptionRequest`

### Optional Arguments:

- All options from Shared Options are supported.

# delete_poll(poll_id, opts \\ [])

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

Deletes a poll

### Sends events:

- `poll.deleted`

### Required Arguments:

- `poll_id`

### Optional Arguments:

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

# delete_poll_option(poll_id, option_id, opts \\ [])

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

Deletes a poll option

### Sends events:

- `poll.updated`

### Required Arguments:

- `poll_id`
- `option_id`

### Optional Arguments:

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

# get_poll(poll_id, opts \\ [])

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

Retrieves a poll

### Required Arguments:

- `poll_id`

### Optional Arguments:

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

# get_poll_option(poll_id, option_id, opts \\ [])

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

Retrieves a poll option

### Required Arguments:

- `poll_id`
- `option_id`

### Optional Arguments:

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

# query_poll_votes(poll_id, payload, opts \\ [])

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

Queries votes

### Required Arguments:

- `poll_id`
- `payload`: `Elixir.ExStreamClient.Model.QueryPollVotesRequest`

### Optional Arguments:

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

# query_polls(payload, opts \\ [])

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

Queries polls

### Required Arguments:

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

### Optional Arguments:

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

# update_poll(payload, opts \\ [])

    @spec update_poll(ExStreamClient.Model.UpdatePollRequest.t(), shared_opts()) ::
      {:ok, ExStreamClient.Model.PollResponse.t()} | {:error, any()}

Updates a poll

### Sends events:

- `poll.closed`
- `poll.updated`

### Required Arguments:

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

### Optional Arguments:

- All options from Shared Options are supported.

# update_poll_option(poll_id, payload, opts \\ [])

    @spec update_poll_option(
      String.t(),
      ExStreamClient.Model.UpdatePollOptionRequest.t(),
      shared_opts()
    ) :: {:ok, ExStreamClient.Model.PollOptionResponse.t()} | {:error, any()}

Updates a poll option

### Sends events:

- `poll.updated`

### Required Arguments:

- `poll_id`
- `payload`: `Elixir.ExStreamClient.Model.UpdatePollOptionRequest`

### Optional Arguments:

- All options from Shared Options are supported.

# update_poll_partial(poll_id, payload, opts \\ [])

    @spec update_poll_partial(
      String.t(),
      ExStreamClient.Model.UpdatePollPartialRequest.t(),
      shared_opts()
    ) :: {:ok, ExStreamClient.Model.PollResponse.t()} | {:error, any()}

Updates a poll partially

### Sends events:

- `poll.updated`

### Required Arguments:

- `poll_id`
- `payload`: `Elixir.ExStreamClient.Model.UpdatePollPartialRequest`

### Optional Arguments:

- All options from Shared Options are supported.