Class: CharacterCorporation

CharacterCorporation

An api adapter that provides functions for accessing various details for a corporation specified by id via functions in the corporation ESI endpoints. Unlike Corporation, his only includes all corporation end points, including those requiring access tokens. Additionally, this corporation adapter is attached to a character so it always reports information on the character's corporation.

You should not usually instantiate this directly as its constructor requires an internal api instance.


new CharacterCorporation(agent, characterId, token)

Create a new corporation agent adapter for the particular character's corporation.

Parameters:
Name Type Description
agent ESIAgent

The ESI agent

characterId Number

The character this is linked to

token String

The SSO access token for the character

Methods


history()

Get a list of all the alliances a corporation has been a member of. This route is cached for up to 3600 seconds.

This makes an HTTP GET request to /corporations/{corporation_id}/alliancehistory/. The route version is v1.

On success, this resolves to alliance history for the given corporation. An example result is:

[
  {
    "alliance": {
      "alliance_id": 99000006,
      "is_deleted": false
    },
    "record_id": 23,
    "start_date": "2016-10-25T14:46:00Z"
  }
]

Note that this is equivalent to Corporation#history.

Returns:

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

Type
Promise.<Array.<Object>>

icon()

Get the icon urls for a corporation. This route is cached for up to 3600 seconds.

This makes an HTTP GET request to /corporations/{corporation_id}/icons/. The route version is v1.

On success, this resolves to urls for icons for the given corporation id and server. An example result is:

{
  "px128x128": "https://imageserver.eveonline.com/Corporation/1000010_128.png",
  "px256x256": "https://imageserver.eveonline.com/Corporation/1000010_256.png",
  "px64x64": "https://imageserver.eveonline.com/Corporation/1000010_64.png"
}

Note that this is equivalent to Corporation#icon

Returns:

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

Type
Promise.<Object>

id()

Get the corporation id of the corp that the character belongs to.

Returns:

A Promise that resolves to the character's corporation id

Type
Promise.<Number>

info()

Public information about a corporation. This route is cached for up to 3600 seconds.

This makes an HTTP GET request to /corporations/{corporation_id}/. The route version is v3.

On success, this resolves to public data about a corporation. An example result is:

{
  "alliance_id": 434243723,
  "ceo_id": 180548812,
  "corporation_description": "This is a corporation description, it's basically just a string",
  "corporation_name": "C C P",
  "creation_date": "2004-11-28T16:42:51Z",
  "creator_id": 180548812,
  "faction": "",
  "member_count": 656,
  "tax_rate": 0.256,
  "ticker": "-CCP-",
  "url": "http://www.eveonline.com"
}

Note that this is equivalent to Corporation#info.

Returns:

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

Type
Promise.<Object>

loyaltyOffers()

Return a list of offers from a specific corporation's loyalty store. This route expires daily at 11:05.

This makes an HTTP GET request to /loyalty/stores/{corporation_id}/offers/. The route version is v1.

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

[
  {
    "isk_cost": 0,
    "lp_cost": 100,
    "offer_id": 1,
    "quantity": 1,
    "required_items": [
      {
        "quantity": 0,
        "type_id": 0
      }
    ],
    "type_id": 123
  }
]

Note that this is equivalent to Corporation#loyaltyOffers

Returns:

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

Type
Promise.<Array.<Object>>

members()

Read the current list of members if the calling character is a member. This route is cached for up to 3600 seconds.

This makes an HTTP GET request to /corporations/{corporation_id}/members/. The route version is v2.

On success, this resolves to list of member character IDs. Note that the type schema of the response is modified from what is defined in ESI. Specifically, it returns only the character_id property.

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

  • esi-corporations.read_corporation_membership.v1
Returns:

A Promise that resolves to character_id integer.

Type
Promise.<Array.<Number>>

roles()

Return the roles of all members if the character has the personnel manager role or any grantable role. This route is cached for up to 3600 seconds.

This makes an HTTP GET request to /corporations/{corporation_id}/roles/. The route version is v1.

On success, this resolves to list of member character ID's and roles. An example result is:

[
  {
    "character_id": 1000171,
    "grantable_roles": [
      ""
    ],
    "grantable_roles_at_base": [
      ""
    ],
    "grantable_roles_at_hq": [
      ""
    ],
    "grantable_roles_at_other": [
      ""
    ],
    "roles": [
      "Director"
    ],
    "roles_at_base": [
      ""
    ],
    "roles_at_hq": [
      ""
    ],
    "roles_at_other": [
      ""
    ]
  }
]

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

  • esi-corporations.read_corporation_membership.v1
Returns:

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

Type
Promise.<Array.<Object>>

structures(page)

Get a list of corporation structures. This route is cached for up to 3600 seconds.

This makes an HTTP GET request to /corporations/{corporation_id}/structures/. The route version is v1.

page must be at least 1.

On success, this resolves to list of corporation structures' information. An example result is:

[
  {
    "corporation_id": 667531913,
    "current_vul": [
      {
        "day": 1,
        "hour": 2
      }
    ],
    "fuel_expires": "",
    "next_vul": [
      {
        "day": 3,
        "hour": 4
      }
    ],
    "profile_id": 11237,
    "services": [
      {
        "name": "name string",
        "state": "state string"
      }
    ],
    "state_timer_end": "",
    "state_timer_start": "",
    "structure_id": 1021975535893,
    "system_id": 30004763,
    "type_id": 35833,
    "unanchors_at": ""
  }
]

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

  • esi-corporations.read_structures.v1
Parameters:
Name Type Default Description
page Number 0

Which page to query, 250 structures per page. If 0, all structures are returned

Returns:

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

Type
Promise.<Array.<Object>>