UNPKG

@heknon/node-webtop

Version:

A Backend for an unofficial WebTop (SmartSchool - Israel) API.

96 lines (95 loc) 4.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.baseUrl = 'https://www.webtop.co.il/mobilev2/'; exports.baseApiUrl = (platform) => `https://www.webtop.co.il/mobilev2/api/?platform=${platform}`; exports.apiAccessor = 'https://www.webtop.co.il/mobilev2/default.aspx?action'; exports.defaultApiRoutes = { homework: `${exports.apiAccessor}=loadHomeWork&userId=`, todayTimetable: `${exports.apiAccessor}=loadShotefTimeTable&classCode=&classNum=&userId=`, todayEvents: `${exports.apiAccessor}=shotefData&classCode=&classNum=&userId=`, grades: (studentYear, firstHalf) => `https://www.webtop.co.il/mobilev2/pupilCard.aspx?platform=ios&moduleID=6&studyYear=${studentYear}&studentID=undefined&divisionID=${firstHalf ? 2946 : 2948}`, inbox: { search: (searchQuery = '') => `https://www.webtop.co.il/mobilev2/messagesBox.aspx?view=inbox&searchQuery=${searchQuery}`, inbox: 'https://www.webtop.co.il/mobilev2/messagesBox.aspx?view=inbox', /** * POST REQUEST * FORM DATA * EXAMPLE: * ID=26312068 OR {ID: 26312068} */ recipients: 'https://www.webtop.co.il/mobilev2/messagesBox.aspx?action=recipients', /** * POST REQUEST * FORM DATA * EXAMPLE: * IDs=25714320 OR {IDs: 25714320} * mass delete example: IDs: 25297630,25202096 OR IDs=25297630%2C25202096 */ deleteMessage: 'https://www.webtop.co.il/mobilev2/messagesBox.aspx?view=inbox&action=delete&folderID=0&labelID=0', /** * POST REQUEST * FORM DATA * EXAMPLE: * IDs=25714320 OR {IDs: 25714320} * mass delete example: IDs: 25297630,25202096 OR IDs=25297630%2C25202096 */ markAsRead: 'https://www.webtop.co.il/mobilev2/messagesBox.aspx?view=inbox&action=markAsRead&folderID=0&labelID=0', /** * POST REQUEST * FORM DATA * EXAMPLE: * IDs=25714320 OR {IDs: 25714320} * mass delete example: IDs: 25297630,25202096 OR IDs=25297630%2C25202096 */ markAsUnread: 'https://www.webtop.co.il/mobilev2/messagesBox.aspx?view=inbox&action=markAsUnread&folderID=0&labelID=0' }, /** * POST REQUEST * FORM DATA * EXAMPLE: * type=teachers&value=pupilProTeachers OR {type: 'teachers', value: 'pupilProTeachers'} */ users: 'https://www.webtop.co.il/mobilev2/messagesBox.aspx?action=getUsers', /** * POST REQUEST * FORM DATA * EXAMPLE: * value=אורי OR {value: 'אורי'} */ searchUsers: 'https://www.webtop.co.il/mobilev2/messagesBox.aspx?action=searchUsers', /** * POST REQUEST * FORM DATA * EXAMPLE: * newPassword=password OR {newPassword: 'password'} */ changePassword: 'https://www.webtop.co.il/mobilev2/settings.aspx?action=savePassword', /** * POST REQUEST * FORM DATA * EXAMPLE: * currentPassword=password&newUsername=username OR {currentPassword: 'password', newUsername: 'username'} */ changeUsername: 'https://www.webtop.co.il/mobilev2/settings.aspx?action=saveUserName', /** * POST REQUEST * FORM DATA * EXAMPLE: * email=email&cellphone=number&emailUponUpdate=0&canReverifiedEmail=false&showMyCellphone=1&showMyEmail=1 */ changePersonalDetails: 'https://www.webtop.co.il/mobilev2/settings.aspx?action=savePersonalDetails', /** * POST REQUEST * FORM DATA * EXAMPLE: * pushNotification_messages=1&pushNotification_timetableChanges=1&pushNotification_timetableChangesEvents=1&pushNotification_timetableChangesTests=1&pushNotification_timetableChangesGeneralMessages=1&pushNotification_discipline=1&pushNotification_homework=1&pushNotification_grades=1&pushNotification_periodGrades=1&pushNotification_matriculationGrades=1 */ changePushNotifications: 'https://www.webtop.co.il/mobilev2/settings.aspx?action=savePushNotification' }; exports.routes = { timetable: 'https://www.webtop.co.il/mobilev2/shotefView.aspx?view=timetable', eventCalendar: (month) => `https://www.webtop.co.il/shotefMonthlyView.aspx?monthIndex=${month - new Date().getMonth() - 1}`, inbox: (page) => `https://www.webtop.co.il/mobilev2/messagesBox.aspx?view=inbox&searchQuery=&pageID=${page}`, message: (id) => `https://www.webtop.co.il/mobilev2/messagesBox.aspx?platform=ios&view=inbox&action=read&ID=${id}`, changesAndExams: 'https://www.webtop.co.il/shotefView.aspx' };