API/SpatieResponseStrategy
SpatieResponseStrategy
src/strategies/spatie-response.strategy.ts1 public methodsclass
Response strategy for the Spatie Query Builder driver
Parses flat Laravel-style pagination responses (Spatie’s Query Builder is built on Laravel’s pagination):
{ "data": [...], "current_page": 1, "total": 100, "per_page": 15, "from": 1, "to": 15, ...}The traversal algorithm (flat response[options.X] lookups) is
inherited from AbstractFlatResponseStrategy; this class exists so
DriverEnum.SPATIE resolves to a distinct identity at the DI layer
even though the parsing logic is shared with the plain Laravel driver.
Constructor
Section titled “Constructor”new SpatieResponseStrategy()Methods
Section titled “Methods”paginate()
Section titled “paginate()”paginate(response: RawResponse, options: ResponseOptions): PaginatedCollection<T>Parse a flat-envelope pagination response into a PaginatedCollection
| Parameter | Type | Description |
|---|---|---|
response |
RawResponse |
The raw API response object |
options |
ResponseOptions |
The response key name configuration |
Returns — A typed PaginatedCollection instance
