Node module for skinsback.com API.
Installation
npm install skinsback-sdk
Usage
const API = require('skinsback-sdk').API;
or
import {API} from 'skinsback-sdk';
`
Constructor options
options[shop_id]
: your shop_id key requiredoptions[secret_key]
: Your personalsecret key
for generate signature required. More about generate signature.options[apiUrl]
: url to API. Default:https://skinsback.com/api.php
.
Example
import {API} from 'skinsback-sdk';
const options = {
shop_id: 1490,
secret_key: 'XCvlP45Y2dH2UmHhk'
}
const api = new API(options);
Api methods
All methods of api return a Promise.
- Check the balance on the site
api.getBalance()
- Get currencies and rates
api.getCurrencies()
- Get orders list
const params = { starting: 15123132, /// Unix time starting ending: 15125832 /// Unix time ending } api.getOrders(params)
- Check order status by Transaction Id
const transaction_id = 65236 api.getOrderStatusByTransactionId(transaction_id)
- Check order status by Order Id
const order_id = 636 api.getOrderStatusByOrderId(order_id)
- Create order
const order_id = 636 ///Уникальный ID заказа в вашей системе api.createOrder(order_id)
- Get server status
api.serverStatus()
- Get error callbacks list
api.getErrorCallbackList()
- MARKET: Price list (Skins availability)
const game = 'csgo' // Game types 'dota2' or 'csgo'. Default: 'csgo' api.getMarketPriceList([game])
- MARKET: Search skins by name
const name = 'FAMAS' // name of skin const game = 'csgo' // Game types 'dota2' or 'csgo'. Default: 'csgo' api.getMarketPriceList(name, [game])
- MARKET: Buy skin by skin name and send to user
const name = 'FAMAS' // name of skin const game = 'csgo' // Game types 'dota2' or 'csgo'. Default: 'csgo' api.buyItemByNameAndSendToUser(name, [game])
- MARKET: Buy skin by skin Id and send to user
const params = { partner: string, // partner value from user trade URL token: string, // token value from user trade URL max_price: number, // max skin cost for buying (as USD). Used as a cost limiter. name: string, // Skin name (market hash name) game: string // Game types 'dota2' or 'csgo'. Default: 'csgo' } api.buyItemByIdAndSendToUser(params)
- MARKET: Get purchase information
const buy_id = 12354322 /// buy_id from method buyItemByIdAndSendToUser or buyItemByNameAndSendToUser api.getInfoAboutBoughtItem(buy_id)
- MARKET: Purchase history
const params = { starting: 15123132, /// Unix time starting ending: 15125832 /// Unix time ending } api.getBoughtItemsHistory(params)
WebSockets
Getting real-time changes for purchased skins.
Usage
const WebSockets = require('skinsback-sdk').WebSockets;
or
import {WebSockets} from 'skinsback-sdk';
`
Constructor options
options[shop_id]
: your shop_id key requiredoptions[secret_key]
: Your personalsecret key
for generate signature. More about generate signature required.options[socket_url]
: SkinsBack socket url Show moreExample
```javascript import {WebSockets} from 'skinsback-sdk';
const options = { shop_id: 1490, secret_key: 'XCvlP45Y2dH2UmHhkl1', socket_url: 'ws://185.71.65.202:7777' }
const sockets = new WebSockets(options);
## WebSockets methods
* [Subscribing to socket events](https://skinsback.com/profile.php?act=api&item=market_websocket)
(Data arriving via sockets goes into the callback function argument as a parsed object)
```javascript
sockets.subscribe(data => console.log(data));
- Calling a callback function when connecting to sockets
const cb = () => console.log('Connected') sockets.connect(cb)
- Calling a callback function when disconnecting from sockets
const cb = () => console.log('Disconnected') sockets.disconnect(cb)