UNPKG

@heknon/node-webtop

Version:

A Backend for an unofficial WebTop (SmartSchool - Israel) API.

64 lines (63 loc) 3.29 kB
/// <reference types="cheerio" /> import { AxiosInstance } from 'axios'; import { CookieJar } from 'tough-cookie'; import { TimeTable } from './TimeTable/DataObjects'; import { WebtopSecurityData, LessonResponse, EventResponse, HomeworkResponse, WebTopUsersResponse, WebTopUserData, PersonalDetails, PushNotifications } from './DataObjects'; export default class Client { id: string; password: string; _axiosInstance: AxiosInstance | null; _cookieJar: CookieJar | null; platform: string | null; constructor(id: string, password: string); /** * get the security necessary for logging in * @param {CheerioStatic} $ parsed html * @returns {WebtopSecurityData} */ _getSecurityData($: CheerioStatic): WebtopSecurityData; /** * gets platform in use * @param {CheerioStatic} $ parsed html * @returns platform axios is using */ _getPlatform($: CheerioStatic): string; login(): Promise<import("axios").AxiosResponse<any>>; logout(): Promise<import("axios").AxiosResponse<any>>; /** * get all the grades of all 3 years of school * @param onlyFilledGrades if only to show grades that have been filled by a teacher. if false grades that haven't been filled will be set to -1 */ getGrades(onlyFilledGrades?: boolean): Promise<import("./Grades/DataObjects").Grades>; /** * get the grades of a semester * @param semester the semester. 1 or 2. * @param studentYear the study year * @param onlyFilledGrades if only to show grades that have been filled by a teacher. if false grades that haven't been filled will be set to -1 */ getSemesterGrades(studentYear?: number, semester?: number, onlyFilledGrades?: boolean): Promise<import("./Grades/DataObjects").GradeSemester>; /** * get the grades of a year * @param studentYear the study year * @param onlyFilledGrades if only to show grades that have been filled by a teacher. if false grades that haven't been filled will be set to -1 */ getYearGrades(studentYear?: number, onlyFilledGrades?: boolean): Promise<import("./Grades/DataObjects").GradeYear>; getTodayLessons(): Promise<LessonResponse[]>; getTodayEvents(): Promise<EventResponse[]>; getHomework(): Promise<HomeworkResponse[]>; /** * @param removeEmptyHours Remove hours which there are no lessons on from the response */ getTimeTable(removeEmptyHours?: boolean): Promise<TimeTable>; getTestLeftToDo(): Promise<import("./TestsLeft/DataObjects").Test[]>; getTimeTableChanges(): Promise<import("./TimeTableChanges/DataObjects").TimeTableChange[]>; getMainPage(): Promise<any>; getUsers(query: string): WebTopUsersResponse; getInbox(page: number): Promise<import("./Inbox/DataObjects").Inbox>; getMessage(id: number): Promise<import("./Inbox/DataObjects").Message>; changePassword(newPassword: string): Promise<any>; changeUsername(currentPassword: string, newUsername: string): Promise<any>; changePersonalDetails(personalDetails: PersonalDetails): Promise<any>; changePushNotifications(pushNotifications: PushNotifications): Promise<any>; getAllGradeUsers(): Promise<WebTopUserData[]>; }