Skip to content

Commit 821a5c2

Browse files
chore: fmt
1 parent 41f23e0 commit 821a5c2

2 files changed

Lines changed: 30 additions & 38 deletions

File tree

src/core/baseClient.ts

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,10 @@ export class BaseClient {
126126
async getStudentInfo(): Promise<GetStudentInfoResponse> {
127127
const body = new URLSearchParams();
128128
body.append("include_data", "true");
129-
const data = await this.makeAuthedRequest(this.API_BASE + "/ping", {
129+
return await this.makeAuthedRequest(this.API_BASE + "/ping", {
130130
method: "POST",
131131
body: body,
132132
});
133-
return data;
134133
}
135134
/**
136135
* Gets the current student's activity
@@ -215,13 +214,12 @@ export class BaseClient {
215214

216215
options?.from && params.append("from", String(options?.from));
217216
options?.to && params.append("to", String(options?.to));
218-
const data: HomeworksResponse = await this.makeAuthedRequest(
217+
return await this.makeAuthedRequest(
219218
this.API_BASE + "/homeworks/" + this.studentId + "?" + params.toString(),
220219
{
221220
method: "GET",
222221
},
223222
);
224-
return data;
225223
}
226224
/**
227225
* Gets the current student's lessons for a given date
@@ -256,27 +254,23 @@ export class BaseClient {
256254
* @returns Array of announcements
257255
*/
258256
async getAnnouncements(): Promise<AnnouncementsResponse> {
259-
return (
260-
await this.makeAuthedRequest(
261-
this.API_BASE + "/announcements/" + this.studentId,
262-
{
263-
method: "GET",
264-
},
265-
)
257+
return await this.makeAuthedRequest(
258+
this.API_BASE + "/announcements/" + this.studentId,
259+
{
260+
method: "GET",
261+
},
266262
);
267263
}
268264
/**
269265
* Gets the current student's detentions
270266
* @returns Array of detentions
271267
*/
272268
async getDetentions(): Promise<DetentionsResponse> {
273-
return (
274-
await this.makeAuthedRequest(
275-
this.API_BASE + "/detentions/" + this.studentId,
276-
{
277-
method: "GET",
278-
},
279-
)
269+
return await this.makeAuthedRequest(
270+
this.API_BASE + "/detentions/" + this.studentId,
271+
{
272+
method: "GET",
273+
},
280274
);
281275
}
282276
/**
@@ -290,31 +284,27 @@ export class BaseClient {
290284
const params = new URLSearchParams();
291285
options?.from && params.append("from", options?.from);
292286
options?.to && params.append("to", options?.to);
293-
return (
294-
await this.makeAuthedRequest(
295-
this.API_BASE +
296-
"/attendance/" +
297-
this.studentId +
298-
"?" +
299-
params.toString(),
300-
{
301-
method: "GET",
302-
},
303-
)
287+
return await this.makeAuthedRequest(
288+
this.API_BASE +
289+
"/attendance/" +
290+
this.studentId +
291+
"?" +
292+
params.toString(),
293+
{
294+
method: "GET",
295+
},
304296
);
305297
}
306298
/**
307299
* Gets the current student's pupil fields
308300
* @returns Array of stats
309301
*/
310302
async getPupilFields(): Promise<PupilFieldsResponse> {
311-
return (
312-
await this.makeAuthedRequest(
313-
this.API_BASE + "/customfields/" + this.studentId,
314-
{
315-
method: "GET",
316-
},
317-
)
303+
return await this.makeAuthedRequest(
304+
this.API_BASE + "/customfields/" + this.studentId,
305+
{
306+
method: "GET",
307+
},
318308
);
319309
}
320310
}

src/core/studentClient.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ export class StudentClient extends BaseClient {
5959
const user = await this.getStudentInfo();
6060
this.studentId = user.data.user.id;
6161
}
62+
6263
/**
63-
* Gets the current student's rewards shop
64+
* Gets the available items in the current student's rewards shop
6465
* @returns Array of purchasable items
6566
*/
6667
async getRewards(): Promise<RewardsResponse> {
@@ -73,10 +74,11 @@ export class StudentClient extends BaseClient {
7374
)
7475
);
7576
}
77+
7678
/**
7779
* Purchase a reward item from the current student's rewards shop
7880
* @param itemId number
79-
* @returns An object containg balence and id
81+
* @returns An object containing the current student's balance and item ID purchased
8082
*/
8183
async purchaseReward(itemId: number): Promise<RewardPurchaseResponse> {
8284
return (

0 commit comments

Comments
 (0)