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

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

Functions

create_poll(payload, opts \\ [])

Creates a new poll

Required Arguments:

All options from Shared Options are supported.

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

Creates a poll option

Sends events:

  • poll.updated

Required Arguments:

All options from Shared Options are supported.

delete_poll(poll_id, opts \\ [])

@spec delete_poll(String.t(),
  req_opts: keyword(),
  client: module(),
  endpoint: String.t(),
  api_key: String.t(),
  api_key_secret: String.t(),
  user_id: String.t()
) :: {: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(),
  req_opts: keyword(),
  client: module(),
  endpoint: String.t(),
  api_key: String.t(),
  api_key_secret: String.t(),
  user_id: String.t()
) :: {: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(),
  req_opts: keyword(),
  client: module(),
  endpoint: String.t(),
  api_key: String.t(),
  api_key_secret: String.t(),
  user_id: String.t()
) :: {: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(),
  req_opts: keyword(),
  client: module(),
  endpoint: String.t(),
  api_key: String.t(),
  api_key_secret: String.t(),
  user_id: String.t()
) :: {: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(),
  req_opts: keyword(),
  client: module(),
  endpoint: String.t(),
  api_key: String.t(),
  api_key_secret: String.t(),
  user_id: String.t()
) :: {:ok, ExStreamClient.Model.PollVotesResponse.t()} | {:error, any()}

Queries votes

Required Arguments:

Optional Arguments:

  • user_id

All options from Shared Options are supported.

query_polls(payload, opts \\ [])

@spec query_polls(ExStreamClient.Model.QueryPollsRequest.t(),
  req_opts: keyword(),
  client: module(),
  endpoint: String.t(),
  api_key: String.t(),
  api_key_secret: String.t(),
  user_id: String.t()
) :: {:ok, ExStreamClient.Model.QueryPollsResponse.t()} | {:error, any()}

Queries polls

Required Arguments:

Optional Arguments:

  • user_id

All options from Shared Options are supported.

update_poll(payload, opts \\ [])

Updates a poll

Sends events:

  • poll.closed
  • poll.updated

Required Arguments:

All options from Shared Options are supported.

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

Updates a poll option

Sends events:

  • poll.updated

Required Arguments:

All options from Shared Options are supported.

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

Updates a poll partially

Sends events:

  • poll.updated

Required Arguments:

All options from Shared Options are supported.