Home Manual Reference Source
import RequestParameters from '@mapcreator/maps4news/src/RequestParameters.js'
public class | source

RequestParameters

Extends:

events~EventEmitter → RequestParameters

Used for keeping track of the request parameters

Static Member Summary

Static Public Members
public static get

Default deleted items filter state

public static set

deleted(value: String)

Default deleted items filter state

public static get

Default extra request parameters

public static set

extra(value: Object)

Default extra request parameters

public static get

Gets the maximum allowed value for perPage Some users will have a special permission that allows them to fetch more than 50 resources at once

public static set

maxPerPage(value: Number)

Sets the maximum allowed value for perPage Some users will have a special permission that allows them to fetch more than 50 resources at once

public static get

Default pagination offset

public static set

offset(value: Number)

Default pagination offset

public static get

page: Number: *

Default page number

public static set

page(value: Number)

Default page number

public static get

Default per page

public static set

perPage(value: Number)

Default per page

public static get

Default search query

public static set

Default search query

public static get

Default sort query

public static set

sort(value: Array<String>)

Default sort query

Static Method Summary

Static Public Methods
public static

Different parameters

public static

Resets all parameters back to default

Constructor Summary

Public Constructor
public

constructor(object: Object)

RequestParameters constructor

Member Summary

Public Members
public get

If deleted items should be shown

public set

deleted(value: String)

Deleted items filter state

public get

Extra parameters

public set

extra(value: Object)

Extra request parameters

public get

Get pagination offset

public set

offset(value: Number)

Pagination offset

public get

page: Number: *

Get page number

public set

page(value: Number)

Page number

public get

Get rows per page

public set

perPage(value: Number)

Rows per page

public get

Search query

public set

Search query

public get

Get sort options

public set

sort(value: Array<String>)

Sort query

Method Summary

Public Methods
public

Apply parameters from object

public

Copy object

public

Urlencode parameters

public

Convert to object

public

Convert to object

public

Generates a cache token

Static Public Members

public static get deleted: String: * source

Default deleted items filter state

Return:

String

Deleted items filter state

public static set deleted(value: String) source

Default deleted items filter state

public static get extra: Object: * source

Default extra request parameters

Return:

Object

Extra request parameters

public static set extra(value: Object) source

Default extra request parameters

public static get maxPerPage: Number: * source

Gets the maximum allowed value for perPage Some users will have a special permission that allows them to fetch more than 50 resources at once

Return:

Number

Maximum amount of resources per page

public static set maxPerPage(value: Number) source

Sets the maximum allowed value for perPage Some users will have a special permission that allows them to fetch more than 50 resources at once

public static get offset: Number: * source

Default pagination offset

Return:

Number

Offset

public static set offset(value: Number) source

Default pagination offset

public static get page: Number: * source

Default page number

Return:

Number

Page number

public static set page(value: Number) source

Default page number

public static get perPage: Number: * source

Default per page

Return:

Number

Per page

public static set perPage(value: Number) source

Default per page

Default search query

Return:

Object<String, String|Array<String>>

Search query

Default search query

public static get sort: Array<String>: * source

Default sort query

Return:

Array<String>

Sort query

public static set sort(value: Array<String>) source

Default sort query

Static Public Methods

public static keys(): Array<String> source

Different parameters

Return:

Array<String>

keys

public static resetDefaults() source

Resets all parameters back to default

Public Constructors

public constructor(object: Object) source

RequestParameters constructor

Params:

NameTypeAttributeDescription
object Object

properties

Public Members

public get deleted: String: * source

If deleted items should be shown

Return:

String

Deleted items filter state

See:

public set deleted(value: String) source

Deleted items filter state

See:

public get extra: Object: * source

Extra parameters

Return:

Object

Extra parameters

public set extra(value: Object) source

Extra request parameters

public get offset: Number: * source

Get pagination offset

Return:

Number

Offset

Throw:

TypeError

public set offset(value: Number) source

Pagination offset

public get page: Number: * source

Get page number

Return:

Number

Page number

Throw:

TypeError

public set page(value: Number) source

Page number

public get perPage: Number: * source

Get rows per page

Return:

Number

Per page

Throw:

TypeError

public set perPage(value: Number) source

Rows per page

Search query

Return:

Object<String, String|Array<String>>

Query

Throw:

TypeError

Search query

public get sort: Array<String>: * source

Get sort options

Return:

Array<String>

Per page

Throw:

TypeError

public set sort(value: Array<String>) source

Sort query

Public Methods

public apply(params: object | RequestParameters): Object[] source

Apply parameters from object

Params:

NameTypeAttributeDescription
params object | RequestParameters

parameters

Return:

Object[]

Array containing the updated values

Example:

const params = new RequestParameters({perPage: 12});

params.perPage === 12;

params.apply({perPage: 50});

params.perPage === 50;

public copy(): RequestParameters source

Copy object

Return:

RequestParameters

Copy

public encode(): string source

Urlencode parameters

Return:

string

HTTP query

public toObject(): Object source

Convert to object

Return:

Object

Object

public toParameterObject(): Object source

Convert to object

Return:

Object

Object

public token(): string source

Generates a cache token

Return:

string

Cache token