mashovapi-js

1.0.6 • Public • Published

*This wrapper is not affiliated or associated with Mashov

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:

Get a school by iterating on the schools list

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;
	  }
	}
})();

Login a user

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
})();

Get all grades and make an average

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.

Retrieving Grades

Usage:

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
  }

Getting User Photo

Usage:

MashovAPI.getPhoto()

Returns a url of type string with photo of user.

Retrieving List of Schools

Usage:

MashovAPI.getSchools() Can be used without user auth

Returns array of JSON objects:

  {
    semel: int,
    name: string,
    years: int array
  }

Retrieving Behavior Events

Usage:

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
  }

Retrieving Birthday Date

Usage:

MashovAPI.getBirthday()

Returns a date string

Retrieving Homework Assignments

Usage:

MashovAPI.getHomework()

Returns array of JSON objects:

  {
    lessonId: int,
    lessonDate: string,
    homework:string,
    groupId: int,
    subjectName: string
  }

Retrieving Report Cards

Usage:

MashovAPI.getGrades()

Returns array of JSON objects:

  {
    fileId: string,
    studentGuid: string,
    labelId: int,
    labelName: string,
    displayOrder: int
  }

Retrieving Report Card Links

Usage:

MashovAPI.getCardLinks()

Returns a link string

Retrieving Student Timetable

Usage:

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
    }
  }

Retrieving Messages

Usage:

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
  }

Retrieving Available Recipients

Usage:

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.

Package Sidebar

Install

npm i mashovapi-js

Weekly Downloads

2

Version

1.0.6

License

ISC

Unpacked Size

125 kB

Total Files

18

Last publish

Collaborators

  • nerya