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

282 lines
6.5 KiB
TypeScript
Raw Normal View History

2022-01-31 22:38:17 +00:00
/* eslint-disable @typescript-eslint/no-explicit-any */
2022-02-06 15:23:30 +00:00
type BooleanHumean = "yes" | "no";
export interface Student {
2022-01-31 22:32:29 +00:00
id: number;
name: string;
first_name: string;
last_name: string;
avatar_url: string;
display_behaviour: boolean;
display_parent_behaviour: boolean;
display_homework: boolean;
display_rewards: boolean;
display_detentions: boolean;
display_report_cards: boolean;
display_classes: boolean;
display_announcements: boolean;
display_attendance: boolean;
display_attendance_type: string;
display_attendance_percentage: boolean;
display_activity: boolean;
display_mental_health: boolean;
display_timetable: boolean;
is_disabled: boolean;
display_two_way_communications: boolean;
display_absences: boolean;
can_upload_attachments: string | null;
display_event_badges: boolean;
display_avatars: boolean;
display_concern_submission: boolean;
display_custom_fields: boolean;
pupil_concerns_help_text: string;
allow_pupils_add_timetable_notes: boolean;
announcements_count: number;
messages_count: number;
pusher_channel_name: string;
has_birthday: boolean;
has_new_survey: boolean;
survey_id: number | null;
detention_alias_plural_uc: string;
2021-10-28 16:51:07 +01:00
}
2022-02-06 11:13:23 +00:00
export interface GetBehaviourOptions {
2022-02-06 12:09:37 +00:00
/**
* From date, in format YYYY-MM-DD
*/
2022-01-31 22:32:29 +00:00
from?: string;
2022-02-06 12:09:37 +00:00
/**
* To date, in format YYYY-MM-DD
*/
2022-01-31 22:32:29 +00:00
to?: string;
}
2022-02-06 11:13:23 +00:00
export interface BehaviourTimelinePoint {
2022-01-31 22:32:29 +00:00
positive: number;
negative: number;
name: string;
start: string;
end: string;
}
2022-02-06 11:13:23 +00:00
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>>;
}
2022-02-06 11:13:23 +00:00
export interface GetActivityOptions {
2022-02-06 12:09:37 +00:00
/**
* From date, in format YYYY-MM-DD
*/
2022-01-31 22:32:29 +00:00
from?: string;
2022-02-06 12:09:37 +00:00
/**
* To date, in format YYYY-MM-DD
*/
2022-01-31 22:32:29 +00:00
to?: string;
2022-02-06 12:09:37 +00:00
/**
* ID of the last activityPoint (used in pagination)
*/
2022-01-31 22:32:29 +00:00
last_id?: string;
}
2022-02-06 11:13:23 +00:00
export interface ActivityPoint {
2022-01-31 22:32:29 +00:00
id: number;
type: string;
polarity: string;
reason: string;
score: number;
timestamp: string;
timestamp_custom_time: string | null;
style: {
border_color: string | null;
custom_class: string | null;
};
pupil_name: string;
lesson_name: string;
teacher_name: string;
room_name: string | null;
note: string;
2022-01-31 22:44:31 +00:00
_can_delete: boolean;
2022-02-06 11:13:23 +00:00
badges: string | undefined;
2022-01-31 22:32:29 +00:00
detention_date: string | null;
detention_time: string | null;
detention_location: string | null;
detention_type: string | null;
}
2022-02-06 11:13:23 +00:00
export type ActivityResponse = Array<ActivityPoint>;
2022-01-31 22:32:29 +00:00
export type DisplayDate = "due_date" | "issue_date";
export interface GetHomeworkOptions {
2022-02-06 12:09:37 +00:00
/**
* Way to sort homeworks
*/
2022-01-31 22:32:29 +00:00
displayDate?: DisplayDate;
2022-02-06 12:09:37 +00:00
/**
* From date, in format YYYY-MM-DD
*/
2022-01-31 22:32:29 +00:00
fromDate?: string;
2022-02-06 12:09:37 +00:00
/**
* To date, in format YYYY-MM-DD
*/
2022-01-31 22:32:29 +00:00
toDate?: string;
}
2022-01-31 22:44:31 +00:00
export interface ValidatedHomeworkAttachment {
id: number;
file_name: string;
file: string;
validated_file: string;
}
2021-10-28 16:51:07 +01:00
export interface Homework {
2022-01-31 22:32:29 +00:00
lesson: string;
subject: string;
teacher: string;
homework_type: string;
id: number;
title: string;
meta_title: string;
description: string;
2022-02-06 12:09:37 +00:00
description_raw: string;
2022-01-31 22:32:29 +00:00
issue_date: string;
due_date: string;
completion_time_unit: string;
completion_time_value: string;
publish_time: string;
status: {
id: number;
state: "not_completed" | "late" | "completed" | null;
2022-01-31 22:44:31 +00:00
mark: any | null;
2022-01-31 22:32:29 +00:00
mark_relative: number;
2022-02-06 15:23:30 +00:00
ticked: BooleanHumean;
allow_attachments: BooleanHumean;
2022-01-31 22:32:29 +00:00
first_seen_date: string;
last_seen_date: string;
attachments: Array<any>;
has_feedback: boolean;
};
validated_links: Array<any>;
2022-01-31 22:44:31 +00:00
validated_attachments: Array<ValidatedHomeworkAttachment>;
2021-10-28 16:51:07 +01:00
}
2022-01-31 22:32:29 +00:00
export type HomeworksResponse = Array<Homework>;
export interface GetLessonsOptions {
2022-02-06 12:09:37 +00:00
/**
* Date to get lessons for, in format YYYY-MM-DD
*/
2022-01-31 22:32:29 +00:00
date: string;
}
export interface Lesson {
2022-01-31 22:32:29 +00:00
teacher_name: string;
lesson_name: string;
subject_name: string;
is_alternative_lesson: boolean;
period_name: string;
period_number: string;
room_name: string;
date: string;
start_time: string;
end_time: string;
key: number;
note_abstract: string;
note: string;
pupil_note_abstract: string;
pupil_note: string;
pupil_note_raw: string;
}
2022-01-31 22:32:29 +00:00
export type LessonsResponse = Array<Lesson>;
2022-01-31 23:13:05 +00:00
export interface LessonPupilBehaviour {
// Not sure what to call this
reason: string;
score: number;
icon: string;
polarity: string;
timestamp: string;
teacher: {
title: string;
first_name: string;
last_name: string;
};
}
export interface PupilEvent {
timestamp: string;
lesson_pupil_behaviour: LessonPupilBehaviour;
event: {
label: string;
};
}
export interface Badge {
id: number;
name: string;
icon: string;
colour: string;
created_date: string;
pupil_badges: Array<PupilEvent>;
icon_url: string;
}
export type BadgesResponse = Array<Badge>;
export interface Detention {
id: number;
2022-02-06 15:23:30 +00:00
attended: BooleanHumean | "upscaled" | "pending";
date: string | null;
length: number | null;
location: string | null;
notes: string | null;
time: string | null;
pupil: {
id: number;
first_name: string;
last_name: string;
school: {
2022-02-06 15:23:30 +00:00
opt_notes_names: BooleanHumean;
opt_notes_comments: BooleanHumean;
opt_notes_comments_pupils: BooleanHumean;
};
};
lesson: {
id: number;
name: string;
subject: {
id: number;
name: string;
};
};
lesson_pupil_behaviour: {
reason: string;
};
teacher: {
id: number;
first_name: string;
last_name: string;
title: string;
};
detention_type: {
name: string;
};
}
2022-02-06 15:14:48 +00:00
export type DetentionsResponse = Array<Detention>;
export interface Annoucement {
id: number;
title: string;
description: string | null;
school_name: string;
teacher_name: string;
school_logo: string | null;
2022-02-06 15:23:30 +00:00
sticky: BooleanHumean;
2022-02-06 15:14:48 +00:00
state: string | null;
timestamp: string;
attachments: Array<{
filename: string;
url: string;
}>;
for_pupils: Array<any>;
comment_visibility: string;
2022-02-06 15:23:30 +00:00
allow_comments: BooleanHumean;
allow_reactions: BooleanHumean;
allow_consent: BooleanHumean;
priority_pinned: BooleanHumean;
requires_consent: BooleanHumean;
2022-02-06 15:14:48 +00:00
can_change_consent: boolean;
consent: string | null;
pupil_consents: Array<any>;
}
2022-02-06 15:23:30 +00:00
export type AnnoucementsResponse = Array<Annoucement>;