nexus-stats-api
v1.0.0
Published
HTTP/Socket.io adapter for api.nexus-stats.com
Downloads
17
Readme
Installation
npm install nexus-stats-api
Usage
const Nexus = require("nexus-stats-api")
const nexus = new Nexus()
nexus.get("/warframe/v1/items").then(res => console.log(res.body)) // list of all stored items
Configuration
const Nexus = require("nexus-stats-api")
const nexus = new Nexus({key: value})
| Key | Default | Description | |:------------- |:------------- |:------------- | | use_socket | true | Whether or not to use Socket.io as standard request engine. Setting to false uses http. Subscriptions will use Socket.io regardless. | | namespace | "/" | Socket.io namespace to connect to | | user_key | null | (optional) User key obtained via Auth-Node registration | | user_secret | null | (optional) User secret obtained via Auth-Node | | ignore_limiter | false | Whether or not to disable the default rate limit adaptions. Disabling this only makes sense if you connect as a user who won't face rate limits. If you disable it anyway, expect all your requests to get blocked. |
API
For response formats, check the provisional nexus-stats docs
Item Price Stats
nexus.getItemStats(name)
Get detailed item statistics for a given item. Returns a promise with a statistics object.
Item Price List
nexus.getItemPrices()
Returns a list of all items and their overall price stats in the last week.
Supply & Demand
nexus.getItemDistribution()
Returns a list of all items and their supply/demand values.
Player Profiles
nexus.getPlayerProfile(name)
Returns the ingame player profile for given user.
Bot Status
nexus.getBotStatus()
Returns the upstatus for all connected bots.
Subscriptions
Subscriptions allow you to receive real-time data whenever an item is updated. Updates trigger on in-game requests.
nexus.subscribe(endpoint)
Subscribe to updates on a specific endpoint. Updates can be listened to via
nexus.on(endpoint, fn)
.
| Argument | Description | Default |
|:------------- |:------------- |:------------- |
| endpoint | URL to listen for updates on e.g. /warframe/v1/items/frost prime/statistics
| None |
nexus.on(ev, fn)
Listens to specific Socket.io event, then runs the given function with the received data
| Argument | Description | Default | |:------------- |:------------- |:------------- | | ev | Event name. Usually a subscribed endpoint URL. | None | | fn | Function to execute on event trigger | None |
RESTful methods
// GET Request
nexus.get(url)
// POST, PUT, PATCH Requests
nexus.post(url, body)
nexus.put(url, body)
nexus.patch(url, body)
// DELETE Request
nexus.delete(url, body)
Sends a RESTful request to a certain URL (without domain) and returns a promise containing the response data.
See the blitz-js-query documentation for further details on sending RESTful methods.