1
0
Fork 0
mirror of https://github.com/classchartsapi/classcharts-api-js.git synced 2026-05-14 11:58:13 +00:00

chore: typo fixes + config files

This commit is contained in:
James Cook 2023-05-14 00:59:21 +01:00
parent f11c7c564d
commit 00e3a13821
17 changed files with 124 additions and 16 deletions

View file

@ -42,13 +42,13 @@ export class BaseClient {
*/
public lastPing = 0;
/**
* @property API_BASE Base API URL, this is different depending if its called as a parent or student
* @property API_BASE Base API URL, this is different depending on if its called as a parent or student
* @internal
*/
protected API_BASE = "";
/**
*
* @param API_BASE Base API URL, this is different depending if its called as a parent or student
* @param API_BASE Base API URL, this is different depending on if its called as a parent or student
*/
constructor(API_BASE: string) {
this.authCookies = [];
@ -57,7 +57,7 @@ export class BaseClient {
/**
* Revalidates the session ID.
*
* This is called automatically when the session ID is older than 3 minutes or when intially using the .login() method
* This is called automatically when the session ID is older than 3 minutes or when initially using the .login() method
* @internal
*/
public async getNewSessionId() {
@ -75,7 +75,7 @@ export class BaseClient {
this.lastPing = Date.now();
}
/**
* Makes a request to the Classcharts API with the required authentication headers
* Makes a request to the ClassCharts API with the required authentication headers
*
* @param path Path to the API endpoint
* @param kyOptions Ky (fetch library) request options

View file

@ -24,7 +24,7 @@ export class ParentClient extends BaseClient {
}
/**
* Authenticates with classcharts
* Authenticates with ClassCharts
*/
async login(): Promise<void> {
if (!this.email) throw new Error("Email not inputted");
@ -33,7 +33,7 @@ export class ParentClient extends BaseClient {
formData.append("email", this.email);
formData.append("logintype", "existing");
formData.append("password", this.password);
formData.append("recaptcha-token", "no-token-avaliable");
formData.append("recaptcha-token", "no-token-available");
const headers = new Headers({
"Content-Type": "application/x-www-form-urlencoded",
});
@ -45,7 +45,7 @@ export class ParentClient extends BaseClient {
});
if (response.status != 302 || !response.headers.get("set-cookie"))
throw new Error(
"Unauthenticated: Classcharts returned an error: " +
"Unauthenticated: ClassCharts returned an error: " +
response.status +
" " +
response.statusText

View file

@ -8,7 +8,7 @@ import ky from "ky-universal";
*/
export class StudentClient extends BaseClient {
/**
* @property studentCode Classcharts student code
* @property studentCode ClassCharts student code
* @internal
*/
private studentCode = "";
@ -20,7 +20,7 @@ export class StudentClient extends BaseClient {
/**
*
* @param studentCode Classcharts student code
* @param studentCode ClassCharts student code
* @param dateOfBirth Student's date of birth
*/
constructor(studentCode: string, dateOfBirth?: string) {
@ -30,7 +30,7 @@ export class StudentClient extends BaseClient {
}
/**
* Authenticates with classcharts
* Authenticates with ClassCharts
*/
async login(): Promise<void> {
if (!this.studentCode) throw new Error("Student Code not inputted");
@ -39,7 +39,7 @@ export class StudentClient extends BaseClient {
formData.append("code", this.studentCode.toUpperCase());
formData.append("dob", this.dateOfBirth);
formData.append("remember_me", "1");
formData.append("recaptcha-token", "no-token-avaliable");
formData.append("recaptcha-token", "no-token-available");
const request = await ky(BASE_URL + "/student/login", {
method: "POST",
body: formData,
@ -49,7 +49,7 @@ export class StudentClient extends BaseClient {
});
if (request.status != 302 || !request.headers.get("set-cookie")) {
throw new Error(
"Unauthenticated: Classcharts returned an error: " +
"Unauthenticated: ClassCharts returned an error: " +
request.status +
" " +
request.statusText