Class: Region

Region

An api adapter that provides functions for accessing various details for a region specified by id, via functions in the market ESI endpoints. You should not usually instantiate this directly as its constructor requires an internal api instance.


new Region(agent, regionId)

Create a new Region for the given agent provider and specific regionId.

Parameters:
Name Type Description
agent ESIAgent

The agent used to generate web requests

regionId Number

The region id that is used for all requests

Methods


buyOrdersFor(typeId)

Return a list of orders in a region. This route is cached for up to 300 seconds.

This makes an HTTP GET request to /markets/{region_id}/orders/. The route version is v1.

This function invokes the route with order_type set to "buy".

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

[
  {
    "duration": 90,
    "is_buy_order": false,
    "issued": "2016-09-03T05:12:25Z",
    "location_id": 60005599,
    "min_volume": 1,
    "order_id": 4623824223,
    "price": 9.9,
    "range": "region",
    "type_id": 34,
    "volume_remain": 1296000,
    "volume_total": 2000000
  }
]
Parameters:
Name Type Description
typeId Number

Return orders only for this type.

Returns:

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

Type
Promise.<Array.<Object>>

history(typeId)

Return a list of historical market statistics for the specified type in a region. This route is cached for up to 3600 seconds.

This makes an HTTP GET request to /markets/{region_id}/history/. The route version is v1.

On success, this resolves to a list of historical market statistics. An example result is:

[
  {
    "average": 5.25,
    "date": "2015-05-01",
    "highest": 5.27,
    "lowest": 5.11,
    "order_count": 2267,
    "volume": 16276782035
  }
]
Parameters:
Name Type Description
typeId Number

Return statistics for this type.

Returns:

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

Type
Promise.<Array.<Object>>

info()

Get information on a region. This route expires daily at 11:05.

This makes an HTTP GET request to /universe/regions/{region_id}/. The route version is v1.

On success, this resolves to information about a region. An example result is:

{
  "constellations": [
    20000302
  ],
  "description": "It has long been an established fact of civilization...",
  "name": "Metropolis",
  "region_id": 10000042
}
Returns:

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

Type
Promise.<Object>

orders(page)

Return a list of orders in a region. This route is cached for up to 300 seconds.

This makes an HTTP GET request to /markets/{region_id}/orders/. The route version is v1.

This function invokes the route with order_type set to "all".

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

[
  {
    "duration": 90,
    "is_buy_order": false,
    "issued": "2016-09-03T05:12:25Z",
    "location_id": 60005599,
    "min_volume": 1,
    "order_id": 4623824223,
    "price": 9.9,
    "range": "region",
    "type_id": 34,
    "volume_remain": 1296000,
    "volume_total": 2000000
  }
]
Parameters:
Name Type Default Description
page Number 0

Optional; which page to query, only used for querying without type_id. Starting at 1.

Returns:

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

Type
Promise.<Array.<Object>>

ordersFor(typeId)

Return a list of orders in a region. This route is cached for up to 300 seconds.

This makes an HTTP GET request to /markets/{region_id}/orders/. The route version is v1.

This function invokes the route with order_type set to "all".

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

[
  {
    "duration": 90,
    "is_buy_order": false,
    "issued": "2016-09-03T05:12:25Z",
    "location_id": 60005599,
    "min_volume": 1,
    "order_id": 4623824223,
    "price": 9.9,
    "range": "region",
    "type_id": 34,
    "volume_remain": 1296000,
    "volume_total": 2000000
  }
]
Parameters:
Name Type Description
typeId Number

Return orders only for this type.

Returns:

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

Type
Promise.<Array.<Object>>

sellOrdersFor(typeId)

Return a list of orders in a region. This route is cached for up to 300 seconds.

This makes an HTTP GET request to /markets/{region_id}/orders/. The route version is v1.

This function invokes the route with order_type set to "sell".

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

[
  {
    "duration": 90,
    "is_buy_order": false,
    "issued": "2016-09-03T05:12:25Z",
    "location_id": 60005599,
    "min_volume": 1,
    "order_id": 4623824223,
    "price": 9.9,
    "range": "region",
    "type_id": 34,
    "volume_remain": 1296000,
    "volume_total": 2000000
  }
]
Parameters:
Name Type Description
typeId Number

Return orders only for this type.

Returns:

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

Type
Promise.<Array.<Object>>