https://github.com/kylestev/osbuddy-api
https://github.com/kylestev/osbuddy-api
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kylestev/osbuddy-api
- Owner: kylestev
- License: mit
- Created: 2018-02-16T17:14:47.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-16T17:53:16.000Z (over 8 years ago)
- Last Synced: 2025-02-14T19:56:26.754Z (over 1 year ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://npmjs.com/package/osbuddy-api)
# osbuddy-api
Unofficial OSBuddy API client. This does not support or document all of the
available endpoints.
## Install
`$ npm i osbuddy-api`
## Example Usage
```javascript
// example.js
const { getHourlyPrices, Statistics } = require('osbuddy-api')
const stats = new Statistics()
// fetch the online user stats
stats.onlineUsers().then(stats => {
console.log('online user statistics:', stats)
})
// get "Santa hat" prices
getHourlyPrices(1050)
.then(({ itemId, interval, records }) => {
console.log(`${records.length} prices for ${itemId}`)
records.forEach(({ timestamp, price, volume }) => {
// price and volume have "buying", "selling", and "overall" fields
console.log(`${new Date(timestamp)} - price: ${price.overall} (total: ${volume.overall})`)
})
})
```