Current section

Files

Jump to
scrapped_twitch_api lib resources subscriptions get_broadcaster_subscriptions.ex
Raw

lib/resources/subscriptions/get_broadcaster_subscriptions.ex

defmodule TwitchApi.Subscriptions.GetBroadcasterSubscriptions do
@moduledoc """
⛔ This module is autogenerated please do not modify manually.
## Example request from twitch api docs:
### descriptions:
### requests:
curl -X GET 'https://api.twitch.tv/helix/subscriptions?broadcaster_id=141981764'
-H'Authorization: Bearer cfabdegwdoklmawdzdo98xt2fo512y'
-H'Client-Id: uo6dggojyb8d6soh92zknwmi5ej1q2'
## Example response from twitch api docs:
### descriptions:
### responses:
{"data":[{"broadcaster_id":"141981764","broadcaster_login":"twitchdev","broadcaster_name":"TwitchDev","gifter_id":"12826","gifter_login":"twitch","gifter_name":"Twitch","is_gift":true,"tier":"1000","plan_name":"Channel Subscription (twitchdev)","user_id":"527115020","user_name":"twitchgaming","user_login":"twitchgaming"},...],"pagination":{"cursor":"xxxx"},"total":13,"points":13}
"""
alias TwitchApi.MyFinch
alias TwitchApi.ApiJson.Template.Method.Headers
@doc """
### Description:
Gets all of a broadcaster’s subscriptions.
### Required authentication:
OAuth token required
Required scope: channel:read:subscriptions
Subscriptions can be requested on behalf of a broadcaster with a user access token or by a Twitch Extension with an app access token if the broadcaster has granted the
channel:read:subscriptions
scope from within the Twitch Extensions manager.
### Required authorization:
"""
@typedoc """
User ID of the broadcaster. Must match the User ID in the Bearer token.
"""
@type broadcaster_id :: %{required(:broadcaster_id) => String.t()}
@typedoc """
Filters the list to include only the specified subscribers. To specify more than one subscriber, include this parameter for each subscriber. For example, &user_id=1234&user_id=5678. You may specify a maximum of 100 subscribers.
"""
@type user_id :: %{required(:user_id) => 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 user_id. If a user_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 """
Maximum number of objects to return. Maximum: 100. Default: 20.
"""
@type first :: %{required(:first) => String.t()}
@spec call(broadcaster_id | user_id | after_query_param | first) ::
{:ok, Finch.Response.t()} | {:error, Exception.t()}
def call(%{broadcaster_id: broadcaster_id}) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/subscriptions?broadcaster_id=#{broadcaster_id}",
Headers.config_headers(),
nil
)
end
def call(%{user_id: user_id}) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/subscriptions?user_id=#{user_id}",
Headers.config_headers(),
nil
)
end
def call(%{after: after_query_param}) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/subscriptions?after=#{after_query_param}",
Headers.config_headers(),
nil
)
end
def call(%{first: first}) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/subscriptions?first=#{first}",
Headers.config_headers(),
nil
)
end
end