class_name ApiRequest
extends HTTPRequest

var url: String
var headers: PackedStringArray
var body: String
var method: HTTPClient.Method
var callback: Callable

func _init(u: String, h: PackedStringArray, m: HTTPClient.Method, b: String = ""):
	super()
	self.url = u
	self.headers = h
	self.method = m
	self.body = b

func resolve(f: Callable) -> Error:
	self.request_completed.connect(f)
	var error = super.request(self.url, self.headers, self.method, self.body)
	if error != OK:
		return error
		
	return OK

