mirror of
https://github.com/classchartsapi/classcharts-api-js.git
synced 2026-05-14 11:58:13 +00:00
feat: add getcode endpoint (#26)
This commit is contained in:
parent
c8f7ab4fb0
commit
40c370c151
2 changed files with 41 additions and 1 deletions
|
|
@ -1,7 +1,12 @@
|
|||
import { API_BASE_STUDENT, BASE_URL } from "../utils/consts.ts";
|
||||
import { BaseClient } from "../core/baseClient.ts";
|
||||
import { parseCookies } from "../utils/utils.ts";
|
||||
import { RewardPurchaseResponse, RewardsResponse } from "../types.ts";
|
||||
import {
|
||||
GetStudentCodeOptions,
|
||||
GetStudentCodeResponse,
|
||||
RewardPurchaseResponse,
|
||||
RewardsResponse,
|
||||
} from "../types.ts";
|
||||
|
||||
/**
|
||||
* Student Client
|
||||
|
|
@ -91,4 +96,22 @@ export class StudentClient extends BaseClient {
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current student's student code
|
||||
* @param options GetStudentCodeOptions
|
||||
* @param options.dateOfBirth Date of birth in the format YYYY-MM-DD
|
||||
* @returns
|
||||
*/
|
||||
async getStudentCode(
|
||||
options: GetStudentCodeOptions,
|
||||
): Promise<GetStudentCodeResponse> {
|
||||
const data = await this.makeAuthedRequest(this.API_BASE + "/getcode", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
date: options.dateOfBirth,
|
||||
}),
|
||||
});
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue