Skip to content

Commit ff87043

Browse files
authored
fix: updated with the webportal api changes (#6)
gg
1 parent b166388 commit ff87043

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

src/wrapper.js

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ export class WebPortal {
100100
exception = options.exception;
101101
delete options.exception;
102102
}
103-
103+
104+
console.log(options)
104105
let header;
105106
if (options.authenticated) {
106107
header = await this.session.get_headers(); // Assumes calling method is authenticated
@@ -261,13 +262,15 @@ export class WebPortal {
261262
async get_attendance(header, semester) {
262263
const ENDPOINT = "/StudentClassAttendance/getstudentattendancedetail";
263264

264-
const payload = {
265+
const payload = await serialize_payload({
265266
clientid: this.session.clientid,
266267
instituteid: this.session.instituteid,
267268
registrationcode: semester.registration_code,
268269
registrationid: semester.registration_id,
269270
stynumber: header.stynumber,
270-
};
271+
});
272+
273+
// console.log(payload)
271274

272275
const resp = await this.__hit("POST", API + ENDPOINT, { json: payload, authenticated: true });
273276
return resp["response"];
@@ -283,15 +286,15 @@ export class WebPortal {
283286
*/
284287
async get_subject_daily_attendance(semester, subjectid, individualsubjectcode, subjectcomponentids) {
285288
const ENDPOINT = "/StudentClassAttendance/getstudentsubjectpersentage";
286-
const payload = {
289+
const payload = await serialize_payload({
287290
cmpidkey: subjectcomponentids.map((id) => ({ subjectcomponentid: id })),
288291
clientid: this.session.clientid,
289292
instituteid: this.session.instituteid,
290293
registrationcode: semester.registration_code,
291294
registrationid: semester.registration_id,
292295
subjectcode: individualsubjectcode,
293296
subjectid: subjectid,
294-
};
297+
});
295298
const resp = await this.__hit("POST", API + ENDPOINT, { json: payload, authenticated: true });
296299
return resp["response"];
297300
}
@@ -303,10 +306,10 @@ export class WebPortal {
303306
async get_registered_semesters() {
304307
const ENDPOINT = "/reqsubfaculty/getregistrationList";
305308

306-
const payload = {
309+
const payload = await serialize_payload({
307310
instituteid: this.session.instituteid,
308311
studentid: this.session.memberid,
309-
};
312+
});
310313
const resp = await this.__hit("POST", API + ENDPOINT, { json: payload, authenticated: true });
311314
return resp["response"]["registrations"].map((i) => Semester.from_json(i));
312315
}
@@ -318,11 +321,11 @@ export class WebPortal {
318321
*/
319322
async get_registered_subjects_and_faculties(semester) {
320323
const ENDPOINT = "/reqsubfaculty/getfaculties";
321-
const payload = {
324+
const payload = await serialize_payload({
322325
instituteid: this.session.instituteid,
323326
studentid: this.session.memberid,
324327
registrationid: semester.registration_id,
325-
};
328+
});
326329
const resp = await this.__hit("POST", API + ENDPOINT, { json: payload, authenticated: true });
327330
return new Registrations(resp["response"]);
328331
}
@@ -333,11 +336,12 @@ export class WebPortal {
333336
*/
334337
async get_semesters_for_exam_events() {
335338
const ENDPOINT = "/studentcommonsontroller/getsemestercode-withstudentexamevents";
336-
const payload = {
339+
const payload = await serialize_payload({
337340
clientid: this.session.clientid,
338341
instituteid: this.session.instituteid,
339342
memberid: this.session.memberid,
340-
};
343+
});
344+
341345
const resp = await this.__hit("POST", API + ENDPOINT, { json: payload, authenticated: true });
342346
return resp["response"]["semesterCodeinfo"]["semestercode"].map((i) => Semester.from_json(i));
343347
}
@@ -349,10 +353,10 @@ export class WebPortal {
349353
*/
350354
async get_exam_events(semester) {
351355
const ENDPOINT = "/studentcommonsontroller/getstudentexamevents";
352-
const payload = {
356+
const payload = await serialize_payload({
353357
instituteid: this.session.instituteid,
354358
registationid: semester.registration_id, // not a typo
355-
};
359+
});
356360

357361
const resp = await this.__hit("POST", API + ENDPOINT, { json: payload, authenticated: true });
358362
return resp["response"]["eventcode"]["examevent"].map((i) => ExamEvent.from_json(i));
@@ -380,10 +384,10 @@ export class WebPortal {
380384
*/
381385
async get_semesters_for_marks() {
382386
const ENDPOINT = "/studentcommonsontroller/getsemestercode-exammarks";
383-
const payload = {
387+
const payload = await serialize_payload({
384388
instituteid: this.session.instituteid,
385389
studentid: this.session.memberid,
386-
};
390+
});
387391
const resp = await this.__hit("POST", API + ENDPOINT, { json: payload, authenticated: true });
388392
return resp["response"]["semestercode"].map((i) => Semester.from_json(i));
389393
}
@@ -432,9 +436,9 @@ export class WebPortal {
432436
*/
433437
async get_semesters_for_grade_card() {
434438
const ENDPOINT = "/studentgradecard/getregistrationList";
435-
const payload = {
439+
const payload = await serialize_payload({
436440
instituteid: this.session.instituteid,
437-
};
441+
});
438442
const resp = await this.__hit("POST", API + ENDPOINT, { json: payload, authenticated: true });
439443
return resp["response"]["registrations"].map((i) => Semester.from_json(i));
440444
}
@@ -461,12 +465,12 @@ export class WebPortal {
461465
async get_grade_card(semester) {
462466
const programid = await this.__get_program_id();
463467
const ENDPOINT = "/studentgradecard/showstudentgradecard";
464-
const payload = {
468+
const payload = await serialize_payload({
465469
branchid: this.session.branch_id,
466470
instituteid: this.session.instituteid,
467471
programid: programid,
468472
registrationid: semester.registration_id,
469-
};
473+
});
470474
const resp = await this.__hit("POST", API + ENDPOINT, { json: payload, authenticated: true });
471475
return resp["response"];
472476
}
@@ -478,12 +482,12 @@ export class WebPortal {
478482
*/
479483
async __get_semester_number() {
480484
const ENDPOINT = "/studentsgpacgpa/checkIfstudentmasterexist";
481-
const payload = {
485+
const payload = await serialize_payload({
482486
instituteid: this.session.instituteid,
483487
studentid: this.session.memberid,
484488
name: this.session.name,
485489
enrollmentno: this.session.enrollmentno,
486-
};
490+
});
487491
const resp = await this.__hit("POST", API + ENDPOINT, { json: payload, authenticated: true });
488492
return resp["response"]["studentlov"]["currentsemester"];
489493
}
@@ -495,11 +499,11 @@ export class WebPortal {
495499
async get_sgpa_cgpa() {
496500
const ENDPOINT = "/studentsgpacgpa/getallsemesterdata";
497501
const stynumber = await this.__get_semester_number();
498-
const payload = {
502+
const payload = await serialize_payload({
499503
instituteid: this.session.instituteid,
500504
studentid: this.session.memberid,
501505
stynumber: stynumber,
502-
};
506+
});
503507
const resp = await this.__hit("POST", API + ENDPOINT, { json: payload, authenticated: true });
504508
return resp["response"];
505509
}

0 commit comments

Comments
 (0)