dupbit-api
v1.1.6
Published
## Installation
Downloads
2
Readme
Dupbit_API
Installation
Node.js
Default:npm install dupbit-api
When also using the websocket:npm install dupbit-api ws
React Native
npm install dupbit-api
Browser
Include this somewhere between your <head>
tags
<script src="https://cdn.jsdelivr.net/npm/ua-parser-js@0/dist/ua-parser.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dupbit-api@latest/index.js"></script>
Create Instance
const Dupbit_API = require("dupbit-api");
const dupbit = new Dupbit_API({
token: "yourtokenhere",
});
dupbit.on("ready", () => {
});
Methods
.list()
Returns all devices for the authenticated user
.sendAPICall(options, override)
Send an api call
tid
client to which the call should be sentcall
call that get forwarded to client
any other object properties get forwarded to the client too.
{
tid: 123,
call: "/test/help", //optional
...
}
override
should contain an options object following the syntax for the Node.js https requests
.reconnect()
Reconnect the client
.disconnect()
Disconnect the client
.login(username, password) <static>
Obtain a token
.login(username, password)
Login when having logged in with an expired token or no token at all
.logout()
Revoke the currently using token and logout
Events
ready
Client is ready
message
Message from the socket, should use the .reply(...)
method on the object
error
There was an error, most likely invaled api key
error_socket
There was an error with the socket connection
disconnect_socket
The socket got closed
reconnecting_socket
Closed socket is attempting to reconnect
revoke
API token for the client got revoked disconnect event will follow
Properties
authenticated
boolean if the client is authenticated
connected
boolean if the client is connected to the websocket