mirror of
https://github.com/classchartsapi/classcharts-api-js.git
synced 2026-05-14 11:58:13 +00:00
feat: attendance
This commit is contained in:
parent
f45d857e9a
commit
04b72babcf
4 changed files with 29 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ import type { AxiosRequestConfig, AxiosInstance } from "axios";
|
|||
import type {
|
||||
ActivityResponse,
|
||||
AnnouncementsResponse,
|
||||
AttendanceResponse,
|
||||
BadgesResponse,
|
||||
BehaviourResponse,
|
||||
DetentionsResponse,
|
||||
|
|
@ -216,4 +217,16 @@ export class ClasschartsClient {
|
|||
}
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Gets the logged in student's attendance
|
||||
* @returns Array of dates of attendance
|
||||
*/
|
||||
async listAttendance(): Promise<AttendanceResponse> {
|
||||
return await this.makeAuthedRequest(
|
||||
this.API_BASE + "/attendance/" + this.studentId,
|
||||
{
|
||||
method: "GET",
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import axios, { AxiosInstance, AxiosRequestConfig } from "axios";
|
||||
import type { AxiosRequestConfig } from "axios";
|
||||
import type { GetPupilsResponse } from "./types";
|
||||
|
||||
import { ClasschartsClient } from "./baseClient";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import axios from "axios";
|
||||
import type { AxiosRequestConfig } from "axios";
|
||||
import { API_BASE_STUDENT, BASE_URL } from "./consts";
|
||||
import { ClasschartsClient } from "./baseClient";
|
||||
|
|
|
|||
15
src/types.ts
15
src/types.ts
|
|
@ -310,3 +310,18 @@ export interface GetFullActivityOptions {
|
|||
*/
|
||||
to: string;
|
||||
}
|
||||
|
||||
export interface AttendanceDate {
|
||||
AM: {
|
||||
code: string;
|
||||
status: "present" | "ignore";
|
||||
late_minutes: number;
|
||||
};
|
||||
PM: {
|
||||
code: string;
|
||||
status: "present" | "ignore";
|
||||
late_minutes: number;
|
||||
};
|
||||
}
|
||||
|
||||
export type AttendanceResponse = Array<Record<string, AttendanceDate>>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue