From a05b3ada93656428b647fb95c9ff6b047e52e635 Mon Sep 17 00:00:00 2001 From: veloii <85405932+veloii@users.noreply.github.com> Date: Fri, 15 Sep 2023 20:08:17 +0100 Subject: [PATCH] feat: add getPupilFields --- src/core/baseClient.ts | 16 ++++++++++++++++ src/types.ts | 14 +++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/core/baseClient.ts b/src/core/baseClient.ts index 79231ff..f42d078 100644 --- a/src/core/baseClient.ts +++ b/src/core/baseClient.ts @@ -15,6 +15,7 @@ import type { GetStudentInfoResponse, HomeworksResponse, LessonsResponse, + PupilFieldsResponse, RewardPurchaseResponse, RewardsResponse, } from "../types.ts"; @@ -334,4 +335,19 @@ export class BaseClient { ) ) } + + /** + * Gets the current student's pupil fields + * @returns Array of stats + */ + async getPupilFields(): Promise { + return ( + await this.makeAuthedRequest( + this.API_BASE + "/apiv2student/customfields" + this.studentId, + { + method: "GET" + } + ) + ) + } } diff --git a/src/types.ts b/src/types.ts index 979d53a..341c7b0 100644 --- a/src/types.ts +++ b/src/types.ts @@ -464,4 +464,16 @@ export interface RewardPurchaseData { balence: number; } -export type RewardPurchaseResponse = ClassChartsResponse; \ No newline at end of file +export type RewardPurchaseResponse = ClassChartsResponse; + +export interface PupilFieldsData { + note: string; + fields: { + id: number; + name: string; + graphic: string; + value: string; + }[] +} + +export type PupilFieldsResponse = ClassChartsResponse; \ No newline at end of file