Package Exports
- skinsback-sdk
- skinsback-sdk/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (skinsback-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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 keyfor 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.
api.getBalance() api.getCurrencies() const params = {
starting: 15123132, /// Unix time starting
ending: 15125832 /// Unix time ending
}
api.getOrders(params) const transaction_id = 65236
api.getOrderStatusByTransactionId(transaction_id) const order_id = 636
api.getOrderStatusByOrderId(order_id) const order_id = 636 ///Уникальный ID заказа в вашей системе
api.createOrder(order_id) api.serverStatus() api.getErrorCallbackList() const game = 'csgo' // Game types 'dota2' or 'csgo'. Default: 'csgo'
api.getMarketPriceList([game]) const name = 'FAMAS' // name of skin
const game = 'csgo' // Game types 'dota2' or 'csgo'. Default: 'csgo'
api.getMarketPriceList(name, [game]) const name = 'FAMAS' // name of skin
const game = 'csgo' // Game types 'dota2' or 'csgo'. Default: 'csgo'
api.buyItemByNameAndSendToUser(name, [game]) 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) const buy_id = 12354322 /// buy_id from method buyItemByIdAndSendToUser or buyItemByNameAndSendToUser
api.getInfoAboutBoughtItem(buy_id) 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 keyfor generate signature. More about generate signature required.options[socket_url]: SkinsBack socket url Show more
####Example
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 (Data arriving via sockets goes into the callback function argument as a parsed object)
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)