A JavaScript library for interacting with the SchoolApp platform - clean, object-oriented access to grades, attendance, and profile data
npm install schoolappbash
npm install schoolapp
`
Or if you're working locally:
`bash
cd js
npm install
`
Quick Start
$3
Getting your data is as simple as this:
`javascript
import { SchoolAppClient } from 'schoolapp';
// Initialize and log in
const client = new SchoolAppClient();
if (await client.login("your.email@example.com", "password")) {
// Get your basic info
const profile = await client.getProfile();
console.log(Hello, ${profile.basic_info.full_name}!);
// Fetch your current semester grades
const grades = await client.getCurrentElemNote();
for (const item of grades) {
console.log(${item.CodeElem}: ${item.Moy});
}
}
`
$3
The library is organized into several specific managers, so you always know where to find what you need:
`javascript
import { SchoolAppClient } from 'schoolapp';
const client = new SchoolAppClient();
await client.login("email@example.com", "password");
// Using the grades manager
const currentGrades = await client.grades.getElementNotes(true);
const allGrades = await client.grades.getElementNotes(false);
const years = await client.grades.getYears();
const semesters = await client.grades.getSemesters();
// Using the attendance manager
const absences = await client.attendance.getAbsences();
const sanctions = await client.attendance.getSanctions();
// Using the profile manager
const profile = await client.profile.getProfile();
const programs = await client.profile.getFilieres();
// Using the course manager
const modules = await client.courses.getModules("1A", "API-MPT", "S1");
`
Project Layout
The library is organized into several specific managers:
- grades: Handle module marks, element notes, and academic year results.
- attendance: Track your absences and see any sanctions.
- profile: Access your personal data and administrative files.
- courses: Browse the study plan and available modules.
API Reference
$3
Main client class for interacting with the SchoolApp API.
#### Constructor
`javascript
new SchoolAppClient(baseUrl)
`
- baseUrl (optional): Base URL of the SchoolApp instance. Defaults to https://schoolapp.ensam-umi.ac.ma
#### Methods
##### Authentication
- async login(email, password): Authenticate with email and password. Returns true if successful.
##### Profile
- async getProfile(): Get detailed student profile information.
- async getFilieres(): Get available academic programs.
##### Grades
- async getCurrentElemNote(): Get element grades for current semester.
- async getElemNote(): Get all element grades.
- async getCurrentModNote(): Get module grades for current semester.
- async getModNote(): Get all module grades.
- async getAnnee(): Get academic year results.
- async getSemestre(): Get semester results.
##### Attendance
- async getAbsences(): Get absence records.
- async getSanctions(): Get disciplinary sanctions.
##### Courses
- async getModules(niveau, filiere, semestre, refreshCsrf): Get modules for a specific academic level, program, and semester.
$3
#### Element
Represents an element (subject) with grades.
Properties:
- CodeElem: Element code
- AU: Academic year
- CC: Continuous evaluation grade
- EX: Exam grade
- TP: Practical work grade
- Moy: Overall average
- ... and more
Methods:
- async ccStats(): Get CC statistics (average, ranking, etc.)
- async exStats(): Get exam statistics
- async tpStats(): Get TP statistics
- async moyStats(): Get overall average statistics
#### Module
Represents a module (collection of elements).
Properties:
- CodeMod: Module code
- AU: Academic year
- Moy: Module average
- Dec: Decision
Methods:
- async stats(): Get module statistics
#### Annee
Represents an academic year result.
Methods:
- async stats(): Get year statistics
#### Semestre
Represents a semester result.
Methods:
- async stats(): Get semester statistics
Examples
See the examples directory for complete working examples.
Requirements
- Node.js >= 14.0.0
- Dependencies:
- axios - HTTP client
- cheerio - HTML parsing
- tough-cookie` - Cookie management