1
0
Fork 0
mirror of https://github.com/classchartsapi/classcharts-api-js.git synced 2026-05-14 03:56:59 +00:00

fix: types

This commit is contained in:
James Cook 2022-02-06 11:13:23 +00:00
parent cb7be6e70b
commit 3cfaa20f2a
2 changed files with 15 additions and 14 deletions

View file

@ -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(),
{

View file

@ -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<ActivityTimelinePoint>;
positiveReasons: Record<string, string>;
negative_reasons: Record<string, string>;
other_positive: Array<any>;
other_negative: Array<any>;
other_positive_count: Array<any>;
other_negative_count: Array<any>;
export interface BehaviourResponse {
timeline: Array<BehaviourTimelinePoint>;
positive_reasons: Record<string, number>;
negative_reasons: Record<string, number>;
other_positive: Array<string>;
other_negative: Array<string>;
other_positive_count: Array<Record<string, number>>;
other_negative_count: Array<Record<string, number>>;
}
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<BehaviourPoint>;
export type ActivityResponse = Array<ActivityPoint>;
export type DisplayDate = "due_date" | "issue_date";
export interface GetHomeworkOptions {
displayDate?: DisplayDate;