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:
parent
e2f3b21ee5
commit
a05b3ada93
2 changed files with 29 additions and 1 deletions
|
|
@ -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<PupilFieldsResponse> {
|
||||
return (
|
||||
await this.makeAuthedRequest(
|
||||
this.API_BASE + "/apiv2student/customfields" + this.studentId,
|
||||
{
|
||||
method: "GET"
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
12
src/types.ts
12
src/types.ts
|
|
@ -465,3 +465,15 @@ export interface 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, []>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue