@smarterservices/sp-public-client
Advanced tools
Comparing version 0.0.78 to 0.0.80
734
index.js
@@ -66,11 +66,10 @@ /*jshint -W069 */ | ||
/** | ||
* Get exam details | ||
* Cancel session for a given exam | ||
* @method | ||
* @name Client#getExam | ||
* @param {string} courseId - | ||
* @name Client#cancelSession | ||
* @param {string} examId - | ||
* @param {string} enrollmentId - | ||
* @param {string} sessionId - | ||
* | ||
*/ | ||
Client.prototype.getExam = function(parameters) { | ||
Client.prototype.cancelSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -82,3 +81,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/exams/{exam_id}'; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}/cancel'; | ||
@@ -90,9 +89,2 @@ var body; | ||
path = path.replace('{course_id}', parameters['courseId']); | ||
if (parameters['courseId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: courseId')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{exam_id}', parameters['examId']); | ||
@@ -105,8 +97,6 @@ | ||
if (parameters['enrollmentId'] !== undefined) { | ||
queryParameters['enrollment_id'] = parameters['enrollmentId']; | ||
} | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['enrollmentId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: enrollmentId')); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
return deferred.promise; | ||
@@ -123,3 +113,3 @@ } | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -129,10 +119,10 @@ return deferred.promise; | ||
/** | ||
* Get student details | ||
* Get all the incident types | ||
* @method | ||
* @name Client#getStudent | ||
* @param {string} institutionId - | ||
* @param {string} studentId - | ||
* @name Client#getIncidentTypes | ||
* @param {string} page - | ||
* @param {string} pageSize - | ||
* | ||
*/ | ||
Client.prototype.getStudent = function(parameters) { | ||
Client.prototype.getIncidentTypes = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -144,3 +134,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/students/{student_id}'; | ||
var path = '/v1/incidents/types'; | ||
@@ -152,14 +142,8 @@ var body; | ||
path = path.replace('{institution_id}', parameters['institutionId']); | ||
if (parameters['institutionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institutionId')); | ||
return deferred.promise; | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
path = path.replace('{student_id}', parameters['studentId']); | ||
if (parameters['studentId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: studentId')); | ||
return deferred.promise; | ||
if (parameters['pageSize'] !== undefined) { | ||
queryParameters['page_size'] = parameters['pageSize']; | ||
} | ||
@@ -180,9 +164,9 @@ | ||
/** | ||
* This endpoint is used to get an image list for an proctor | ||
* Will return return a list of courses for an institution | ||
* @method | ||
* @name Client#listProctorImages | ||
* @param {string} userId - | ||
* @name Client#listCourses | ||
* @param {string} institutionId - | ||
* | ||
*/ | ||
Client.prototype.listProctorImages = function(parameters) { | ||
Client.prototype.listCourses = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -194,3 +178,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/proctor/{user_id}/images'; | ||
var path = '/v1/institutions/{institution_id}/courses'; | ||
@@ -202,6 +186,6 @@ var body; | ||
path = path.replace('{user_id}', parameters['userId']); | ||
path = path.replace('{institution_id}', parameters['institutionId']); | ||
if (parameters['userId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: userId')); | ||
if (parameters['institutionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institutionId')); | ||
return deferred.promise; | ||
@@ -223,10 +207,9 @@ } | ||
/** | ||
* This endpoint is used to upload headshot for a proctor | ||
* Will return detailed information about an institution | ||
* @method | ||
* @name Client#uploadProctorImage | ||
* @param {string} userId - | ||
* @param {} body - | ||
* @name Client#getInstitution | ||
* @param {string} institutionId - | ||
* | ||
*/ | ||
Client.prototype.uploadProctorImage = function(parameters) { | ||
Client.prototype.getInstitution = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -238,3 +221,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/proctor/{user_id}/images'; | ||
var path = '/v1/institutions/{institution_id}'; | ||
@@ -246,13 +229,9 @@ var body; | ||
path = path.replace('{user_id}', parameters['userId']); | ||
path = path.replace('{institution_id}', parameters['institutionId']); | ||
if (parameters['userId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: userId')); | ||
if (parameters['institutionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institutionId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -266,3 +245,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); | ||
@@ -272,10 +251,11 @@ return deferred.promise; | ||
/** | ||
* Will return return details about a single course | ||
* Get history of current session | ||
* @method | ||
* @name Client#getCourse | ||
* @param {string} courseId - | ||
* @param {string} institutionId - | ||
* @name Client#getAgreementHistory | ||
* @param {string} token - | ||
* @param {string} sessionId - | ||
* @param {string} agreementId - | ||
* | ||
*/ | ||
Client.prototype.getCourse = function(parameters) { | ||
Client.prototype.getAgreementHistory = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -287,3 +267,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/courses/{course_id}'; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/history'; | ||
@@ -295,16 +275,25 @@ var body; | ||
path = path.replace('{course_id}', parameters['courseId']); | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
if (parameters['courseId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: courseId')); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{institution_id}', parameters['institutionId']); | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['institutionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institutionId')); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{agreement_id}', parameters['agreementId']); | ||
if (parameters['agreementId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: agreementId')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -323,9 +312,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* List all exams for a course | ||
* Get instructor details | ||
* @method | ||
* @name Client#listExams | ||
* @name Client#getInstructor | ||
* @param {string} courseId - | ||
* @param {string} instructorId - | ||
* | ||
*/ | ||
Client.prototype.listExams = function(parameters) { | ||
Client.prototype.getInstructor = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -337,3 +327,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/exams'; | ||
var path = '/v1/courses/{course_id}/instructors/{instructor_id}'; | ||
@@ -352,39 +342,9 @@ var body; | ||
if (parameters.$queryParameters) { | ||
Object.keys(parameters.$queryParameters) | ||
.forEach(function(parameterName) { | ||
var parameter = parameters.$queryParameters[parameterName]; | ||
queryParameters[parameterName] = parameter; | ||
}); | ||
} | ||
path = path.replace('{instructor_id}', parameters['instructorId']); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
return deferred.promise; | ||
}; | ||
/** | ||
* Used to login and authenticate proctors | ||
* @method | ||
* @name Client#proctorLogin | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.proctorLogin = function(parameters) { | ||
if (parameters === undefined) { | ||
parameters = {}; | ||
if (parameters['instructorId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: instructorId')); | ||
return deferred.promise; | ||
} | ||
var deferred = Q.defer(); | ||
var domain = this.domain; | ||
var path = '/v1/proctors/login'; | ||
var body; | ||
var queryParameters = {}; | ||
var headers = {}; | ||
var form = {}; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -398,3 +358,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); | ||
@@ -404,10 +364,10 @@ return deferred.promise; | ||
/** | ||
* Cancel session for a given exam | ||
* Gets the zookeeper session history | ||
* @method | ||
* @name Client#cancelSession | ||
* @param {string} examId - | ||
* @name Client#getProcesses | ||
* @param {string} sessionId - | ||
* @param {string} zookeeperId - | ||
* | ||
*/ | ||
Client.prototype.cancelSession = function(parameters) { | ||
Client.prototype.getProcesses = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -419,3 +379,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}/cancel'; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
@@ -427,13 +387,15 @@ var body; | ||
path = path.replace('{exam_id}', parameters['examId']); | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['zookeeperId'] !== undefined) { | ||
queryParameters['zookeeper_id'] = parameters['zookeeperId']; | ||
} | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
if (parameters['zookeeperId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: zookeeperId')); | ||
return deferred.promise; | ||
@@ -450,3 +412,3 @@ } | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -456,10 +418,10 @@ return deferred.promise; | ||
/** | ||
* Join an existing session and get permissions | ||
* Updates the session with the current running processes | ||
* @method | ||
* @name Client#joinSession | ||
* @param {string} sessionId - Access Key | ||
* @name Client#sessionProcesses | ||
* @param {string} sessionId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.joinSession = function(parameters) { | ||
Client.prototype.sessionProcesses = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -471,3 +433,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/join'; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
@@ -498,3 +460,3 @@ var body; | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('PUT', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -504,11 +466,11 @@ return deferred.promise; | ||
/** | ||
* Get session details for a given exam | ||
* Get exam details | ||
* @method | ||
* @name Client#getSession | ||
* @param {string} token - | ||
* @name Client#getExam | ||
* @param {string} courseId - | ||
* @param {string} examId - | ||
* @param {string} sessionId - | ||
* @param {string} enrollmentId - | ||
* | ||
*/ | ||
Client.prototype.getSession = function(parameters) { | ||
Client.prototype.getExam = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -520,3 +482,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}'; | ||
var path = '/v1/courses/{course_id}/exams/{exam_id}'; | ||
@@ -528,8 +490,6 @@ var body; | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
path = path.replace('{course_id}', parameters['courseId']); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
if (parameters['courseId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: courseId')); | ||
return deferred.promise; | ||
@@ -545,6 +505,8 @@ } | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['enrollmentId'] !== undefined) { | ||
queryParameters['enrollment_id'] = parameters['enrollmentId']; | ||
} | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
if (parameters['enrollmentId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: enrollmentId')); | ||
return deferred.promise; | ||
@@ -566,10 +528,8 @@ } | ||
/** | ||
* Start a new session and create permissions | ||
* Used to make sure that the api is current only | ||
* @method | ||
* @name Client#startSession | ||
* @param {string} sessionId - Access Key | ||
* @param {} body - | ||
* @name Client#health | ||
* | ||
*/ | ||
Client.prototype.startSession = function(parameters) { | ||
Client.prototype.health = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -581,3 +541,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/start'; | ||
var path = '/v1'; | ||
@@ -589,13 +549,2 @@ var body; | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -609,3 +558,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); | ||
@@ -615,11 +564,11 @@ return deferred.promise; | ||
/** | ||
* List incidents for a given session | ||
* Get session details for a given exam | ||
* @method | ||
* @name Client#listIncidents | ||
* @name Client#getSession | ||
* @param {string} token - | ||
* @param {string} examId - | ||
* @param {string} sessionId - | ||
* @param {string} page - | ||
* @param {string} pageSize - | ||
* | ||
*/ | ||
Client.prototype.listIncidents = function(parameters) { | ||
Client.prototype.getSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -631,3 +580,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}'; | ||
@@ -639,15 +588,23 @@ var body; | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
return deferred.promise; | ||
} | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
path = path.replace('{exam_id}', parameters['examId']); | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['pageSize'] !== undefined) { | ||
queryParameters['page_size'] = parameters['pageSize']; | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
return deferred.promise; | ||
} | ||
@@ -668,10 +625,11 @@ | ||
/** | ||
* Creates an incident for a given session | ||
* Get agreements to sign | ||
* @method | ||
* @name Client#createIncident | ||
* @name Client#getAgreements | ||
* @param {string} token - | ||
* @param {string} sessionId - | ||
* @param {} body - | ||
* @param {string} locationId - | ||
* | ||
*/ | ||
Client.prototype.createIncident = function(parameters) { | ||
Client.prototype.getAgreements = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -683,3 +641,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
var path = '/v1/sessions/{session_id}/agreements/location/{location_id}'; | ||
@@ -691,2 +649,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['sessionId']); | ||
@@ -699,4 +666,7 @@ | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
path = path.replace('{location_id}', parameters['locationId']); | ||
if (parameters['locationId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: locationId')); | ||
return deferred.promise; | ||
} | ||
@@ -712,3 +682,3 @@ | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -718,9 +688,10 @@ return deferred.promise; | ||
/** | ||
* Will return return a list of courses for an institution | ||
* Get student details | ||
* @method | ||
* @name Client#listCourses | ||
* @name Client#getStudent | ||
* @param {string} institutionId - | ||
* @param {string} studentId - | ||
* | ||
*/ | ||
Client.prototype.listCourses = function(parameters) { | ||
Client.prototype.getStudent = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -732,3 +703,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/courses'; | ||
var path = '/v1/institutions/{institution_id}/students/{student_id}'; | ||
@@ -747,2 +718,9 @@ var body; | ||
path = path.replace('{student_id}', parameters['studentId']); | ||
if (parameters['studentId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: studentId')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -761,9 +739,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Will return detailed information about an institution | ||
* Will return return details about a single course | ||
* @method | ||
* @name Client#getInstitution | ||
* @name Client#getCourse | ||
* @param {string} courseId - | ||
* @param {string} institutionId - | ||
* | ||
*/ | ||
Client.prototype.getInstitution = function(parameters) { | ||
Client.prototype.getCourse = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -775,3 +754,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}'; | ||
var path = '/v1/institutions/{institution_id}/courses/{course_id}'; | ||
@@ -783,2 +762,9 @@ var body; | ||
path = path.replace('{course_id}', parameters['courseId']); | ||
if (parameters['courseId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: courseId')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{institution_id}', parameters['institutionId']); | ||
@@ -804,8 +790,11 @@ | ||
/** | ||
* Will return a full list of all institutions | ||
* List incidents for a given session | ||
* @method | ||
* @name Client#listInstitutions | ||
* @name Client#listIncidents | ||
* @param {string} sessionId - | ||
* @param {string} page - | ||
* @param {string} pageSize - | ||
* | ||
*/ | ||
Client.prototype.listInstitutions = function(parameters) { | ||
Client.prototype.listIncidents = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -817,3 +806,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions'; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
@@ -825,2 +814,17 @@ var body; | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
if (parameters['pageSize'] !== undefined) { | ||
queryParameters['page_size'] = parameters['pageSize']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -839,9 +843,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* List sessions for a given exam | ||
* Creates an incident for a given session | ||
* @method | ||
* @name Client#listSessions | ||
* @param {string} examId - | ||
* @name Client#createIncident | ||
* @param {string} sessionId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.listSessions = function(parameters) { | ||
Client.prototype.createIncident = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -853,3 +858,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/sessions'; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
@@ -861,9 +866,13 @@ var body; | ||
path = path.replace('{exam_id}', parameters['examId']); | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -877,3 +886,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); | ||
@@ -883,10 +892,9 @@ return deferred.promise; | ||
/** | ||
* Gets the zookeeper session history | ||
* List all exams for a course | ||
* @method | ||
* @name Client#getProcesses | ||
* @param {string} sessionId - | ||
* @param {string} zookeeperId - | ||
* @name Client#listExams | ||
* @param {string} courseId - | ||
* | ||
*/ | ||
Client.prototype.getProcesses = function(parameters) { | ||
Client.prototype.listExams = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -898,3 +906,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
var path = '/v1/courses/{course_id}/exams'; | ||
@@ -906,18 +914,9 @@ var body; | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
path = path.replace('{course_id}', parameters['courseId']); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
if (parameters['courseId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: courseId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['zookeeperId'] !== undefined) { | ||
queryParameters['zookeeper_id'] = parameters['zookeeperId']; | ||
} | ||
if (parameters['zookeeperId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: zookeeperId')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -936,10 +935,11 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Updates the session with the current running processes | ||
* This endpoint is used to get an image list for an user | ||
* @method | ||
* @name Client#sessionProcesses | ||
* @name Client#listImages | ||
* @param {string} sessionId - | ||
* @param {} body - | ||
* @param {string} clientId - | ||
* @param {string} type - | ||
* | ||
*/ | ||
Client.prototype.sessionProcesses = function(parameters) { | ||
Client.prototype.listImages = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -951,3 +951,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
@@ -966,6 +966,15 @@ var body; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
if (parameters['clientId'] !== undefined) { | ||
queryParameters['client_id'] = parameters['clientId']; | ||
} | ||
if (parameters['clientId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: clientId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['type'] !== undefined) { | ||
queryParameters['type'] = parameters['type']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -979,3 +988,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); | ||
@@ -985,11 +994,11 @@ return deferred.promise; | ||
/** | ||
* Get history of current session | ||
* This endpoint is used to upload images for a user | ||
* @method | ||
* @name Client#getAgreementHistory | ||
* @name Client#uploadImage | ||
* @param {string} token - | ||
* @param {string} sessionId - | ||
* @param {string} agreementId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.getAgreementHistory = function(parameters) { | ||
Client.prototype.uploadImage = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1001,3 +1010,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/history'; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
@@ -1025,7 +1034,4 @@ var body; | ||
path = path.replace('{agreement_id}', parameters['agreementId']); | ||
if (parameters['agreementId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: agreementId')); | ||
return deferred.promise; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
@@ -1041,3 +1047,3 @@ | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -1047,9 +1053,11 @@ return deferred.promise; | ||
/** | ||
* List students for a given exam | ||
* List all instructors for a course | ||
* @method | ||
* @name Client#listStudents | ||
* @param {string} examId - | ||
* @name Client#listInstructors | ||
* @param {string} courseId - | ||
* @param {string} page - | ||
* @param {string} pageSize - | ||
* | ||
*/ | ||
Client.prototype.listStudents = function(parameters) { | ||
Client.prototype.listInstructors = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1061,3 +1069,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/students'; | ||
var path = '/v1/courses/{course_id}/instructors'; | ||
@@ -1069,9 +1077,17 @@ var body; | ||
path = path.replace('{exam_id}', parameters['examId']); | ||
path = path.replace('{course_id}', parameters['courseId']); | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
if (parameters['courseId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: courseId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
if (parameters['pageSize'] !== undefined) { | ||
queryParameters['page_size'] = parameters['pageSize']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1090,11 +1106,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* This endpoint is used to get an image list for an user | ||
* Will return start and end time for a users media | ||
* @method | ||
* @name Client#listImages | ||
* @param {string} sessionId - | ||
* @param {string} clientId - | ||
* @param {string} type - | ||
* @name Client#videoSetup | ||
* @param {string} userId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.listImages = function(parameters) { | ||
Client.prototype.videoSetup = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1106,3 +1121,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
var path = '/v1/{userId}/videoSetup'; | ||
@@ -1114,22 +1129,13 @@ var body; | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
path = path.replace('{userId}', parameters['userId']); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
if (parameters['userId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: userId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['clientId'] !== undefined) { | ||
queryParameters['client_id'] = parameters['clientId']; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters['clientId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: clientId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['type'] !== undefined) { | ||
queryParameters['type'] = parameters['type']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1143,3 +1149,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); | ||
@@ -1149,11 +1155,10 @@ return deferred.promise; | ||
/** | ||
* This endpoint is used to upload images for a user | ||
* Start a new session and create permissions | ||
* @method | ||
* @name Client#uploadImage | ||
* @param {string} token - | ||
* @param {string} sessionId - | ||
* @name Client#startSession | ||
* @param {string} sessionId - Access Key | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.uploadImage = function(parameters) { | ||
Client.prototype.startSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1165,3 +1170,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
var path = '/v1/sessions/{session_id}/start'; | ||
@@ -1173,11 +1178,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['sessionId']); | ||
@@ -1207,11 +1203,9 @@ | ||
/** | ||
* List all instructors for a course | ||
* List students for a given exam | ||
* @method | ||
* @name Client#listInstructors | ||
* @param {string} courseId - | ||
* @param {string} page - | ||
* @param {string} pageSize - | ||
* @name Client#listStudents | ||
* @param {string} examId - | ||
* | ||
*/ | ||
Client.prototype.listInstructors = function(parameters) { | ||
Client.prototype.listStudents = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1223,3 +1217,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/instructors'; | ||
var path = '/v1/exams/{exam_id}/students'; | ||
@@ -1231,17 +1225,9 @@ var body; | ||
path = path.replace('{course_id}', parameters['courseId']); | ||
path = path.replace('{exam_id}', parameters['examId']); | ||
if (parameters['courseId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: courseId')); | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
if (parameters['pageSize'] !== undefined) { | ||
queryParameters['page_size'] = parameters['pageSize']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1260,10 +1246,8 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Get instructor details | ||
* Will return a full list of all institutions | ||
* @method | ||
* @name Client#getInstructor | ||
* @param {string} courseId - | ||
* @param {string} instructorId - | ||
* @name Client#listInstitutions | ||
* | ||
*/ | ||
Client.prototype.getInstructor = function(parameters) { | ||
Client.prototype.listInstitutions = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1275,3 +1259,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/instructors/{instructor_id}'; | ||
var path = '/v1/institutions'; | ||
@@ -1283,16 +1267,2 @@ var body; | ||
path = path.replace('{course_id}', parameters['courseId']); | ||
if (parameters['courseId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: courseId')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{instructor_id}', parameters['instructorId']); | ||
if (parameters['instructorId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: instructorId')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1404,8 +1374,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* 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} sessionId - Access Key | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.health = function(parameters) { | ||
Client.prototype.joinSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1417,3 +1389,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1'; | ||
var path = '/v1/sessions/{session_id}/join'; | ||
@@ -1425,2 +1397,13 @@ var body; | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1434,3 +1417,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); | ||
@@ -1440,11 +1423,9 @@ return deferred.promise; | ||
/** | ||
* Get agreements to sign | ||
* List sessions for a given exam | ||
* @method | ||
* @name Client#getAgreements | ||
* @param {string} token - | ||
* @param {string} sessionId - | ||
* @param {string} locationId - | ||
* @name Client#listSessions | ||
* @param {string} examId - | ||
* | ||
*/ | ||
Client.prototype.getAgreements = function(parameters) { | ||
Client.prototype.listSessions = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1456,3 +1437,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/agreements/location/{location_id}'; | ||
var path = '/v1/exams/{exam_id}/sessions'; | ||
@@ -1464,25 +1445,9 @@ var body; | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
path = path.replace('{exam_id}', parameters['examId']); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{location_id}', parameters['locationId']); | ||
if (parameters['locationId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: locationId')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1572,10 +1537,9 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Get all the incident types | ||
* This endpoint is used to get an image list for an proctor | ||
* @method | ||
* @name Client#getIncidentTypes | ||
* @param {string} page - | ||
* @param {string} pageSize - | ||
* @name Client#listProctorImages | ||
* @param {string} userId - | ||
* | ||
*/ | ||
Client.prototype.getIncidentTypes = function(parameters) { | ||
Client.prototype.listProctorImages = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1587,3 +1551,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/incidents/types'; | ||
var path = '/v1/proctor/{user_id}/images'; | ||
@@ -1595,8 +1559,7 @@ var body; | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
path = path.replace('{user_id}', parameters['userId']); | ||
if (parameters['pageSize'] !== undefined) { | ||
queryParameters['page_size'] = parameters['pageSize']; | ||
if (parameters['userId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: userId')); | ||
return deferred.promise; | ||
} | ||
@@ -1617,5 +1580,5 @@ | ||
/** | ||
* Will return start and end time for a users media | ||
* This endpoint is used to upload headshot for a proctor | ||
* @method | ||
* @name Client#videoSetup | ||
* @name Client#uploadProctorImage | ||
* @param {string} userId - | ||
@@ -1625,3 +1588,3 @@ * @param {} body - | ||
*/ | ||
Client.prototype.videoSetup = function(parameters) { | ||
Client.prototype.uploadProctorImage = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1633,3 +1596,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/{userId}/videoSetup'; | ||
var path = '/v1/proctor/{user_id}/images'; | ||
@@ -1641,3 +1604,3 @@ var body; | ||
path = path.replace('{userId}', parameters['userId']); | ||
path = path.replace('{user_id}', parameters['userId']); | ||
@@ -1665,3 +1628,40 @@ if (parameters['userId'] === undefined) { | ||
}; | ||
/** | ||
* Used to login and authenticate proctors | ||
* @method | ||
* @name Client#proctorLogin | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.proctorLogin = function(parameters) { | ||
if (parameters === undefined) { | ||
parameters = {}; | ||
} | ||
var deferred = Q.defer(); | ||
var domain = this.domain; | ||
var path = '/v1/proctors/login'; | ||
var body; | ||
var queryParameters = {}; | ||
var headers = {}; | ||
var form = {}; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
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; | ||
}; | ||
return Client; | ||
@@ -1668,0 +1668,0 @@ })(); |
@@ -1,1 +0,1 @@ | ||
{"name":"@smarterservices/sp-public-client","version":"0.0.78","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.80","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} |