stalcraft-api
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

Stalcraft API Wrapper in TypeScript

This is a wrapper for the Stalcraft API in TypeScript.
It also contains fully typed model of Stalcraft database format.

Installation

npm install stalcraft-api

Database Usage

import { StalcraftAPI } from 'stalcraft-api';

let database = new StalcraftDatabase(new GithubRepository(), 'global')

// Get all item entries
return database.getItemEntries().then((data) => {
    console.log(data)
    expect(data.length).toBeGreaterThan(0);
});

// Get specific item info
return database.getItemEntries().then((data) => {
    const entry = data[0]
    let item = database.getItemInfo(entry)
    console.log(item)
});

API Usage

import { StalcraftAppClient } from 'stalcraft-api';

// Create APP client from secret
let client = StalcraftAppClient.fromSecret(clientId, clientSecret);

// Get all auction lots for item with id 3grl in RU region
client.getAuctionLots("RU", "3grl").then((data) => {
    console.log(data)
});
import { StalcraftAppClient } from 'stalcraft-api';

// Create APP client from token
let app = new StalcraftAppClient(DEMO_URL, DEMO_APP_TOKEN);
// Get all auction lots for item with id 3grl in RU region
app.getAuctionLots("RU", "3grl").then((data) => {
    console.log(data)
});
import { StalcraftUserClient } from 'stalcraft-api';

// Create USER client
let user = new StalcraftUserClient(DEMO_URL, DEMO_USER_TOKEN);
// Get all characters for user
return user.getCharactersList("RU").then((data) => {
    console.log(data)
});

Package Sidebar

Install

npm i stalcraft-api

Weekly Downloads

1

Version

0.1.5

License

Apache-2.0

Unpacked Size

77.6 kB

Total Files

29

Last publish

Collaborators

  • justagod