IPagedResource
Interface to interact with paged asynchronous resources
export interface IPagedResource<TItem>
Properties
Property | Modifiers | Type | Description |
|---|---|---|---|
| string | (Optional) | |
| TItem[] | ||
| number | ||
| number | ||
| number |
Methods
Method | Description |
|---|---|
Request all the pages merged in a single array. | |
Request all the pages merged in a single array and sort them using the given comparator. | |
Request a specific page of the resource | |
Request next page of the resource |
Property details
IPagedResource.cacheIdproperty
readonly cacheId?: string;
IPagedResource.itemsproperty
readonly items: TItem[];
IPagedResource.limitproperty
readonly limit: number;
IPagedResource.offsetproperty
readonly offset: number;
IPagedResource.totalCountproperty
readonly totalCount: number;
Method details
IPagedResource.all()method
Request all the pages merged in a single array.
all(): Promise<TItem[]>;
Returns
Promise<TItem[]>
promise of an array for all the pages’ contents in one array
Remarks
This MUST respect all the original query settings except for the paging settings (e.g. offset, limit).
IPagedResource.allSorted()method
Request all the pages merged in a single array and sort them using the given comparator.
allSorted(compareFn: (a: TItem, b: TItem) => number): Promise<TItem[]>;
Parameters
Parameter | Type | Description |
|---|---|---|
compareFn | (a: TItem, b: TItem) => number | the compare function to use - the semantics are the same os for the Array.sort parameter |
Returns
Promise<TItem[]>
promise of an array for all the pages’ contents in one array
Remarks
This MUST respect all the original query settings except for the paging settings (e.g. offset, limit).
IPagedResource.goTo()method
Request a specific page of the resource
goTo(pageIndex: number): Promise<IPagedResource<TItem>>;
Parameters
Parameter | Type | Description |
|---|---|---|
pageIndex | number | index of requested page: positive, zero-based |
Returns
Promise<IPagedResource<TItem>>
promise of a paged resource with the results of selected page
IPagedResource.next()method
Request next page of the resource
next(): Promise<IPagedResource<TItem>>;
Returns
Promise<IPagedResource<TItem>>
promise of a paged resource with the results of next page