Class: Alliances

Alliances

An api adapter over the end points handling multiple alliances via functions in the alliance 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 Alliances are functions and can be invoked directly, besides accessing its members. Its default function action is equivalent to get or all if no id is provided.


new Alliances(agent)

Create a new Alliances function using the given agent.

Parameters:
Name Type Description
agent ESIAgent

The ESI agent

Members


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

Type:

Methods


all()

List all active player alliances. This route is cached for up to 3600 seconds.

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

On success, this resolves to list of Alliance IDs.

Returns:

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

Type
Promise.<Array.<Number>>

get(id)

Create a new Alliance end point targeting the particular alliance by id.

Parameters:
Name Type Description
id Number

The alliance id

Returns:
Type
Alliance

names(ids)

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

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

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

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

[
  {
    "id": 1000171,
    "name": "Republic University"
  }
]

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

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

A comma separated list of alliance IDs. If not provided then the names of all alliances will be returned.

Returns:

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

Type
Promise.<Array.<Object>>