Constructor
new NationRequest(nation)
Parameters:
| Name | Type | Description |
|---|---|---|
nation |
string | Name of the nation to request data on |
Methods
authenticate(credential) → {this}
Provide a login credential for the nation in order to be able to request
NationPrivateShards.
Parameters:
| Name | Type | Description |
|---|---|---|
credential |
NSCredential | Login credential to use |
Returns:
The request, for chaining
- Type
- this
(async) raw()
For a stored credential, the
NSCredential#updateFromResponse method is invoked with the
received response headers.
(async) send() → {Promise.<types.Nation>}
Returns:
- Type
- Promise.<types.Nation>
setCensusMode(…modes) → {this}
Set one or more modes to request the World Census scale data in. Only
affects requests containing the NationShard.CENSUS shard. If
custom modes are not requested, the API uses CensusMode.SCORE,
CensusMode.RANK_REGION, and CensusMode.RANK_WORLD.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
modes |
string |
<repeatable> |
|
Returns:
The request, for chaining
- Type
- this
setCensusScale(…scales) → {this}
Define one or more CensusScales to query. Only affects requests
containing the NationShard.CENSUS shard. If this is not set, the
API uses the day's featured scale.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
scales |
number |
<repeatable> |
IDs of the census scales to request; |
Returns:
The request, for chaining
- Type
- this
setDisplayNotices(from) → {this}
Set the timestamp from which on to display notices. Affects requests
containing the NationPrivateShard.NOTICES shard.
Note that the NS API uses the same argument name for this timestamp,
the telegram sender for the NationShard.TG_RECRUITABLE and
NationShard.TG_CAMPAIGNABLE shards, and the starting timestamp
for queries of the NationShard.CENSUS shard, and it thus is
impossible to use this function without removing data set for one of
those in this request instance.
Parameters:
| Name | Type | Description |
|---|---|---|
from |
number | Timestamp from which on to display notices |
Returns:
The request, for chaining
- Type
- this
setHistoryMode(fromnullable, tonullable) → {this}
Set the CensusMode to history mode to query historical census
scores. Affects requests containing the NationShard.CENSUS
shard. Modes previously set via NationRequest#setCensusMode are
overwritten, since history mode cannot be combined with other modes.
Note that the NS API uses the same argument name for the starting
timestamp, the TG sender for the NationShard.TG_RECRUITABLE and
NationShard.TG_CAMPAIGNABLE, and the display timestamp for the
NationPrivateShard.NOTICES shards, and it thus is impossible to
use this function without removing data set for one of those in this
request instance.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
from |
number |
<nullable> |
Timestamp from which on to request the data; |
to |
number |
<nullable> |
Timestamp up to which to request the data; |
Returns:
The request, for chaining
- Type
- this
setTGSender(sender) → {this}
Set a hypothetical sender region. Affects requests containing the
NationShard.TG_RECRUITABLE or
NationShard.TG_CAMPAIGNABLE shards.
Note that the NS API uses the same argument name for the sender, the
starting timestamp for queries of the NationShard.CENSUS shard
(in history mode), and the display timestamp for the
NationPrivateShard.NOTICES shard, and it thus is impossible to
use this function without removing data set for one of those in this
request instance.
Parameters:
| Name | Type | Description |
|---|---|---|
sender |
string | Name of the theoretical sender region |
Returns:
The request, for chaining
- Type
- this
verify(checksum, tokennullable) → {this}
Add a request to the nation login verification endpoint to this request instance.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
checksum |
string | The checksum |
||
token |
string |
<nullable> |
null | Custom token for the verification process, or
|
Returns:
The request, for chaining
- Type
- this