UNPKG

ecoledirecte.js

Version:

Good-looking client for EcoleDirecte's private API.

71 lines (70 loc) 2.77 kB
/// <reference types="node" /> import { Account } from "./Account"; import { Session } from "../Session"; import { studentAccount, gradesResSuccess, studentAccountModule, studentDocsResSuccess } from "ecoledirecte-api-types/v3"; import { Cloud, Document, TimelineElem } from "../classes"; import { Message, Grade, Period, Assignement, Course } from "../classes"; import { Wallet } from "../classes/Wallet"; export declare class Student extends Account { private session; type: "student"; private account; constructor(session: Session); /** * Fetches the homework * @param dates (Array of) variable(s) which can be converted into Date object(s). Preffered type: "YYYY-MM-DD" * @param onlyWithWork If true, will ignore all assignements objects that do not contain any homework */ getHomework(params?: { dates?: Array<Date | string | number> | (Date | string | number); onlyWithWork?: boolean; }, context?: Record<string, unknown>): Promise<Assignement[]>; /** * @returns Every sent and received message, in ascending order by id */ getMessages(context?: Record<string, unknown>): Promise<Message[]>; /** * @returns Every grade */ getGrades(context?: Record<string, unknown>): Promise<Grade[]>; /** * @returns Every periods with their subjects. Useful to get more infos about grades. * It is recommended to cache them. */ getPeriods(context?: Record<string, unknown>): Promise<Period[]>; /** * @returns The equivalent of `getGrades` and `getPeriods`, with only 1 request */ getGradesAndPeriods(context?: Record<string, unknown>): Promise<{ grades: Grade[]; periods: Period[]; _raw: gradesResSuccess; }>; /** * @returns Every wallet available */ getWallets(context?: Record<string, unknown>): Promise<Wallet[]>; timeline(context?: Record<string, unknown>): Promise<TimelineElem[]>; private _photo?; private _photoUri?; getPhoto(): Promise<Buffer | undefined>; get photo(): { buffer?: Buffer; uri?: string; }; getCloud(): Promise<Cloud>; /** * @param dates (Array of) variable(s) which can be converted into Date object(s). Preffered type: "YYYY-MM-DD" * @returns The timetable as an array of courses */ getTimetable(dates?: Array<Date | string | number> | (Date | string | number)): Promise<Course[]>; getDocuments(archiveYear?: string): Promise<{ admin: Document[]; bills: Document[]; grades: Document[]; schoolLife: Document[]; _raw: studentDocsResSuccess["data"]; }>; hasModule(module: studentAccountModule["code"]): boolean; get _raw(): studentAccount; }