ClassCharts API JS
A Node.js and Deno wrapper for getting information from the Classcharts API.
Source
•
Issues
•
NPM
•
Deno
•
Discord
•
Library Docs
•
API Docs
Introduction
The ClassCharts API is a typescript wrapper around the ClassCharts API. It
allows you to easily make requests to the ClassCharts API without having to
worry about the underlying implementation of making requests.
Help
For any help with the library, please join the
discord where you can ask questions and get
help from the community.
Contributing
Contributions are welcome! There are lots of API endpoints which we simply do
not have access to to implement, so if you have access to them, please consider
contributing! If you have any questions, feel free to ask in the
discord.
Installation
Requirements
- Node.js 18 or newer
OR - Deno
NPM
npm install classcharts-api
Deno
The imports in the examples are for Node.js, but can easily be substituted for
Deno.
import {
ParentClient,
StudentClient,
} from "https://deno.land/x/classcharts_api/mod.ts";
Logging In
Before making any requests, you must login to the client. This will get you a
session ID which will be used for all requests.
Student Client
import { StudentClient } from "classcharts-api";
const client = new StudentClient("classchartsCode", "01/1/2000");
await client.login();
Parent Client
?> The parent client is not tested, as I do not have access to a parent account.
If you experience any issues, please open an issue or PR.
import { ParentClient } from "classcharts-api";
const client = new ParentClient("username", "password");
await client.login();
Universal Methods
All the following methods can be used on both the student and parent client.
Each example expects the client to be already logged in.
.getStudentInfo
const studentInfo = await client.getStudentInfo();
console.log(studentInfo);
.getActivity
const activity = await client.getActivity({
from: "2023-04-01",
to: "2023-05-10",
last_id: "12",
});
console.log(activity);
.getFullActivity
const activity = await client.getFullActivity({
from: "2023-04-01",
to: "2023-05-10",
});
console.log(activity);
.getBehaviour
Gets behaviour for a given date range.
const behaviour = await client.getBehaviour({
from: "2023-04-01",
to: "2023-05-10",
});
console.log(behaviour);
.getHomeworks
Gets homeworks for a given date range.
const homeworks = await client.getHomeworks({
from: "2023-04-01",
to: "2023-05-10",
displayDate: 'issue_date'
});
console.log(homeworks);
.getLessons
Gets lessons for a specific date.
const lessons = await client.getLessons({
date: "2023-04-01",
});
console.log(lessons);
.getBadges
Gets all earned badges.
const badges = await client.getBadges();
console.log(badges);
.getAnnouncements
Gets all announcements.
const announcements = await client.getAnnouncements();
console.log(announcements);
.getDetentions
?> This method does not include meta
in the response, since I do not have
access to this endpoint to test it. If you have access to this endpoint, please
open a PR to add the meta
response. Thanks!
Gets all detentions.
const detentions = await client.getDetentions();
console.log(detentions);
.getAttendance
?> This method does not include meta
in the response, since I do not have
access to this endpoint to test it. If you have access to this endpoint, please
open a PR to add the meta
response. Thanks!
Gets attendance.
const attendance = await client.getAttendance();
console.log(attendance);
Parent Specific Methods
.getPupils
Gets a list of all pupils the parent has access to.
const pupils = await client.getPupils();
console.log(pupils);
.selectPupil
Selects a pupil to make subsequent requests for.
await client.selectPupil(123);