apim-developer-portal1
Version:
API management developer portal
41 lines (34 loc) • 950 B
text/typescript
export class Page<T> {
/**
* Collection of items on the page.
*/
public value: T[];
/**
* Number of items in the page.
*/
public count: number;
/**
* A link to the next page of the query result.
*/
public nextLink?: string; // TODO: Implement .next() instead of link.
/**
* A link to the next page of the query result.
*/
public maxTimestamp?: Date; // TODO: Implement .next() instead of link.
constructor() {
this.value = [];
this.count = 0;
this.nextLink = null;
this.maxTimestamp = null;
}
public getSkip(): number {
if (!this.nextLink) {
return undefined;
}
const url = new URL(this.nextLink);
const queryParams = new URLSearchParams(decodeURIComponent(url.search));
if (queryParams.has("$skip")) {
return parseInt(queryParams.get("$skip"));
}
}
}