TrishulClient Class

Namespace: TrishulApi\Core\Http
Implements: TrishulClientInterface

The TrishulClient class provides methods to make HTTP requests (GET, POST, PUT, DELETE) using cURL. It supports both "mono" and "flux" variants for each HTTP method.

Methods

get_mono($url, TrishulClientHeader $headers)

Performs a GET request to the specified URL with provided headers.

Parameters: Returns: Response from the server.

get_flux($url, TrishulClientHeader $headers)

Performs a GET request (flux variant) to the specified URL with provided headers.

Parameters: Returns: Response from the server.

post_mono($url, $data, TrishulClientHeader $headers)

Performs a POST request to the specified URL with provided data and headers.

Parameters: Returns: Response from the server.

post_flux($url, array $data, TrishulClientHeader $headers)

Performs a POST request (flux variant) to the specified URL with provided data and headers.

Parameters: Returns: Response from the server.

delete_mono($url, TrishulClientHeader $headers)

Performs a DELETE request to the specified URL with provided headers.

Parameters: Returns: Response from the server.

delete_flux($url, array $data, TrishulClientHeader $headers)

Performs a DELETE request (flux variant) to the specified URL with provided headers.

Parameters: Returns: Response from the server.

put_mono($url, $data, TrishulClientHeader $headers)

Performs a PUT request to the specified URL with provided data and headers.

Parameters: Returns: Response from the server.

put_flux($url, array $data, TrishulClientHeader $headers)

Performs a PUT request (flux variant) to the specified URL with provided data and headers.

Parameters: Returns: Response from the server.

__makeCurlRequest($url, $requestType, $data, $headers)

Private helper method to perform the actual cURL request.
Sets up cURL options based on the request type and executes the request.

Parameters: Returns: Response from the server.

Usage Example


$client = new TrishulApi\Core\Http\TrishulClient();
$headers = new TrishulApi\Core\Http\TrishulClientHeader();
$response = $client->get_mono('https://api.example.com/data', $headers);