Git Product home page Git Product logo

ecoledirecte.js's Introduction

ecoledirecte.js · GitHub npm npm

The module is still under semver 1.0.0: This means that big changes in the methods / import architecture can happen at any time. Make sure your code is compatible with the new version after updating.

Browse EcoleDirecte's private API with the module of your dreams.

ed.js is a Promise-based module, built on TypeScript for a better IntelliSense and type-guarded, solid features. It keeps evolving and new features are being added.

Examples

Get the homework of a day

import { Session } from "ecoledirecte.js";

// Create a new Session.
const session = new Session("identifiant", "motdepasse");

// Bring your session to life!
const account = await session.login().catch(err => {
	console.error("This login did not go well.");
});

// Is it a student account?
if (!account || account.type !== "student") throw new Error("Not a student!");

// Get the homework due for a specific date as a simplified array
const homework = await account.getHomework({ dates: "2021-01-14" });

// Every piece of data from the API is reformated  (eg: base64 string are
// converted to text/HTML). The raw data remains always available as _raw
console.log(homework[2].contenuDeSeance.content.text);

Introduction to events

Events can be used to do something when something else happens, in real-time. (very specific, as you can tell) For instance, the following will log the method and the url each time ed.js sends a request to the EcoleDirecte servers.

import { events } from "ecoledirecte.js";

events.on("request", ({ method, url }) => console.log(method, url));
// POST https://api.ecoledirecte.com/v3/login.awp
// POST https://api.ecoledirecte.com/v3/eleves/4179/timeline.awp
// ...

Dependencies walkthrough

Dependency Description
node-fetch A light-weight module that brings window.fetch to Node.js
html-to-text Converter that parses HTML and returns text.
ecoledirecte-api-types Module that maps the routes and types related to EcoleDirecte's API. Originally a part of ed.js

ecoledirecte.js's People

Contributors

a2br avatar dependabot[bot] avatar modernchocolate avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.