poe-watch-api
Getting Started
Install with npm:
$ npm install poe-watch-api
Integration:
const PoeWatch = ;
Example usage:
Before you can do something with data from the API, categories
, leagues
and itemdata
must be updated. This happens automatically once you create a new PoeWatch
object unless you set autoUpdate
to false
. If you want to start doing things as soon as possible you should consider using the ready
event, which is emitted once the above data has been updated.
let poeWatch = ; poeWatch;
You can also update the data yourself by setting autoUpdate
to false
and using the .update()
method.
let poeWatch = autoUpdate: false; poeWatch;
Alternatively you can create a PoeWatch
object and make sure it's ready with the .isReady()
method if you need the API at a later time.
Classes
PoeWatch
Kind: global class
- PoeWatch
- new PoeWatch([options])
- .update() ⇒
Promise
- .requestLeagues() ⇒
Promise.<Object>
- .requestItemdata() ⇒
Promise.<Object>
- .requestCategories() ⇒
Promise.<Object>
- .requestItem(properties) ⇒
Promise.<Item>
- .getItemData(properties) ⇒
ItemData
- .getLeague(properties) ⇒
League
- .isUpdating() ⇒
boolean
- .isReady() ⇒
boolean
- .hasLeagues() ⇒
boolean
- .hasItemData() ⇒
boolean
- .hasCategories() ⇒
boolean
- "error"
- "ready"
new PoeWatch([options])
Param | Type | Default | Description |
---|---|---|---|
[options] | Object |
||
[options.autoUpdate] | boolean |
true |
Requests league, item data and category data from poe.watch when creating a new PoeWatch object |
Promise
poeWatch.update() ⇒ Requests league, item data and category data from poe.watch and stores them
Kind: instance method of PoeWatch
Promise.<Object>
poeWatch.requestLeagues() ⇒ Requests league data from poe.watch
Kind: instance method of PoeWatch
Promise.<Object>
poeWatch.requestItemdata() ⇒ Requests item data data from poe.watch
Kind: instance method of PoeWatch
Promise.<Object>
poeWatch.requestCategories() ⇒ Requests category data from poe.watch
Kind: instance method of PoeWatch
Promise.<Item>
poeWatch.requestItem(properties) ⇒ Returns item data including price data for a specific item
Item data must be requested with .requestItemdata() or .update() before using this method
Kind: instance method of PoeWatch
Param | Type | Description |
---|---|---|
properties | Object |
An object containing one or more properties of the item |
[properties.id] | number |
poe.watch ID of the item |
[properties.name] | string |
Item name |
[properties.type] | string |
Base type |
[properties.frame] | number |
Frame type |
[properties.tier] | number |
Map tier |
[properties.lvl] | number |
Level (e.g. gem level) |
[properties.quality] | number |
Quality (e.g. gem quality) |
[properties.corrupted] | boolean |
Whether the item is corrupted or not |
[properties.links] | number |
Count of links |
[properties.ilvl] | number |
Item level |
[properties.var] | string |
Variation |
[properties.relic] | number |
Whether the item is a relic or not. true always sets properties.frame to 9 |
[properties.icon] | string |
Icon URL |
[properties.category] | string |
Item category |
[properties.group] | string |
Item category group |
ItemData
poeWatch.getItemData(properties) ⇒ Returns item data for a specific item
Item data must be requested with .requestItemdata() or .update() before using this method
Kind: instance method of PoeWatch
Param | Type | Description |
---|---|---|
properties | Object |
An object containing one or more properties of the item |
[properties.id] | number |
poe.watch ID of the item |
[properties.name] | string |
Item name |
[properties.type] | string |
Base type |
[properties.frame] | number |
Frame type |
[properties.tier] | number |
Map tier |
[properties.lvl] | number |
Level (e.g. gem level) |
[properties.quality] | number |
Quality (e.g. gem quality) |
[properties.corrupted] | boolean |
Whether the item is corrupted or not |
[properties.links] | number |
Count of links |
[properties.ilvl] | number |
Item level |
[properties.var] | string |
Variation |
[properties.relic] | number |
Whether the item is a relic or not. true always sets properties.frame to 9 |
[properties.icon] | string |
Icon URL |
[properties.category] | string |
Item category |
[properties.group] | string |
Item category group |
League
poeWatch.getLeague(properties) ⇒ Returns league data for a specific league
League data must be requested with .requestLeagues() or .update() before using this method
Only the most useful properties are listed below. You can use any property of a league from the poe.watch API though, please refer to the API structure here
Kind: instance method of PoeWatch
Param | Type | Description |
---|---|---|
properties | Object |
An object containing one or more properties of the league |
[properties.id] | number |
ID of the league |
[properties.name] | string |
League name |
boolean
poeWatch.isUpdating() ⇒ Returns true
if data is currently being updated
Kind: instance method of PoeWatch
boolean
poeWatch.isReady() ⇒ Returns true
if all data is available and the API is ready to be used
Kind: instance method of PoeWatch
boolean
poeWatch.hasLeagues() ⇒ Returns true
if league data is available
Kind: instance method of PoeWatch
boolean
poeWatch.hasItemData() ⇒ Returns true
if item data is currently being updated
Kind: instance method of PoeWatch
boolean
poeWatch.hasCategories() ⇒ Returns true
if category data is currently being updated
Kind: instance method of PoeWatch
"error"
Emitted when an error occurred while updating on creation. Only emitted when options.autoUpdate
is set to true
Kind: event emitted by PoeWatch
"ready"
Emitted when all data has been requested successfully. Only emitted when options.autoUpdate
is set to true
Kind: event emitted by PoeWatch
History
Kind: global class
- History
- .getLast([count]) ⇒
Array
- .getSparkline([type], [count]) ⇒
Array
- .getLast([count]) ⇒
Array
history.getLast([count]) ⇒ Returns the latest count
entries (days) of the history in an array
Kind: instance method of History
Param | Type | Default | Description |
---|---|---|---|
[count] | Number |
max |
The count of the last entries (days) that should be returned. Defaults to the full history |
Array
history.getSparkline([type], [count]) ⇒ Returns a sparkline, optionally only of the last count
entries (days) in an array
Kind: instance method of History
Param | Type | Default | Description |
---|---|---|---|
[type] | 'mean' | 'median' | 'mode' | 'quantity' |
mean |
Mean, median, mode or quantity |
[count] | Number |
max |
The count of the last entries (days) that should be returned. Defaults to the full history |
ItemData
Item ⇐ Kind: global class
Extends: ItemData
- Item ⇐
ItemData
- .getPriceData() ⇒
Array.<PriceData>
- .getPriceDataByLeague(league) ⇒
PriceData
- .getId() ⇒
number
- .getName() ⇒
string
- .getType() ⇒
string
- .getFrame() ⇒
string
- .getTier() ⇒
string
- .getLevel() ⇒
string
- .getQuality() ⇒
string
- .isCorrupted() ⇒
string
- .getLinks() ⇒
number
- .getItemLevel() ⇒
number
- .getVariation() ⇒
string
- .getIcon() ⇒
string
- .getCategory() ⇒
string
- .getGroup() ⇒
string
- .getPriceData() ⇒
Array.<PriceData>
item.getPriceData() ⇒ Returns price data for every league
Kind: instance method of Item
Returns: Array.<PriceData>
- Array of PriceData objects for each league holding the price data for the item
PriceData
item.getPriceDataByLeague(league) ⇒ Returns price data for a specific league
Kind: instance method of Item
Returns: PriceData
- PriceData object holding the price data for the item
Param | Type | Description |
---|---|---|
league | string | number |
Name or ID of the league |
number
item.getId() ⇒ Returns the poe.watch ID of the item
Kind: instance method of Item
string
item.getName() ⇒ Returns the name of the item
Kind: instance method of Item
string
item.getType() ⇒ Returns the type of the item
Kind: instance method of Item
string
item.getFrame() ⇒ Returns the frametype of the item
Kind: instance method of Item
string
item.getTier() ⇒ Returns the map tier of the item
Kind: instance method of Item
string
item.getLevel() ⇒ Returns the level of the item
Kind: instance method of Item
string
item.getQuality() ⇒ Returns the quality of the item
Kind: instance method of Item
string
item.isCorrupted() ⇒ Returns true
if the item is corrupted
Kind: instance method of Item
number
item.getLinks() ⇒ Returns the links of the item
Kind: instance method of Item
number
item.getItemLevel() ⇒ Returns the item level of the item
Kind: instance method of Item
string
item.getVariation() ⇒ Returns the variation of the item
Kind: instance method of Item
string
item.getIcon() ⇒ Returns the URL to the icon of the item
Kind: instance method of Item
string
item.getCategory() ⇒ Returns the category of the item
Kind: instance method of Item
string
item.getGroup() ⇒ Returns the category group of the item
Kind: instance method of Item
ItemData
Kind: global class
- ItemData
- .getId() ⇒
number
- .getName() ⇒
string
- .getType() ⇒
string
- .getFrame() ⇒
string
- .getTier() ⇒
string
- .getLevel() ⇒
string
- .getQuality() ⇒
string
- .isCorrupted() ⇒
string
- .getLinks() ⇒
number
- .getItemLevel() ⇒
number
- .getVariation() ⇒
string
- .getIcon() ⇒
string
- .getCategory() ⇒
string
- .getGroup() ⇒
string
- .getId() ⇒
number
itemData.getId() ⇒ Returns the poe.watch ID of the item
Kind: instance method of ItemData
string
itemData.getName() ⇒ Returns the name of the item
Kind: instance method of ItemData
string
itemData.getType() ⇒ Returns the type of the item
Kind: instance method of ItemData
string
itemData.getFrame() ⇒ Returns the frametype of the item
Kind: instance method of ItemData
string
itemData.getTier() ⇒ Returns the map tier of the item
Kind: instance method of ItemData
string
itemData.getLevel() ⇒ Returns the level of the item
Kind: instance method of ItemData
string
itemData.getQuality() ⇒ Returns the quality of the item
Kind: instance method of ItemData
string
itemData.isCorrupted() ⇒ Returns true
if the item is corrupted
Kind: instance method of ItemData
number
itemData.getLinks() ⇒ Returns the links of the item
Kind: instance method of ItemData
number
itemData.getItemLevel() ⇒ Returns the item level of the item
Kind: instance method of ItemData
string
itemData.getVariation() ⇒ Returns the variation of the item
Kind: instance method of ItemData
string
itemData.getIcon() ⇒ Returns the URL to the icon of the item
Kind: instance method of ItemData
string
itemData.getCategory() ⇒ Returns the category of the item
Kind: instance method of ItemData
string
itemData.getGroup() ⇒ Returns the category group of the item
Kind: instance method of ItemData
League
Kind: global class
- League
- .getId() ⇒
number
- .getName() ⇒
string
- .getDisplayName() ⇒
string
- .isHardcore() ⇒
boolean
- .isUpcoming() ⇒
boolean
- .isActive() ⇒
boolean
- .isEvent() ⇒
boolean
- .getStart() ⇒
string
- .getEnd() ⇒
string
- .getDuration() ⇒
Object
- .getId() ⇒
number
league.getId() ⇒ Returns the ID of the league
Kind: instance method of League
string
league.getName() ⇒ Returns the internal name of the league
Kind: instance method of League
string
league.getDisplayName() ⇒ Returns the display name of the league
Kind: instance method of League
boolean
league.isHardcore() ⇒ Returns true
if the league is a hardcore league
Kind: instance method of League
boolean
league.isUpcoming() ⇒ Returns true
if the league has not started yet
Kind: instance method of League
boolean
league.isActive() ⇒ Returns true
if the league is currently active
Kind: instance method of League
boolean
league.isEvent() ⇒ Returns true
if the league is an event league
Kind: instance method of League
string
league.getStart() ⇒ Returns the time the league starts
Kind: instance method of League
Returns: string
- Time in YYYY-MM-DDThh:mm:ss.sTZD
format
string
league.getEnd() ⇒ Returns the time the league ends
Kind: instance method of League
Returns: string
- Time in YYYY-MM-DDThh:mm:ss.sTZD
format
Object
league.getDuration() ⇒ Returns an object containing the total, elapsed and remaining seconds of the league
Kind: instance method of League
PriceData
Kind: global class
- PriceData
- .getLeague() ⇒
League
- .getMean() ⇒
number
- .getMedian() ⇒
number
- .getMode() ⇒
number
- .getMin() ⇒
number
- .getMax() ⇒
number
- .getExalted() ⇒
number
- .getCount() ⇒
number
- .getQuantity() ⇒
number
- .getHistory() ⇒
History
- .getLeague() ⇒
League
priceData.getLeague() ⇒ Returns the league information
Kind: instance method of PriceData
number
priceData.getMean() ⇒ Returns the mean value of the item
Kind: instance method of PriceData
number
priceData.getMedian() ⇒ Returns the median value of the item
Kind: instance method of PriceData
number
priceData.getMode() ⇒ Returns the mode value of the item
Kind: instance method of PriceData
number
priceData.getMin() ⇒ Returns the minimum value of the item
Kind: instance method of PriceData
number
priceData.getMax() ⇒ Returns the maximum value of the item
Kind: instance method of PriceData
number
priceData.getExalted() ⇒ Returns the value of the item in Exalted Orbs
Kind: instance method of PriceData
number
priceData.getCount() ⇒ Returns the total count of listed items
Kind: instance method of PriceData
number
priceData.getQuantity() ⇒ Returns the count of currently listed items
Kind: instance method of PriceData
History
priceData.getHistory() ⇒ Returns the price history of the item
Kind: instance method of PriceData