1.0.2 • Published 6 years ago

infoeducatie-api-client v1.0.2

Weekly downloads
5
License
ISC
Repository
github
Last release
6 years ago

This is the TypeScript/JavaScript client for the api.infoeducatie.ro

Check the API repository at: https://github.com/infoeducatie/infoeducatie-api

Sample usage:

//typescript
import { InfoeducatieApi, Current } from "infoeducatie-api-client";

(async _ => {
    let api = new InfoeducatieApi();
    
    let current: Current = await api.authorize("your-key").getCurrent();
    if(current.is_logged_in) { // check is the current session is logged in
        console.log(current.user.email); // will print the email of the currently logged in user
    } else {
        console.log("Could not authorize against Infoeducatie's API");
    }
})();

The client works with javascript as well... but i recommend using it with typescript :)

//javascript
let { InfoeducatieApi } = require("infoeducatie-api-client");

(async _ => {
    let api = new InfoeducatieApi();

    let current = await api.authorize("your-key").getCurrent();
    if(current.is_logged_in) { // check is the current session is logged in
        console.log(current.user.email); // will print the email of the currently logged in user
    } else {
        console.log("Could not authorize against Infoeducatie's API");
    }
})();

Check the typings for more info on the usage! The DOCs of the API are pretty much missing (except for the API.md) so i had to reverse it using the ruby code :) Hope you enjoy!

Want to contribute?

Here's how!