mirror of
https://github.com/classchartsapi/classcharts-api-js.git
synced 2026-05-14 11:58:13 +00:00
feat: attendance filtering
Co-authored-by: Harrison <harrisondcrafter@gmail.com>
This commit is contained in:
parent
257f5d052c
commit
39aa5cb7ea
2 changed files with 20 additions and 2 deletions
|
|
@ -8,6 +8,7 @@ import type {
|
|||
BehaviourResponse,
|
||||
DetentionsResponse,
|
||||
GetActivityOptions,
|
||||
GetAttendanceOptions,
|
||||
GetBehaviourOptions,
|
||||
GetFullActivityOptions,
|
||||
GetHomeworkOptions,
|
||||
|
|
@ -219,11 +220,17 @@ export class ClasschartsClient {
|
|||
}
|
||||
/**
|
||||
* Gets the logged in student's attendance
|
||||
* @param options GetAttendanceOptions
|
||||
* @returns Array of dates of attendance
|
||||
*/
|
||||
async listAttendance(): Promise<AttendanceResponse> {
|
||||
async listAttendance(
|
||||
options?: GetAttendanceOptions
|
||||
): Promise<AttendanceResponse> {
|
||||
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,
|
||||
this.API_BASE + "/attendance/" + this.studentId + "?" + params.toString(),
|
||||
{
|
||||
method: "GET",
|
||||
}
|
||||
|
|
|
|||
11
src/types.ts
11
src/types.ts
|
|
@ -311,6 +311,17 @@ export interface GetFullActivityOptions {
|
|||
to: string;
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue