ResoNet-Lib is a Node.js library that provides an easy way to interface with the Resonite Api and its SignalR endpoints.
- Install the library by running
npm install github:Reso-Net/ResoNet-Lib
- Create a new instance of
ResoNetLib
and supply a customconfig
that follows the config scheme below - Call
client.start()
to login and start SignalR - Call what ever functions you may need for example
const user = await client.fetchUser("U-LeCloutPanda");
{
"username": "",
"password": "",
"totp": ""
}
TOTP is only needed if you use TOTP on the account
const ResoNetLib = require('resonet-lib');
const config = require('config.json');
const client = new ResoNetLib(config);
async function setup() {
await client.start();
const contacts = await client.fetchContacts();
contacts.forEach(contact => {
client.log(`Username ${contact.contactUsername}, Contact Status ${contact.contactStatus}, Is Accepted: ${contact.isAccepted}`);
})
}
setup();
More examples can be found in the examples folder.