Class: Colonies

Colonies

An api adapter over the end points handling the planetary interaction colonies for a character via functions in the planetary interaction 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 Colonies are functions and can be invoked directly, besides accessing its members. Its default function action is equivalent to layout or all if no id is given.


new Colonies(agent, characterId, token)

Create a new Colonies function for the character, including its SSO token.

Parameters:
Name Type Description
agent ESIAgent

The ESI agent

characterId Number

The id of the character whose PI is accessed

token String

The SSO access token for the character

Methods


all()

Returns a list of all planetary colonies owned by a character. This route is cached for up to 600 seconds.

This makes an HTTP GET request to /characters/{character_id}/planets/. The route version is v1.

On success, this resolves to list of colonies. An example result is:

[
  {
    "last_update": "2016-11-28T16:42:51Z",
    "num_pins": 1,
    "owner_id": 90000001,
    "planet_id": 40023691,
    "planet_type": "plasma",
    "solar_system_id": 30000379,
    "upgrade_level": 0
  }
]

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

  • esi-planets.manage_planets.v1
Returns:

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

Type
Promise.<Array.<Object>>

layout(planetId)

Returns full details on the layout of a single planetary colony, including links, pins and routes. Note: Planetary information is only recalculated when the colony is viewed through the client. Information will not update until this criteria is met. This route is cached for up to 600 seconds.

This makes an HTTP GET request to /characters/{character_id}/planets/{planet_id}/. The route version is v2.

On success, this resolves to colony layout. An example result is:

{
  "links": [
    {
      "destination_pin_id": 1000000017022,
      "link_level": 0,
      "source_pin_id": 1000000017021
    }
  ],
  "pins": [
    {
      "expiry_time": "",
      "extractor_details": {
        "cycle_time": 0,
        "head_radius": 0,
        "heads": [
          {
            "head_id": 0,
            "latitude": 0,
            "longitude": 0
          }
        ],
        "product_type_id": 0,
        "qty_per_cycle": 0
      },
      "factory_details": {
        "schematic_id": 0
      },
      "install_time": "",
      "last_cycle_start": "",
      "latitude": 1.55087844973,
      "longitude": 0.717145933308,
      "pin_id": 1000000017021,
      "schematic_id": 0,
      "type_id": 2254
    }
  ],
  "routes": [
    {
      "content_type_id": 2393,
      "destination_pin_id": 1000000017030,
      "quantity": 20,
      "route_id": 4,
      "source_pin_id": 1000000017029,
      "waypoints": [
        {
          "order": 0,
          "pin_id": 0
        }
      ]
    }
  ]
}

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

  • esi-planets.manage_planets.v1
Parameters:
Name Type Description
planetId Number

Planet id of the target planet.

Returns:

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

Type
Promise.<Object>