@tool
extends TwitchData

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

## 
## #/components/schemas/EventSubSubscription
class_name TwitchEventSubSubscription
	
## An ID that identifies the subscription.
@export var id: String:
	set(val): 
		id = val
		track_data(&"id", val)

## The subscription's status. The subscriber receives events only for **enabled** subscriptions. Possible values are:  
##   
## * enabled — The subscription is enabled.
## * webhook\_callback\_verification\_pending — The subscription is pending verification of the specified callback URL.
## * webhook\_callback\_verification\_failed — The specified callback URL failed verification.
## * notification\_failures\_exceeded — The notification delivery failure rate was too high.
## * authorization\_revoked — The authorization was revoked for one or more users specified in the **Condition** object.
## * moderator\_removed — The moderator that authorized the subscription is no longer one of the broadcaster's moderators.
## * user\_removed — One of the users specified in the **Condition** object was removed.
## * version\_removed — The subscription to subscription type and version is no longer supported.
## * beta\_maintenance — The subscription to the beta subscription type was removed due to maintenance.
## * websocket\_disconnected — The client closed the connection.
## * websocket\_failed\_ping\_pong — The client failed to respond to a ping message.
## * websocket\_received\_inbound\_traffic — The client sent a non-pong message. Clients may only send pong messages (and only in response to a ping message).
## * websocket\_connection\_unused — The client failed to subscribe to events within the required time.
## * websocket\_internal\_error — The Twitch WebSocket server experienced an unexpected error.
## * websocket\_network\_timeout — The Twitch WebSocket server timed out writing the message to the client.
## * websocket\_network\_error — The Twitch WebSocket server experienced a network error writing the message to the client.
@export var status: String:
	set(val): 
		status = val
		track_data(&"status", val)

## The subscription's type. See [Subscription Types](https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#subscription-types).
@export var type: String:
	set(val): 
		type = val
		track_data(&"type", val)

## The version number that identifies this definition of the subscription's data.
@export var version: String:
	set(val): 
		version = val
		track_data(&"version", val)

## The subscription's parameter values. This is a string-encoded JSON object whose contents are determined by the subscription type.
@export var condition: Dictionary:
	set(val): 
		condition = val
		track_data(&"condition", val)

## The date and time (in RFC3339 format) of when the subscription was created.
@export var created_at: String:
	set(val): 
		created_at = val
		track_data(&"created_at", val)

## The transport details used to send the notifications.
@export var transport: Transport:
	set(val): 
		transport = val
		track_data(&"transport", val)

## The amount that the subscription counts against your limit. [Learn More](https://dev.twitch.tv/docs/eventsub/manage-subscriptions/#subscription-limits)
@export var cost: int:
	set(val): 
		cost = val
		track_data(&"cost", val)
var response: BufferedHTTPClient.ResponseData


## Constructor with all required fields.
static func create(_id: String, _status: String, _type: String, _version: String, _condition: Dictionary, _created_at: String, _transport: Transport, _cost: int) -> TwitchEventSubSubscription:
	var twitch_event_sub_subscription: TwitchEventSubSubscription = TwitchEventSubSubscription.new()
	twitch_event_sub_subscription.id = _id
	twitch_event_sub_subscription.status = _status
	twitch_event_sub_subscription.type = _type
	twitch_event_sub_subscription.version = _version
	twitch_event_sub_subscription.condition = _condition
	twitch_event_sub_subscription.created_at = _created_at
	twitch_event_sub_subscription.transport = _transport
	twitch_event_sub_subscription.cost = _cost
	return twitch_event_sub_subscription


static func from_json(d: Dictionary) -> TwitchEventSubSubscription:
	var result: TwitchEventSubSubscription = TwitchEventSubSubscription.new()
	if d.get("id", null) != null:
		result.id = d["id"]
	if d.get("status", null) != null:
		result.status = d["status"]
	if d.get("type", null) != null:
		result.type = d["type"]
	if d.get("version", null) != null:
		result.version = d["version"]
	if d.get("condition", null) != null:
		result.condition = d["condition"]
	if d.get("created_at", null) != null:
		result.created_at = d["created_at"]
	if d.get("transport", null) != null:
		result.transport = Transport.from_json(d["transport"])
	if d.get("cost", null) != null:
		result.cost = d["cost"]
	return result



## The transport details used to send the notifications.
## #/components/schemas/EventSubSubscription/Transport
class Transport extends TwitchData:

	## The transport method. Possible values are:  
	##   
	## * webhook
	## * websocket
	@export var method: String:
		set(val): 
			method = val
			track_data(&"method", val)
	
	## The callback URL where the notifications are sent. Included only if `method` is set to **webhook**.
	@export var callback: String:
		set(val): 
			callback = val
			track_data(&"callback", val)
	
	## An ID that identifies the WebSocket that notifications are sent to. Included only if `method` is set to **websocket**.
	@export var session_id: String:
		set(val): 
			session_id = val
			track_data(&"session_id", val)
	
	## The UTC date and time that the WebSocket connection was established. Included only if `method` is set to **websocket**.
	@export var connected_at: String:
		set(val): 
			connected_at = val
			track_data(&"connected_at", val)
	
	## The UTC date and time that the WebSocket connection was lost. Included only if `method` is set to **websocket**.
	@export var disconnected_at: String:
		set(val): 
			disconnected_at = val
			track_data(&"disconnected_at", val)
	
	
	
	## Constructor with all required fields.
	static func create(_method: String) -> Transport:
		var transport: Transport = Transport.new()
		transport.method = _method
		return transport
	
	
	static func from_json(d: Dictionary) -> Transport:
		var result: Transport = Transport.new()
		if d.get("method", null) != null:
			result.method = d["method"]
		if d.get("callback", null) != null:
			result.callback = d["callback"]
		if d.get("session_id", null) != null:
			result.session_id = d["session_id"]
		if d.get("connected_at", null) != null:
			result.connected_at = d["connected_at"]
		if d.get("disconnected_at", null) != null:
			result.disconnected_at = d["disconnected_at"]
		return result
	