0.0.2 • Published 4 years ago
faceitapi v0.0.2
Faceit API Handler
Faceit API Handler is a lightweight node module to handle Faceit API requests and responses
Content
Features
- Lightweight (1 dependency)
- Support Promise API
- Support Asynchronous calls
Installation
Use the package manager npm to install faceitapi.
npm install faceitapi
Usage
const Faceit = require('faceitapi');
const faceit = new Faceit('YOUR-API-KEY');
const resp = await faceit.getPlayerStats('T777A');
console.log(resp);
Promises & Async/Await
Faceit API Handdler supports both interfaces
Promises
faceit.getPlayerStats('FACEIT-NICKNAME')
.then(resp=>console.log(resp))
.catch(e=>console.log(e));
Async/Await
async () => {
const resp = await faceit.getPlayerStats('FACEIT-NICKNAME');
console.log(resp);
}()
API
Main methods
faceit.getPlayerStats(nickname,options)
Additional methods
faceit.getId(nickname)
faceit.getPlayerStatsHistory(id,game)
Documentation
Class: Faceit(api-key)
api-key
:string
Methods
getPlayerStats(nickname,options = { default: {} })
Retrieves player's full stats , to enable retreiving additional stats , like history , hubs , etc , check
options
nickname
:String
,options
:Object
options:{ default:{} type:{ name: history } }
getId(nickname)
Retrieves player's id
nickname
:string
Returns
String
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.