From 3cfaa20f2a9253cbec9517f990d41022cb6fc474 Mon Sep 17 00:00:00 2001 From: James Cook Date: Sun, 6 Feb 2022 11:13:23 +0000 Subject: [PATCH] fix: types --- src/client.ts | 2 +- src/types.ts | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/client.ts b/src/client.ts index 6009aba..0ed3785 100644 --- a/src/client.ts +++ b/src/client.ts @@ -122,6 +122,7 @@ export class ClasschartsClient { const params = new URLSearchParams(); options?.from && params.append("from", options?.from); options?.to && params.append("to", options?.to); + options?.last_id && params.append("last_id", options?.last_id); return this.makeAuthedRequest( API_BASE + "/activity/" + this.sessionId + "?" + params.toString(), { @@ -140,7 +141,6 @@ export class ClasschartsClient { const params = new URLSearchParams(); options?.from && params.append("from", options?.from); options?.to && params.append("to", options?.to); - options?.last_id && params.append("last_id", options?.last_id); return await this.makeAuthedRequest( API_BASE + "/behaviour/" + this.studentId + "?" + params.toString(), { diff --git a/src/types.ts b/src/types.ts index 49787bb..78e4408 100644 --- a/src/types.ts +++ b/src/types.ts @@ -37,32 +37,32 @@ export interface Student { survey_id: number | null; detention_alias_plural_uc: string; } -export interface GetActivityOptions { +export interface GetBehaviourOptions { from?: string; to?: string; } -export interface ActivityTimelinePoint { +export interface BehaviourTimelinePoint { positive: number; negative: number; name: string; start: string; end: string; } -export interface ActivityResponse { - timeline: Array; - positiveReasons: Record; - negative_reasons: Record; - other_positive: Array; - other_negative: Array; - other_positive_count: Array; - other_negative_count: Array; +export interface BehaviourResponse { + timeline: Array; + positive_reasons: Record; + negative_reasons: Record; + other_positive: Array; + other_negative: Array; + other_positive_count: Array>; + other_negative_count: Array>; } -export interface GetBehaviourOptions { +export interface GetActivityOptions { from?: string; to?: string; last_id?: string; } -export interface BehaviourPoint { +export interface ActivityPoint { id: number; type: string; polarity: string; @@ -80,12 +80,13 @@ export interface BehaviourPoint { room_name: string | null; note: string; _can_delete: boolean; + badges: string | undefined; detention_date: string | null; detention_time: string | null; detention_location: string | null; detention_type: string | null; } -export type BehaviourResponse = Array; +export type ActivityResponse = Array; export type DisplayDate = "due_date" | "issue_date"; export interface GetHomeworkOptions { displayDate?: DisplayDate;