1.0.8 โ€ข Published 5 months ago

ecoledirecte-client v1.0.8

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

๐Ÿ“š EcoleDirecte Client

ecoledirecte-client est un module Node.js permettant d'interagir avec l'API d'Ecole Directe de maniรจre simple et efficace.


๐Ÿš€ Installation

npm install ecoledirecte-client

๐Ÿ”น Importation et Connexion

Connexion ร  l'API

const { Auth, Api } = require("ecoledirecte-client");


async function main() {
    try {
        const auth = new Auth("questions.json");
        const api = new Api(await auth.login("MY_LOGIN", "MY_PASSWORD"));

        const profile = await api.getProfile();
        
        console.log("Profil's informations :");
        console.log("Name :", profile.nom);
        console.log("First name :", profile.prenom);
        
    } catch (error) {
        console.error(error.message);
    }
}

main();

๐Ÿ” Utilisation of the main features

๐Ÿ“Œ Get the list of students on a account

async function getStudentsExample() {
    const token = await Auth.login("identifiant", "motdepasse");
    const api = new Api(token);

    const students = await api.getStudents();
    console.log(students);
}

getStudentsExample();

๐Ÿ“Œ Get the notes of a student

async function getNotesExample() {
    const token = await Auth.login("identifiant", "motdepasse");
    const api = new Api(token);

    const students = await api.getStudents();
    if (students.length > 0) {
        const firstStudent = students[0];
        const notes = await firstStudent.getNotes();
        console.log(notes);
    }
}

getNotesExample();

๐Ÿ“Œ Get the homeworks day of a student

async function getHomeworksExample() {
    const token = await Auth.login("identifiant", "motdepasse");
    const api = new Api(token);

    const students = await api.getStudents();
    if (students.length > 0) {
        const firstStudent = students[0];
        const homeworksDay = await firstStudent.getHomeworksDay();
        console.log(homeworksDay);
    }
}

getHomeworksExample();

๐Ÿ“Œ Get the homeworks of a day

async function getHomeworksExample() {
    const token = await Auth.login("identifiant", "motdepasse");
    const api = new Api(token);

    const students = await api.getStudents();
    if (students.length > 0) {
        const firstStudent = students[0];
        const homeworksDay = await firstStudent.getHomeworksDay();
        if (homeworksDay.length > 0) {
            const firstHomeworksDay = homeworksDay[0];
            const homeworks = await firstHomeworksDay.getMore();
            console.log(homeworks);
        }
    }   
}

getHomeworksExample();

๐Ÿ“‰ Example of questions.json :

    {
        "question": "Quelle est votre ville de rรฉsidence ?",
        "reponse": "Paris"
    },

Several questions are possible, see the questions.json.example file for more information.

๐Ÿ› ๏ธ Dependencies

  • Node.js >= 16 (necessary for the module to work)

๐Ÿ  Contribution

If you want to improve this project : 1. Fork the GitHub repo. 2. Clone the project :

git clone https://github.com/ton-user/ecoledirecte-client.git
  1. Installe les dรฉpendances :
    npm install
  2. Create a branch and propose your changes.

๐ŸŸ Licence

This project is under the MIT license. You can use it freely as long as you mention the original author.


๐Ÿ’Œ Contact

If you encounter a problem, open an issue on GitHub. ๐Ÿš€ You can also reach me by email at contact@pierre.ebele.fr or pierre@ebele.fr

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago