Class: WorldRequest

nationscript/requests/world~WorldRequest()

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

Constructor

new WorldRequest()

Methods

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

Returns:
Type
Promise.<types.World>

setBannerQuery(…banners) → {this}

Define the banners to be queried. Only affects requests containing the WorldShard.BANNER shard.

Parameters:
Name Type Attributes Description
banners string <repeatable>

IDs of the desired banners

Returns:

The request, for chaining

Type
this

setCensusLeaderboardOptions(scalenullable, offsetnullable) → {this}

Define a custom CensusScale and rank to start compiling from. Affects queries of the WorldShard.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 all shards listed for the WorldRequest#setCensusScales function, and setting it here will thus override any previously set via it 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

setCensusScales(…scales) → {this}

Define one or more CensusScales to query. Affects requests containing the WorldShard.CENSUS, WorldShard.CENSUS_DESCRIPTION, WorldShard.CENSUS_NAME, WorldShard.CENSUS_RANKS, and WorldShard.CENSUS_TITLE shards. If this is not set, the API uses the day's featured scale.

Only the CENSUS shard displays results for more than one scale. The others will only return data for the first one specified.

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

setDispatch(id) → {this}

Set the ID of the dispatch to be queried. Only affects requests containing the WorldShard.DISPATCH shard.

Parameters:
Name Type Description
id number

ID of the desired dispatch

Returns:

The request, for chaining

Type
this

setDispatchSearchOptions(authornullable, categorynullable, subcategorynullable, searchModenullable) → {this}

Define custom criteria by which to query dispatches. Only affects requests containing the WorldShard.DISPATCH_LIST shard.

Parameters:
Name Type Attributes Description
author string <nullable>

Name of the nation to exclusively query the dispatches of; null to not query by authorship

category string <nullable>

DispatchCategory to query; null to query all categories

subcategory string <nullable>

DispatchSubcategory to query from within the category; null to query all subcategories

searchMode string <nullable>

DispatchSearchMode to apply

Returns:

The request, for chaining

Type
this

setFactionID(fid) → {this}

Specify the ID of the N-Day faction to request details on. Only affects requests containing the WorldShard.FACTION shard.

Parameters:
Name Type Description
fid number

ID of the desired faction.

Returns:

The request, for chaining.

Type
this

setHappeningsFilters(…filters) → {this}

Limit the list of happening events to be queried to those matching one of the given filters. Only affects requests containing the WorldShard.HAPPENINGS shard.

Parameters:
Name Type Attributes Description
filters string <repeatable>

HappeningsFilters to apply

Returns:

The request, for chaining

Type
this

setHappeningsLimit(limit) → {this}

Set a limit for how many happening events may be returned. Only affects requests containing the WorldShard.HAPPENINGS shard.

Parameters:
Name Type Description
limit number

Maximum number of happenings to return. Values below 1 and 200 are ignored by the API

Returns:

The request, for chaining

Type
this

setHappeningsNations(…nations) → {this}

Specify one or more nations from which alone to query happening events. Only affects requests containing the WorldShard.HAPPENINGS shard. Targets set via WorldRequest#setHappeningsRegions will be overwritten!

Parameters:
Name Type Attributes Description
nations string <repeatable>

Name(s) of the desired nations.

Returns:

The request, for chaining.

Type
this

setHappeningsRegions(…regions) → {this}

Specify one or more regions from which alone to query happening events. Only affects requests containing the WorldShard.HAPPENINGS shard. Targets set via WorldRequest#setHappeningsNations will be overwritten!

Parameters:
Name Type Attributes Description
regions string <repeatable>

Name(s) of the desired regions.

Returns:

The request, for chaining.

Type
this

setHappeningsWindowID(startnullable, endnullable) → {this}

Limit the list of happening events to be queried to those occurring after and before the happening events with the specified IDs. Only affects requests containing the WorldShard.HAPPENINGS shard.

Parameters:
Name Type Attributes Description
start number <nullable>

ID of the happening event from which on to return happening events; null to not demand a minimum ID

end number <nullable>

ID of the happening event up to which to return happening events; null to not demand a maximum ID

Returns:

The request, for chaining

Type
this

setHappeningsWindowTime(startnullable, endnullable) → {this}

Limit the list of happening events to be queried to those occurring after and before the given timestamps. Only affects requests containing the WorldShard.HAPPENINGS shard.

Parameters:
Name Type Attributes Description
start number <nullable>

Timestamp from which on to return happening events; null to start from the earliest available

end number <nullable>

Timestamp up to which to return happening events; null to end with the most recent available

Returns:

The request, for chaining

Type
this

setPoll(id) → {this}

Set the ID of the poll to query. Only affects requests containing the WorldShard.POLL shard.

Parameters:
Name Type Description
id number

ID of the desired poll

Returns:

The request, for chaining

Type
this

setRegionSearchTags(…tags) → {this}

Specify tags to query regions by. Only affects requests containing the WorldShard.REGIONS_BY_TAG shard.

Parameters:
Name Type Attributes Description
tags string <repeatable>

Tags that regions must (not) have in order to be returned; use Tag.NOT + [tag] to disallow a tag

Returns:

The request, for chaining

Type
this