0.0.2 • Published 4 years ago
@speedcubing/donut v0.0.2
SCO Donut
Speedcubing Online's API client.
npm install --save @speedcubing/donutGetting Started
The first thing you must do to use Donut is create a connection. To create a connection, you must have an API key and token OR a Speedcubing Online account. More information about that below.
import donut = require('@speedcubing/donut');
donut.connect({ /* OPTIONS */ })
.then((err, connection) => {
// ...
});Options
apiKey: An API key that is used to authenticate API requests. If anapiKeyvalue is provided, you must also provide anapiTokenvalue.apiToken: Your API token, only required if you have provided an apiKey.email: The email of your Speedcubing Online account. This can be used as an alternative to providing an API key and token, but it requires apasswordvalue as well.password: Your SCO account's password.url: The URL of Speedcubing Online, default:https://speedcubing-staging.herokuapp.com
Getting a User
By UUID
Using the connection.getUserByUuid method, you can get a user by their UUID.
import donut = require('@speedcubing/donut');
donut.connect({ /* OPTIONS */ })
.then((err, connection) => {
connection.getUserByUuid('[uuid]', (err, user) => {
if (err) throw err;
// ...
});
});