generated from jamesrswift/Best-README-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
JamesxX edited this page Apr 19, 2022
·
3 revisions
to be completed soon
To add the library to your project, as with all node modules, simply call the following command in your terminal:
npm install --save traw
Simply, getting a TRAW instance is as simple as instantiating it through the constructor, with a valid requestor class. Here is an example below, taken directly from one of the TRAW unit tests:
import {traw, passwordGrantRequestor, userAgent} from 'traw'
import variables from "../../mochavariables.json"
let instance : traw = new traw(new passwordGrantRequestor({
userAgent: new userAgent(
variables.credentials.useragent.platform,
variables.credentials.useragent.API,
variables.credentials.useragent.version,
variables.credentials.useragent.user
),
username: variables.credentials.login.username,
password: variables.credentials.login.password,
client_id: variables.credentials.client.id,
client_secret: variables.credentials.client.secret
}))
That's it! You don't need to do any more calls, TRAW will internally make sure that you are always logged in. There are different requestors available, which you will choose based on the type of app you are making (e.g., a script, a mobile app, a website, etc.).
These pages are maintained by humans. For up-to-date information on the library, please visit https://jamesxx.github.io/traw/