Current section

Files

Jump to
scrapped_twitch_api lib resources analytics get_extension_analytics.ex
Raw

lib/resources/analytics/get_extension_analytics.ex

defmodule TwitchApi.Analytics.GetExtensionAnalytics do
@moduledoc """
⛔ This module is autogenerated please do not modify manually.
## Example request from twitch api docs:
### descriptions:
This gets the URLs for all reports for all Extensions of the authenticated client. For the purpose of this example, assume the request is issued on June 1, 2018.
### requests:
curl -X GET 'https://api.twitch.tv/helix/analytics/extensions'
-H'Authorization: Bearer cfabdegwdoklmawdzdo98xt2fo512y'
-H'Client-Id: uo6dggojyb8d6soh92zknwmi5ej1q2'
## Example response from twitch api docs:
### descriptions:
### responses:
{"data":[{"extension_id":"efgh","URL":"https://twitch-piper-reports.s3-us-west-2.amazonaws.com/dynamic/LoL%20ADC_overview_v2_2018-03-01_2018-06-01_8a879932-8e70-7a4c-2b97-e0eaba28c3b0.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAI7LOPgTrAIVYE6KQ%2F20180731%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20180731T202847Z&X-Amz-Expires=60&X-Amz-Security-Token=FQoDYXdzEDMaDObdwyOVISdo6feHSSK3A9R9gMFeS5frG5Dsr4k4tJemqCIazhsQJrpsehBoOufaQkCxrb8RD3oU0xC5pWrZe9kN%2BnezIoLOgTtFRAqTzdIr7J5iUOxGFyKN9XmrmUHGexFfALvoPQWUJNbxoFU6shajSmO3sPK2GnuEaGmIrAqjKrim8saLHDV%2FdSi2ZH3fFx6sBQEGv13Lx0zua7AsvaL%2BSfhIAcOazWjYLMU5N9bxXmaN7IAIF4UjNPqbg07RMWW70hm0edH0RPi%2Fw00faeeSvmreHq6c1C1Lu8a7AysMb0pEGBT7VxmuGmWsXyjLWZ6oNgbx88HXoMJpmAn5Y1hUu7VzOaa84T%2BmCF5Sbn7hbB1xIiPdzaVQ%2Bd85sy4ln09h7dgKh6GFE1VTas2v7RJU1lyD%2FZ%2FWKBwV5Ol8GEGrF1pme8mSBpPGUAJ4vxjLmrGL7ctty%2F0vXke3PyD%2B4%2FtHZ67xaw0y8EKrau23Xvt3blkcDNoQYOfcS%2FqbaK%2BHpyVq4bIBtQq%2BHYU5MuFkgEuwSe5zPDle1ysKSN11B6B6Sy7Httrq542OONS%2BfURkczMbKSPEShddN32Y9VUqKYdUo%2FsWVQQoy7uC2wU%3D&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3Bfilename%3D%22WoW%20Armory_overview_v1_2018-04-30_2018-06-01.csv%22&X-Amz-Signature=eb7721e40cbfd1d7409887dae3792cdb2add025ace953a63ba8e3545b92ae058","type":"overview_v2","date_range":{"started_at":"2018-03-01T00:00:00Z","ended_at":"2018-06-01T00:00:00Z"}},...],"pagination":{"cursor":"eyJiIjpudWxsLCJhIjp7Ik9mZnNldCI6NX19"}}
"""
alias TwitchApi.MyFinch
alias TwitchApi.ApiJson.Template.Method.Headers
@doc """
### Description:
Gets a URL that Extension developers can use to download analytics reports (CSV files) for their Extensions. The URL is valid for 5 minutes. For details about analytics and the fields returned, see the Insights & Analytics guide.
### Required authentication:
OAuth token required
Required scope: analytics:read:extensions
### Required authorization:
"""
# 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 extension_id. If an extension_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()}
# Ending date/time for returned reports, in RFC3339 format with the hours, minutes, and seconds zeroed out and the UTC timezone: YYYY-MM-DDT00:00:00Z. The report covers the entire ending date; e.g., if 2018-05-01T00:00:00Z is specified, the report covers up to 2018-05-01T23:59:59Z.If this is provided, started_at also must be specified. If ended_at is later than the default end date, the default date is used. Default: 1-2 days before the request was issued (depending on report availability).
@type ended_at :: %{required(:ended_at) => String.t()}
# Client ID value assigned to the extension when it is created. If this is specified, the returned URL points to an analytics report for just the specified extension. If this is not specified, the response includes multiple URLs (paginated), pointing to separate analytics reports for each of the authenticated user’s Extensions.
@type extension_id :: %{required(:extension_id) => String.t()}
# Maximum number of objects to return. Maximum: 100. Default: 20.
@type first :: %{required(:first) => integer}
# Starting date/time for returned reports, in RFC3339 format with the hours, minutes, and seconds zeroed out and the UTC timezone: YYYY-MM-DDT00:00:00Z. This must be on or after January 31, 2018.If this is provided, ended_at also must be specified. If started_at is earlier than the default start date, the default date is used.  The file contains one row of data per day.
@type started_at :: %{required(:started_at) => String.t()}
# Type of analytics report that is returned. Currently, this field has no affect on the response as there is only one report type. If additional types were added, using this field would return only the URL for the specified report. Limit: 1. Valid values: "overview_v2".
@type type :: %{required(:type) => 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(after_query_param | ended_at | extension_id | first | started_at | type, user_info) ::
{:ok, Finch.Response.t()} | {:error, Exception.t()}
def call(%{after: after_query_param}, user_info) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/analytics/extensions?after=#{after_query_param}",
Headers.config_oauth_headers(user_info),
nil
)
end
def call(%{ended_at: ended_at}, user_info) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/analytics/extensions?ended_at=#{ended_at}",
Headers.config_oauth_headers(user_info),
nil
)
end
def call(%{extension_id: extension_id}, user_info) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/analytics/extensions?extension_id=#{extension_id}",
Headers.config_oauth_headers(user_info),
nil
)
end
def call(%{first: first}, user_info) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/analytics/extensions?first=#{first}",
Headers.config_oauth_headers(user_info),
nil
)
end
def call(%{started_at: started_at}, user_info) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/analytics/extensions?started_at=#{started_at}",
Headers.config_oauth_headers(user_info),
nil
)
end
def call(%{type: type}, user_info) do
MyFinch.request(
"GET",
"https://api.twitch.tv/helix/analytics/extensions?type=#{type}",
Headers.config_oauth_headers(user_info),
nil
)
end
end