Class: RegionRequest

nationscript/requests/region~RegionRequest(region)

Request subclass for building requests to the regions endpoint of the API.

Constructor

new RegionRequest(region)

Parameters:
Name Type Description
region string

Name of the region to request data on

Methods

(async) send() → {Promise.<types.Region>}

Returns:
Type
Promise.<types.Region>

setCensusLeaderboardOptions(scalenullable, offsetnullable) → {this}

Define a custom CensusScale and rank to start compiling from. Affects queries of the RegionShard.CENSUS_RANKS shard. If this is not set, API uses the day's featured scale, and starts from rank 1.

Note that the NS API uses the same argument name for the custom scale both here and for queries of the RegionShard.CENSUS shard, and setting it here will thus override any custom scales previously set via RegionRequest#setCensusScales in this request instance.

Parameters:
Name Type Attributes Default Description
scale number <nullable>

ID of the desired World Census scale; null to use the day's featured scale

offset number <nullable>
1

Rank from which to start (inclusive); null to start from rank 1

Returns:

The request, for chaining

Type
this

setCensusMode(…modes) → {this}

Set one or more CensusModes to request the World Census scale data in. Only affects requests containing the RegionShard.CENSUS shard. If custom modes are not requested, the API uses CensusMode.SCORE and CensusMode.RANK_WORLD.

Parameters:
Name Type Attributes Description
modes string <repeatable>

Mode(s) to use. CensusMode.RANK_REGION and CensusMode.RANK_REGION_PERCENT are ignored by the API in requests for region data

Returns:

The request, for chaining

Type
this

setCensusScales(…scales) → {this}

Define one or more CensusScales to query. Affects requests containing the RegionShard.CENSUS shard. If this is not set, the API uses the day's featured scale.

Note that the NS API uses the same argument name for the custom scales here and for queries of the RegionShard.CENSUS_RANKS shard, and setting them here will thus override any custom scales previously set via RegionRequest#setCensusLeaderboardOptions in this request instance.

Parameters:
Name Type Attributes Description
scales number <repeatable>

IDs of the census scales to request; null to request all

Returns:

The request, for chaining

Type
this

setRMBHistoryOptions(limitnullable, offset, start) → {this}

Define criteria by which to query RMB posts. Affects the RegionShard.RMB_MESSAGES shard. If this is not set, the API returns the 10 most recent posts.

Note that the NS API uses the same argument name for the message limit here and the nation limit for queries of the RegionShard.RMB_MOST_POSTS, RegionShard.RMB_MOST_LIKES, or RegionShard.RMB_MOST_LIKED shards, and setting it here will thus override a limit previously set via RegionRequest#setRMBLeaderboardOptions in this request instance.

Parameters:
Name Type Attributes Description
limit number <nullable>

Maximum number of messages to return; values below 1 and above 100 are ignored by the API

offset number

How many posts to shift the result list backwards

start number

Post ID from which on to consider messages

Returns:

The request, for chaining

Type
this

setRMBLeaderboardOptions(limitnullable, fromnullable, tonullable) → {this}

Define a time period for which to consider nations' aggregate RMB activity and a maximum number of nations to rank. Affects requests containing the RegionShard.RMB_MOST_POSTS, RegionShard.RMB_MOST_LIKES, or RegionShard.RMB_MOST_LIKED shards. If this is not set, the API returns all nations with a score from the dawn of time up to now.

Note that the NS API uses the same argument name for the nation limit here and the message limit for queries of the RegionShard.RMB_MESSAGES shard, and setting it here will thus override a limit previously set via RegionRequest#setRMBHistoryOptions in this request instance.

Parameters:
Name Type Attributes Description
limit number <nullable>

Maximum number of nations to return; null to return all that have a score

from number <nullable>

Timestamp from which on to consider RMB activity; null to start from the earliest available

to number <nullable>

Timestamp up to which to consider RMB activity; null to use all up to now

Returns:

The request, for chaining

Type
this