@emiran/omu-ubys 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,264 @@
1
+ interface UBYSSessionOptions {
2
+ baseUrl?: string;
3
+ timeoutMs?: number;
4
+ headers?: Record<string, string>;
5
+ }
6
+
7
+ interface UserProfile {
8
+ name: string;
9
+ studentNumber: string;
10
+ faculty: string;
11
+ department: string;
12
+ sapId?: string;
13
+ studentId?: number;
14
+ semesterId?: number;
15
+ academicYear?: number;
16
+ cumulativeGpa?: number;
17
+ }
18
+ interface Advisor {
19
+ name: string;
20
+ email?: string;
21
+ }
22
+ interface Exam {
23
+ examType: string;
24
+ name: string;
25
+ date?: string;
26
+ score?: number;
27
+ average?: number;
28
+ ranking?: string;
29
+ }
30
+ interface Course {
31
+ code: string;
32
+ name: string;
33
+ credit?: number;
34
+ passingGrade?: number;
35
+ letterGrade?: string;
36
+ status?: string;
37
+ classId?: string;
38
+ exams?: Exam[];
39
+ }
40
+ interface Semester {
41
+ name: string;
42
+ gpa?: number;
43
+ courses: Course[];
44
+ }
45
+ interface ScheduleItem {
46
+ day: string;
47
+ startTime: string;
48
+ endTime: string;
49
+ courseName: string;
50
+ courseCode?: string;
51
+ classroom?: string;
52
+ instructor?: string;
53
+ }
54
+ interface MenuItem {
55
+ name: string;
56
+ category?: string;
57
+ calories?: number;
58
+ }
59
+ interface CafeteriaMenu {
60
+ date: string;
61
+ items: MenuItem[];
62
+ }
63
+ interface Student {
64
+ id: string;
65
+ name: string;
66
+ surname: string;
67
+ imageUrl?: string;
68
+ }
69
+ interface Instructor {
70
+ name: string;
71
+ imageUrl?: string;
72
+ }
73
+ interface ClassDetailSurvey {
74
+ required: boolean;
75
+ message: string;
76
+ url?: string;
77
+ expired?: boolean;
78
+ }
79
+ interface ClassDetail {
80
+ exams: Exam[];
81
+ students: Student[];
82
+ instructor?: Instructor;
83
+ classAverage?: number;
84
+ status?: string;
85
+ letterGrade?: string;
86
+ survey?: ClassDetailSurvey;
87
+ }
88
+ interface ChatSearchOptions {
89
+ keyword?: string;
90
+ pageNumber?: number;
91
+ pageSize?: number;
92
+ }
93
+ interface ChatRecipientSearchOptions {
94
+ chatIds: string[];
95
+ pageNumber?: number;
96
+ pageSize?: number;
97
+ }
98
+ interface ChatMessageSearchOptions {
99
+ chatRecepientIds: string[];
100
+ keyword?: string;
101
+ pageNumber?: number;
102
+ pageSize?: number;
103
+ }
104
+ interface ChatSearchResult {
105
+ pageNumber: number;
106
+ pageSize: number;
107
+ totalNumberOfPages: number;
108
+ totalNumberOfRecords: number;
109
+ nextPageUrl?: string | null;
110
+ items: Chat[];
111
+ }
112
+ interface ChatRecipientSearchResult {
113
+ pageNumber: number;
114
+ pageSize: number;
115
+ totalNumberOfPages: number;
116
+ totalNumberOfRecords: number;
117
+ nextPageUrl?: string | null;
118
+ items: ChatRecipient[];
119
+ }
120
+ interface ChatMessageSearchResult {
121
+ pageNumber: number;
122
+ pageSize: number;
123
+ totalNumberOfPages: number;
124
+ totalNumberOfRecords: number;
125
+ nextPageUrl?: string | null;
126
+ items: ChatMessageReceipt[];
127
+ }
128
+ interface Chat {
129
+ id: string;
130
+ name: string;
131
+ isGroup: boolean;
132
+ createdOn: string;
133
+ createdBy: number;
134
+ encryptedCreatedBy?: string | null;
135
+ chatRecepientId?: string;
136
+ lastMessageSendedOn?: string;
137
+ lastMessageReadedOn?: string;
138
+ recipients: ChatRecipient[];
139
+ }
140
+ interface ChatRecipient {
141
+ id: string;
142
+ chatId: string;
143
+ userEncryptId?: string;
144
+ userId: number;
145
+ personId: number;
146
+ personEncryptId?: string;
147
+ createdOn: string;
148
+ createdBy: number;
149
+ encryptedCreatedBy?: string | null;
150
+ lastMessageId?: string;
151
+ lastMessageSendedOn?: string;
152
+ recipientName?: string;
153
+ recipientSurname?: string;
154
+ chatMessages: ChatMessageReceipt[];
155
+ }
156
+ interface ChatMessageReceipt {
157
+ id: string;
158
+ chatRecepientId: string;
159
+ messageId: string;
160
+ readedOn?: string | null;
161
+ createdOn: string;
162
+ createdBy: number;
163
+ encryptedCreatedBy?: string | null;
164
+ senderName?: string;
165
+ senderSurname?: string;
166
+ isEveryBodyReaded: boolean;
167
+ message: ChatMessage;
168
+ }
169
+ interface ChatMessage {
170
+ id: string;
171
+ parentId?: string | null;
172
+ subject: string;
173
+ fileArchiveId?: string | null;
174
+ createdOn: string;
175
+ createdBy: number;
176
+ encryptedCreatedBy?: string | null;
177
+ recipientReadedOnList: Record<string, string | null>;
178
+ }
179
+ interface StudentProgram {
180
+ StudentId?: number;
181
+ RecordSemester?: number;
182
+ RecordYear?: number;
183
+ AcademicProgramName?: string;
184
+ UnitName?: string;
185
+ GANO?: number;
186
+ }
187
+ interface StudentInfoPayload {
188
+ Programs?: StudentProgram[];
189
+ Person?: {
190
+ Person?: {
191
+ Name?: string;
192
+ Surname?: string;
193
+ };
194
+ };
195
+ }
196
+
197
+ interface UBYSClientOptions extends UBYSSessionOptions {
198
+ username?: string;
199
+ password?: string;
200
+ }
201
+ declare class UBYSClient {
202
+ private readonly session;
203
+ private readonly credentials;
204
+ private closed;
205
+ private state;
206
+ constructor(options?: UBYSClientOptions);
207
+ get isLoggedIn(): boolean;
208
+ get isClosed(): boolean;
209
+ login(username?: string | undefined, password?: string | undefined): Promise<void>;
210
+ getProfile(): Promise<UserProfile>;
211
+ getAdvisor(): Promise<Advisor | null>;
212
+ getCafeteriaMenu(): Promise<CafeteriaMenu | null>;
213
+ getMessages(options?: ChatSearchOptions): Promise<ChatSearchResult>;
214
+ getChatRecipients(options: ChatRecipientSearchOptions): Promise<ChatRecipientSearchResult>;
215
+ getChatMessages(options: ChatMessageSearchOptions): Promise<ChatMessageSearchResult>;
216
+ getGrades(): Promise<Semester[]>;
217
+ getClassDetails(classId: string): Promise<ClassDetail>;
218
+ getTranscript(): Promise<Semester[]>;
219
+ getWeeklySchedule(): Promise<ScheduleItem[]>;
220
+ clearSession(): void;
221
+ close(): Promise<void>;
222
+ private ensureAuthenticated;
223
+ private ensureOpen;
224
+ private fetchDashboardHtml;
225
+ private resolveTranscriptPath;
226
+ }
227
+
228
+ interface UBYSErrorOptions {
229
+ cause?: unknown;
230
+ code?: string;
231
+ details?: Record<string, unknown>;
232
+ }
233
+ declare class UBYSError extends Error {
234
+ readonly code: string;
235
+ readonly details: Record<string, unknown> | undefined;
236
+ constructor(message: string, options?: UBYSErrorOptions);
237
+ }
238
+ declare class AuthenticationError extends UBYSError {
239
+ constructor(message?: string, options?: UBYSErrorOptions);
240
+ }
241
+ declare class LoginError extends AuthenticationError {
242
+ constructor(message?: string, options?: UBYSErrorOptions);
243
+ }
244
+ declare class SessionExpiredError extends AuthenticationError {
245
+ constructor(message?: string, options?: UBYSErrorOptions);
246
+ }
247
+ declare class NetworkError extends UBYSError {
248
+ constructor(message?: string, options?: UBYSErrorOptions);
249
+ }
250
+ declare class HttpError extends UBYSError {
251
+ readonly statusCode: number;
252
+ constructor(statusCode: number, message?: string, options?: UBYSErrorOptions);
253
+ }
254
+ declare class ParseError extends UBYSError {
255
+ constructor(message?: string, options?: UBYSErrorOptions);
256
+ }
257
+ declare class NotImplementedUBYSError extends UBYSError {
258
+ constructor(message?: string, options?: UBYSErrorOptions);
259
+ }
260
+ declare class ClientClosedError extends UBYSError {
261
+ constructor(message?: string, options?: UBYSErrorOptions);
262
+ }
263
+
264
+ export { type Advisor, AuthenticationError, type CafeteriaMenu, type Chat, type ChatMessage, type ChatMessageReceipt, type ChatMessageSearchOptions, type ChatMessageSearchResult, type ChatRecipient, type ChatRecipientSearchOptions, type ChatRecipientSearchResult, type ChatSearchOptions, type ChatSearchResult, type ClassDetail, type ClassDetailSurvey, ClientClosedError, type Course, type Exam, HttpError, type Instructor, LoginError, type MenuItem, NetworkError, NotImplementedUBYSError, ParseError, type ScheduleItem, type Semester, SessionExpiredError, type Student, type StudentInfoPayload, type StudentProgram, UBYSClient, type UBYSClientOptions, UBYSError, type UserProfile };