Class: ShardableRequest

nationscript/requests/base~ShardableRequest()

Superclass for all request subclasses that address API endpoints that accept specific shards.

Adds several functions to make setting, adding, and removing singular or multiple shards from the request easier than with the DataRequest's more abstract argument manipulation methods.

Constructor

new ShardableRequest()

Methods

addShards(…shards) → {this}

Adds more shards to any already set for this request.

Parameters:
Name Type Attributes Description
shards string <repeatable>

Identifiers of the desired shards

Returns:

The request, for chaining

Type
this

clearShards() → {this}

Removes all previously set sharding from this request.

Returns:

The request, for chaining

Type
this

getShards() → {Array.<string>}

Gets all shards currently registered to be queried with this request.

Returns:

Names of all shards currently set in this request

Type
Array.<string>

removeShards(…shards) → {this}

Removes the specified shards from those to be queried with this request.

Parameters:
Name Type Attributes Description
shards string <repeatable>

Identifiers of the unwanted shards

Returns:

The request, for chaining

Type
this

shard(…shards) → {this}

Defines specific shards to query from the NS API.

Parameters:
Name Type Attributes Description
shards string <repeatable>

Identifiers of the desired shards

Returns:

The request, for chaining

Type
this