1
0
Fork 0
mirror of https://github.com/classchartsapi/classcharts-api-js.git synced 2026-05-14 11:58:13 +00:00

feat: add getPupilFields

This commit is contained in:
veloii 2023-09-15 20:08:17 +01:00
parent e2f3b21ee5
commit a05b3ada93
2 changed files with 29 additions and 1 deletions

View file

@ -15,6 +15,7 @@ import type {
GetStudentInfoResponse, GetStudentInfoResponse,
HomeworksResponse, HomeworksResponse,
LessonsResponse, LessonsResponse,
PupilFieldsResponse,
RewardPurchaseResponse, RewardPurchaseResponse,
RewardsResponse, RewardsResponse,
} from "../types.ts"; } from "../types.ts";
@ -334,4 +335,19 @@ export class BaseClient {
) )
) )
} }
/**
* Gets the current student's pupil fields
* @returns Array of stats
*/
async getPupilFields(): Promise<PupilFieldsResponse> {
return (
await this.makeAuthedRequest(
this.API_BASE + "/apiv2student/customfields" + this.studentId,
{
method: "GET"
}
)
)
}
} }

View file

@ -464,4 +464,16 @@ export interface RewardPurchaseData {
balence: number; balence: number;
} }
export type RewardPurchaseResponse = ClassChartsResponse<RewardPurchaseData, []>; export type RewardPurchaseResponse = ClassChartsResponse<RewardPurchaseData, []>;
export interface PupilFieldsData {
note: string;
fields: {
id: number;
name: string;
graphic: string;
value: string;
}[]
}
export type PupilFieldsResponse = ClassChartsResponse<PupilFieldsData, []>;