Skip to content

liberatos278/bakalari.js

 
 

Repository files navigation

bakalari.js

A simple JavaScript Bakaláři API wrapper.

Installation

You need Node and NPM (Node Package Manager)

npm install @godlessssss/bakalari.js

Usage

// Requiring the library from npm
const Bakalari = require('@godlessssss/bakalari.js')

// Instancing a user with url, username and password
let client = new Bakalari.User('URL', 'USERNAME', 'PASSWORD')

// Logging in to the Bakalari API
client.login()

// Waiting for client to be ready
client.on('ready', async () => {
    // Getting marks info from the API
    let marks = await client.get(Bakalari.Modules.Marks)
    // logging it to the console
    console.log(marks)
});

Available Modules

Main function

await client.get(Module, ...Arguments)

Bakalari.Modules.Marks

await client.get(Bakalari.Modules.Marks)
  • returns Array of Subjects, that contain Marks Array

Bakalari.Modules.Subjects

await client.get(Bakalari.Modules.Subjects)
  • returns Array of Subjects

Bakalari.Modules.Absence

await client.get(Bakalari.Modules.Absence)
  • returns Absence Array and Absence by Subject Array

Bakalari.Modules.Events

await client.get(Bakalari.Modules.Events)
  • returns Array of Events

Bakalri.Modules.Homeworks

await client.get(Bakalari.Modules.Homeworks)
  • returns Array of Homeworks

Bakalari.Modules.UserInfo

await client.get(Bakalari.Modules.UserInfo)
  • returns User Object

Bakalari.Modules.Timetable

  • Permanent Timetable
await client.get(Bakalari.Modules.Timetable)
  • Actual Timetable
await client.get(Bakalari.Modules.Timetable, 'actual')

Bakalari.Modules.Substitutions

await client.get(Bakalari.Modules.Substitutions)
  • returns Array of Substitutions

Bakalari.Modules.FinalMarks

await client.get(Bakalari.Modules.FinalMarks)
  • returns Array of school certificates and Final Marks for your term

Bakalari.Modules.Whatif

await client.get(Bakalari.Modules.Whatif, array_of_marks)
  • Example
await client.get(Bakalari.Modules.Whatif, [
    {
        MarkText: '1',
        Weight: 4,
        SubjectId: ' 2',
        Id: null,
        MaxPoints: 0
    }
])

MarkText: The mark number you want to add to the prediction - must be string

Weight: The weight of the mark

SubjectId: The ID of the subject you want to predict - use Subjects module to get the ID

Id: The ID of mark - prediction marks are always null

MaxPoints: Maximum number of points to get - this is only used when you use points system

  • returns Array of Marks with presumed subject average

About

A simple API wrapper over Bakalari API

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%