2018-08-14 13:13:32 +02:00
|
|
|
/**
|
|
|
|
* Render OrderedCollection
|
|
|
|
* @param id URL of self
|
|
|
|
* @param totalItems Total number of items
|
|
|
|
* @param first URL of first page (optional)
|
|
|
|
* @param last URL of last page (optional)
|
2018-09-18 06:08:27 +02:00
|
|
|
* @param orderedItems attached objects (optional)
|
2018-08-14 13:13:32 +02:00
|
|
|
*/
|
2019-12-14 19:37:19 +01:00
|
|
|
export default function(id: string | null, totalItems: any, first?: string, last?: string, orderedItems?: object) {
|
2018-08-14 13:13:32 +02:00
|
|
|
const page: any = {
|
|
|
|
id,
|
|
|
|
type: 'OrderedCollection',
|
|
|
|
totalItems,
|
|
|
|
};
|
|
|
|
|
|
|
|
if (first) page.first = first;
|
|
|
|
if (last) page.last = last;
|
2018-09-18 06:08:27 +02:00
|
|
|
if (orderedItems) page.orderedItems = orderedItems;
|
2018-08-14 13:13:32 +02:00
|
|
|
|
|
|
|
return page;
|
|
|
|
}
|