classcharts-api
Advanced tools
Comparing version 1.5.1 to 1.5.2
@@ -127,2 +127,4 @@ "use strict"; | ||
options?.toDate && params.append("to", String(options?.toDate)); | ||
options?.from && params.append("from", String(options?.from)); | ||
options?.to && params.append("to", String(options?.to)); | ||
const data = await this.makeAuthedRequest(this.API_BASE + "/homeworks/" + this.studentId + "?" + params.toString(), { | ||
@@ -129,0 +131,0 @@ method: "GET", |
@@ -6,2 +6,3 @@ "use strict"; | ||
const consts_1 = require("./consts"); | ||
const utils_1 = require("./utils"); | ||
/** | ||
@@ -47,12 +48,6 @@ * The base client | ||
throw new Error("Unauthenticated: Classcharts returned an error"); | ||
const cookies = request.headers["set-cookie"]; | ||
for (let i = 0; i < cookies.length; i++) { | ||
cookies[i] = cookies[i].substring(0, cookies[i].indexOf(";")); | ||
} | ||
this.authCookies = cookies; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
let sessionID = decodeURI(cookies[1]) | ||
.replace(/%3A/g, ":") | ||
.replace(/%2C/g, ","); | ||
sessionID = JSON.parse(sessionID.substring(sessionID.indexOf("{"), sessionID.length)); | ||
const cookies = String(request.headers["set-cookie"]); | ||
this.authCookies = cookies.split(";"); | ||
const sessionCookies = (0, utils_1.parseCookies)(cookies); | ||
const sessionID = JSON.parse(String(sessionCookies["parent_session_credentials"])); | ||
this.sessionId = sessionID.session_id; | ||
@@ -59,0 +54,0 @@ this.pupils = await this.getPupils(); |
@@ -6,2 +6,3 @@ "use strict"; | ||
const baseClient_1 = require("./baseClient"); | ||
const utils_1 = require("./utils"); | ||
/** | ||
@@ -47,12 +48,6 @@ * The base client | ||
throw new Error("Unauthenticated: Classcharts returned an error"); | ||
const cookies = request.headers["set-cookie"]; | ||
for (let i = 0; i < cookies.length; i++) { | ||
cookies[i] = cookies[i].substring(0, cookies[i].indexOf(";")); | ||
} | ||
this.authCookies = cookies; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
let sessionID = decodeURI(cookies[1]) | ||
.replace(/%3A/g, ":") | ||
.replace(/%2C/g, ","); | ||
sessionID = JSON.parse(sessionID.substring(sessionID.indexOf("{"), sessionID.length)); | ||
const cookies = String(request.headers["set-cookie"]); | ||
this.authCookies = cookies.split(";"); | ||
const sessionCookies = (0, utils_1.parseCookies)(cookies); | ||
const sessionID = JSON.parse(String(sessionCookies["student_session_credentials"])); | ||
this.sessionId = sessionID.session_id; | ||
@@ -59,0 +54,0 @@ const user = await this.getStudentInfo(); |
@@ -111,9 +111,17 @@ export interface Student { | ||
/** | ||
* From date, in format YYYY-MM-DD | ||
* @deprecated Use "from" instead | ||
*/ | ||
fromDate?: string; | ||
/** | ||
* @deprecated Use "to" instead | ||
*/ | ||
toDate?: string; | ||
/** | ||
* From date, in format YYYY-MM-DD | ||
*/ | ||
from?: string; | ||
/** | ||
* To date, in format YYYY-MM-DD | ||
*/ | ||
toDate?: string; | ||
to?: string; | ||
} | ||
@@ -120,0 +128,0 @@ export interface ValidatedHomeworkAttachment { |
{ | ||
"name": "classcharts-api", | ||
"version": "1.5.1", | ||
"version": "1.5.2", | ||
"description": "A javascript wrapper for getting information from the Classcharts API", | ||
@@ -12,7 +12,7 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/classchartsapi/js/issues" | ||
"url": "https://github.com/classchartsapi/classcharts-api-js/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/classchartsapi/js.git" | ||
"url": "https://github.com/classchartsapi/classcharts-api-js.git" | ||
}, | ||
@@ -19,0 +19,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
42360
24
848
0