The ULTIMATE wrapper for EcoleDirecte's private API.
Version πΈ Flower 0.2.0 (π± Seedling)
wrapDirecte is a powerful, modern, and type-safe TypeScript wrapper for the EcoleDirecte API. It provides a clean interface to access grades, homework, messaging, timetable, and more, with built-in support for 2FA and multi-account management.
npm install wrapdirecteimport { WrapDirecte } from 'wrapdirecte';
const client = new WrapDirecte();
// 1. Authenticate
const loginResult = await client.login('USERNAME', 'PASSWORD');
// 2. Handle 2FA if required
if (loginResult.status === '2FA_REQUIRED') {
console.log('Question:', loginResult.challenge?.question);
// In a real app, prompt the user for the answer
await client.submit2FA('THE_ANSWER');
}
// 3. Access your data
const account = client.getAccount();
console.log(`Hello, ${account?.firstName}!`);
// 4. Use modules
const homework = await client.homework?.getHomework('2026-04-08');
const grades = await client.grades?.getGrades('2025-2026');Tip
The user-agent is automatically generated from your package.json. You can customize it:
new WrapDirecte({ appName: 'MyGreatApp', appVersion: '2.0.0' })
| Method | Description |
|---|---|
login(user, pass, uuid?, preferredId?) |
Primary authentication method |
submit2FA(answer, uuid?) |
Submit answer for 2FA challenges |
directLogin(user, pass, proof, uuid?) |
Bypass 2FA if you have a valid faProof |
relogin(user, pass, uuid) |
Refresh an existing session |
selectAccount(accountId) |
Switch between student accounts |
logout() |
Clear session and tokens |
getAccount() |
Get the currently selected account |
isAuthenticated |
Returns true if logged in and account selected |
After a successful login, these modules are accessible via client.<module>:
homework: Fetch, mark as done, add comments.grades: Access grades, periods, and averages.messaging: Send/receive messages, manage folders, contacts.timetable: Weekly schedules and iCal integration.absences: Track absences, delays, and sanctions.timeline: School news and personal event feed.documents: Download invoices, reports, and certificates.cloud: Full file management (upload, download, move, delete).settings: Manage account profile and preferences.
Note
All module methods accept an optional options parameter. Use { raw: true } to bypass cleaning and get the original API response.
getHomework(date): ReturnsCleanHomework[].markAsDone(homeworkId, status): Update completion status.addComment(homeworkId, text): Post a comment on a task.
getGrades(year): Returns grades, periods, and settings.
getMessages(year): Returns inbox, sent, drafts, and archives.getMessageContent(id, year): Get full body and attachments.sendMessage(params): Compose and send new messages.getContacts(type): Fetch available recipients.
getTimetable(start, end): Get courses for a date range.getIcalUrl(): Generate a subscription link for external calendars.
getCloudFiles(depth?): List files and folders.uploadFile(path, data, name): Upload files to the cloud.downloadFile(params): Download any file from the system.deleteNodes(nodes)/moveNodes(...): File operations.
The wrapper transforms complex API responses into clean, predictable interfaces.
Click to see CleanHomework interface
interface CleanHomework {
id: number;
date: Date | null;
subject: string;
subjectCode: string;
teacherName: string;
isInterrogation: boolean;
isDone: boolean;
content: string;
files: CleanFile[];
comments: CleanComment[];
sessionContent: {
content: string;
files: CleanFile[];
comments: CleanComment[];
};
}Click to see CleanMessage interface
interface CleanMessage {
id: number;
subject: string;
date: Date | null;
from: CleanContact;
to: CleanContact[];
content?: string;
isRead: boolean;
hasAttachments: boolean;
attachments: CleanAttachment[];
type: 'received' | 'sent' | 'draft' | 'archived' | 'classeur';
}The project uses ts-node for testing and tsup for building.
- Clone the repo and
npm install. - Create a
.envfile from.env.examplewith your credentials.
npm run test-login # Test authentication
npm run test-homework # Test homework module
npm run test # Run all enabled tests in all.test.tsnpm run build # Bundle with tsupLicense: LGPL 3.0.
Legal Notice: This project is not affiliated with EcoleDirecte. Use it responsibly. YOU are responsible for your usage of this wrapper. Don't use it with accounts you don't have permission to access.
Made with β€οΈ by the Scool team