pokepurple/addons/twitcher/generated/twitch_get_broadcaster_subscriptions.gd

180 lines
6.1 KiB
GDScript3
Raw Normal View History

@tool
extends TwitchData
# CLASS GOT AUTOGENERATED DON'T CHANGE MANUALLY. CHANGES CAN BE OVERWRITTEN EASILY.
class_name TwitchGetBroadcasterSubscriptions
##
## #/components/schemas/GetBroadcasterSubscriptionsResponse
class Response extends TwitchData:
## The list of users that subscribe to the broadcaster. The list is empty if the broadcaster has no subscribers.
@export var data: Array[TwitchBroadcasterSubscription]:
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)
## The current number of subscriber points earned by this broadcaster. Points are based on the subscription tier of each user that subscribes to this broadcaster. For example, a Tier 1 subscription is worth 1 point, Tier 2 is worth 2 points, and Tier 3 is worth 6 points. The number of points determines the number of emote slots that are unlocked for the broadcaster (see [Subscriber Emote Slots](https://help.twitch.tv/s/article/subscriber-emote-guide#emoteslots)).
@export var points: int:
set(val):
points = val
track_data(&"points", val)
## The total number of users that subscribe to this broadcaster.
@export var total: int:
set(val):
total = val
track_data(&"total", val)
var response: BufferedHTTPClient.ResponseData
## Constructor with all required fields.
static func create(_data: Array[TwitchBroadcasterSubscription], _points: int, _total: int) -> Response:
var response: Response = Response.new()
response.data = _data
response.points = _points
response.total = _total
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(TwitchBroadcasterSubscription.from_json(value))
if d.get("pagination", null) != null:
result.pagination = ResponsePagination.from_json(d["pagination"])
if d.get("points", null) != null:
result.points = d["points"]
if d.get("total", null) != null:
result.total = d["total"]
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
points = response.points
total = response.total
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/GetBroadcasterSubscriptionsResponse/Pagination
class ResponsePagination extends TwitchData:
## The cursor used to get the next or previous page of results. Use the cursor to set the requests _after_ or _before_ query parameter depending on whether youre paging forwards or backwards.
@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_broadcaster_subscriptions
## #/components/schemas/GetBroadcasterSubscriptionsOpt
class Opt extends TwitchData:
## Filters the list to include only the specified subscribers. To specify more than one subscriber, include this parameter for each subscriber. For example, `&user_id=1234&user_id=5678`. You may specify a maximum of 100 subscribers.
@export var user_id: Array[String]:
set(val):
user_id = val
track_data(&"user_id", 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 items per page. The default is 20.
@export var first: String:
set(val):
first = val
track_data(&"first", val)
## The cursor used to get the next page of results. Do not specify if you set the _user\_id_ query parameter. The **Pagination** object in the response contains the cursors value. [Read More](https://dev.twitch.tv/docs/api/guide#pagination)
@export var after: String:
set(val):
after = val
track_data(&"after", val)
## The cursor used to get the previous page of results. Do not specify if you set the _user\_id_ query parameter. The **Pagination** object in the response contains the cursors value. [Read More](https://dev.twitch.tv/docs/api/guide#pagination)
@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("user_id", null) != null:
for value in d["user_id"]:
result.user_id.append(value)
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