mirror of
https://github.com/classchartsapi/classcharts-api-js.git
synced 2026-05-14 11:58:13 +00:00
fix: attendance typing && expose full attendance response object
This commit is contained in:
parent
a9afa0e9e5
commit
0adb90390f
2 changed files with 23 additions and 14 deletions
|
|
@ -300,6 +300,6 @@ export class BaseClient {
|
|||
method: "GET",
|
||||
},
|
||||
)
|
||||
).data;
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
35
src/types.ts
35
src/types.ts
|
|
@ -412,17 +412,26 @@ export interface GetAttendanceOptions {
|
|||
to: string;
|
||||
}
|
||||
|
||||
export interface AttendanceDate {
|
||||
AM: {
|
||||
code: string;
|
||||
status: "present" | "ignore";
|
||||
late_minutes: number;
|
||||
};
|
||||
PM: {
|
||||
code: string;
|
||||
status: "present" | "ignore";
|
||||
late_minutes: number;
|
||||
};
|
||||
export interface AttendancePeriod {
|
||||
code: string;
|
||||
status: "present" | "ignore";
|
||||
late_minutes: number;
|
||||
lesson_name?: string;
|
||||
room_name?: string;
|
||||
}
|
||||
// TODO: Update typings to include meta response. Currently not possible since I don't have access
|
||||
export type AttendanceResponse = Record<string, AttendanceDate>[];
|
||||
|
||||
export interface AttendanceMeta {
|
||||
dates: string[];
|
||||
sessions: string[];
|
||||
start_date: string;
|
||||
end_date: string;
|
||||
percentage: string;
|
||||
percentage_since_august: string;
|
||||
}
|
||||
|
||||
export type AttendanceData = Record<string, Record<string, AttendancePeriod>>;
|
||||
|
||||
export type AttendanceResponse = ClassChartsResponse<
|
||||
AttendanceData,
|
||||
AttendanceMeta
|
||||
>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue