@smarterservices/sp-public-client
Advanced tools
728
index.js
@@ -66,9 +66,10 @@ /*jshint -W069 */ | ||
/** | ||
* List students for a given exam | ||
* Join an existing session and get permissions | ||
* @method | ||
* @name Client#listStudents | ||
* @param {string} exam_id - | ||
* @name Client#joinSession | ||
* @param {string} session_id - Access Key | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.listStudents = function(parameters) { | ||
Client.prototype.joinSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -80,3 +81,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/students'; | ||
var path = '/v1/sessions/{session_id}/join'; | ||
@@ -88,9 +89,13 @@ var body; | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -104,3 +109,3 @@ Object.keys(parameters.$queryParameters) | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -110,11 +115,10 @@ return deferred.promise; | ||
/** | ||
* Get history of current session | ||
* Will return return details about a single course | ||
* @method | ||
* @name Client#getAgreementHistory | ||
* @param {string} token - | ||
* @param {string} session_id - | ||
* @param {string} agreement_id - | ||
* @name Client#getCourse | ||
* @param {string} course_id - | ||
* @param {string} institution_id - | ||
* | ||
*/ | ||
Client.prototype.getAgreementHistory = function(parameters) { | ||
Client.prototype.getCourse = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -126,3 +130,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/history'; | ||
var path = '/v1/institutions/{institution_id}/courses/{course_id}'; | ||
@@ -134,25 +138,16 @@ var body; | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
path = path.replace('{course_id}', parameters['course_id']); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
if (parameters['course_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: course_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
path = path.replace('{institution_id}', parameters['institution_id']); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
if (parameters['institution_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institution_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{agreement_id}', parameters['agreement_id']); | ||
if (parameters['agreement_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: agreement_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -171,9 +166,13 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* List all exams for a course | ||
* Sign an agreement | ||
* @method | ||
* @name Client#listExams | ||
* @param {string} course_id - | ||
* @name Client#signAgreements | ||
* @param {string} token - | ||
* @param {string} session_id - | ||
* @param {string} agreement_id - | ||
* @param {string} version_id - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.listExams = function(parameters) { | ||
Client.prototype.signAgreements = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -185,3 +184,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/exams'; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/versions/{version_id}/sign'; | ||
@@ -193,9 +192,36 @@ var body; | ||
path = path.replace('{course_id}', parameters['course_id']); | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
if (parameters['course_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: course_id')); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{agreement_id}', parameters['agreement_id']); | ||
if (parameters['agreement_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: agreement_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{version_id}', parameters['version_id']); | ||
if (parameters['version_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: version_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -209,3 +235,3 @@ Object.keys(parameters.$queryParameters) | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -215,9 +241,10 @@ return deferred.promise; | ||
/** | ||
* Will return detailed information about an institution | ||
* Get all the incident types | ||
* @method | ||
* @name Client#getInstitution | ||
* @param {string} institution_id - | ||
* @name Client#getIncidentTypes | ||
* @param {string} page - | ||
* @param {string} page_size - | ||
* | ||
*/ | ||
Client.prototype.getInstitution = function(parameters) { | ||
Client.prototype.getIncidentTypes = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -229,3 +256,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}'; | ||
var path = '/v1/incidents/types'; | ||
@@ -237,7 +264,8 @@ var body; | ||
path = path.replace('{institution_id}', parameters['institution_id']); | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
if (parameters['institution_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institution_id')); | ||
return deferred.promise; | ||
if (parameters['page_size'] !== undefined) { | ||
queryParameters['page_size'] = parameters['page_size']; | ||
} | ||
@@ -258,11 +286,11 @@ | ||
/** | ||
* Get exam details | ||
* List incidents for a given session | ||
* @method | ||
* @name Client#getExam | ||
* @param {string} course_id - | ||
* @param {string} exam_id - | ||
* @param {string} enrollment_id - | ||
* @name Client#listIncidents | ||
* @param {string} session_id - | ||
* @param {string} page - | ||
* @param {string} page_size - | ||
* | ||
*/ | ||
Client.prototype.getExam = function(parameters) { | ||
Client.prototype.listIncidents = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -274,3 +302,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/exams/{exam_id}'; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
@@ -282,25 +310,17 @@ var body; | ||
path = path.replace('{course_id}', parameters['course_id']); | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['course_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: course_id')); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
return deferred.promise; | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
if (parameters['enrollment_id'] !== undefined) { | ||
queryParameters['enrollment_id'] = parameters['enrollment_id']; | ||
if (parameters['page_size'] !== undefined) { | ||
queryParameters['page_size'] = parameters['page_size']; | ||
} | ||
if (parameters['enrollment_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: enrollment_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -319,10 +339,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Get instructor details | ||
* Creates an incident for a given session | ||
* @method | ||
* @name Client#getInstructor | ||
* @param {string} course_id - | ||
* @param {string} instructor_id - | ||
* @name Client#createIncident | ||
* @param {string} session_id - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.getInstructor = function(parameters) { | ||
Client.prototype.createIncident = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -334,3 +354,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/instructors/{instructor_id}'; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
@@ -342,14 +362,11 @@ var body; | ||
path = path.replace('{course_id}', parameters['course_id']); | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['course_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: course_id')); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{instructor_id}', parameters['instructor_id']); | ||
if (parameters['instructor_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: instructor_id')); | ||
return deferred.promise; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
@@ -365,3 +382,3 @@ | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -371,10 +388,11 @@ return deferred.promise; | ||
/** | ||
* Returns the media token needed for the client to connect to the session. | ||
* Get history of current session | ||
* @method | ||
* @name Client#getMediaToken | ||
* @name Client#getAgreementHistory | ||
* @param {string} token - | ||
* @param {string} session_id - | ||
* @param {string} client_id - | ||
* @param {string} agreement_id - | ||
* | ||
*/ | ||
Client.prototype.getMediaToken = function(parameters) { | ||
Client.prototype.getAgreementHistory = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -386,3 +404,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/clients/{client_id}/mediatoken'; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/history'; | ||
@@ -394,2 +412,11 @@ var body; | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
@@ -402,6 +429,6 @@ | ||
path = path.replace('{client_id}', parameters['client_id']); | ||
path = path.replace('{agreement_id}', parameters['agreement_id']); | ||
if (parameters['client_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: client_id')); | ||
if (parameters['agreement_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: agreement_id')); | ||
return deferred.promise; | ||
@@ -423,10 +450,10 @@ } | ||
/** | ||
* Get all the incident types | ||
* Get instructor details | ||
* @method | ||
* @name Client#getIncidentTypes | ||
* @param {string} page - | ||
* @param {string} page_size - | ||
* @name Client#getInstructor | ||
* @param {string} course_id - | ||
* @param {string} instructor_id - | ||
* | ||
*/ | ||
Client.prototype.getIncidentTypes = function(parameters) { | ||
Client.prototype.getInstructor = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -438,3 +465,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/incidents/types'; | ||
var path = '/v1/courses/{course_id}/instructors/{instructor_id}'; | ||
@@ -446,8 +473,14 @@ var body; | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
path = path.replace('{course_id}', parameters['course_id']); | ||
if (parameters['course_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: course_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['page_size'] !== undefined) { | ||
queryParameters['page_size'] = parameters['page_size']; | ||
path = path.replace('{instructor_id}', parameters['instructor_id']); | ||
if (parameters['instructor_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: instructor_id')); | ||
return deferred.promise; | ||
} | ||
@@ -468,10 +501,9 @@ | ||
/** | ||
* Start a new session and create permissions | ||
* Will return detailed information about an institution | ||
* @method | ||
* @name Client#startSession | ||
* @param {string} session_id - Access Key | ||
* @param {} body - | ||
* @name Client#getInstitution | ||
* @param {string} institution_id - | ||
* | ||
*/ | ||
Client.prototype.startSession = function(parameters) { | ||
Client.prototype.getInstitution = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -483,3 +515,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/start'; | ||
var path = '/v1/institutions/{institution_id}'; | ||
@@ -491,13 +523,9 @@ var body; | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
path = path.replace('{institution_id}', parameters['institution_id']); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
if (parameters['institution_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institution_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -511,3 +539,3 @@ Object.keys(parameters.$queryParameters) | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -517,9 +545,9 @@ return deferred.promise; | ||
/** | ||
* Will return return a list of courses for an institution | ||
* List students for a given exam | ||
* @method | ||
* @name Client#listCourses | ||
* @param {string} institution_id - | ||
* @name Client#listStudents | ||
* @param {string} exam_id - | ||
* | ||
*/ | ||
Client.prototype.listCourses = function(parameters) { | ||
Client.prototype.listStudents = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -531,3 +559,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/courses'; | ||
var path = '/v1/exams/{exam_id}/students'; | ||
@@ -539,6 +567,6 @@ var body; | ||
path = path.replace('{institution_id}', parameters['institution_id']); | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
if (parameters['institution_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institution_id')); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
return deferred.promise; | ||
@@ -560,10 +588,9 @@ } | ||
/** | ||
* Get student details | ||
* Will return return a list of courses for an institution | ||
* @method | ||
* @name Client#getStudent | ||
* @name Client#listCourses | ||
* @param {string} institution_id - | ||
* @param {string} student_id - | ||
* | ||
*/ | ||
Client.prototype.getStudent = function(parameters) { | ||
Client.prototype.listCourses = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -575,3 +602,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/students/{student_id}'; | ||
var path = '/v1/institutions/{institution_id}/courses'; | ||
@@ -590,9 +617,2 @@ var body; | ||
path = path.replace('{student_id}', parameters['student_id']); | ||
if (parameters['student_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: student_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -611,11 +631,8 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* List incidents for a given session | ||
* Used to make sure that the api is current only | ||
* @method | ||
* @name Client#listIncidents | ||
* @param {string} session_id - | ||
* @param {string} page - | ||
* @param {string} page_size - | ||
* @name Client#health | ||
* | ||
*/ | ||
Client.prototype.listIncidents = function(parameters) { | ||
Client.prototype.health = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -627,3 +644,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
var path = '/v1'; | ||
@@ -635,17 +652,2 @@ var body; | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
if (parameters['page_size'] !== undefined) { | ||
queryParameters['page_size'] = parameters['page_size']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -664,10 +666,11 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Creates an incident for a given session | ||
* Get exam details | ||
* @method | ||
* @name Client#createIncident | ||
* @param {string} session_id - | ||
* @param {} body - | ||
* @name Client#getExam | ||
* @param {string} course_id - | ||
* @param {string} exam_id - | ||
* @param {string} enrollment_id - | ||
* | ||
*/ | ||
Client.prototype.createIncident = function(parameters) { | ||
Client.prototype.getExam = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -679,3 +682,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
var path = '/v1/courses/{course_id}/exams/{exam_id}'; | ||
@@ -687,13 +690,25 @@ var body; | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
path = path.replace('{course_id}', parameters['course_id']); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
if (parameters['course_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: course_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['enrollment_id'] !== undefined) { | ||
queryParameters['enrollment_id'] = parameters['enrollment_id']; | ||
} | ||
if (parameters['enrollment_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: enrollment_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -707,3 +722,3 @@ Object.keys(parameters.$queryParameters) | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -771,10 +786,9 @@ return deferred.promise; | ||
/** | ||
* Cancel session for a given exam | ||
* Used to login and authenticate proctors | ||
* @method | ||
* @name Client#cancelSession | ||
* @param {string} exam_id - | ||
* @param {string} session_id - | ||
* @name Client#proctorLogin | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.cancelSession = function(parameters) { | ||
Client.prototype.proctorLogin = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -786,3 +800,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}/cancel'; | ||
var path = '/v1/proctors/login'; | ||
@@ -794,16 +808,6 @@ var body; | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
return deferred.promise; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -822,11 +826,11 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Get session details for a given exam | ||
* List all instructors for a course | ||
* @method | ||
* @name Client#getSession | ||
* @param {string} token - | ||
* @param {string} exam_id - | ||
* @param {string} session_id - | ||
* @name Client#listInstructors | ||
* @param {string} course_id - | ||
* @param {string} page - | ||
* @param {string} page_size - | ||
* | ||
*/ | ||
Client.prototype.getSession = function(parameters) { | ||
Client.prototype.listInstructors = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -838,3 +842,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}'; | ||
var path = '/v1/courses/{course_id}/instructors'; | ||
@@ -846,23 +850,15 @@ var body; | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
path = path.replace('{course_id}', parameters['course_id']); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
if (parameters['course_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: course_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
return deferred.promise; | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
return deferred.promise; | ||
if (parameters['page_size'] !== undefined) { | ||
queryParameters['page_size'] = parameters['page_size']; | ||
} | ||
@@ -883,10 +879,10 @@ | ||
/** | ||
* Will return return details about a single course | ||
* Start a new session and create permissions | ||
* @method | ||
* @name Client#getCourse | ||
* @param {string} course_id - | ||
* @param {string} institution_id - | ||
* @name Client#startSession | ||
* @param {string} session_id - Access Key | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.getCourse = function(parameters) { | ||
Client.prototype.startSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -898,3 +894,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/courses/{course_id}'; | ||
var path = '/v1/sessions/{session_id}/start'; | ||
@@ -906,16 +902,45 @@ var body; | ||
path = path.replace('{course_id}', parameters['course_id']); | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['course_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: course_id')); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{institution_id}', parameters['institution_id']); | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters['institution_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institution_id')); | ||
return deferred.promise; | ||
if (parameters.$queryParameters) { | ||
Object.keys(parameters.$queryParameters) | ||
.forEach(function(parameterName) { | ||
var parameter = parameters.$queryParameters[parameterName]; | ||
queryParameters[parameterName] = parameter; | ||
}); | ||
} | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
return deferred.promise; | ||
}; | ||
/** | ||
* Will return a full list of all institutions | ||
* @method | ||
* @name Client#listInstitutions | ||
* | ||
*/ | ||
Client.prototype.listInstitutions = function(parameters) { | ||
if (parameters === undefined) { | ||
parameters = {}; | ||
} | ||
var deferred = Q.defer(); | ||
var domain = this.domain; | ||
var path = '/v1/institutions'; | ||
var body; | ||
var queryParameters = {}; | ||
var headers = {}; | ||
var form = {}; | ||
if (parameters.$queryParameters) { | ||
@@ -934,13 +959,11 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Sign an agreement | ||
* Get session details for a given exam | ||
* @method | ||
* @name Client#signAgreements | ||
* @name Client#getSession | ||
* @param {string} token - | ||
* @param {string} exam_id - | ||
* @param {string} session_id - | ||
* @param {string} agreement_id - | ||
* @param {string} version_id - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.signAgreements = function(parameters) { | ||
Client.prototype.getSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -952,3 +975,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/versions/{version_id}/sign'; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}'; | ||
@@ -969,27 +992,16 @@ var body; | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{agreement_id}', parameters['agreement_id']); | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['agreement_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: agreement_id')); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{version_id}', parameters['version_id']); | ||
if (parameters['version_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: version_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1003,3 +1015,3 @@ Object.keys(parameters.$queryParameters) | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -1009,8 +1021,9 @@ return deferred.promise; | ||
/** | ||
* Used to make sure that the api is current only | ||
* List sessions for a given exam | ||
* @method | ||
* @name Client#health | ||
* @name Client#listSessions | ||
* @param {string} exam_id - | ||
* | ||
*/ | ||
Client.prototype.health = function(parameters) { | ||
Client.prototype.listSessions = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1022,3 +1035,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1'; | ||
var path = '/v1/exams/{exam_id}/sessions'; | ||
@@ -1030,2 +1043,9 @@ var body; | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1129,9 +1149,9 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* List sessions for a given exam | ||
* List all exams for a course | ||
* @method | ||
* @name Client#listSessions | ||
* @param {string} exam_id - | ||
* @name Client#listExams | ||
* @param {string} course_id - | ||
* | ||
*/ | ||
Client.prototype.listSessions = function(parameters) { | ||
Client.prototype.listExams = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1143,3 +1163,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/sessions'; | ||
var path = '/v1/courses/{course_id}/exams'; | ||
@@ -1151,6 +1171,6 @@ var body; | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
path = path.replace('{course_id}', parameters['course_id']); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
if (parameters['course_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: course_id')); | ||
return deferred.promise; | ||
@@ -1172,10 +1192,11 @@ } | ||
/** | ||
* Join an existing session and get permissions | ||
* This endpoint is used to get an image list for an user | ||
* @method | ||
* @name Client#joinSession | ||
* @param {string} session_id - Access Key | ||
* @param {} body - | ||
* @name Client#listImages | ||
* @param {string} session_id - | ||
* @param {string} client_id - | ||
* @param {string} type - | ||
* | ||
*/ | ||
Client.prototype.joinSession = function(parameters) { | ||
Client.prototype.listImages = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1187,3 +1208,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/join'; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
@@ -1202,6 +1223,15 @@ var body; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
if (parameters['client_id'] !== undefined) { | ||
queryParameters['client_id'] = parameters['client_id']; | ||
} | ||
if (parameters['client_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: client_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['type'] !== undefined) { | ||
queryParameters['type'] = parameters['type']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1215,3 +1245,3 @@ Object.keys(parameters.$queryParameters) | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -1221,9 +1251,11 @@ return deferred.promise; | ||
/** | ||
* Used to login and authenticate proctors | ||
* This endpoint is used to upload images for a user | ||
* @method | ||
* @name Client#proctorLogin | ||
* @name Client#uploadImage | ||
* @param {string} token - | ||
* @param {string} session_id - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.proctorLogin = function(parameters) { | ||
Client.prototype.uploadImage = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1235,3 +1267,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/proctors/login'; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
@@ -1243,2 +1275,18 @@ var body; | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
@@ -1261,8 +1309,10 @@ body = parameters['body']; | ||
/** | ||
* Will return a full list of all institutions | ||
* Get student details | ||
* @method | ||
* @name Client#listInstitutions | ||
* @name Client#getStudent | ||
* @param {string} institution_id - | ||
* @param {string} student_id - | ||
* | ||
*/ | ||
Client.prototype.listInstitutions = function(parameters) { | ||
Client.prototype.getStudent = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1274,3 +1324,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions'; | ||
var path = '/v1/institutions/{institution_id}/students/{student_id}'; | ||
@@ -1282,2 +1332,16 @@ var body; | ||
path = path.replace('{institution_id}', parameters['institution_id']); | ||
if (parameters['institution_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institution_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{student_id}', parameters['student_id']); | ||
if (parameters['student_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: student_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1296,11 +1360,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* List all instructors for a course | ||
* Returns the media token needed for the client to connect to the session. | ||
* @method | ||
* @name Client#listInstructors | ||
* @param {string} course_id - | ||
* @param {string} page - | ||
* @param {string} page_size - | ||
* @name Client#getMediaToken | ||
* @param {string} session_id - | ||
* @param {string} client_id - | ||
* | ||
*/ | ||
Client.prototype.listInstructors = function(parameters) { | ||
Client.prototype.getMediaToken = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1312,3 +1375,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/instructors'; | ||
var path = '/v1/sessions/{session_id}/clients/{client_id}/mediatoken'; | ||
@@ -1320,15 +1383,14 @@ var body; | ||
path = path.replace('{course_id}', parameters['course_id']); | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['course_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: course_id')); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
path = path.replace('{client_id}', parameters['client_id']); | ||
if (parameters['page_size'] !== undefined) { | ||
queryParameters['page_size'] = parameters['page_size']; | ||
if (parameters['client_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: client_id')); | ||
return deferred.promise; | ||
} | ||
@@ -1444,11 +1506,10 @@ | ||
/** | ||
* This endpoint is used to get an image list for an user | ||
* Cancel session for a given exam | ||
* @method | ||
* @name Client#listImages | ||
* @name Client#cancelSession | ||
* @param {string} exam_id - | ||
* @param {string} session_id - | ||
* @param {string} client_id - | ||
* @param {string} type - | ||
* | ||
*/ | ||
Client.prototype.listImages = function(parameters) { | ||
Client.prototype.cancelSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1460,3 +1521,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}/cancel'; | ||
@@ -1468,66 +1529,9 @@ var body; | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['client_id'] !== undefined) { | ||
queryParameters['client_id'] = parameters['client_id']; | ||
} | ||
if (parameters['client_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: client_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['type'] !== undefined) { | ||
queryParameters['type'] = parameters['type']; | ||
} | ||
if (parameters.$queryParameters) { | ||
Object.keys(parameters.$queryParameters) | ||
.forEach(function(parameterName) { | ||
var parameter = parameters.$queryParameters[parameterName]; | ||
queryParameters[parameterName] = parameter; | ||
}); | ||
} | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
return deferred.promise; | ||
}; | ||
/** | ||
* This endpoint is used to upload images for a user | ||
* @method | ||
* @name Client#uploadImage | ||
* @param {string} token - | ||
* @param {string} session_id - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.uploadImage = function(parameters) { | ||
if (parameters === undefined) { | ||
parameters = {}; | ||
} | ||
var deferred = Q.defer(); | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
var body; | ||
var queryParameters = {}; | ||
var headers = {}; | ||
var form = {}; | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
@@ -1540,6 +1544,2 @@ | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1546,0 +1546,0 @@ Object.keys(parameters.$queryParameters) |
@@ -1,1 +0,1 @@ | ||
{"name":"@smarterservices/sp-public-client","version":"0.0.65","description":"the middle layer to microservice architecture for SP that handles tasks like proxying to backend api's,formatting responces,checking permissions","main":"index.js","dependencies":{"q":"latest","request":"latest"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"jordan piepkow","license":null} | ||
{"name":"@smarterservices/sp-public-client","version":"0.0.66","description":"the middle layer to microservice architecture for SP that handles tasks like proxying to backend api's,formatting responces,checking permissions","main":"index.js","dependencies":{"q":"latest","request":"latest"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"jordan piepkow","license":null} |