Skip to content

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';constmyKey='ADD_YOUR_KEY_HERE';consttorn=newTornAPI(myKey);constmyBattleStats=awaittorn.user.battlestats();// check for errorif(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

Importing TornOpenAPI types

  1. Download https://www.torn.com/swagger/openapi.json locally to the main directory
  2. Run npm run gentypes

About

No description, website, or topics provided.

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages