classcharts-api
Advanced tools
Comparing version 1.4.0 to 1.5.0
import type { AxiosRequestConfig, AxiosInstance } from "axios"; | ||
import type { ActivityResponse, AnnouncementsResponse, BadgesResponse, BehaviourResponse, DetentionsResponse, GetActivityOptions, GetBehaviourOptions, GetFullActivityOptions, GetHomeworkOptions, GetLessonsOptions, HomeworksResponse, LessonsResponse, Student } from "./types"; | ||
import type { ActivityResponse, AnnouncementsResponse, AttendanceResponse, BadgesResponse, BehaviourResponse, DetentionsResponse, GetActivityOptions, GetAttendanceOptions, GetBehaviourOptions, GetFullActivityOptions, GetHomeworkOptions, GetLessonsOptions, HomeworksResponse, LessonsResponse, Student } from "./types"; | ||
/** | ||
@@ -69,2 +69,8 @@ * The base client | ||
getDetentions(): Promise<DetentionsResponse>; | ||
/** | ||
* Gets the logged in student's attendance | ||
* @param options GetAttendanceOptions | ||
* @returns Array of dates of attendance | ||
*/ | ||
listAttendance(options?: GetAttendanceOptions): Promise<AttendanceResponse>; | ||
} |
@@ -174,4 +174,17 @@ "use strict"; | ||
} | ||
/** | ||
* Gets the logged in student's attendance | ||
* @param options GetAttendanceOptions | ||
* @returns Array of dates of attendance | ||
*/ | ||
async listAttendance(options) { | ||
const params = new URLSearchParams(); | ||
options?.from && params.append("from", options?.from); | ||
options?.to && params.append("to", options?.to); | ||
return await this.makeAuthedRequest(this.API_BASE + "/attendance/" + this.studentId + "?" + params.toString(), { | ||
method: "GET", | ||
}); | ||
} | ||
} | ||
exports.ClasschartsClient = ClasschartsClient; | ||
//# sourceMappingURL=baseClient.js.map |
@@ -1,2 +0,2 @@ | ||
import { AxiosRequestConfig } from "axios"; | ||
import type { AxiosRequestConfig } from "axios"; | ||
import type { GetPupilsResponse } from "./types"; | ||
@@ -3,0 +3,0 @@ import { ClasschartsClient } from "./baseClient"; |
@@ -1,2 +0,1 @@ | ||
declare type BooleanHuman = "yes" | "no"; | ||
export interface Student { | ||
@@ -146,4 +145,4 @@ id: number; | ||
mark_relative: number; | ||
ticked: BooleanHuman; | ||
allow_attachments: BooleanHuman; | ||
ticked: "yes" | "no"; | ||
allow_attachments: "yes" | "no"; | ||
first_seen_date: string; | ||
@@ -214,3 +213,3 @@ last_seen_date: string; | ||
id: number; | ||
attended: BooleanHuman | "upscaled" | "pending"; | ||
attended: "yes" | "no" | "upscaled" | "pending"; | ||
date: string | null; | ||
@@ -226,5 +225,5 @@ length: number | null; | ||
school: { | ||
opt_notes_names: BooleanHuman; | ||
opt_notes_comments: BooleanHuman; | ||
opt_notes_comments_pupils: BooleanHuman; | ||
opt_notes_names: "yes" | "no"; | ||
opt_notes_comments: "yes" | "no"; | ||
opt_notes_comments_pupils: "yes" | "no"; | ||
}; | ||
@@ -261,3 +260,3 @@ }; | ||
school_logo: string | null; | ||
sticky: BooleanHuman; | ||
sticky: "yes" | "no"; | ||
state: string | null; | ||
@@ -271,7 +270,7 @@ timestamp: string; | ||
comment_visibility: string; | ||
allow_comments: BooleanHuman; | ||
allow_reactions: BooleanHuman; | ||
allow_consent: BooleanHuman; | ||
priority_pinned: BooleanHuman; | ||
requires_consent: BooleanHuman; | ||
allow_comments: "yes" | "no"; | ||
allow_reactions: "yes" | "no"; | ||
allow_consent: "yes" | "no"; | ||
priority_pinned: "yes" | "no"; | ||
requires_consent: "yes" | "no"; | ||
can_change_consent: boolean; | ||
@@ -312,2 +311,24 @@ consent: string | null; | ||
} | ||
export {}; | ||
export interface GetAttendanceOptions { | ||
/** | ||
* From date, in format YYYY-MM-DD | ||
*/ | ||
from: string; | ||
/** | ||
* To date, in format YYYY-MM-DD | ||
*/ | ||
to: string; | ||
} | ||
export interface AttendanceDate { | ||
AM: { | ||
code: string; | ||
status: "present" | "ignore"; | ||
late_minutes: number; | ||
}; | ||
PM: { | ||
code: string; | ||
status: "present" | "ignore"; | ||
late_minutes: number; | ||
}; | ||
} | ||
export declare type AttendanceResponse = Array<Record<string, AttendanceDate>>; |
{ | ||
"name": "classcharts-api", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "A javascript wrapper for getting information from the Classcharts API", | ||
@@ -21,5 +21,5 @@ "keywords": [ | ||
"build": "tsc", | ||
"generateDocs": "npx typedoc --entryPointStrategy expand ./src", | ||
"generateDocs": "typedoc --entryPointStrategy expand ./src", | ||
"test": "jest", | ||
"prepublishOnly": "npm run build" | ||
"prepublishOnly": "pnpm run build" | ||
}, | ||
@@ -32,4 +32,3 @@ "author": "James Cook", | ||
"files": [ | ||
"dist/**", | ||
"build/**" | ||
"dist/**" | ||
], | ||
@@ -36,0 +35,0 @@ "devDependencies": { |
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
41542
828