Current section

Files

Jump to
scrapped_twitch_api lib resources moderation get_moderator_events.ex
Raw

lib/resources/moderation/get_moderator_events.ex

defmodule TwitchApi.Moderation.GetModeratorEvents do
@moduledoc """
⛔ This module is autogenerated please do not modify manually.
## Example request from twitch api docs:
### descriptions:
Returns users added or removed as moderators for Broadcaster ID 198704263.
### requests:
curl -X GET 'https://api.twitch.tv/helix/moderation/moderators/events?broadcaster_id=198704263'
-H'Authorization: Bearer cfabdegwdoklmawdzdo98xt2fo512y'
-H'Client-Id: uo6dggojyb8d6soh92zknwmi5ej1q2'
## Example response from twitch api docs:
### descriptions:
### responses:
{"data":[{"id":"1IVBTnDSUDApiBQW4UBcVTK4hPr","event_type":"moderation.moderator.remove","event_timestamp":"2019-03-15T18:18:14Z","version":"1.0","event_data":{"broadcaster_id":"198704263","broadcaster_login":"aan22209","broadcaster_name":"aan22209","user_id":"423374343","user_login":"glowillig","user_name":"glowillig"}},{"id":"1IVIPQdYIEnD8nJ376qkASDzsj7","event_type":"moderation.moderator.add","event_timestamp":"2019-03-15T19:15:13Z","version":"1.0","event_data":{"broadcaster_id":"198704263","broadcaster_login":"aan22209","broadcaster_name":"aan22209","user_id":"423374343","user_login":"glowillig","user_name":"glowillig"}},{"id":"1IVBTP7gG61oXLMu7fvnRhrpsro","event_type":"moderation.moderator.remove","event_timestamp":"2019-03-15T18:18:11Z","version":"1.0","event_data":{"broadcaster_id":"198704263","broadcaster_login":"aan22209","broadcaster_name":"aan22209","user_id":"424596340","user_login":"quotrok","user_name":"quotrok"}}],"pagination":{"cursor":"eyJiIjpudWxsLCJhIjp7IkN1cnNvciI6IjEwMDQ3MzA2NDo4NjQwNjU3MToxSVZCVDFKMnY5M1BTOXh3d1E0dUdXMkJOMFcifX0"}}
"""
alias TwitchApi.MyFinch
alias TwitchApi.ApiJson.Template.Method.Headers
@doc """
### Description:
Returns a list of moderators or users added and removed as moderators from a channel.
### Required authentication:
### Required authorization:
OAuth token requiredRequired scope: moderation:read
"""
# Provided broadcaster_id must match the user_id in the auth token.Maximum: 1
@type broadcaster_id :: %{required(:broadcaster_id) => String.t()}
# Filters the results and only returns a status object for users who have been added or removed as moderators in this channel and have a matching user_id.Format: Repeated Query Parameter, e.g./moderation/moderators/events?broadcaster_id=1&user_id=2&user_id=3Maximum: 100
@type user_id :: %{required(:user_id) => String.t()}
# 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()}
# Maximum number of objects to return. Maximum: 100. Default: 20.
@type first :: %{required(:first) => String.t()}
# Map containing the user needed information for the user OAuth access token fetch
@type user_info :: %{user_id: integer | binary} | %{user_name: binary}
@spec call(broadcaster_id | user_id | 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/moderation/moderators/events?broadcaster_id=#{broadcaster_id}",
Headers.config_oauth_headers(user_info),
nil
)
end
def call(%{user_id: user_id}, user_info) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/moderation/moderators/events?user_id=#{user_id}",
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/moderation/moderators/events?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/moderation/moderators/events?first=#{first}",
Headers.config_oauth_headers(user_info),
nil
)
end
end