scoreboard-sdk
v0.0.1
Published
SDK for Scoreboard
Downloads
2
Readme
Scoreboard SDK
Welcome to Scoreboard's SDK. It is written in TypeScript
and compiled down to JavaScript
with all the definitions. All of the interfaces and classes are exported from the server itself.
Base project
Installation
cd my-fancy-project/src
git clone https://github.com/kekland/scoreboard-sdk
Updating
cd my-fancy-project/src/scoreboard-sdk
git pull origin master
Examples
Setting up
const sdk = require('./scoreboard-sdk') //Import the SDK
//Set the base URL
sdk.scoreboardBaseUrl = 'http://api.scoreboard.kz'
Getting competitions
//Example: Getting competitions
const competitions = await sdk.CompetitionModel.getCompetitions({ skip: 0, take: 5 })
console.log(competitions)
Deleting a competition
//Example: Deleting first competition
const token = 'My JWT token'
await competitions.items[0].deleteCompetition(token)
Registration
const data = await sdk.UserModel.register({
username: 'lukeskywalker',
password: 'mypassword',
email: '[email protected]',
name: { first: 'Luke', last: 'Skywalker' },
role: sdk.Role.Organizer
})
console.log(data)
Important stuff
All requests and functions are asynchronous, and will throw an error if something bad happens. So, you should wrap all your requests with try {} catch {}
blocks.
Contact me
E-Mail: [email protected]