diff --git a/src/client.ts b/src/client.ts index 0ed3785..e2538a2 100644 --- a/src/client.ts +++ b/src/client.ts @@ -2,6 +2,7 @@ import Undici from "undici"; import { RequestOptions } from "undici/types/dispatcher"; import { ActivityResponse, + AnnoucementsResponse, BadgesResponse, BehaviourResponse, DetentionsResponse, @@ -208,6 +209,18 @@ export class ClasschartsClient { } ); } + /** + * Lists the logged in student's annoucements + * @returns Array of annoucements + */ + async listAnnoucements(): Promise { + return await this.makeAuthedRequest( + API_BASE + "/annoucements/" + this.studentId, + { + method: "GET", + } + ); + } /** * Gets the logged in student's detentions * @returns Array of detentions diff --git a/src/types.ts b/src/types.ts index bdf40bb..5951abe 100644 --- a/src/types.ts +++ b/src/types.ts @@ -249,4 +249,32 @@ export interface Detention { name: string; }; } -export type DetentionsResponse = Array; \ No newline at end of file +export type DetentionsResponse = Array; + +export interface Annoucement { + id: number; + title: string; + description: string | null; + school_name: string; + teacher_name: string; + school_logo: string | null; + sticky: "yes" | "no"; + state: string | null; + timestamp: string; + attachments: Array<{ + filename: string; + url: string; + }>; + for_pupils: Array; + comment_visibility: string; + allow_comments: "yes" | "no"; + allow_reactions: "yes" | "no"; + allow_consent: "yes" | "no"; + priority_pinned: "yes" | "no"; + requires_consent: "yes" | "no"; + can_change_consent: boolean; + consent: string | null; + pupil_consents: Array; +} + +export type AnnoucementsResponse = Array \ No newline at end of file