npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ecoledirecte.js

v1.0.0

Published

Good-looking client for EcoleDirecte's private API.

Downloads

95

Readme

ecoledirecte.js · GitHub npm npm

As of August 8, 2023, this module is no longer maintained: This means that although the module is perfectly functioning, I will not update it to comply to future EcoleDirecte API changes. The module may fail to fetch or send data. I would greatly appreciate PRs for feature requests / bug patches, as I no longer have the time to work on this project. Thank you.

Browse EcoleDirecte's private API with ED.js, an unofficial API client.

ed.js is a Promise-based module, built on TypeScript for a better IntelliSense and type-guarded features.

Examples

Warning: these examples might not work on your machine (depending on whether you're using commonjs or ES6 module)

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 reformatted  (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 |