0.0.1 • Published 7 years ago
scoreboard-sdk v0.0.1
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-sdkUpdating
cd my-fancy-project/src/scoreboard-sdk
git pull origin masterExamples
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: 'myniceemail@mynicedomain.com',
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: kk.erzhan@gmail.com
0.0.1
7 years ago