@tool
extends TwitchData

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

class_name TwitchSendExtensionPubSubMessage
	


## 
## #/components/schemas/SendExtensionPubSubMessageBody
class Body extends TwitchData:

	## The target of the message. Possible values are:  
	##   
	## * broadcast
	## * global
	## * whisper-<user-id>
	##   
	## If `is_global_broadcast` is **true**, you must set this field to global. The broadcast and global values are mutually exclusive; specify only one of them.
	@export var target: Array[String]:
		set(val): 
			target = val
			track_data(&"target", val)
	
	## The ID of the broadcaster to send the message to. Don’t include this field if `is_global_broadcast` is set to **true**.
	@export var broadcaster_id: String:
		set(val): 
			broadcaster_id = val
			track_data(&"broadcaster_id", val)
	
	## A Boolean value that determines whether the message should be sent to all channels where your extension is active. Set to **true** if the message should be sent to all channels. The default is **false**.
	@export var is_global_broadcast: bool:
		set(val): 
			is_global_broadcast = val
			track_data(&"is_global_broadcast", val)
	
	## The message to send. The message can be a plain-text string or a string-encoded JSON object. The message is limited to a maximum of 5 KB.
	@export var message: String:
		set(val): 
			message = val
			track_data(&"message", val)
	var response: BufferedHTTPClient.ResponseData
	
	
	## Constructor with all required fields.
	static func create(_target: Array[String], _broadcaster_id: String, _message: String) -> Body:
		var body: Body = Body.new()
		body.target = _target
		body.broadcaster_id = _broadcaster_id
		body.message = _message
		return body
	
	
	static func from_json(d: Dictionary) -> Body:
		var result: Body = Body.new()
		if d.get("target", null) != null:
			for value in d["target"]:
				result.target.append(value)
		if d.get("broadcaster_id", null) != null:
			result.broadcaster_id = d["broadcaster_id"]
		if d.get("is_global_broadcast", null) != null:
			result.is_global_broadcast = d["is_global_broadcast"]
		if d.get("message", null) != null:
			result.message = d["message"]
		return result
	