NAME

Apertur::SDK::HTTPClient - HTTP wrapper for the Apertur API

SYNOPSIS

use Apertur::SDK::HTTPClient;

my $http = Apertur::SDK::HTTPClient->new(
    base_url => 'https://api.aptr.ca',
    api_key  => 'aptr_live_...',
);

my $data = $http->request('GET', '/api/v1/stats');
my $raw  = $http->request_raw('GET', '/api/v1/upload-sessions/uuid/qr');

DESCRIPTION

Low-level HTTP client used internally by all Apertur SDK resource classes. Handles JSON serialisation, bearer token authentication, multipart uploads, and maps HTTP error responses to typed exception objects.

METHODS

new(%args)

Constructor. Accepts base_url, api_key, and oauth_token.

request($method, $path, %opts)

Sends a JSON API request and returns the decoded response as a hashref or arrayref. Returns undef for 204 No Content responses.

Options: body (JSON string), headers (hashref), multipart (arrayref for HTTP::Request::Common multipart POST), timeout (per-request override in seconds for the underlying LWP::UserAgent timeout).

request_raw($method, $path, %opts)

Sends a request and returns the raw response body as a byte string.