Current section
Files
Jump to
Current section
Files
lib/resources/moderation/get_moderators.ex
defmodule TwitchApi.Moderation.GetModerators do
@moduledoc """
⛔ This module is autogenerated please do not modify manually.
## Example request from twitch api docs:
### descriptions:
This request returns any moderators for Broadcaster ID 198704263.
### requests:
curl -X GET 'https://api.twitch.tv/helix/moderation/moderators?broadcaster_id=198704263'
-H'Authorization: Bearer cfabdegwdoklmawdzdo98xt2fo512y'
-H'Client-Id: uo6dggojyb8d6soh92zknwmi5ej1q2'
## Example response from twitch api docs:
### descriptions:
### responses:
{"data":[{"user_id":"424596340","user_login":"quotrok","user_name":"quotrok"},...],"pagination":{"cursor":"eyJiIjpudWxsLCJhIjp7IkN1cnNvciI6IjEwMDQ3MzA2NDo4NjQwNjU3MToxSVZCVDFKMnY5M1BTOXh3d1E0dUdXMkJOMFcifX0"}}
"""
alias TwitchApi.MyFinch
alias TwitchApi.ApiJson.Template.Method.Headers
@doc """
### Description:
Returns all moderators in a channel.
### Required authentication:
### Required authorization:
Requires a user access token that includes the moderation:read scope. If your app also adds and removes moderators, you can use the channel:manage:moderators scope instead. The ID in the broadcaster_id query parameter must match the user ID in the access token.
"""
@typedoc """
Provided broadcaster_id must match the user_id in the auth token. Maximum: 1
"""
@type broadcaster_id :: %{required(:broadcaster_id) => String.t()}
@typedoc """
Filters the results and only returns a status object for users who are moderators in this channel and have a matching user_id.Format: Repeated Query Parameter, eg. /moderation/moderators?broadcaster_id=1&user_id=2&user_id=3Maximum: 100
"""
@type user_id :: %{required(:user_id) => String.t()}
@typedoc """
Maximum number of objects to return. Maximum: 100. Default: 20.
"""
@type first :: %{required(:first) => 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()}
@spec call(broadcaster_id | user_id | first | after_query_param) ::
{:ok, Finch.Response.t()} | {:error, Exception.t()}
def call(%{broadcaster_id: broadcaster_id}) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/moderation/moderators?broadcaster_id=#{broadcaster_id}",
Headers.config_headers(),
nil
)
end
def call(%{user_id: user_id}) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/moderation/moderators?user_id=#{user_id}",
Headers.config_headers(),
nil
)
end
def call(%{first: first}) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/moderation/moderators?first=#{first}",
Headers.config_headers(),
nil
)
end
def call(%{after: after_query_param}) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/moderation/moderators?after=#{after_query_param}",
Headers.config_headers(),
nil
)
end
end