Install with npm:
$ npm install poe-watch-api
Integration:
const PoeWatch = require("poe-watch-api");
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 = new PoeWatch();
poeWatch.on("ready", () => {
// Request data for a 6-linked relic Shavronne's Wrappings
poeWatch.requestItem({name: "Shavronne's Wrappings", links: 6, relic: true})
.then((item) => {
// Get the sparkline of the median value of the last week in Standard league
let medianSparkline = item.getPriceDataByLeague("Standard").getHistory().getSparkline("median", 7);
console.log("Median value history of last week: " + medianSparkline.toString());
})
.catch((error) => {
console.error("An error occurred", error);
});
});
You can also update the data yourself by setting autoUpdate
to false
and using the .update()
method.
let poeWatch = new PoeWatch({autoUpdate: false});
poeWatch.update()
.then(() => {
return poeWatch.requestItem({name: "Exalted Orb"});
})
.then((item) => {
let meanValue = item.getPriceDataByLeague("Standard").getMean();
console.log("Exalted Orbs are currently worth " + meanValue + " Chaos Orbs in Standard league");
})
.catch((error) => {
console.error("An error occurred", error);
});
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.
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"
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 |
Requests league, item data and category data from poe.watch and stores them
Kind: instance method of PoeWatch
Requests league data from poe.watch
Kind: instance method of PoeWatch
Requests item data data from poe.watch
Kind: instance method of PoeWatch
Requests category data from poe.watch
Kind: instance method of PoeWatch
poeWatch.requestItem(properties) ⇒ Promise.<Item>
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 |
poeWatch.getItemData(properties) ⇒ ItemData
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 |
poeWatch.getLeague(properties) ⇒ League
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 |
Returns true
if data is currently being updated
Kind: instance method of PoeWatch
Returns true
if all data is available and the API is ready to be used
Kind: instance method of PoeWatch
Returns true
if league data is available
Kind: instance method of PoeWatch
Returns true
if item data is currently being updated
Kind: instance method of PoeWatch
Returns true
if category data is currently being updated
Kind: instance method of PoeWatch
Emitted when an error occurred while updating on creation. Only emitted when options.autoUpdate
is set to true
Kind: event emitted by PoeWatch
Emitted when all data has been requested successfully. Only emitted when options.autoUpdate
is set to true
Kind: event emitted by PoeWatch
Kind: global class
- History
- .getLast([count]) ⇒
Array
- .getSparkline([type], [count]) ⇒
Array
- .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 |
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 |
Item ⇐ ItemData
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() ⇒
item.getPriceData() ⇒ Array.<PriceData>
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
item.getPriceDataByLeague(league) ⇒ PriceData
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 |
Returns the poe.watch ID of the item
Kind: instance method of Item
Returns the name of the item
Kind: instance method of Item
Returns the type of the item
Kind: instance method of Item
Returns the frametype of the item
Kind: instance method of Item
Returns the map tier of the item
Kind: instance method of Item
Returns the level of the item
Kind: instance method of Item
Returns the quality of the item
Kind: instance method of Item
Returns true
if the item is corrupted
Kind: instance method of Item
Returns the links of the item
Kind: instance method of Item
Returns the item level of the item
Kind: instance method of Item
Returns the variation of the item
Kind: instance method of Item
Returns the URL to the icon of the item
Kind: instance method of Item
Returns the category of the item
Kind: instance method of Item
Returns the category group of the item
Kind: instance method of Item
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() ⇒
Returns the poe.watch ID of the item
Kind: instance method of ItemData
Returns the name of the item
Kind: instance method of ItemData
Returns the type of the item
Kind: instance method of ItemData
Returns the frametype of the item
Kind: instance method of ItemData
Returns the map tier of the item
Kind: instance method of ItemData
Returns the level of the item
Kind: instance method of ItemData
Returns the quality of the item
Kind: instance method of ItemData
Returns true
if the item is corrupted
Kind: instance method of ItemData
Returns the links of the item
Kind: instance method of ItemData
Returns the item level of the item
Kind: instance method of ItemData
Returns the variation of the item
Kind: instance method of ItemData
Returns the URL to the icon of the item
Kind: instance method of ItemData
Returns the category of the item
Kind: instance method of ItemData
Returns the category group of the item
Kind: instance method of ItemData
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() ⇒
Returns the ID of the league
Kind: instance method of League
Returns the internal name of the league
Kind: instance method of League
Returns the display name of the league
Kind: instance method of League
Returns true
if the league is a hardcore league
Kind: instance method of League
Returns true
if the league has not started yet
Kind: instance method of League
Returns true
if the league is currently active
Kind: instance method of League
Returns true
if the league is an event league
Kind: instance method of League
Returns the time the league starts
Kind: instance method of League
Returns: string
- Time in YYYY-MM-DDThh:mm:ss.sTZD
format
Returns the time the league ends
Kind: instance method of League
Returns: string
- Time in YYYY-MM-DDThh:mm:ss.sTZD
format
Returns an object containing the total, elapsed and remaining seconds of the league
Kind: instance method of League
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() ⇒
priceData.getLeague() ⇒ League
Returns the league information
Kind: instance method of PriceData
Returns the mean value of the item
Kind: instance method of PriceData
Returns the median value of the item
Kind: instance method of PriceData
Returns the mode value of the item
Kind: instance method of PriceData
Returns the minimum value of the item
Kind: instance method of PriceData
Returns the maximum value of the item
Kind: instance method of PriceData
Returns the value of the item in Exalted Orbs
Kind: instance method of PriceData
Returns the total count of listed items
Kind: instance method of PriceData
Returns the count of currently listed items
Kind: instance method of PriceData
priceData.getHistory() ⇒ History
Returns the price history of the item
Kind: instance method of PriceData