NAME

WebService::Qdrant::Response - Qdrant HTTP response and decoded JSON

VERSION

version 0.0001

SYNOPSIS

my $response = $qdrant->get_collection(collection_name => 'notes');
if ($response->is_success && !defined $response->decode_error) {
    my $configuration = $response->result;
} else {
    warn $response->raw_content;
}

DESCRIPTION

Represents one completed HTTP exchange. Qdrant results remain ordinary Perl hashes, arrays, scalars, and JSON booleans. HTTP errors do not throw. A body that cannot be decoded is retained with a decoding diagnostic.

SUBROUTINES/METHODS

new

my $response = WebService::Qdrant::Response->new(
    http_code   => 200,
    raw_content => '{"status":"ok","result":{"exists":false}}',
);

Requires http_code. raw_content defaults to an empty string and is expected to contain UTF-8 JSON bytes. The body is decoded once.

is_success

True for HTTP codes 200 through 299. This describes the HTTP outcome only; it does not imply that the body is valid JSON or that a result is true.

json_response

The complete decoded JSON value, preserving unknown fields. Returns undef on decoding failure or for JSON null; decode_error distinguishes these.

result

Returns the decoded operation result.

status

Returns the Qdrant status string or error hash.

time

Returns the server-reported processing time.

Read the corresponding top-level Qdrant envelope field. Missing fields or a non-object JSON body return undef. status may be a string or an error hash. result can include a false boolean or an empty list without implying an HTTP failure. time is the server-reported processing time.

usage

Returns the decoded top-level usage information, preserving its nested structure for inspection or debugging. Returns undef when usage is absent or the response body is not a JSON object.

ATTRIBUTES

http_code

Numeric HTTP status code.

raw_content

Response body bytes after HTTP content decoding, before JSON decoding. Available even for HTML, empty, or malformed responses.

decode_error

JSON decoding diagnostic, or undef on successful decoding. Invalid JSON never causes construction to throw. An empty body produces a diagnostic.

SEE ALSO

WebService::Qdrant, WebService::Qdrant::UA

AUTHOR

D Ruth Holloway <ruth@hiruthie.me>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by D Ruth Holloway.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.