@smarterservices/sp-public-client
Advanced tools
Comparing version 0.0.63 to 0.0.64
788
index.js
@@ -66,10 +66,9 @@ /*jshint -W069 */ | ||
/** | ||
* Will return return details about a single course | ||
* List sessions for a given exam | ||
* @method | ||
* @name Client#getCourse | ||
* @param {string} course_id - | ||
* @param {string} institution_id - | ||
* @name Client#listSessions | ||
* @param {string} exam_id - | ||
* | ||
*/ | ||
Client.prototype.getCourse = function(parameters) { | ||
Client.prototype.listSessions = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -81,3 +80,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/courses/{course_id}'; | ||
var path = '/v1/exams/{exam_id}/sessions'; | ||
@@ -89,16 +88,41 @@ var body; | ||
path = path.replace('{course_id}', parameters['course_id']); | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
if (parameters['course_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: course_id')); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{institution_id}', parameters['institution_id']); | ||
if (parameters.$queryParameters) { | ||
Object.keys(parameters.$queryParameters) | ||
.forEach(function(parameterName) { | ||
var parameter = parameters.$queryParameters[parameterName]; | ||
queryParameters[parameterName] = parameter; | ||
}); | ||
} | ||
if (parameters['institution_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institution_id')); | ||
return deferred.promise; | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
return deferred.promise; | ||
}; | ||
/** | ||
* Used to make sure that the api is current only | ||
* @method | ||
* @name Client#health | ||
* | ||
*/ | ||
Client.prototype.health = function(parameters) { | ||
if (parameters === undefined) { | ||
parameters = {}; | ||
} | ||
var deferred = Q.defer(); | ||
var domain = this.domain; | ||
var path = '/v1'; | ||
var body; | ||
var queryParameters = {}; | ||
var headers = {}; | ||
var form = {}; | ||
if (parameters.$queryParameters) { | ||
@@ -117,10 +141,9 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Start a new session and create permissions | ||
* Will return return a list of courses for an institution | ||
* @method | ||
* @name Client#startSession | ||
* @param {string} session_id - Access Key | ||
* @param {} body - | ||
* @name Client#listCourses | ||
* @param {string} institution_id - | ||
* | ||
*/ | ||
Client.prototype.startSession = function(parameters) { | ||
Client.prototype.listCourses = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -132,3 +155,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/start'; | ||
var path = '/v1/institutions/{institution_id}/courses'; | ||
@@ -140,13 +163,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) { | ||
@@ -160,3 +179,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); | ||
@@ -166,10 +185,10 @@ return deferred.promise; | ||
/** | ||
* Returns the media token needed for the client to connect to the session. | ||
* Gets the zookeeper session history | ||
* @method | ||
* @name Client#getMediaToken | ||
* @name Client#getProcesses | ||
* @param {string} session_id - | ||
* @param {string} client_id - | ||
* @param {string} zookeeper_id - | ||
* | ||
*/ | ||
Client.prototype.getMediaToken = function(parameters) { | ||
Client.prototype.getProcesses = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -181,3 +200,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/clients/{client_id}/mediatoken'; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
@@ -196,6 +215,8 @@ var body; | ||
path = path.replace('{client_id}', parameters['client_id']); | ||
if (parameters['zookeeper_id'] !== undefined) { | ||
queryParameters['zookeeper_id'] = parameters['zookeeper_id']; | ||
} | ||
if (parameters['client_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: client_id')); | ||
if (parameters['zookeeper_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: zookeeper_id')); | ||
return deferred.promise; | ||
@@ -217,9 +238,10 @@ } | ||
/** | ||
* This endpoint is used to get an image list for an proctor | ||
* Updates the session with the current running processes | ||
* @method | ||
* @name Client#listProctorImages | ||
* @param {string} user_id - | ||
* @name Client#sessionProcesses | ||
* @param {string} session_id - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.listProctorImages = function(parameters) { | ||
Client.prototype.sessionProcesses = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -231,3 +253,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/proctor/{user_id}/images'; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
@@ -239,9 +261,13 @@ var body; | ||
path = path.replace('{user_id}', parameters['user_id']); | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['user_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: user_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) { | ||
@@ -255,3 +281,3 @@ Object.keys(parameters.$queryParameters) | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('PUT', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -261,10 +287,9 @@ return deferred.promise; | ||
/** | ||
* This endpoint is used to upload headshot for a proctor | ||
* Used to login and authenticate proctors | ||
* @method | ||
* @name Client#uploadProctorImage | ||
* @param {string} user_id - | ||
* @name Client#proctorLogin | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.uploadProctorImage = function(parameters) { | ||
Client.prototype.proctorLogin = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -276,3 +301,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/proctor/{user_id}/images'; | ||
var path = '/v1/proctors/login'; | ||
@@ -284,9 +309,2 @@ var body; | ||
path = path.replace('{user_id}', parameters['user_id']); | ||
if (parameters['user_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: user_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
@@ -309,11 +327,10 @@ body = parameters['body']; | ||
/** | ||
* List incidents for a given session | ||
* Returns the media token needed for the client to connect to the session. | ||
* @method | ||
* @name Client#listIncidents | ||
* @name Client#getMediaToken | ||
* @param {string} session_id - | ||
* @param {string} page - | ||
* @param {string} page_size - | ||
* @param {string} client_id - | ||
* | ||
*/ | ||
Client.prototype.listIncidents = function(parameters) { | ||
Client.prototype.getMediaToken = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -325,3 +342,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
var path = '/v1/sessions/{session_id}/clients/{client_id}/mediatoken'; | ||
@@ -340,8 +357,7 @@ var body; | ||
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; | ||
} | ||
@@ -362,10 +378,8 @@ | ||
/** | ||
* Creates an incident for a given session | ||
* Will return a full list of all institutions | ||
* @method | ||
* @name Client#createIncident | ||
* @param {string} session_id - | ||
* @param {} body - | ||
* @name Client#listInstitutions | ||
* | ||
*/ | ||
Client.prototype.createIncident = function(parameters) { | ||
Client.prototype.listInstitutions = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -377,3 +391,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
var path = '/v1/institutions'; | ||
@@ -385,13 +399,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['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -405,3 +408,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); | ||
@@ -411,9 +414,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) { | ||
@@ -425,3 +429,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}'; | ||
var path = '/v1/incidents/types'; | ||
@@ -433,7 +437,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']; | ||
} | ||
@@ -454,11 +459,11 @@ | ||
/** | ||
* Get exam details | ||
* Get history of current session | ||
* @method | ||
* @name Client#getExam | ||
* @param {string} course_id - | ||
* @param {string} exam_id - | ||
* @param {string} enrollment_id - | ||
* @name Client#getAgreementHistory | ||
* @param {string} token - | ||
* @param {string} session_id - | ||
* @param {string} agreement_id - | ||
* | ||
*/ | ||
Client.prototype.getExam = function(parameters) { | ||
Client.prototype.getAgreementHistory = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -470,3 +475,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/exams/{exam_id}'; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/history'; | ||
@@ -478,22 +483,22 @@ 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('{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['enrollment_id'] !== undefined) { | ||
queryParameters['enrollment_id'] = parameters['enrollment_id']; | ||
} | ||
path = path.replace('{agreement_id}', parameters['agreement_id']); | ||
if (parameters['enrollment_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: enrollment_id')); | ||
if (parameters['agreement_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: agreement_id')); | ||
return deferred.promise; | ||
@@ -515,9 +520,10 @@ } | ||
/** | ||
* List students for a given exam | ||
* Start a new session and create permissions | ||
* @method | ||
* @name Client#listStudents | ||
* @param {string} exam_id - | ||
* @name Client#startSession | ||
* @param {string} session_id - Access Key | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.listStudents = function(parameters) { | ||
Client.prototype.startSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -529,3 +535,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/students'; | ||
var path = '/v1/sessions/{session_id}/start'; | ||
@@ -537,9 +543,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) { | ||
@@ -553,3 +563,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); | ||
@@ -559,8 +569,10 @@ return deferred.promise; | ||
/** | ||
* Used to make sure that the api is current only | ||
* Join an existing session and get permissions | ||
* @method | ||
* @name Client#health | ||
* @name Client#joinSession | ||
* @param {string} session_id - Access Key | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.health = function(parameters) { | ||
Client.prototype.joinSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -572,3 +584,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1'; | ||
var path = '/v1/sessions/{session_id}/join'; | ||
@@ -580,2 +592,13 @@ 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['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -589,3 +612,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); | ||
@@ -595,11 +618,10 @@ return deferred.promise; | ||
/** | ||
* 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) { | ||
@@ -611,3 +633,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}/cancel'; | ||
@@ -619,22 +641,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; | ||
} | ||
if (parameters['client_id'] !== undefined) { | ||
queryParameters['client_id'] = parameters['client_id']; | ||
} | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['client_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: client_id')); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['type'] !== undefined) { | ||
queryParameters['type'] = parameters['type']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -648,3 +664,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); | ||
@@ -654,11 +670,10 @@ return deferred.promise; | ||
/** | ||
* This endpoint is used to upload images for a user | ||
* Get student details | ||
* @method | ||
* @name Client#uploadImage | ||
* @param {string} token - | ||
* @param {string} session_id - | ||
* @param {} body - | ||
* @name Client#getStudent | ||
* @param {string} institution_id - | ||
* @param {string} student_id - | ||
* | ||
*/ | ||
Client.prototype.uploadImage = function(parameters) { | ||
Client.prototype.getStudent = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -670,3 +685,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
var path = '/v1/institutions/{institution_id}/students/{student_id}'; | ||
@@ -678,22 +693,16 @@ var body; | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
path = path.replace('{institution_id}', parameters['institution_id']); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
if (parameters['institution_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institution_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
path = path.replace('{student_id}', parameters['student_id']); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
if (parameters['student_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: student_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -707,3 +716,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); | ||
@@ -713,10 +722,9 @@ return deferred.promise; | ||
/** | ||
* Get all the incident types | ||
* List students for a given exam | ||
* @method | ||
* @name Client#getIncidentTypes | ||
* @param {string} page - | ||
* @param {string} page_size - | ||
* @name Client#listStudents | ||
* @param {string} exam_id - | ||
* | ||
*/ | ||
Client.prototype.getIncidentTypes = function(parameters) { | ||
Client.prototype.listStudents = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -728,3 +736,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/incidents/types'; | ||
var path = '/v1/exams/{exam_id}/students'; | ||
@@ -736,8 +744,7 @@ var body; | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
if (parameters['page_size'] !== undefined) { | ||
queryParameters['page_size'] = parameters['page_size']; | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
return deferred.promise; | ||
} | ||
@@ -758,10 +765,13 @@ | ||
/** | ||
* Join an existing session and get permissions | ||
* Sign an agreement | ||
* @method | ||
* @name Client#joinSession | ||
* @param {string} session_id - Access Key | ||
* @name Client#signAgreements | ||
* @param {string} token - | ||
* @param {string} session_id - | ||
* @param {string} agreement_id - | ||
* @param {string} version_id - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.joinSession = function(parameters) { | ||
Client.prototype.signAgreements = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -773,3 +783,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/join'; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/versions/{version_id}/sign'; | ||
@@ -781,2 +791,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']); | ||
@@ -789,2 +808,16 @@ | ||
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) { | ||
@@ -807,9 +840,9 @@ body = parameters['body']; | ||
/** | ||
* Used to login and authenticate proctors | ||
* List all exams for a course | ||
* @method | ||
* @name Client#proctorLogin | ||
* @param {} body - | ||
* @name Client#listExams | ||
* @param {string} course_id - | ||
* | ||
*/ | ||
Client.prototype.proctorLogin = function(parameters) { | ||
Client.prototype.listExams = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -821,3 +854,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/proctors/login'; | ||
var path = '/v1/courses/{course_id}/exams'; | ||
@@ -829,4 +862,7 @@ var body; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
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; | ||
} | ||
@@ -842,3 +878,3 @@ | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -848,11 +884,9 @@ return deferred.promise; | ||
/** | ||
* Get session details for a given exam | ||
* This endpoint is used to get an image list for an proctor | ||
* @method | ||
* @name Client#getSession | ||
* @param {string} token - | ||
* @param {string} exam_id - | ||
* @param {string} session_id - | ||
* @name Client#listProctorImages | ||
* @param {string} user_id - | ||
* | ||
*/ | ||
Client.prototype.getSession = function(parameters) { | ||
Client.prototype.listProctorImages = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -864,3 +898,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}'; | ||
var path = '/v1/proctor/{user_id}/images'; | ||
@@ -872,25 +906,9 @@ var body; | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
path = path.replace('{user_id}', parameters['user_id']); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
if (parameters['user_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: user_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; | ||
} | ||
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) { | ||
@@ -909,10 +927,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Get student details | ||
* This endpoint is used to upload headshot for a proctor | ||
* @method | ||
* @name Client#getStudent | ||
* @param {string} institution_id - | ||
* @param {string} student_id - | ||
* @name Client#uploadProctorImage | ||
* @param {string} user_id - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.getStudent = function(parameters) { | ||
Client.prototype.uploadProctorImage = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -924,3 +942,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/students/{student_id}'; | ||
var path = '/v1/proctor/{user_id}/images'; | ||
@@ -932,14 +950,11 @@ var body; | ||
path = path.replace('{institution_id}', parameters['institution_id']); | ||
path = path.replace('{user_id}', parameters['user_id']); | ||
if (parameters['institution_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institution_id')); | ||
if (parameters['user_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: user_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['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
@@ -955,3 +970,3 @@ | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -961,11 +976,11 @@ return deferred.promise; | ||
/** | ||
* Get agreements to sign | ||
* This endpoint is used to get an image list for an user | ||
* @method | ||
* @name Client#getAgreements | ||
* @param {string} token - | ||
* @name Client#listImages | ||
* @param {string} session_id - | ||
* @param {string} location_id - | ||
* @param {string} client_id - | ||
* @param {string} type - | ||
* | ||
*/ | ||
Client.prototype.getAgreements = function(parameters) { | ||
Client.prototype.listImages = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -977,3 +992,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/agreements/location/{location_id}'; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
@@ -985,11 +1000,2 @@ 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']); | ||
@@ -1002,9 +1008,15 @@ | ||
path = path.replace('{location_id}', parameters['location_id']); | ||
if (parameters['client_id'] !== undefined) { | ||
queryParameters['client_id'] = parameters['client_id']; | ||
} | ||
if (parameters['location_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: location_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) { | ||
@@ -1023,9 +1035,11 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* List sessions for a given exam | ||
* This endpoint is used to upload images for a user | ||
* @method | ||
* @name Client#listSessions | ||
* @param {string} exam_id - | ||
* @name Client#uploadImage | ||
* @param {string} token - | ||
* @param {string} session_id - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.listSessions = function(parameters) { | ||
Client.prototype.uploadImage = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1037,3 +1051,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/sessions'; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
@@ -1045,9 +1059,22 @@ var body; | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_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; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1061,3 +1088,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); | ||
@@ -1067,10 +1094,11 @@ return deferred.promise; | ||
/** | ||
* Cancel session for a given exam | ||
* Get exam details | ||
* @method | ||
* @name Client#cancelSession | ||
* @name Client#getExam | ||
* @param {string} course_id - | ||
* @param {string} exam_id - | ||
* @param {string} session_id - | ||
* @param {string} enrollment_id - | ||
* | ||
*/ | ||
Client.prototype.cancelSession = function(parameters) { | ||
Client.prototype.getExam = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1082,3 +1110,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}/cancel'; | ||
var path = '/v1/courses/{course_id}/exams/{exam_id}'; | ||
@@ -1090,2 +1118,9 @@ var body; | ||
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; | ||
} | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
@@ -1098,6 +1133,8 @@ | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['enrollment_id'] !== undefined) { | ||
queryParameters['enrollment_id'] = parameters['enrollment_id']; | ||
} | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
if (parameters['enrollment_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: enrollment_id')); | ||
return deferred.promise; | ||
@@ -1114,3 +1151,3 @@ } | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -1120,8 +1157,10 @@ return deferred.promise; | ||
/** | ||
* Will return a full list of all institutions | ||
* Get instructor details | ||
* @method | ||
* @name Client#listInstitutions | ||
* @name Client#getInstructor | ||
* @param {string} course_id - | ||
* @param {string} instructor_id - | ||
* | ||
*/ | ||
Client.prototype.listInstitutions = function(parameters) { | ||
Client.prototype.getInstructor = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1133,3 +1172,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions'; | ||
var path = '/v1/courses/{course_id}/instructors/{instructor_id}'; | ||
@@ -1141,2 +1180,16 @@ var body; | ||
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; | ||
} | ||
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.$queryParameters) { | ||
@@ -1155,9 +1208,11 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* List all exams for a course | ||
* Get session details for a given exam | ||
* @method | ||
* @name Client#listExams | ||
* @param {string} course_id - | ||
* @name Client#getSession | ||
* @param {string} token - | ||
* @param {string} exam_id - | ||
* @param {string} session_id - | ||
* | ||
*/ | ||
Client.prototype.listExams = function(parameters) { | ||
Client.prototype.getSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1169,3 +1224,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/exams'; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}'; | ||
@@ -1177,9 +1232,25 @@ 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('{exam_id}', parameters['exam_id']); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
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.$queryParameters) { | ||
@@ -1198,9 +1269,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Will return return a list of courses for an institution | ||
* Will return return details about a single course | ||
* @method | ||
* @name Client#listCourses | ||
* @name Client#getCourse | ||
* @param {string} course_id - | ||
* @param {string} institution_id - | ||
* | ||
*/ | ||
Client.prototype.listCourses = function(parameters) { | ||
Client.prototype.getCourse = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1212,3 +1284,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/courses'; | ||
var path = '/v1/institutions/{institution_id}/courses/{course_id}'; | ||
@@ -1220,2 +1292,9 @@ var body; | ||
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; | ||
} | ||
path = path.replace('{institution_id}', parameters['institution_id']); | ||
@@ -1241,11 +1320,11 @@ | ||
/** | ||
* Get history of current session | ||
* Get agreements to sign | ||
* @method | ||
* @name Client#getAgreementHistory | ||
* @name Client#getAgreements | ||
* @param {string} token - | ||
* @param {string} session_id - | ||
* @param {string} agreement_id - | ||
* @param {string} location_id - | ||
* | ||
*/ | ||
Client.prototype.getAgreementHistory = function(parameters) { | ||
Client.prototype.getAgreements = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1257,3 +1336,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/history'; | ||
var path = '/v1/sessions/{session_id}/agreements/location/{location_id}'; | ||
@@ -1281,6 +1360,6 @@ var body; | ||
path = path.replace('{agreement_id}', parameters['agreement_id']); | ||
path = path.replace('{location_id}', parameters['location_id']); | ||
if (parameters['agreement_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: agreement_id')); | ||
if (parameters['location_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: location_id')); | ||
return deferred.promise; | ||
@@ -1302,10 +1381,9 @@ } | ||
/** | ||
* Gets the zookeeper session history | ||
* Will return detailed information about an institution | ||
* @method | ||
* @name Client#getProcesses | ||
* @param {string} session_id - | ||
* @param {string} zookeeper_id - | ||
* @name Client#getInstitution | ||
* @param {string} institution_id - | ||
* | ||
*/ | ||
Client.prototype.getProcesses = function(parameters) { | ||
Client.prototype.getInstitution = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1317,3 +1395,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
var path = '/v1/institutions/{institution_id}'; | ||
@@ -1325,18 +1403,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['zookeeper_id'] !== undefined) { | ||
queryParameters['zookeeper_id'] = parameters['zookeeper_id']; | ||
} | ||
if (parameters['zookeeper_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: zookeeper_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1355,10 +1424,11 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Updates the session with the current running processes | ||
* List incidents for a given session | ||
* @method | ||
* @name Client#sessionProcesses | ||
* @name Client#listIncidents | ||
* @param {string} session_id - | ||
* @param {} body - | ||
* @param {string} page - | ||
* @param {string} page_size - | ||
* | ||
*/ | ||
Client.prototype.sessionProcesses = function(parameters) { | ||
Client.prototype.listIncidents = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1370,3 +1440,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
@@ -1385,6 +1455,10 @@ var body; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
if (parameters['page_size'] !== undefined) { | ||
queryParameters['page_size'] = parameters['page_size']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1398,3 +1472,3 @@ Object.keys(parameters.$queryParameters) | ||
this.request('PUT', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -1404,13 +1478,10 @@ return deferred.promise; | ||
/** | ||
* Sign an agreement | ||
* Creates an incident for a given session | ||
* @method | ||
* @name Client#signAgreements | ||
* @param {string} token - | ||
* @name Client#createIncident | ||
* @param {string} session_id - | ||
* @param {string} agreement_id - | ||
* @param {string} version_id - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.signAgreements = function(parameters) { | ||
Client.prototype.createIncident = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1422,3 +1493,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/versions/{version_id}/sign'; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
@@ -1430,11 +1501,2 @@ 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']); | ||
@@ -1447,16 +1509,2 @@ | ||
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) { | ||
@@ -1479,50 +1527,2 @@ body = parameters['body']; | ||
/** | ||
* Get instructor details | ||
* @method | ||
* @name Client#getInstructor | ||
* @param {string} course_id - | ||
* @param {string} instructor_id - | ||
* | ||
*/ | ||
Client.prototype.getInstructor = function(parameters) { | ||
if (parameters === undefined) { | ||
parameters = {}; | ||
} | ||
var deferred = Q.defer(); | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/instructors/{instructor_id}'; | ||
var body; | ||
var queryParameters = {}; | ||
var headers = {}; | ||
var form = {}; | ||
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; | ||
} | ||
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.$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; | ||
}; | ||
/** | ||
* List all instructors for a course | ||
@@ -1529,0 +1529,0 @@ * @method |
@@ -1,1 +0,1 @@ | ||
{"name":"@smarterservices/sp-public-client","version":"0.0.63","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.64","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} |