- Create new instance of
Librus
struct with student's username and password - Create new session via
Login
method - Call any other method (List of available methods)
package main
import (
"fmt"
"net/http"
golibrus "github.com/0x113/librus-api-go"
)
func main() {
httpClient := &http.Client{}
client := &golibrus.Librus{
Client: httpClient,
Username: "student username", // only student, ends with "u", e.g. "1111111u"
Password: "student password",
}
if err := client.Login(); err != nil {
panic(err)
}
// here you can call any other method
luckyNumber, err := client.GetLuckyNumber()
if err != nil {
panic(err)
}
fmt.Printf("Date: %s, lucky number: %d", luckyNumber.LuckyNumberDay, luckyNumber.LuckyNumber)
// output: Date: 2020-03-12, lucky number: 12
}
Required, saves access token for future usage
Returns lucky number and date of it
Example
// CREATE SESSION BEFORE [see basic example for details]
luckyNumber, err := client.GetLuckyNumber()
if err != nil {
panic(err)
}
fmt.Printf("Date: %s, lucky number: %d", luckyNumber.LuckyNumberDay, luckyNumber.LuckyNumber)
// output: Date: 2020-03-12, lucky number: 12
Returns user's first and last name
Example
// CREATE SESSION BEFORE [see basic example for details]
fullName, err := client.GetUserRealName()
if err != nil {
panic(err)
}
fmt.Printf("Full name: %s", fullName)
// output: Full name: Jan Kowalski
Returns new ClassDetails
object
Example
// CREATE SESSION BEFORE [see basic example for details]
classDetails, err := client.GetUserClass()
if err != nil {
panic(err)
}
fmt.Printf("Class: %s%s", classDetails.Number, classDetails.Symbol)
fmt.Printf("End of first semester: %s", classDetails.EndFirstSemester)
fmt.Printf("School year: %s -> %s", classDetails.BeginSchoolYear, classDetails.EndSchoolYear)
// output: Class: 3e
// output: End of first semester: 2020-01-03
// output: School year: 2019-09-02 -> 2020-06-23
Returns info about every grade. Check GradeDetails
struct for more details.
Example
// CREATE SESSION BEFORE [see basic example for details]
userGrades, err := client.GetUserGrades()
if err != nil {
panic(err)
}
for _, grade := range userGrades {
fmt.Printf("Grade %s, subject: %s, added by: %s %s", grade.Grade, grade.Subject, grade.AddedBy.FirstName, grade.AddedBy.LastName)
}
// output: ...
// output: Grade: 5, subject: Matematyka, added by: Jan Kowalski
// output: Grade: 4, subject: Fizyka, added by: Jan Nowak
// output: ...
Returns subject name.
Example
// CREATE SESSION BEFORE [see basic example for details]
subject, err := client.GetSubject(12300212)
if err != nil {
panic(err)
}
fmt.Printf("Subject name: %s", subject)
// output: Subject name: Matematyka
Returns grade category name
Example
// CREATE SESSION BEFORE [see basic example for details]
category, err := client.GetCategory(12300212)
if err != nil {
panic(err)
}
fmt.Printf("Category name: %s", category)
// output: Category name: Sprawdzian
Returns user's info, also teacher's info like first name and last name.
Example
// CREATE SESSION BEFORE [see basic example for details]
userInfo, err := client.GetUser(12300212)
if err != nil {
panic(err)
}
fmt.Printf("First name: %s, last name: %s", userInfo.FirstName, userInfo.LastName)
// output: First name: Jan, last name: Kowalski
- Lucky number
- Student info
- Subject info
- Student grades
- School info
- Attendances
- Messages
- Timetable
- Get classrooms
- Class free days
- Get all class free days
- Filter data to get only for specific class
- Behaviour grades
- Parent teacher conferences
- What's new since last login
- Return in json format
None 👌