@ikonintegration/mod-courses-client

1.0.0-alpha5 • Public • Published

module-auditing-client Node.js Package

Courses module nodejs API client

Overall

  • npm npm npm (tag) Libraries.io dependency status for latest release, scoped npm package
  • GitHub commit activity
  • GitHub last commit

How to Use

import SMCourses from '@ikonintegration/mod-courses-client';

const API = new SMCourses({
  //those 3 need to be provided
  endpoint: SharedModules_CoursesEndpoint,
  //Must be specified when using service routes
  apiKey: config.examProvider.key, //API token on IDM.AppID format (generate from APIKey at https://runkit.com/gwdp/idm-appid)
  //Must be specified when using admin or user routes
  authorizationToken: '', -- optional, IDM JWT for shared module admins and user routes -- Accepts a function to be called async and return the token
  namespace: '' 
});

//Create or update user
const resp = API.user.createOrUpdateUser({
          user: {
            firstName: 'Gabriel', lastName: 'Pacheco',
            email: 'gabriel.xx@gmail.com', id: 'IDM-ID'
          }
    }
);
if (!resp || resp.statusCode != 200) {
  return ERROR:
} return SUCCESS;

//Enroll user into course or update user
const resp = API.course.enrollUser(userID, courseID);
if (!resp || resp.statusCode != 200) {
  return ERROR:
} return SUCCESS;

//SSO
const resp = API.course.generateSSO(userID, courseID, optionalCallbackURL);
if (!resp || resp.statusCode != 200) {
  return ERROR:
} return resp.body.url;

Headers

The following 2 headers must be specified in every request!

  • ProviderID
  • Authorization

Available API methods

User:

  • API.user.createOrUpdateUser(userObj)
  • API.user.updateUser(userObj)

Course:

  • API.course.enrollUser(userID, courseID, optionalQuizID)
  • API.course.unrollUser(userID, courseID, optionalQuizID)
  • API.course.generateSSO(userID, courseID, callbackURL /optional/)
  • API.course.getGrade(userID, courseID, gradeID)

Readme

Keywords

none

Package Sidebar

Install

npm i @ikonintegration/mod-courses-client

Weekly Downloads

1

Version

1.0.0-alpha5

License

none

Unpacked Size

9.55 kB

Total Files

8

Last publish

Collaborators

  • vitor-ikon
  • mateus.ikon
  • gwdebes
  • rescio