Class: Characters

Characters

An api adapter over the end points handling multiple characters via functions in the character ESI endpoints. You should not usually instantiate this directly as its constructor requires an internal api instance.

This is a function class so instances of Characters are functions and can be invoked directly, besides accessing its members. Its default function action is equivalent to get.


new Characters(agent)

Create a new Characters function using the given agent.

Parameters:
Name Type Description
agent ESIAgent

The ESI agent

Members


A Search module instance configured to search over the 'character' type.

Type:

Methods


affiliations(ids)

Bulk lookup of character IDs to corporation, alliance and faction. This route is cached for up to 3600 seconds.

This makes an HTTP POST request to /characters/affiliation/. The route version is v1.

The array length of ids must be between 1 and 1000.

On success, this resolves to character corporation, alliance and faction IDs. An example result is:

[
  {
    "alliance_id": 434243723,
    "character_id": 95538921,
    "corporation_id": 109299958,
    "faction_id": 0
  }
]
Parameters:
Name Type Description
ids Array.<Number>

The character IDs to fetch affiliations for.

Returns:

A Promise that resolves to the parsed JSON of the response.

Type
Promise.<Array.<Object>>

get(id, token)

Create a new CharacterInfo or Character end point targeting the particular character by id. If token is provided then an authorized Character is returned, otherwise the non-authenticated CharacterInfo is returned.

Parameters:
Name Type Description
id Number

The character id

token String

Optional; the character's SSO token

Returns:
Type
Character | CharacterInfo

names(ids)

Resolve a set of character IDs to character names. This route is cached for up to 3600 seconds.

This makes an HTTP GET request to /characters/names/. The route version is v1.

The array length of ids must be between 1 and 1000.

On success, this resolves to list of id/name associations. An example result is:

[
  {
    "id": 95465499,
    "name": "CCP Bartender"
  }
]

Note that the type schema of the response is modified from what is defined in ESI. Specifically:

  • The character_id property is renamed to id.
  • The character_name property is renamed to name.
Parameters:
Name Type Description
ids Array.<Number>

A comma separated list of character IDs.

Returns:

A Promise that resolves to the parsed JSON of the response.

Type
Promise.<Array.<Object>>