+
+# 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](https://discord.gg/DTcwugcgZ2) where you can ask questions and get help from the community.
+
+# Installation
+
+## Requirements
+
+- Node.js 16 or newer
+
+## NPM
+
+```bash
+npm install classcharts-api # npm
+yarn add classcharts-api # yarn
+pnpm add classcharts-api # pnpm
+```
+
+# 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
+
+```typescript
+import { StudentClient } from "classcharts-api";
+
+// Date of birth MUST in the format DD/MM/YYYY
+const client = new StudentClient("classchartsCode", "01/1/2000");
+await client.login();
+```
+
+## Parent Client
+
+```typescript
+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`
+
+```typescript
+const studentInfo = await client.getStudentInfo();
+console.log(studentInfo);
+/**
+{
+ success: 1,
+ data: {
+ user: {
+ id: 2339528,
+ ...
+ }
+ },
+ meta: {
+ session_id: '5vf2v7n5uk9jftrxaarrik39vk6yjm48',
+ ...
+ }
+}
+*/
+```
+
+## `.getActivity`
+
+```typescript
+// Dates must be in format YYYY-MM-DD
+const activity = await client.getActivity({
+ from: "2023-04-01",
+ to: "2023-05-10",
+ last_id: "12",
+});
+console.log(activity);
+```
+
+## `.getFullActivity`
+
+```typescript
+// Dates must be in format YYYY-MM-DD
+const activity = await client.getFullActivity({
+ from: "2023-04-01",
+ to: "2023-05-10",
+});
+console.log(activity);
+```
+
+## `.getBehaviour`
+
+Gets behaviour for a given date range.
+
+```typescript
+// Dates must be in format YYYY-MM-DD
+const behaviour = await client.getBehaviour({
+ from: "2023-04-01",
+ to: "2023-05-10",
+});
+console.log(behaviour);
+
+/**
+{
+ "success": 1,
+ "data": {
+ "timeline": [
+ {
+ "positive": 426,
+ ...
+ },
+ ],
+ ...
+ "meta": {
+ "start_date": "2023-04-01T00:00:00+00:00",
+ ...
+ }
+}
+*/
+```
+
+## `.getHomeworks`
+
+Gets homeworks for a given date range.
+
+```typescript
+// Dates must be in format YYYY-MM-DD
+const homeworks = await client.getHomeworks({
+ from: "2023-04-01",
+ to: "2023-05-10",
+ displayDate: 'issue_date' // Can be 'due_date' or 'issue_date'
+});
+console.log(homeworks);
+
+/**
+{
+ success: 1,
+ data: [
+ {
+ lesson: '7A/Pe1',
+ ...
+ },
+ ],
+ meta: {
+ start_date: '2023-04-01T00:00:00+00:00',
+ ...
+ }
+}
+
+```
+
+## `.getLessons`
+
+Gets lessons for a specific date.
+
+```typescript
+// Dates must be in format YYYY-MM-DD
+const lessons = await client.getLessons({
+ date: "2023-04-01",
+});
+console.log(lessons);
+
+/**
+{
+ "success": 1,
+ "data": [
+ {
+ "teacher_name": "Mr J Doe",
+ ...
+ }
+ ...
+ ],
+ "meta": {
+ "dates": [
+ "2023-05-04"
+ ],
+ ...
+ }
+}
+*/
+```
+
+## `.getBadges`
+
+Gets all earned badges.
+
+```typescript
+const badges = await client.getBadges();
+console.log(badges);
+
+/**
+{
+ success: 1,
+ data: [
+ {
+ id: 123,
+ name: 'Big Badge',
+ ...
+ },
+ ...
+ ],
+ meta: []
+}
+*/
+```
+
+## `.getAnnouncements`
+
+Gets all announcements.
+
+```typescript
+const announcements = await client.getAnnouncements();
+console.log(announcements);
+```
+
+## `.getDetentions`
+
+Gets all detentions.
+
+```typescript
+const detentions = await client.getDetentions();
+console.log(detentions);
+```
+
+## `.getAttendance`
+
+Gets attendance.
+
+```typescript
+const attendance = await client.getAttendance();
+console.log(attendance);
+```
+
+# Parent Specific Methods
+
+## `.getPupils`
+
+Gets a list of all pupils the parent has access to.
+
+```typescript
+const pupils = await client.getPupils();
+console.log(pupils);
+/**
+[
+ {
+ id: 123,
+ name: 'John Doe',
+ ...
+ },
+ ...
+]
+*/
+```
+
+## `.selectPupil`
+
+Selects a pupil to make subsequent requests for.
+
+```typescript
+await client.selectPupil(123);
+```
diff --git a/docs/index.html b/docs/index.html
new file mode 100644
index 0000000..5d950b1
--- /dev/null
+++ b/docs/index.html
@@ -0,0 +1,38 @@
+
+
+
+
+ Classcharts-API
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/readme.md b/readme.md
index c8fa0c2..5395263 100644
--- a/readme.md
+++ b/readme.md
@@ -1,29 +1,23 @@
-# Classcharts API
+
Classcharts API
+
+
+
+
+
+
+
-A client for the classcharts API
+
A typescript wrapper for getting information from the Classcharts API.
+
+# Links
- [Documentation](https://classchartsapi.github.io/classcharts-api-js/)
-- [API Documentation (with library examples)](https://classchartsapi.github.io/api-docs/#introduction)
- [Discord](https://discord.gg/DTcwugcgZ2)
-# Examples
+# Contributing
-Docs are very much a WIP, for any help with the library, please join the discord above
+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](https://discord.gg/DTcwugcgZ2).
-```typescript
-import { StudentClient } from "classcharts-api";
-async function main() {
- const client = new StudentClient("classchartsCode", "01/1/2000");
- await client.login();
- console.log(
- await client.getBehaviour({
- from: "20/01/2000",
- to: "01/02/2000",
- })
- );
- console.log(await client.getActivity());
- console.log(await client.getStudentInfo());
-}
+# Help
-main();
-```
+For any help with the library, please join the [discord](https://discord.gg/DTcwugcgZ2) where you can ask questions and get help from the community.
diff --git a/typedoc.config.cjs b/typedoc.config.cjs
index f1cac71..9ecd167 100644
--- a/typedoc.config.cjs
+++ b/typedoc.config.cjs
@@ -13,7 +13,7 @@ module.exports = {
Github: "https://github.com/classchartsapi/classcharts-api-js",
},
includeVersion: true,
- out: "docs",
+ out: "docs/typedoc",
sort: "required-first",
umamiOptions: {
src: "https://umami.jaminit.co.uk/script.js",
From 06300ec95a2a14533d4934dbc9f72cab0f0ca12f Mon Sep 17 00:00:00 2001
From: James Cook
Date: Thu, 4 May 2023 21:56:56 +0100
Subject: [PATCH 05/15] chore: update readme name
---
readme.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/readme.md b/readme.md
index 5395263..53c505e 100644
--- a/readme.md
+++ b/readme.md
@@ -1,4 +1,4 @@
-
Classcharts API
+
Classcharts API JS
From 451f80062cff0b27d91b49b18b57ac8d3833ccd0 Mon Sep 17 00:00:00 2001
From: James Cook
Date: Thu, 4 May 2023 22:18:40 +0100
Subject: [PATCH 06/15] chore: add required node version to package.json
---
.changeset/lucky-horses-guess.md | 5 +++++
package.json | 5 ++++-
2 files changed, 9 insertions(+), 1 deletion(-)
create mode 100644 .changeset/lucky-horses-guess.md
diff --git a/.changeset/lucky-horses-guess.md b/.changeset/lucky-horses-guess.md
new file mode 100644
index 0000000..5b79a87
--- /dev/null
+++ b/.changeset/lucky-horses-guess.md
@@ -0,0 +1,5 @@
+---
+"classcharts-api": patch
+---
+
+Specify the required node version
diff --git a/package.json b/package.json
index 28ce8a6..5f1dd83 100644
--- a/package.json
+++ b/package.json
@@ -60,5 +60,8 @@
},
"files": [
"dist/**"
- ]
+ ],
+ "engines": {
+ "node": ">=16"
+ }
}
From 86df2e09279770ec21ed80698df797e8f1e1adfd Mon Sep 17 00:00:00 2001
From: James
Date: Thu, 4 May 2023 22:39:55 +0100
Subject: [PATCH 07/15] feat: Small docs improvements (#29)
---
.gitignore | 3 ++-
docs/README.md | 12 ++++++++++++
docs/index.html | 2 ++
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 815af20..2b61141 100644
--- a/.gitignore
+++ b/.gitignore
@@ -118,4 +118,5 @@ dist
.pnp.*
tests/config.json
-tests/sandbox.js
\ No newline at end of file
+
+docs/typedoc
\ No newline at end of file
diff --git a/docs/README.md b/docs/README.md
index 868b1c3..18817b4 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -36,7 +36,13 @@ For any help with the library, please join the [discord](https://discord.gg/DTcw
```bash
npm install classcharts-api # npm
+```
+
+```bash
yarn add classcharts-api # yarn
+```
+
+```bash
pnpm add classcharts-api # pnpm
```
@@ -230,6 +236,8 @@ console.log(badges);
## `.getAnnouncements`
+?> 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 announcements.
```typescript
@@ -239,6 +247,8 @@ 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.
```typescript
@@ -248,6 +258,8 @@ 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.
```typescript
diff --git a/docs/index.html b/docs/index.html
index 5d950b1..7d11319 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -34,5 +34,7 @@
+
+