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

@ -1,5 +1,5 @@
dist/
docs/
node_modules/
.eslintrc.js
.eslintrc.cjs
tsconfig.json

5
.idea/.gitignore generated vendored Normal file
View file

@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

12
.idea/classcharts-api-js.iml generated Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

58
.idea/codeStyles/Project.xml generated Normal file
View file

@ -0,0 +1,58 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<HTMLCodeStyleSettings>
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
<option name="HTML_ENFORCE_QUOTES" value="true" />
</HTMLCodeStyleSettings>
<JSCodeStyleSettings version="0">
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
<option name="SPACES_WITHIN_IMPORTS" value="true" />
</JSCodeStyleSettings>
<TypeScriptCodeStyleSettings version="0">
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
<option name="SPACES_WITHIN_IMPORTS" value="true" />
</TypeScriptCodeStyleSettings>
<VueCodeStyleSettings>
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
</VueCodeStyleSettings>
<codeStyleSettings language="HTML">
<option name="SOFT_MARGINS" value="80" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="SOFT_MARGINS" value="80" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="TypeScript">
<option name="SOFT_MARGINS" value="80" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Vue">
<option name="SOFT_MARGINS" value="80" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View file

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View file

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

8
.idea/modules.xml generated Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/classcharts-api-js.iml" filepath="$PROJECT_DIR$/.idea/classcharts-api-js.iml" />
</modules>
</component>
</project>

6
.idea/prettier.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PrettierConfiguration">
<option name="myConfigurationMode" value="AUTOMATIC" />
</component>
</project>

6
.idea/vcs.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View file

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Classcharts-API</title>
<title>ClassCharts-API</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<!-- <meta name="description" content="Description"> -->
<meta

View file

@ -7,7 +7,7 @@
"name": "James Cook",
"email": "james@jaminit.co.uk"
},
"description": "A Typescript wrapper for getting information from the Classcharts API",
"description": "A Typescript wrapper for getting information from the ClassCharts API",
"keywords": [
"node",
"typescript",

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

View file

@ -1,4 +1,6 @@
import { StudentClient } from "../src";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { code, dob } from "./config.json";
import "jest-extended";
const client = new StudentClient(code, dob);

View file

@ -16,7 +16,7 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"skipLibCheck": true,
"isolatedModules": true
"isolatedModules": true,
},
"include": ["./src/**/*"]
}