Skip to content
API/IResponseStrategy

IResponseStrategy

src/interfaces/response-strategy.interface.ts1 public methodsinterface

Strategy interface for parsing paginated API responses

Each driver implements this interface to parse responses from the corresponding backend format into a PaginatedCollection.

paginate(response: RawResponse, options: ResponseOptions, headers?: HeaderBag): PaginatedCollection<T>

Parse a raw API response into a typed PaginatedCollection

Parameter Type Description
response RawResponse The raw API response object (body). For drivers that emit a bare array body (e.g. PostgREST), pass the array here.
options ResponseOptions The response key name configuration
headers HeaderBag Optional HTTP response headers. Drivers that carry pagination metadata in headers (PostgREST’s Content-Range) read from this bag; body-only drivers ignore it. Accepts anything with a .get() accessor (HttpHeaders, Headers) or a plain Record<string, string>.

Returns — A typed PaginatedCollection instance