ExStreamClient.Operations.Chat.Polls (ExStreamClient v0.1.7)

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()

@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 \\ [])

Creates a new poll

Required Arguments:

Optional Arguments:

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

Creates a poll option

Sends events:

  • poll.updated

Required Arguments:

Optional Arguments:

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:

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:

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:

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:

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:

Optional Arguments:

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:

Optional Arguments:

update_poll(payload, opts \\ [])

Updates a poll

Sends events:

  • poll.closed
  • poll.updated

Required Arguments:

Optional Arguments:

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

Updates a poll option

Sends events:

  • poll.updated

Required Arguments:

Optional Arguments:

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

Updates a poll partially

Sends events:

  • poll.updated

Required Arguments:

Optional Arguments: