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.
Methods
Section titled “Methods”paginate()
Section titled “paginate()”paginate(response: RawResponse, options: ResponseOptions, headers?: HeaderBag, limit?: number): 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>. |
limit |
number |
Optional page size the request asked for; Paginator.paginate() passes the store’s limit. Drivers whose response places the rows but does not state the page size (PostgREST’s Content-Range) need it to place a short last page; the rest ignore it. |
Returns — A typed PaginatedCollection instance
