@tool
extends TwitchData

# CLASS GOT AUTOGENERATED DON'T CHANGE MANUALLY. CHANGES CAN BE OVERWRITTEN EASILY.

class_name TwitchGetBitsLeaderboard
	


## 
## #/components/schemas/GetBitsLeaderboardResponse
class Response extends TwitchData:

	## A list of leaderboard leaders. The leaders are returned in rank order by how much they’ve cheered. The array is empty if nobody has cheered bits.
	@export var data: Array[TwitchBitsLeaderboard]:
		set(val): 
			data = val
			track_data(&"data", val)
	
	## The reporting window’s start and end dates, in RFC3339 format. The dates are calculated by using the _started\_at_ and _period_ query parameters. If you don’t specify the _started\_at_ query parameter, the fields contain empty strings.
	@export var date_range: ResponseDateRange:
		set(val): 
			date_range = val
			track_data(&"date_range", val)
	
	## The number of ranked users in `data`. This is the value in the _count_ query parameter or the total number of entries on the leaderboard, whichever is less.
	@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[TwitchBitsLeaderboard], _date_range: ResponseDateRange, _total: int) -> Response:
		var response: Response = Response.new()
		response.data = _data
		response.date_range = _date_range
		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(TwitchBitsLeaderboard.from_json(value))
		if d.get("date_range", null) != null:
			result.date_range = ResponseDateRange.from_json(d["date_range"])
		if d.get("total", null) != null:
			result.total = d["total"]
		return result
	


## The reporting window’s start and end dates, in RFC3339 format. The dates are calculated by using the _started\_at_ and _period_ query parameters. If you don’t specify the _started\_at_ query parameter, the fields contain empty strings.
## #/components/schemas/GetBitsLeaderboardResponse/DateRange
class ResponseDateRange extends TwitchData:

	## The reporting window’s start date.
	@export var started_at: String:
		set(val): 
			started_at = val
			track_data(&"started_at", val)
	
	## The reporting window’s end date.
	@export var ended_at: String:
		set(val): 
			ended_at = val
			track_data(&"ended_at", val)
	
	
	
	## Constructor with all required fields.
	static func create(_started_at: String, _ended_at: String) -> ResponseDateRange:
		var response_date_range: ResponseDateRange = ResponseDateRange.new()
		response_date_range.started_at = _started_at
		response_date_range.ended_at = _ended_at
		return response_date_range
	
	
	static func from_json(d: Dictionary) -> ResponseDateRange:
		var result: ResponseDateRange = ResponseDateRange.new()
		if d.get("started_at", null) != null:
			result.started_at = d["started_at"]
		if d.get("ended_at", null) != null:
			result.ended_at = d["ended_at"]
		return result
	


## All optional parameters for TwitchAPI.get_bits_leaderboard
## #/components/schemas/GetBitsLeaderboardOpt
class Opt extends TwitchData:

	## The number of results to return. The minimum count is 1 and the maximum is 100\. The default is 10.
	@export var count: int:
		set(val): 
			count = val
			track_data(&"count", val)
	
	## The time period over which data is aggregated (uses the PST time zone). Possible values are:  
	##   
	## * day — A day spans from 00:00:00 on the day specified in _started\_at_ and runs through 00:00:00 of the next day.
	## * week — A week spans from 00:00:00 on the Monday of the week specified in _started\_at_ and runs through 00:00:00 of the next Monday.
	## * month — A month spans from 00:00:00 on the first day of the month specified in _started\_at_ and runs through 00:00:00 of the first day of the next month.
	## * year — A year spans from 00:00:00 on the first day of the year specified in _started\_at_ and runs through 00:00:00 of the first day of the next year.
	## * all — Default. The lifetime of the broadcaster's channel.
	@export var period: String:
		set(val): 
			period = val
			track_data(&"period", val)
	
	## The start date, in RFC3339 format, used for determining the aggregation period. Specify this parameter only if you specify the _period_ query parameter. The start date is ignored if _period_ is all.  
	##   
	## Note that the date is converted to PST before being used, so if you set the start time to `2022-01-01T00:00:00.0Z` and _period_ to month, the actual reporting period is December 2021, not January 2022\. If you want the reporting period to be January 2022, you must set the start time to `2022-01-01T08:00:00.0Z` or `2022-01-01T00:00:00.0-08:00`.  
	##   
	## If your start date uses the ‘+’ offset operator (for example, `2022-01-01T00:00:00.0+05:00`), you must URL encode the start date.
	@export var started_at: String:
		set(val): 
			started_at = val
			track_data(&"started_at", val)
	
	## An ID that identifies a user that cheered bits in the channel. If _count_ is greater than 1, the response may include users ranked above and below the specified user. To get the leaderboard’s top leaders, don’t specify a user ID.
	@export var user_id: String:
		set(val): 
			user_id = val
			track_data(&"user_id", 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("count", null) != null:
			result.count = d["count"]
		if d.get("period", null) != null:
			result.period = d["period"]
		if d.get("started_at", null) != null:
			result.started_at = d["started_at"]
		if d.get("user_id", null) != null:
			result.user_id = d["user_id"]
		return result
	