Current section

Files

Jump to
scrapped_twitch_api lib resources channel_points get_custom_reward_redemption.ex
Raw

lib/resources/channel_points/get_custom_reward_redemption.ex

defmodule TwitchApi.ChannelPoints.GetCustomRewardRedemption do
@moduledoc """
⛔ This module is autogenerated please do not modify manually.
## Example request from twitch api docs:
### descriptions:
This example lists custom reward redemptions for a specific reward:
This example gets custom reward redemptions by ID.
### requests:
curl -X GET 'https://api.twitch.tv/helix/channel_points/custom_rewards/redemptions?broadcaster_id=274637212&reward_id=92af127c-7326-4483-a52b-b0da0be61c01&id=17fa2df1-ad76-4804-bfa5-a40ef63efe63'
-H'Client-Id: gx2pv4208cff0ig9ou7nk3riccffxt'
-H'Authorization: Bearer vjxv3i0l4zxru966wsnwji51tmpkj2'
curl -X GET 'https://api.twitch.tv/helix/channel_points/custom_rewards/redemptions?broadcaster_id=274637212&reward_id=92af127c-7326-4483-a52b-b0da0be61c01&status=CANCELED'
-H'Client-Id: gx2pv4208cff0ig9ou7nk3riccffxt'
-H'Authorization: Bearer vjxv3i0l4zxru966wsnwji51tmpkj2'
## Example response from twitch api docs:
### descriptions:
### responses:
{"data":[{"broadcaster_name":"torpedo09","broadcaster_login":"torpedo09","broadcaster_id":"274637212","id":"17fa2df1-ad76-4804-bfa5-a40ef63efe63","user_id":"274637212","user_name":"torpedo09","user_input":"","status":"CANCELED","redeemed_at":"2020-07-01T18:37:32Z","reward":{"id":"92af127c-7326-4483-a52b-b0da0be61c01","title":"game analysis","prompt":"","cost":50000}}]}
{"data":[{"broadcaster_name":"torpedo09","broadcaster_login":"torpedo09","broadcaster_id":"274637212","id":"17fa2df1-ad76-4804-bfa5-a40ef63efe63","user_login":"torpedo09","user_id":"274637212","user_name":"torpedo09","user_input":"","status":"CANCELED","redeemed_at":"2020-07-01T18:37:32Z","reward":{"id":"92af127c-7326-4483-a52b-b0da0be61c01","title":"game analysis","prompt":"","cost":50000}}],"pagination":{"cursor":"eyJiIjpudWxsLCJhIjp7IkN1cnNvciI6Ik1UZG1ZVEprWmpFdFlXUTNOaTAwT0RBMExXSm1ZVFV0WVRRd1pXWTJNMlZtWlRZelgxOHlNREl3TFRBM0xUQXhWREU0T2pNM09qTXlMakl6TXpFeU56RTFOMW89In19"}}
"""
alias TwitchApi.MyFinch
alias TwitchApi.ApiJson.Template.Method.Headers
@doc """
### Description:
Returns Custom Reward Redemption objects for a Custom Reward on a channel that was created by the same client_id. 
### Required authentication:
User OAuth token
Required scope: channel:read:redemptions
### Required authorization:
"""
@typedoc """
Provided broadcaster_id must match the user_id in the user OAuth token.
"""
@type broadcaster_id :: %{required(:broadcaster_id) => String.t()}
@typedoc """
When ID is not provided, this parameter returns paginated Custom Reward Redemption objects for redemptions of the Custom Reward with ID reward_id.
"""
@type reward_id :: %{required(:reward_id) => String.t()}
@typedoc """
When used, this param filters the results and only returns Custom Reward Redemption objects for the redemptions with matching ID. Maximum: 50
"""
@type id :: %{required(:id) => String.t()}
@typedoc """
When id is not provided, this param is required and filters the paginated Custom Reward Redemption objects for redemptions with the matching status. Can be one of UNFULFILLED, FULFILLED or CANCELED
"""
@type status :: %{required(:status) => String.t()}
@typedoc """
Sort order of redemptions returned when getting the paginated Custom Reward Redemption objects for a reward. One of: OLDEST, NEWEST. Default: OLDEST.
"""
@type sort :: %{required(:sort) => String.t()}
@typedoc """
Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response. This applies only to queries without ID. If an ID is specified, it supersedes any cursor/offset combinations. The cursor value specified here is from the pagination response field of a prior query.
"""
@type after_query_param :: %{required(:after_query_param) => String.t()}
@typedoc """
Number of results to be returned when getting the paginated Custom Reward Redemption objects for a reward. Limit: 50. Default: 20.
"""
@type first :: %{required(:first) => integer}
@typedoc """
Map containing the user needed information for the fetch of the required user OAuth access token.
You will be able to choose from one way or the other for fetching previously OAuth access tokens.
:user_id field contains the user ID from twitch, e.g. 61425548 or "61425548"
:user_name field constains the user name from twitch, e.g. "hiimkamiyuzu"
"""
@type user_info :: %{user_id: integer | binary} | %{user_name: binary}
@spec call(
broadcaster_id | reward_id | id | status | sort | after_query_param | first,
user_info
) :: {:ok, Finch.Response.t()} | {:error, Exception.t()}
def call(%{broadcaster_id: broadcaster_id}, user_info) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/channel_points/custom_rewards/redemptions?broadcaster_id=#{broadcaster_id}",
Headers.config_oauth_headers(user_info),
nil
)
end
def call(%{reward_id: reward_id}, user_info) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/channel_points/custom_rewards/redemptions?reward_id=#{reward_id}",
Headers.config_oauth_headers(user_info),
nil
)
end
def call(%{id: id}, user_info) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/channel_points/custom_rewards/redemptions?id=#{id}",
Headers.config_oauth_headers(user_info),
nil
)
end
def call(%{status: status}, user_info) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/channel_points/custom_rewards/redemptions?status=#{status}",
Headers.config_oauth_headers(user_info),
nil
)
end
def call(%{sort: sort}, user_info) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/channel_points/custom_rewards/redemptions?sort=#{sort}",
Headers.config_oauth_headers(user_info),
nil
)
end
def call(%{after: after_query_param}, user_info) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/channel_points/custom_rewards/redemptions?after=#{after_query_param}",
Headers.config_oauth_headers(user_info),
nil
)
end
def call(%{first: first}, user_info) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/channel_points/custom_rewards/redemptions?first=#{first}",
Headers.config_oauth_headers(user_info),
nil
)
end
end