KickHTTPClient
Inherits: RefCounted < Object
HTTP client for making requests to the Kick API.
Description
KickHTTPClient handles low-level HTTP communication with the Kick API, including connection management, request queueing, rate limiting, and response parsing. This class is typically used internally by KickAPI and its request handlers.
# Example of manual HTTP client usage (advanced)
var http_client = KickHTTPClient.new()
func _ready():
http_client.set_access_token("your_token")
http_client.set_response_callback(_on_response)
# Queue a GET request
var params = {"username": ["streamer123"]}
http_client.queue_request("users_data", HTTPClient.METHOD_GET, "/users", params)
func _process(_delta):
# Poll for responses
http_client.poll()
func _on_response(signal_name: String, response_code: int, data: Dictionary):
print("Response: ", signal_name, " Code: ", response_code)
print("Data: ", data)
# Check rate limit
var remaining = http_client.get_rate_limit_remaining()
print("Rate limit remaining: ", remaining)
Tutorials
Methods
get_queue_size() const |
|
get_rate_limit_remaining() const |
|
get_rate_limit_reset() const |
|
is_busy() const |
|
void |
poll() |
query_string_from_dict(params: Dictionary) static |
|
void |
queue_request(signal_name: String, method: Method, path: String, query_params: Dictionary = {}, body: String = "") |
void |
set_access_token(token: String) |
void |
set_base_url(url: String) |
void |
set_response_callback(callback: Callable) |
void |
set_tls_options(tls_options: TLSOptions) |
Method Descriptions
Returns the number of requests currently in the queue waiting to be sent.
int get_rate_limit_remaining() const 🔗
Returns the number of API requests remaining before hitting the rate limit.
int get_rate_limit_reset() const 🔗
Returns the Unix timestamp when the rate limit will reset.
Returns true if the client is currently processing requests or has queued requests.
void poll() 🔗
Polls the HTTP client to process pending requests and responses. Should be called regularly (e.g., each frame).
String query_string_from_dict(params: Dictionary) static 🔗
Converts a Dictionary to a URL-encoded query string.
void queue_request(signal_name: String, method: Method, path: String, query_params: Dictionary = {}, body: String = "") 🔗
Queues an HTTP request to be sent to the Kick API.
void set_access_token(token: String) 🔗
Sets the access token for API authentication.
void set_base_url(url: String) 🔗
Sets the base URL for the Kick API. Default is https://api.kick.com/public/v1.
void set_response_callback(callback: Callable) 🔗
Sets the callback function that will be called when a response is received.
void set_tls_options(tls_options: TLSOptions) 🔗
There is currently no description for this method. Please help us by contributing one!