/** * ClientFacade * A single point of entry for the client to interact with the API * This is also a singleton class */ import { ClassDbSchema } from "./db-schemas/Class"; import Class from "./local-models/Class"; import User from "./local-models/user/UserProfile"; import { Observable } from "./observable/Observable"; import { ProvidersEnum } from "./types/apis-related"; import { StudentOrTeacherEnum } from "./types/class-related"; import { BadgesCounts, Scores } from "@robotical/automatic-assessments"; declare class ClientFacade extends Observable { private static instance; private auth; private classroomApi; protected selectedClassroom: Class | null; private userProfile; private provider; protected classes: ClassDbSchema[]; protected studentOrTeacher: StudentOrTeacherEnum | null; private constructor(); /** * Get the singleton instance of the ClientFacade. */ static getInstance(): ClientFacade; /** * Orchistrates the login process given the provided provider. * It also fetches the user profile and the list of classes associated with that profile */ logUserIn(provider: ProvidersEnum, email?: string, pw?: string): Promise; /** * Get list of classes for that user prof */ getUserProfClasses(): Promise; /** * Checks if a auth session exists and logs user in if it does */ checkAuthSessionAndLogin(): Promise; /** * Log ouser out */ logUserOut(): Promise; /** * Deselects all classes */ deselectClass(): Promise; /** * Selects a class from the list of classes of the connected user profile. * When a class is selected, we fetch the details of the class from the database, like enrolled students, notes, etc. */ selectClass(classId: string | null): Promise; /** * Creates a session for a class. */ createSession(): Promise; /** * Stops a session for a class. */ stopSession(): Promise; /** * Joins a session as a student */ joinSession(): Promise; /** * Leaves a session as a student */ exitSession(): Promise; /** * Turns student's status to active */ activateStudent(): Promise; /** * Adds a class note */ addClassNote(text: string, imageFile?: File, onUploadProgress?: (progressEvent: any) => void): Promise; /** * Adds a session note */ addSessionNote(text: string, imageFile?: File, sessionId?: string, onUploadProgress?: (progressEvent: any) => void): Promise; /** * Adds class announcement */ addClassAnnouncement(text: string, imageFile?: File, onUploadProgress?: (progressEvent: any) => void): Promise; /** * Adds session announcement */ addSessionAnnouncement(text: string, imageFile?: File, sessionId?: string, onUploadProgress?: (progressEvent: any) => void): Promise; /** * Removes a note from a class. */ removeClassNote(nodeId: string): Promise; /** * Removes a note from a session. */ removeSessionNote(nodeId: string, sessionId?: string): Promise; /** * Handles the removal of an announcement from the selected classroom. */ removeClassAnnouncement(announcementId: string): void; /** * Handles the removal of an announcement from a session. */ removeSessionAnnouncement(announcementId: string, sessionId?: string): void; /** * Adds question to session */ addQuestionToSession(question: string, sessionId?: string): Promise; /** * Submits an answer to a question */ submitAnswerToQuestion(questionId: string, answer: string): void; /** * Updates an answer to a question */ updateAnswerToQuestion(questionId: string, answerId: string, answer: string): void; /** * Reads a class announcement */ readClassAnnouncement(announcementId: string): void; /** * Reads a session announcement */ readSessionAnnouncement(announcementId: string): void; /** * Creates a new code submission */ submitCode(title: string, code: string, explanation: string, onUploadProgress?: (progressEvent: any) => void): Promise; /** * Updates a code submission */ updateCodeSubmission(codeSubmissionId: string, title: string, code: string, explanation: string): Promise; /** * Removes code submission */ removeCodeSubmission(codeSubmissionId: string): void; /** * Creates studentSessionData scores * @Note we don't really initiate the creation of studentSessionData scores from the client side */ createStudentSessionDataScores(scores: Scores): void; /** * Updates studentSessionData scores * only updates if this is a student */ updateStudentSessionDataScores(scores: Scores): void; /** * Updates session's title */ updateSessionTitle(title: string, sessionId?: string): void; fetchSessionData(sessionId: string): Promise; fetchAllSessionData(): Promise; fetchStudentBadges(studentId: string): Promise; updateStudentBadges(studentBadgesScores: BadgesCounts): Promise; fetchStudentCodeSubmissions(studentId: string): Promise; createUserProfile(email: string, pw: string, firstName: string, lastName: string): Promise; createClass(title: string, section: string): Promise; fetchUserProfiles(): Promise; generateDummyData(): Promise; registerCredUser(email: string, firstName: string, lastName: string, password: string): Promise; createClassCodeInvite(classId: string): Promise; getClassCodeInviteById(id: string): Promise; getClassCodeInviteByClassId(classId: string): Promise; getClassCodeInviteByCode(code: string): Promise; regenerateClassCodeInvite(id: string): Promise; joinClassUsingInviteCode(code: string): Promise; /** * Sets the user profile and publishes the event */ setUserProfile(userProfile: User): void; setClasses(classes: ClassDbSchema[]): void; setStudentOrTeacher(studentOrTeacher: string): void; setSelectedClassroom(classroom: Class | null): void; classUpdated(updatedClass: Class): void; studentJoinedSession(updatedClass: Class): void; studentExitedSession(updatedClass: Class): void; studentActivated(updatedClass: Class): void; studentDeactivated(updatedClass: Class): void; sessionCreated(updatedClass: Class): void; clearActiveSession(updatedClass: Class): void; classAnnouncementAdded(updatedClass: Class): void; sessionAnnouncementAdded(updatedClass: Class): void; questionAdded(updatedClass: Class): void; answerCreated(updatedClass: Class): void; answerUpdated(updatedClass: Class): void; classAnnouncementRead(updatedClass: Class): void; sessionAnnouncementRead(updatedClass: Class): void; codeSubmissionCreated(updatedClass: Class): void; codeSubmissionUpdated(updatedClass: Class): void; codeSubmissionRemoved(updatedClass: Class): void; sessionAnnouncementRemoved(updatedClass: Class): void; classAnnouncementRemoved(updatedClass: Class): void; studentSessionDataScoresUpdated(updatedClass: Class): void; studentSessionDataScoresCreated(updatedClass: Class): void; sessionTitleUpdated(updatedClass: Class): void; sessionDataFetched(updatedClassroom: Class): void; } export default ClientFacade;