248 lines
No EOL
8.5 KiB
GDScript
248 lines
No EOL
8.5 KiB
GDScript
@tool
|
||
extends TwitchData
|
||
|
||
# CLASS GOT AUTOGENERATED DON'T CHANGE MANUALLY. CHANGES CAN BE OVERWRITTEN EASILY.
|
||
|
||
class_name TwitchGetVideos
|
||
|
||
|
||
|
||
##
|
||
## #/components/schemas/GetVideosResponse
|
||
class Response extends TwitchData:
|
||
|
||
## The list of published videos that match the filter criteria.
|
||
@export var data: Array[TwitchVideo]:
|
||
set(val):
|
||
data = val
|
||
track_data(&"data", val)
|
||
|
||
## Contains the information used to page through the list of results. The object is empty if there are no more pages left to page through. [Read More](https://dev.twitch.tv/docs/api/guide#pagination)
|
||
@export var pagination: ResponsePagination:
|
||
set(val):
|
||
pagination = val
|
||
track_data(&"pagination", val)
|
||
var response: BufferedHTTPClient.ResponseData
|
||
|
||
|
||
## Constructor with all required fields.
|
||
static func create(_data: Array[TwitchVideo]) -> Response:
|
||
var response: Response = Response.new()
|
||
response.data = _data
|
||
return response
|
||
|
||
|
||
static func from_json(d: Dictionary) -> Response:
|
||
var result: Response = Response.new()
|
||
if d.get("data", null) != null:
|
||
for value in d["data"]:
|
||
result.data.append(TwitchVideo.from_json(value))
|
||
if d.get("pagination", null) != null:
|
||
result.pagination = ResponsePagination.from_json(d["pagination"])
|
||
return result
|
||
|
||
|
||
|
||
func _has_pagination() -> bool:
|
||
if pagination == null: return false
|
||
if pagination.cursor == null || pagination.cursor == "": return false
|
||
return true
|
||
|
||
var _next_page: Callable
|
||
var _cur_iter: int = 0
|
||
|
||
|
||
func next_page() -> Response:
|
||
var response: Response = await _next_page.call()
|
||
_cur_iter = 0
|
||
_next_page = response._next_page
|
||
data = response.data
|
||
pagination = response.pagination
|
||
|
||
return response
|
||
|
||
|
||
func _iter_init(iter: Array) -> bool:
|
||
if data.is_empty(): return false
|
||
iter[0] = data[0]
|
||
return data.size() > 0
|
||
|
||
|
||
func _iter_next(iter: Array) -> bool:
|
||
if data.size() - 1 > _cur_iter:
|
||
_cur_iter += 1
|
||
iter[0] = data[_cur_iter]
|
||
if data.size() - 1 == _cur_iter && not _has_pagination():
|
||
return false
|
||
return true
|
||
|
||
|
||
func _iter_get(iter: Variant) -> Variant:
|
||
if data.size() - 1 == _cur_iter && _has_pagination():
|
||
await next_page()
|
||
return iter
|
||
|
||
|
||
## Contains the information used to page through the list of results. The object is empty if there are no more pages left to page through. [Read More](https://dev.twitch.tv/docs/api/guide#pagination)
|
||
## #/components/schemas/GetVideosResponse/Pagination
|
||
class ResponsePagination extends TwitchData:
|
||
|
||
## The cursor used to get the next page of results. Use the cursor to set the request's _after_ or _before_ query parameter depending on whether you're paging forwards or backwards through the results.
|
||
@export var cursor: String:
|
||
set(val):
|
||
cursor = val
|
||
track_data(&"cursor", val)
|
||
|
||
|
||
|
||
## Constructor with all required fields.
|
||
static func create() -> ResponsePagination:
|
||
var response_pagination: ResponsePagination = ResponsePagination.new()
|
||
return response_pagination
|
||
|
||
|
||
static func from_json(d: Dictionary) -> ResponsePagination:
|
||
var result: ResponsePagination = ResponsePagination.new()
|
||
if d.get("cursor", null) != null:
|
||
result.cursor = d["cursor"]
|
||
return result
|
||
|
||
|
||
|
||
## All optional parameters for TwitchAPI.get_videos
|
||
## #/components/schemas/GetVideosOpt
|
||
class Opt extends TwitchData:
|
||
|
||
## A list of IDs that identify the videos you want to get. To get more than one video, include this parameter for each video you want to get. For example, `id=1234&id=5678`. You may specify a maximum of 100 IDs. The endpoint ignores duplicate IDs and IDs that weren't found (if there's at least one valid ID).
|
||
##
|
||
## The _id_, _user\_id_, and _game\_id_ parameters are mutually exclusive.
|
||
@export var id: Array[String]:
|
||
set(val):
|
||
id = val
|
||
track_data(&"id", val)
|
||
|
||
## The ID of the user whose list of videos you want to get.
|
||
##
|
||
## The _id_, _user\_id_, and _game\_id_ parameters are mutually exclusive.
|
||
@export var user_id: String:
|
||
set(val):
|
||
user_id = val
|
||
track_data(&"user_id", val)
|
||
|
||
## A category or game ID. The response contains a maximum of 500 videos that show this content. To get category/game IDs, use the [Search Categories](https://dev.twitch.tv/docs/api/reference#search-categories) endpoint.
|
||
##
|
||
## The _id_, _user\_id_, and _game\_id_ parameters are mutually exclusive.
|
||
@export var game_id: String:
|
||
set(val):
|
||
game_id = val
|
||
track_data(&"game_id", val)
|
||
|
||
## A filter used to filter the list of videos by the language that the video owner broadcasts in. For example, to get videos that were broadcast in German, set this parameter to the ISO 639-1 two-letter code for German (i.e., DE). For a list of supported languages, see [Supported Stream Language](https://help.twitch.tv/s/article/languages-on-twitch#streamlang). If the language is not supported, use “other.”
|
||
##
|
||
## Specify this parameter only if you specify the _game\_id_ query parameter.
|
||
@export var language: String:
|
||
set(val):
|
||
language = val
|
||
track_data(&"language", val)
|
||
|
||
## A filter used to filter the list of videos by when they were published. For example, videos published in the last week. Possible values are:
|
||
##
|
||
## * all
|
||
## * day
|
||
## * month
|
||
## * week
|
||
##
|
||
## The default is "all," which returns videos published in all periods.
|
||
##
|
||
## Specify this parameter only if you specify the _game\_id_ or _user\_id_ query parameter.
|
||
@export var period: String:
|
||
set(val):
|
||
period = val
|
||
track_data(&"period", val)
|
||
|
||
## The order to sort the returned videos in. Possible values are:
|
||
##
|
||
## * time — Sort the results in descending order by when they were created (i.e., latest video first).
|
||
## * trending — Sort the results in descending order by biggest gains in viewership (i.e., highest trending video first).
|
||
## * views — Sort the results in descending order by most views (i.e., highest number of views first).
|
||
##
|
||
## The default is "time."
|
||
##
|
||
## Specify this parameter only if you specify the _game\_id_ or _user\_id_ query parameter.
|
||
@export var sort: String:
|
||
set(val):
|
||
sort = val
|
||
track_data(&"sort", val)
|
||
|
||
## A filter used to filter the list of videos by the video's type. Possible case-sensitive values are:
|
||
##
|
||
## * all
|
||
## * archive — On-demand videos (VODs) of past streams.
|
||
## * highlight — Highlight reels of past streams.
|
||
## * upload — External videos that the broadcaster uploaded using the Video Producer.
|
||
##
|
||
## The default is "all," which returns all video types.
|
||
##
|
||
## Specify this parameter only if you specify the _game\_id_ or _user\_id_ query parameter.
|
||
@export var type: String:
|
||
set(val):
|
||
type = val
|
||
track_data(&"type", val)
|
||
|
||
## The maximum number of items to return per page in the response. The minimum page size is 1 item per page and the maximum is 100\. The default is 20.
|
||
##
|
||
## Specify this parameter only if you specify the _game\_id_ or _user\_id_ query parameter.
|
||
@export var first: String:
|
||
set(val):
|
||
first = val
|
||
track_data(&"first", val)
|
||
|
||
## The cursor used to get the next page of results. The **Pagination** object in the response contains the cursor’s value. [Read More](https://dev.twitch.tv/docs/api/guide#pagination)
|
||
##
|
||
## Specify this parameter only if you specify the _user\_id_ query parameter.
|
||
@export var after: String:
|
||
set(val):
|
||
after = val
|
||
track_data(&"after", val)
|
||
|
||
## The cursor used to get the previous page of results. The **Pagination** object in the response contains the cursor’s value. [Read More](https://dev.twitch.tv/docs/api/guide#pagination)
|
||
##
|
||
## Specify this parameter only if you specify the _user\_id_ query parameter.
|
||
@export var before: String:
|
||
set(val):
|
||
before = val
|
||
track_data(&"before", val)
|
||
|
||
|
||
|
||
## Constructor with all required fields.
|
||
static func create() -> Opt:
|
||
var opt: Opt = Opt.new()
|
||
return opt
|
||
|
||
|
||
static func from_json(d: Dictionary) -> Opt:
|
||
var result: Opt = Opt.new()
|
||
if d.get("id", null) != null:
|
||
for value in d["id"]:
|
||
result.id.append(value)
|
||
if d.get("user_id", null) != null:
|
||
result.user_id = d["user_id"]
|
||
if d.get("game_id", null) != null:
|
||
result.game_id = d["game_id"]
|
||
if d.get("language", null) != null:
|
||
result.language = d["language"]
|
||
if d.get("period", null) != null:
|
||
result.period = d["period"]
|
||
if d.get("sort", null) != null:
|
||
result.sort = d["sort"]
|
||
if d.get("type", null) != null:
|
||
result.type = d["type"]
|
||
if d.get("first", null) != null:
|
||
result.first = d["first"]
|
||
if d.get("after", null) != null:
|
||
result.after = d["after"]
|
||
if d.get("before", null) != null:
|
||
result.before = d["before"]
|
||
return result
|
||
|