PaginatedCollection
Defined in: src/lib/models/paginated-collection.ts:5
Type Parameters
T
T extends IPaginatedObject
Constructors
Constructor
new PaginatedCollection<
T>(data,page,from?,to?,total?,perPage?,prevPageUrl?,nextPageUrl?,lastPage?,firstPageUrl?,lastPageUrl?):PaginatedCollection<T>
Defined in: src/lib/models/paginated-collection.ts:6
Parameters
data
T[]
page
number
from?
number
to?
number
total?
number
perPage?
number
prevPageUrl?
string
nextPageUrl?
string
lastPage?
number
firstPageUrl?
string
lastPageUrl?
string
Returns
PaginatedCollection<T>
Properties
data
data:
T[]
Defined in: src/lib/models/paginated-collection.ts:7
firstPageUrl?
readonlyoptionalfirstPageUrl?:string
Defined in: src/lib/models/paginated-collection.ts:16
from?
readonlyoptionalfrom?:number
Defined in: src/lib/models/paginated-collection.ts:9
lastPage?
readonlyoptionallastPage?:number
Defined in: src/lib/models/paginated-collection.ts:15
lastPageUrl?
readonlyoptionallastPageUrl?:string
Defined in: src/lib/models/paginated-collection.ts:17
nextPageUrl?
readonlyoptionalnextPageUrl?:string
Defined in: src/lib/models/paginated-collection.ts:14
page
readonlypage:number
Defined in: src/lib/models/paginated-collection.ts:8
perPage?
readonlyoptionalperPage?:number
Defined in: src/lib/models/paginated-collection.ts:12
prevPageUrl?
readonlyoptionalprevPageUrl?:string
Defined in: src/lib/models/paginated-collection.ts:13
to?
readonlyoptionalto?:number
Defined in: src/lib/models/paginated-collection.ts:10
total?
readonlyoptionaltotal?:number
Defined in: src/lib/models/paginated-collection.ts:11
Methods
normalize()
normalize(
id?):INormalized
Defined in: src/lib/models/paginated-collection.ts:35
Normalize the collection to a paginated list of ids for state-managed applications.
This method returns a single key object, where the key is the page number and the associated value is an array of ids. Each id is fetched by the collection items, looking up for the "id" key. If an id is supplied to this method, it will be used instead of the default "id" key.
Please note that in case the key doesn't exist in the collection's item, a KeyNotFoundError is thrown
Parameters
id?
string
Returns
INormalized
[]
Throws
KeyNotFoundItem