1.0.2 • Published 7 years ago

dimigo v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

node-dimigo

npm v npm dt node v npm l

Dimigo REST API wrapper for Node.js

Installation

$ npm install dimigo

API Reference

  • Dimigo
    • constructor
      • new Dimigo(opts)
    • static
      • .createHash(password) ⇒ String
    • instance
      • .identifyUser(username, password, hash) ⇒ Object
      • .getStudent(username) ⇒ Object
      • .getTeacher(username) ⇒ Object

Dimigo

new Dimigo(opts)

Create a new API wrapper.

ParamTypeDescription
optsObject
opts.hostStringURL of Dimigo REST API server
opts.usernameStringUsername for HTTP Basic Authorization
opts.passwordStringPassword for HTTP Basic Authorization

Dimigo.createHash(password)

Calculate the Dimigo hash value of a password.

ParamTypeDescription
passwordStringPassword to be hashed
Return value ⇒ String

the Dimigo hash of the password

Dimigo hashing algorithm
'@' + sha256(password + sprintf('%010u', crc32(password)))

api.identifyUser(username, password, hash)

Authenticate and get a data of the user.

ParamTypeDescription
usernameStringUsername of Dimigo account
passwordStringPassword of Dimigo account
hashFunctionHash function (default: Dimigo.createHash)
Return value ⇒ Object

The user data from Dimigo REST API.

KeyTypeDescription
idintPrimary key
usernameStringUnique
emailString
nameStringKorean name
nickString?User-specific name
genderStringM: male, F: female, NULL: unknown
userTypecharS: students, T: teachers, D: dormitory teachers, P: parents, O: others
birthdayString?YYYY-MM-DD
statusint10 for active, 0 for deactivated
facePhotoString?Image URL for face image
userPhotoString?Image URL for user-specific image
createdAtStringYYYY-MM-DD HH:mm:ss
updatedAtStringYYYY-MM-DD HH:mm:ss
passwordHashString?Not available
ssoTokenString?SSO token for student.dimigo.hs.kr

api.getStudent(username)

Get a data of enrolled student.

ParamTypeDescription
usernameStringUsername of Dimigo student account
Return value ⇒ Object

The student data from Dimigo REST API.

KeyTypeDescription
idintPrimary key
usernameStringUnique
nameStringKorean name
genderStringM: male, F: female, NULL: unknown
gradeintCurrent grade (1 to 3)
clazzintCurrent class (1 to 6)
numberintCurrent number in class
serialStringSerial code (e.g. 2409)
rfcardUidStringRFID UID of student ID card
facePhotoString?Image URL for face image
userPhotoString?Image URL for user-specific image
dormitoryString?Current dormitory (학봉관, 본관 or null)
roomNumString?Current dormitory room number (~3 digits)

api.getTeacher(username)

Get a data of the teacher.

Return value ⇒ Object

The teacher data from Dimigo REST API.

KeyTypeDescription
idintPrimary key
usernameStringUnique
nameStringKorean name
genderStringM: male, F: female, NULL: unknown
positionString?e.g. 부장교사, 교사, 교감, 교장
roleString?e.g. 담임, 비담임, 1학년부장, IT특성화부장, 교무부장
gradeint?Current grade (1 to 3, if role is 담임 or 부담임)
clazzint?Current class (1 to 6, if role is 담임 or 부담임)