Class: Fleet

Fleet

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


new Fleet(agent, token, fleetId)

Create a new Fleet function using the given agent with SSO access from token. The fleetId must also be provided.

Parameters:
Name Type Description
agent ESIAgent

The ESI agent

token String

The SSO access token for the character

fleetId Number

The fleet id of the fleet the character belongs to

Members


wings :Wings

The Wings api adapter for accessing and modifying the wing state of the fleet.

Type:

Methods


info()

Return details about a fleet. This route is cached for up to 5 seconds.

This makes an HTTP GET request to /fleets/{fleet_id}/. The route version is v1.

On success, this resolves to details about a fleet. An example result is:

{
  "is_free_move": false,
  "is_registered": false,
  "is_voice_enabled": false,
  "motd": "This is an <b>awesome</b> fleet!"
}

This function must be used with an SSO token that has the following scopes:

  • esi-fleets.read_fleet.v1
Returns:

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

Type
Promise.<Object>

invite(invitation)

Invite a character into the fleet, if a character has a CSPA charge set, it is not possible to invite them to the fleet using ESI.

This makes an HTTP POST request to /fleets/{fleet_id}/members/. The route version is v1.

An example value for invitation is shown below:

{
  "character_id": 0,
  "role": "- If a character is invited with the `fleet_commander` role, neither `wing_id` or `squad_id` should be specified - If a character is invited with the `wing_commander` role, only `wing_id` should be specified - If a character is invited with the `squad_commander` role, both `wing_id` and `squad_id` should be specified - If a character is invited with the `squad_member` role, `wing_id` and `squad_id` should either both be specified or not specified at all. If they aren’t specified, the invited character will join any squad with available positions\n",
  "squad_id": 0,
  "wing_id": 0
}

On success, this resolves to an empty object.

This function must be used with an SSO token that has the following scopes:

  • esi-fleets.write_fleet.v1
Parameters:
Name Type Description
invitation Object

Details of the invitation.

Returns:

A Promise that resolves to an empty object.

Type
Promise.<Object>

kick(memberId)

Kick a fleet member.

This makes an HTTP DELETE request to /fleets/{fleet_id}/members/{member_id}/. The route version is v1.

On success, this resolves to an empty object.

This function must be used with an SSO token that has the following scopes:

  • esi-fleets.write_fleet.v1
Parameters:
Name Type Description
memberId Number

The character ID of a member in this fleet.

Returns:

A Promise that resolves to an empty object.

Type
Promise.<Object>

members()

Return information about fleet members. This route is cached for up to 5 seconds.

This makes an HTTP GET request to /fleets/{fleet_id}/members/. The route version is v1.

On success, this resolves to a list of fleet members. An example result is:

[
  {
    "character_id": 93265215,
    "join_time": "2016-04-29T12:34:56Z",
    "role": "squad_commander",
    "role_name": "Squad Commander (Boss)",
    "ship_type_id": 33328,
    "solar_system_id": 30003729,
    "squad_id": 3129411261968,
    "station_id": 61000180,
    "takes_fleet_warp": true,
    "wing_id": 2073711261968
  }
]

This function must be used with an SSO token that has the following scopes:

  • esi-fleets.read_fleet.v1
Returns:

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

Type
Promise.<Array.<Object>>

move(memberId, moveOrder)

Move a fleet member around.

This makes an HTTP PUT request to /fleets/{fleet_id}/members/{member_id}/. The route version is v1.

An example value for moveOrder is shown below:

{
  "role": "- If a character is moved to the `fleet_commander` role, neither `wing_id` or `squad_id` should be specified - If a character is moved to the `wing_commander` role, only `wing_id` should be specified - If a character is moved to the `squad_commander` role, both `wing_id` and `squad_id` should be specified - If a character is moved to the `squad_member` role, both `wing_id` and `squad_id` should be specified\n",
  "squad_id": 0,
  "wing_id": 0
}

On success, this resolves to an empty object.

This function must be used with an SSO token that has the following scopes:

  • esi-fleets.write_fleet.v1
Parameters:
Name Type Description
memberId Number

The character ID of a member in this fleet.

moveOrder Object

Details of the invitation.

Returns:

A Promise that resolves to an empty object.

Type
Promise.<Object>

update(motd, isFreeMove)

Update settings about a fleet.

This makes an HTTP PUT request to /fleets/{fleet_id}/. The route version is v1.

The route parameter, new_settings, is built implicitly by the function. The function argument motd maps to the motd property of the new_settings route parameter. The function argument isFreeMove maps to the is_free_move property of the new_settings route parameter.

On success, this resolves to an empty object.

This function must be used with an SSO token that has the following scopes:

  • esi-fleets.write_fleet.v1
Parameters:
Name Type Description
motd String

New fleet MOTD in CCP flavoured HTML.

isFreeMove Boolean

Should free-move be enabled in the fleet.

Returns:

A Promise that resolves to an empty object.

Type
Promise.<Object>