OdataResponseStrategy
ArchivedThese are the docs for ng-qubee 3.8. Read the 4.0 docs for @qubeejs/angular.
Defined in: src/lib/strategies/odata-response.strategy.ts:40
Response strategy for the OData v4 driver
Parses OData collection responses:
{ "@odata.context": "https://api.example.com/$metadata#Products", "@odata.count": 100, "@odata.nextLink": "https://api.example.com/Products?$count=true&$top=10&$skip=30", "value": [...]}OData emits no current-page or page-size field in the body, so this
strategy derives them by inspecting the @odata.nextLink URL:
perPagecomes from the link’s$topparam, falling back to the item count of the current (necessarily full) page when the link carries no$top.currentPageis$skip ÷ perPage— the next page starts where the current one ends. Without a usable link ($skiptoken-based server-driven paging, or the last page) the strategy falls back to page 1, which is only guaranteed correct for single-page results.lastPageisceil(total ÷ perPage); on a link-less response it resolves to 1 when the page provably holds the whole result set.
The total requires $count=true on the request — the request strategy
always emits it. Envelope keys contain literal dots (@odata.count),
so key paths from OdataResponseOptions are read with flat bracket
access, never dot-path traversal.
https://docs.oasis-open.org/odata/odata-json-format/v4.01/odata-json-format-v4.01.html
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new OdataResponseStrategy():
OdataResponseStrategy
Returns
Section titled “Returns”OdataResponseStrategy
Methods
Section titled “Methods”paginate()
Section titled “paginate()”paginate<
T>(response,options):PaginatedCollection<T>
Defined in: src/lib/strategies/odata-response.strategy.ts:50
Parse an OData collection response into a PaginatedCollection
Type Parameters
Section titled “Type Parameters”T extends IPaginatedObject
Parameters
Section titled “Parameters”response
Section titled “response”Record<string, any>
The raw API response body
options
Section titled “options”The response key name configuration
Returns
Section titled “Returns”A typed PaginatedCollection instance