0.0.2 • Published 3 years ago

@speedcubing/donut v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

SCO Donut

Speedcubing Online's API client.

npm install --save @speedcubing/donut

Getting 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 an apiKey value is provided, you must also provide an apiToken value.
  • 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 a password value 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;
			// ...
		});
	});