Skip to content

donato/torn-api

 
 

Repository files navigation

ts-torn-api

ts-torn-api is a TypeScript wrapper for using the Torn API.

Installing

Using npm:

$ npm install ts-torn-api

Using

import { TornAPI } from 'ts-torn-api';

const myKey = 'ADD_YOUR_KEY_HERE';
const torn = new TornAPI(myKey);
const myBattleStats = await torn.user.battlestats();

// check for error
if (TornAPI.isError(myBattleStats)) {
    console.log(`${myBattleStats.code}: ${myBattleStats.error}`);
} else {
    console.log(`strength: ${myBattleStats.strength}`);
    console.log(`speed: ${myBattleStats.speed}`);
}

Building

  1. Clone this repo, git clone https://github.com/jgolla/torn-api
  2. Install the dependencies, npm install
  3. Build the library, npm run build

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 99.9%
  • Shell 0.1%