183 lines
No EOL
5.5 KiB
GDScript
183 lines
No EOL
5.5 KiB
GDScript
@tool
|
||
extends TwitchData
|
||
|
||
# CLASS GOT AUTOGENERATED DON'T CHANGE MANUALLY. CHANGES CAN BE OVERWRITTEN EASILY.
|
||
|
||
class_name TwitchGetCustomRewardRedemption
|
||
|
||
|
||
|
||
##
|
||
## #/components/schemas/GetCustomRewardRedemptionResponse
|
||
class Response extends TwitchData:
|
||
|
||
## The list of redemptions for the specified reward. The list is empty if there are no redemptions that match the redemption criteria.
|
||
@export var data: Array[TwitchCustomRewardRedemption]:
|
||
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[TwitchCustomRewardRedemption]) -> 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(TwitchCustomRewardRedemption.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/GetCustomRewardRedemptionResponse/Pagination
|
||
class ResponsePagination extends TwitchData:
|
||
|
||
## The cursor used to get the next page of results. Use the cursor to set the request’s _after_ query parameter.
|
||
@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_custom_reward_redemption
|
||
## #/components/schemas/GetCustomRewardRedemptionOpt
|
||
class Opt extends TwitchData:
|
||
|
||
## The status of the redemptions to return. The possible case-sensitive values are:
|
||
##
|
||
## * CANCELED
|
||
## * FULFILLED
|
||
## * UNFULFILLED
|
||
##
|
||
## **NOTE**: This field is required only if you don’t specify the _id_ query parameter.
|
||
##
|
||
## **NOTE**: Canceled and fulfilled redemptions are returned for only a few days after they’re canceled or fulfilled.
|
||
@export var status: String:
|
||
set(val):
|
||
status = val
|
||
track_data(&"status", val)
|
||
|
||
## A list of IDs to filter the redemptions by. To specify more than one ID, include this parameter for each redemption you want to get. For example, `id=1234&id=5678`. You may specify a maximum of 50 IDs.
|
||
##
|
||
## Duplicate IDs are ignored. The response contains only the IDs that were found. If none of the IDs were found, the response is 404 Not Found.
|
||
@export var id: Array[String]:
|
||
set(val):
|
||
id = val
|
||
track_data(&"id", val)
|
||
|
||
## The order to sort redemptions by. The possible case-sensitive values are:
|
||
##
|
||
## * OLDEST
|
||
## * NEWEST
|
||
##
|
||
## The default is OLDEST.
|
||
@export var sort: String:
|
||
set(val):
|
||
sort = val
|
||
track_data(&"sort", 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)
|
||
@export var after: String:
|
||
set(val):
|
||
after = val
|
||
track_data(&"after", val)
|
||
|
||
## The maximum number of redemptions to return per page in the response. The minimum page size is 1 redemption per page and the maximum is 50\. The default is 20.
|
||
@export var first: int:
|
||
set(val):
|
||
first = val
|
||
track_data(&"first", 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("status", null) != null:
|
||
result.status = d["status"]
|
||
if d.get("id", null) != null:
|
||
for value in d["id"]:
|
||
result.id.append(value)
|
||
if d.get("sort", null) != null:
|
||
result.sort = d["sort"]
|
||
if d.get("after", null) != null:
|
||
result.after = d["after"]
|
||
if d.get("first", null) != null:
|
||
result.first = d["first"]
|
||
return result
|
||
|