Need private packages and team management tools?Check out npm Teams »

mysu-api

1.0.2 • Public • Published

MySU Web API Build Status Coverage Status

Unofficial Sabanci University MySU Web API.

Install

npm i mysu-api

Usage

MySU does not allow CORS requests, so requests made while developing on web gets HTTP 400. You can create mysu instance with bypassCORS configuration as a workaround. Requests will be made through a proxy if bypassCORS is set to true. It drastically reduces the performance. If requests are not cross domain, set bypassCORS to false.

const mysu = new MySU({ bypassCORS: true });

Refer to Table of contents for all available functions.

let res = await mysu.getPerson('eralp sahin', 'alumni');
/*
res => [
  {
    "username": "eralpsahin",
    "name": "Eralp Şahin",
    "birthday": "2019-11-09",
    "photo": "http://suisimg.sabanciuniv.edu/photos/000018105237389123.jpg",
    "degree": " ",
    "program": " "
  }
]
*/

Description

MySU API does not require authentication. It does not cross check the requested username. Without any authentication one can get anyones private information

let data = await mysu.sucard(username);
/*
data => {
  meals: [...],
  prints: [...],
  transports: [...]
}
*/

API

Table of Contents

authenticate

This function authenticates the user to MySU app.

Server does not need authentication for other requests. Ultimately, authentication is not needed.

Parameters

  • username string SU-Net username
  • password string SU-Net password

Returns Number Error code of the response

sucard

This function retrieves SuCard transaction records from MySU.

Parameters

  • username string SU-Net username

Returns Object SuCard transaction record object with meals, transports, prints keys.

courseSchedule

This function retrieves Course Schedule of a student.

Parameters

  • username string SU-Net username

Returns Object Object containing {courseCDN: courseTitle} fields.

getPerson

Parameters

  • search String Search string.
  • type String Peoples type: alumni - student - staff. (optional, default "student")
  • limit (string | number) Limit the number of people returned. (optional, default "")
  • start (string | number) Return the people starting from start index. (optional, default 0)

Returns Array Array of person objects as in the example above.

License

MIT © Eralp Sahin

Keywords

Install

npm i mysu-api

DownloadsWeekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

25.6 kB

Total Files

9

Last publish

Collaborators

  • avatar