Home Reference Source
import PagedRequest from '~/models/Request/PagedRequest.js'
public class | source

PagedRequest

Extends:

Request → PagedRequest

Direct Subclass:

Notifications

Runs request using Axtell REST paging.

Constructor Summary

Public Constructor
public

constructor(options: Object)

Member Summary

Public Members
public get

If they are definetly more.

public get

Gets the current page.

public set

Sets the current page.

Method Summary

Public Methods
public

The async iterator loads individual items.

public

async getPage(page: number, mutate: boolean): Object

Gets a specific page.

public

async nextPage(): Object

Runs for the next page (starts at zero).

Inherited Summary

From class Request
protected
public

cancel()

Cancels the request.

public

format(data: Object): Object

Formats the request object and returns an object of Request<T>'s T.

public

async run(o: Object): Promise

Performs the request

Public Constructors

public constructor(options: Object) source

Creates request given path. Provide options as object

Override:

Request#constructor

Params:

NameTypeAttributeDescription
options Object

See Request#constructor

Public Members

public get areMore: boolean source

If they are definetly more. If you haven't run a request this is false because we have no idea how many there are at the time.

public get page: number source

Gets the current page.

public set page: number source

Sets the current page. Do note this will remove all context but will not break iterators.

Public Methods

public [Symbol.iterator]() source

The async iterator loads individual items. DO NOT call any other methods as that will mess up the page indexing.

public async getPage(page: number, mutate: boolean): Object source

Gets a specific page.

Params:

NameTypeAttributeDescription
page number

The page to load

mutate boolean
  • optional
  • default: true

Set to false to not mutate.

Return:

Object

Return Properties:

NameTypeAttributeDescription
data Object[]

Array of data

areMore boolean

If there is more. If mutate is true, this is the same as doing PagedRequest#areMore

public async nextPage(): Object source

Runs for the next page (starts at zero).

Return:

Object (nullable: true)

Same type as the Request#format.