mashovapi-js
v1.0.6
Published
A Mashov JS API wrapper
Downloads
2
Maintainers
Readme
What is Mashov API JS?
This is a nodeJS wrapper for the Mashov System
Contents
Installation:
npm i MashovAPI
It's that easy! NPM automatically installs required modules such as request.
You can get npm here if you don't have it installed.
Examples:
const MashovAPI = require("mashovapi-js");
var semel = "";
(async function(){
var allSchools = await MashovAPI.getSchools();
for(var i = 0; i < allSchools.length; i++){
if(allSchools[i].name == "/*School Name*/"){
semel = allSchools[i].semel;
}
}
})();
const MashovAPI = require("mashovapi-js");
(async function(){
await MashovAPI.loginWithCreds({username:"/*username*/",password:"/*password",year:2021,school:semel})
//Get the semel, which is the school ID by using the function refrenced above
})();
const MashovAPI = require("mashovapi-js");
(async function(){
let grades = await MashovAPI.getGrades();
let average = 0;
for(var i = 0; i < grades.length; i++){
average+=grades[i].grade;
}
average = average/grades.length;
console.log("Your average is: " + average);
})();
API
Mashov-API JS is an asynchronous library, which means it needs to be run in an async function with await statements.
MashovAPI.getGrades()
Returns array of JSON objects:
{
studentGuid: string,
gradingEventId: int,
grade: int,
rangeGrade: string,
rate: int,
timestamp: string,
teacherName: string,
groupId: int,
groupName: string,
subjectName:string,
eventDate:string,
id: int,
gradingPeriod: int,
gradingEvent: string,
gradeRate: int,
gradeTypeId: int,
gradeType:string
}
MashovAPI.getPhoto()
Returns a url of type string with photo of user.
MashovAPI.getSchools()
Can be used without user auth
Returns array of JSON objects:
{
semel: int,
name: string,
years: int array
}
For behavior in class:
MashovAPI.getBehave()
For behavior out of class:
MashovAPI.getOutBehave()
Returns array of JSON objects:
{
studentGuid: string,
eventCode: int,
justified: int (1 or -1),
lessonId: int,
reporterGuid: string,
timestamp: string,
groupId: int,
lessonType: int,
lesson: int,
lessonDate: string,
lessonReporter: string,
achvaCode: int,
achvaName: string,
achvaAval: int,
justificationId: int,
justification: string,
reporter:string,
subject: string
}
MashovAPI.getBirthday()
Returns a date string
MashovAPI.getHomework()
Returns array of JSON objects:
{
lessonId: int,
lessonDate: string,
homework:string,
groupId: int,
subjectName: string
}
MashovAPI.getGrades()
Returns array of JSON objects:
{
fileId: string,
studentGuid: string,
labelId: int,
labelName: string,
displayOrder: int
}
MashovAPI.getCardLinks()
Returns a link string
MashovAPI.getTimetable()
Returns array of JSON objects:
{
timeTable: { groupId: int, day: int (1-7), lesson: int, roomNum: string, weeks: int },
groupDetails: {
groupId: int,
groupName: string,
subjectName: string,
groupTeachers: array,
groupInactiveTeachers: array
}
}
MashovAPI.getMail()
Returns array of JSON objects:
{
conversationId: string,
subject: string,
sendTime: string,
isNew: boolean,
hasDrafts: boolean,
hasAttachments: boolean,
messages:array of message objects,
labels: array,
preventReply: boolean
}
MashovAPI.getRecipients()
Returns array of JSON objects:
{
displayOrder: int,
value: string,
valueType: string,
targetType: string,
displayName: string
}
Plans
- √ Authenticate with Mashov
- √ Get basic user data (Grades, photos, behavior)
- Send messages
Progress
| Module | Status | Notes | | ------------- |-------------: | ------- | | Basic Info | 100% | All planned features implemented. | | Authentication| 100% | All planned features implemented. | | Mail Class | 80% | Sending messages |
FAQ
Is this library legal? Does it use hacking?
This library is 100% legal, and does not use hacking at all. It uses requests Mashov makes, and only gives data to an authenticated user!
Can I contribute?
Any contribution will be amazing, feel free to submit a PR.