116 lines
3.2 KiB
GDScript3
116 lines
3.2 KiB
GDScript3
|
|
@tool
|
|||
|
|
extends TwitchData
|
|||
|
|
|
|||
|
|
# CLASS GOT AUTOGENERATED DON'T CHANGE MANUALLY. CHANGES CAN BE OVERWRITTEN EASILY.
|
|||
|
|
|
|||
|
|
class_name TwitchGetExtensionLiveChannels
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
##
|
|||
|
|
## #/components/schemas/GetExtensionLiveChannelsResponse
|
|||
|
|
class Response extends TwitchData:
|
|||
|
|
|
|||
|
|
## The list of broadcasters that are streaming live and that have installed or activated the extension.
|
|||
|
|
@export var data: Array[TwitchExtensionLiveChannel]:
|
|||
|
|
set(val):
|
|||
|
|
data = val
|
|||
|
|
track_data(&"data", val)
|
|||
|
|
|
|||
|
|
## This field contains the cursor used to page through the results. The field is empty if there are no more pages left to page through. Note that this field is a string compared to other endpoints that use a **Pagination** object. [Read More](https://dev.twitch.tv/docs/api/guide#pagination)
|
|||
|
|
@export var pagination: String:
|
|||
|
|
set(val):
|
|||
|
|
pagination = val
|
|||
|
|
track_data(&"pagination", val)
|
|||
|
|
var response: BufferedHTTPClient.ResponseData
|
|||
|
|
|
|||
|
|
|
|||
|
|
## Constructor with all required fields.
|
|||
|
|
static func create(_data: Array[TwitchExtensionLiveChannel]) -> 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(TwitchExtensionLiveChannel.from_json(value))
|
|||
|
|
if d.get("pagination", null) != null:
|
|||
|
|
result.pagination = d["pagination"]
|
|||
|
|
return result
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
func _has_pagination() -> bool:
|
|||
|
|
if pagination == null || pagination == "": 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
|
|||
|
|
|
|||
|
|
|
|||
|
|
## All optional parameters for TwitchAPI.get_extension_live_channels
|
|||
|
|
## #/components/schemas/GetExtensionLiveChannelsOpt
|
|||
|
|
class Opt extends TwitchData:
|
|||
|
|
|
|||
|
|
## The specific maximum number of items per page in the response. The actual number returned may be less than this limit. [Read More](https://dev.twitch.tv/docs/api/guide#pagination)
|
|||
|
|
@export var first: int:
|
|||
|
|
set(val):
|
|||
|
|
first = val
|
|||
|
|
track_data(&"first", val)
|
|||
|
|
|
|||
|
|
## The cursor used to get the next page of results. The `pagination` field in the response contains the cursor’s value. [Read More](https://dev.twitch.tv/docs/api/guide#pagination)
|
|||
|
|
@export var after: String:
|
|||
|
|
set(val):
|
|||
|
|
after = val
|
|||
|
|
track_data(&"after", 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("first", null) != null:
|
|||
|
|
result.first = d["first"]
|
|||
|
|
if d.get("after", null) != null:
|
|||
|
|
result.after = d["after"]
|
|||
|
|
return result
|
|||
|
|
|