import { ElementType } from "./webuntis/resources/ElementType.js"; import { Class, Holiday, LoginResult, Room, Schoolyear, Student, Subject, Teacher, Timetable } from "./wrappers/index.js"; /** * Client for making JSON-RPC requests to the WebUntis API. * Designed by following [this documentation](https://untis-sr.ch/wp-content/uploads/2019/11/2018-09-20-WebUntis_JSON_RPC_API.pdf) */ export declare class UntisClient { private rpcClient; private loginName; private loginData; /** * Creates a new client. * @param untisInstance the school's WebUntis API instance, e.g. `ikarus.webuntis.com` * @param schoolName the school's loginName */ constructor(untisInstance: string, schoolName: string); /** * Makes a request to the WebUntis API. * @param method the JSON-RPC method to call * @param [params={}] JSON-RPC parameters, defaults to {} * @returns the result, type-casted into the provided type */ private request; /** * Logs in as a user. Needs to be called before accessing all other methods. * You should log out ({@link UntisClient.logout()}) as soon as possible to free resources on WebUntis' servers. * @param username username to log in with * @param password user password * @returns a {@link LoginResult} containing whether the login was successful */ login(username: string, password: string): Promise; /** * Logs out the current user and resets the Client. */ logout(): Promise; /** * Fetches all teachers. * @returns a list of teachers */ getTeachers(): Promise; /** * Fetches all rooms. * @returns a list of rooms */ getRooms(): Promise; /** * Fetches all subjects. * @returns a list of subjects */ getSubjects(): Promise; /** * Fetches all classes. * @returns a list of classes */ getClasses(): Promise; /** * Fetches all students. * @returns a list of students */ getStudents(): Promise; /** * Fetches all schoolyears. * @returns a list of schoolyears. */ getSchoolyears(): Promise; /** * Fetches the current schoolyear. * @returns the current schoolyear */ getCurrentSchoolyear(): Promise; /** * Fetches holidays in the current schoolyear. * @returns a list of holidays */ getHolidays(): Promise; /** * Fetches last time the timetable was updated for this school. * @returns a DateTime */ getLatestImportTime(): Promise; /** * Fetches the timetable for the current user in the specificed time range. * @param startDate start of the time range, formatted as `yyyy-mm-dd` * @param endDate end of the time range, formatted as `yyyy-mm-dd` * @returns a timetable containing all periods the user is part of, sorted by their start time */ getOwnTimetable(startDate: string, endDate: string): Promise; /** * Fetches the timetable for the given element in the specificed time range. * May throw a JSON-RPC error if the current user doesn't have the necessary permissions. * @param startDate start of the time range, formatted as `yyyy-mm-dd` * @param endDate end of the time range, formatted as `yyyy-mm-dd` * @param type the type of element * @param id the element's id * @returns a timetable containing all periods the element has access to */ getTimetableForElement(startDate: string, endDate: string, type: ElementType.Teacher | ElementType.Student, id: number): Promise; /** * Returns data about the current user. * @returns the data * @throws {@link Error} if the client is not logged in */ getUserData(): { loginName: string; type: ElementType.Teacher | ElementType.Student; id: number; classId: number; }; }