Current section

Files

Jump to
scrapped_twitch_api lib resources polls end_poll.ex
Raw

lib/resources/polls/end_poll.ex

defmodule TwitchApi.Polls.EndPoll do
@moduledoc """
⛔ This module is autogenerated please do not modify manually.
## Example request from twitch api docs:
### descriptions:
Ends a specific poll for the TwitchDev channel, but allows the results to be visible for viewers.
### requests:
curl -X PATCH 'https://api.twitch.tv/helix/polls'
-H'Authorization: Bearer cfabdegwdoklmawdzdo98xt2fo512y'
-H'Client-Id: uo6dggojyb8d6soh92zknwmi5ej1q2'
-H'Content-Type: application/json'
-d'{
"broadcaster_id":"141981764",
"id":"ed961efd-8a3f-4cf5-a9d0-e616c590cd2a",
"status":"TERMINATED"
}'
## Example response from twitch api docs:
### descriptions:
### responses:
{"data":[{"id":"ed961efd-8a3f-4cf5-a9d0-e616c590cd2a","broadcaster_id":"141981764","broadcaster_name":"TwitchDev","broadcaster_login":"twitchdev","title":"Heads or Tails?","choices":[{"id":"4c123012-1351-4f33-84b7-43856e7a0f47","title":"Heads","votes":0,"channel_points_votes":0,"bits_votes":0},{"id":"279087e3-54a7-467e-bcd0-c1393fcea4f0","title":"Tails","votes":0,"channel_points_votes":0,"bits_votes":0}],"bits_voting_enabled":false,"bits_per_vote":0,"channel_points_voting_enabled":true,"channel_points_per_vote":100,"status":"TERMINATED","duration":1800,"started_at":"2021-03-19T06:08:33.871278372Z","ended_at":"2021-03-19T06:11:26.746889614Z"}]}
"""
alias TwitchApi.MyFinch
alias TwitchApi.ApiJson.Template.Method.Headers
@doc """
### Description:
NEW End a poll that is currently active.
### Required authentication:
### Required authorization:
User OAuth tokenRequired scope: channel:manage:polls
"""
# Map containing the user needed information for the user OAuth access token fetch
@type user_info :: %{user_id: integer | binary} | %{user_name: binary}
# The broadcaster running polls. Provided broadcaster_id must match the user_id in the user OAuth token.Maximum => 1
@spec call(
%{
required(:broadcaster_id) => String.t(),
# ID of the poll.
required(:id) => String.t(),
# The poll status to be set. Valid values => TERMINATED => End the poll manually but allow it to be viewed publicly.ARCHIVED => End the poll manually and do not allow it to be viewed publicly.
required(:status) => String.t()
}
| nil,
user_info
) :: {:ok, Finch.Response.t()} | {:error, Exception.t()}
def call(body_params, user_info) do
MyFinch.request(
"PATCH",
"https://api.twitch.tv/helix/polls",
Headers.config_oauth_headers(user_info),
body_params
)
end
end