### Install dnevnik-mos-ru-api with npm Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Use this command to install the library using npm. ```bash npm install dnevnik-mos-ru-api ``` -------------------------------- ### Install dnevnik-mos-ru-api with yarn Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Use this command to install the library using yarn. ```bash yarn add dnevnik-mos-ru-api ``` -------------------------------- ### Get Schedule from Last Week Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Retrieves the schedule for the past week, focusing on lessons. Displays the lesson start time and subject name. ```javascript client.getSchedule(DateTime.now().minus(Duration.fromObject({week:1}))).then(e => { for (let a of e.activities) { if(a.type==="LESSON") { console.log(a.begin_time + ": " + a.lesson.subject_name); } } }).catch(e => console.error(e)); ``` -------------------------------- ### Get Teams Links Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Retrieves links for online lessons from the previous day. Useful for accessing virtual classrooms. ```javascript client.getTeamsLinks(DateTime.now().minus({day:1})).then(e => { for (let teamsLink of e) { console.log(teamsLink.link); } }).catch(e => console.log(e)) ``` -------------------------------- ### Get Menu Information Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Fetches the daily menu information. Displays a comma-separated list of meal names for each mealtime. ```javascript client.getMenu().then(e => { for (let meal of e) { console.log(meal.meals.map(e => e.name).join(", ")); } }).catch(e => console.log(e)); ``` -------------------------------- ### Get Subjects List Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Fetches a list of all subjects available to the student. Useful for mapping subject IDs to names. ```javascript client.getSubjects().then(e => { for (let subject of e) { console.log(subject.name); } }).catch(e => console.error(e)); ``` -------------------------------- ### Get Average Marks Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Fetches the average marks for the student. This provides a summary of academic performance. ```javascript client.getAverageMarks().then(e => { e.forEach(m => console.log(m.name + " " + m.mark)); }).catch(e => console.error(e)); ``` -------------------------------- ### Get Notifications Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Retrieves a list of notifications. Specifically logs the description of new homework notifications. ```javascript client.getNotifications().then(e => { for (let notification of e) { if(notification.event_type === "create_homework") { console.log(notification.new_hw_description); } } }).catch(e => console.log(e)) ``` -------------------------------- ### Get Progress Information Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Fetches learning progress information, broken down by sections and subjects. Displays the percentage of completed hours for each subject. ```javascript client.getProgress().then(e => { for (let section of e.sections) { for (let subject of section.subjects) { console.log(subject.subject_name + " " + subject.passed_hours/subject.total_hours*100 + "% "); } } }).catch(e => console.log(e)) ``` -------------------------------- ### Get Teacher Information Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Fetches information about a specific teacher using their ID. Displays the teacher's first and middle names. ```javascript client.getTeacher(2483049).then(e => { console.log(e.user.first_name+" "+e.user.middle_name); }).catch(e => console.log(e)) ``` -------------------------------- ### Get Visits from Last Month Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Fetches attendance records for the past month. Displays the date and the check-in times for each visit. ```javascript client.getVisits(DateTime.now().minus({month:1})).then(e => { for (let visitDay of e) { console.log(visitDay.date.toFormat("dd.MM.yyyy")); for (let visit of visitDay.visits) { console.log("- "+visit.in.toFormat("HH:mm")); } } }).catch(e => console.log(e)) ``` -------------------------------- ### Get Homework from Last Week Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Fetches homework assignments from the past week. Displays the subject name and homework description. ```javascript client.getHomework(DateTime.now().minus(Duration.fromObject({week:1}))).then(e => { for (let subject of e) { console.log(subject.homework_entry.homework.subject.name + " " + subject.homework_entry.description); } }).catch(e => console.error(e)); ``` -------------------------------- ### Get Billing Balance Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Retrieves billing details for a specified period (last 5 months to next month). Displays the current balance, divided by 100. ```javascript client.getBilling(DateTime.now().minus({month:5}), DateTime.now().plus({month:1})).then(e => { console.log(e.balance/100) }).catch(e => console.log(e)) ``` -------------------------------- ### Get Additional Education Groups Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Retrieves a list of groups for additional education. Useful for finding extracurricular or specialized courses. ```javascript client.getAdditionalEducationGroups().then(e => { for (let additionalEducationGroup of e) { console.log(additionalEducationGroup.name); } }).catch(e => console.log(e)) ``` -------------------------------- ### Get User Profile Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Retrieves the user's profile with various details including groups, attendances, assignments, and marks. Useful for comprehensive user data retrieval. ```javascript client.getProfile({with_groups:true, with_ae_attendances: true, with_attendances: true, with_ec_attendances: true, with_assignments: true, with_parents: true, with_subjects: true, with_marks: true, with_final_marks: true, with_home_based_periods: true, with_lesson_info: true, with_lesson_comments: true}).then(e => { for (let mark of e.marks) { console.log(mark.name + " " + mark.subject_id); } }).catch(e => console.log(e)) ``` -------------------------------- ### Get Current Academic Year Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Retrieves the name of the current academic year. Useful for context in reporting or data filtering. ```javascript DnevnikClient.getCurrentAcademicYear().then(e => console.log(e.name)).catch(e => console.error(e)); ``` -------------------------------- ### Get Marks from Last Week Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Retrieves a list of marks from the past week. Displays the subject ID and the first grade value. ```javascript client.getMarks(DateTime.now().minus(Duration.fromObject({week:1}))).then(e => { for (let subject of e) { console.log(subject.subject_id + ": " + subject.values[0].grade.five); } }).catch(e => console.error(e)); ``` -------------------------------- ### Get Per-Period Marks Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Fetches marks categorized by academic periods (e.g., quarters). Displays subject names and average marks for each period. ```javascript client.getPerPeriodMarks().then(e => { for (let subjectMark of e) { console.log(subjectMark.subject_name,subjectMark.periods.map(e => e.avg_five).join(" ")); } }).catch(e => console.log(e)) ``` -------------------------------- ### Authenticate with Token Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Authenticate using a predefined student ID and token. This is a simpler method if you have the necessary credentials. ```javascript let client = new Dnevnik.DnevnikClient(new Dnevnik.PredefinedAuthenticator(process.env.student_id, process.env.token)); // работа с клиентом ``` -------------------------------- ### Authenticate with Login and Password Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Use this method for authenticating using your Dnevnik login and password. Ensure you have the 'login' and 'password' environment variables set. ```javascript let auth = new Dnevnik.PuppeteerAuthenticator(process.env.login, process.env.password, {headless: false}); await auth.init(); await auth.authenticate(); let client = new Dnevnik.DnevnikClient(auth); // работа с клиентом await auth.close(); ``` -------------------------------- ### Bypass SMS with TOTP Source: https://github.com/redguyru/dnevnikapi/blob/master/README.md Authenticate with login, password, and a TOTP code for bypassing SMS verification. Requires 'login', 'password', and 'totp' environment variables. ```javascript let auth = new Dnevnik.PuppeteerAuthenticator(process.env.login, process.env.password, {headless: false, totp: process.env.totp}); await auth.init(); await auth.authenticate(); let client = new Dnevnik.DnevnikClient(auth); // работа с клиентом await auth.close(); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.