@smarterservices/sp-public-client
Advanced tools
Comparing version 0.0.76 to 0.0.77
830
index.js
@@ -66,9 +66,10 @@ /*jshint -W069 */ | ||
/** | ||
* List all exams for a course | ||
* Cancel session for a given exam | ||
* @method | ||
* @name Client#listExams | ||
* @param {string} courseId - | ||
* @name Client#cancelSession | ||
* @param {string} examId - | ||
* @param {string} sessionId - | ||
* | ||
*/ | ||
Client.prototype.listExams = function(parameters) { | ||
Client.prototype.cancelSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -80,3 +81,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/exams'; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}/cancel'; | ||
@@ -88,9 +89,16 @@ 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; | ||
} | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -104,3 +112,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,10 +118,10 @@ return deferred.promise; | ||
/** | ||
* Get instructor details | ||
* Gets the zookeeper session history | ||
* @method | ||
* @name Client#getInstructor | ||
* @param {string} courseId - | ||
* @param {string} instructorId - | ||
* @name Client#getProcesses | ||
* @param {string} sessionId - | ||
* @param {string} zookeeperId - | ||
* | ||
*/ | ||
Client.prototype.getInstructor = function(parameters) { | ||
Client.prototype.getProcesses = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -125,3 +133,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/instructors/{instructor_id}'; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
@@ -133,13 +141,15 @@ var body; | ||
path = path.replace('{course_id}', parameters['courseId']); | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['courseId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: courseId')); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{instructor_id}', parameters['instructorId']); | ||
if (parameters['zookeeperId'] !== undefined) { | ||
queryParameters['zookeeper_id'] = parameters['zookeeperId']; | ||
} | ||
if (parameters['instructorId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: instructorId')); | ||
if (parameters['zookeeperId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: zookeeperId')); | ||
return deferred.promise; | ||
@@ -161,10 +171,10 @@ } | ||
/** | ||
* Get all the incident types | ||
* Updates the session with the current running processes | ||
* @method | ||
* @name Client#getIncidentTypes | ||
* @param {string} page - | ||
* @param {string} pageSize - | ||
* @name Client#sessionProcesses | ||
* @param {string} sessionId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.getIncidentTypes = function(parameters) { | ||
Client.prototype.sessionProcesses = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -176,3 +186,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/incidents/types'; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
@@ -184,8 +194,11 @@ var body; | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['pageSize'] !== undefined) { | ||
queryParameters['page_size'] = parameters['pageSize']; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
@@ -201,3 +214,3 @@ | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('PUT', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -207,10 +220,11 @@ return deferred.promise; | ||
/** | ||
* Will return return details about a single course | ||
* Get exam details | ||
* @method | ||
* @name Client#getCourse | ||
* @name Client#getExam | ||
* @param {string} courseId - | ||
* @param {string} institutionId - | ||
* @param {string} examId - | ||
* @param {string} enrollmentId - | ||
* | ||
*/ | ||
Client.prototype.getCourse = function(parameters) { | ||
Client.prototype.getExam = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -222,3 +236,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/courses/{course_id}'; | ||
var path = '/v1/courses/{course_id}/exams/{exam_id}'; | ||
@@ -237,9 +251,18 @@ var body; | ||
path = path.replace('{institution_id}', parameters['institutionId']); | ||
path = path.replace('{exam_id}', parameters['examId']); | ||
if (parameters['institutionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institutionId')); | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['enrollmentId'] !== undefined) { | ||
queryParameters['enrollment_id'] = parameters['enrollmentId']; | ||
} | ||
if (parameters['enrollmentId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: enrollmentId')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -258,2 +281,39 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* 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; | ||
}; | ||
/** | ||
* Get agreements to sign | ||
@@ -317,9 +377,9 @@ * @method | ||
/** | ||
* List sessions for a given exam | ||
* This endpoint is used to get an image list for an proctor | ||
* @method | ||
* @name Client#listSessions | ||
* @param {string} examId - | ||
* @name Client#listProctorImages | ||
* @param {string} userId - | ||
* | ||
*/ | ||
Client.prototype.listSessions = function(parameters) { | ||
Client.prototype.listProctorImages = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -331,3 +391,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/sessions'; | ||
var path = '/v1/proctor/{user_id}/images'; | ||
@@ -339,6 +399,6 @@ var body; | ||
path = path.replace('{exam_id}', parameters['examId']); | ||
path = path.replace('{user_id}', parameters['userId']); | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
if (parameters['userId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: userId')); | ||
return deferred.promise; | ||
@@ -360,10 +420,10 @@ } | ||
/** | ||
* Start a new session and create permissions | ||
* This endpoint is used to upload headshot for a proctor | ||
* @method | ||
* @name Client#startSession | ||
* @param {string} sessionId - Access Key | ||
* @name Client#uploadProctorImage | ||
* @param {string} userId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.startSession = function(parameters) { | ||
Client.prototype.uploadProctorImage = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -375,3 +435,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/start'; | ||
var path = '/v1/proctor/{user_id}/images'; | ||
@@ -383,6 +443,6 @@ var body; | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
path = path.replace('{user_id}', 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; | ||
@@ -408,11 +468,11 @@ } | ||
/** | ||
* Get exam details | ||
* This endpoint is used to get an image list for an user | ||
* @method | ||
* @name Client#getExam | ||
* @param {string} courseId - | ||
* @param {string} examId - | ||
* @param {string} enrollmentId - | ||
* @name Client#listImages | ||
* @param {string} sessionId - | ||
* @param {string} clientId - | ||
* @param {string} type - | ||
* | ||
*/ | ||
Client.prototype.getExam = function(parameters) { | ||
Client.prototype.listImages = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -424,3 +484,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/exams/{exam_id}'; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
@@ -432,25 +492,22 @@ var body; | ||
path = path.replace('{course_id}', parameters['courseId']); | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['courseId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: courseId')); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{exam_id}', parameters['examId']); | ||
if (parameters['clientId'] !== undefined) { | ||
queryParameters['client_id'] = parameters['clientId']; | ||
} | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
if (parameters['clientId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: clientId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['enrollmentId'] !== undefined) { | ||
queryParameters['enrollment_id'] = parameters['enrollmentId']; | ||
if (parameters['type'] !== undefined) { | ||
queryParameters['type'] = parameters['type']; | ||
} | ||
if (parameters['enrollmentId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: enrollmentId')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -469,10 +526,11 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Get student details | ||
* This endpoint is used to upload images for a user | ||
* @method | ||
* @name Client#getStudent | ||
* @param {string} institutionId - | ||
* @param {string} studentId - | ||
* @name Client#uploadImage | ||
* @param {string} token - | ||
* @param {string} sessionId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.getStudent = function(parameters) { | ||
Client.prototype.uploadImage = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -484,3 +542,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/students/{student_id}'; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
@@ -492,16 +550,22 @@ var body; | ||
path = path.replace('{institution_id}', parameters['institutionId']); | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
if (parameters['institutionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institutionId')); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{student_id}', parameters['studentId']); | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['studentId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: studentId')); | ||
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) { | ||
@@ -515,3 +579,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); | ||
@@ -521,8 +585,10 @@ return deferred.promise; | ||
/** | ||
* Will return a full list of all institutions | ||
* Join an existing session and get permissions | ||
* @method | ||
* @name Client#listInstitutions | ||
* @name Client#joinSession | ||
* @param {string} sessionId - Access Key | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.listInstitutions = function(parameters) { | ||
Client.prototype.joinSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -534,3 +600,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions'; | ||
var path = '/v1/sessions/{session_id}/join'; | ||
@@ -542,2 +608,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) { | ||
@@ -551,3 +628,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); | ||
@@ -557,11 +634,10 @@ return deferred.promise; | ||
/** | ||
* Get session details for a given exam | ||
* Will return return details about a single course | ||
* @method | ||
* @name Client#getSession | ||
* @param {string} token - | ||
* @param {string} examId - | ||
* @param {string} sessionId - | ||
* @name Client#getCourse | ||
* @param {string} courseId - | ||
* @param {string} institutionId - | ||
* | ||
*/ | ||
Client.prototype.getSession = function(parameters) { | ||
Client.prototype.getCourse = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -573,3 +649,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}'; | ||
var path = '/v1/institutions/{institution_id}/courses/{course_id}'; | ||
@@ -581,25 +657,16 @@ 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; | ||
} | ||
path = path.replace('{exam_id}', parameters['examId']); | ||
path = path.replace('{institution_id}', parameters['institutionId']); | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
if (parameters['institutionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institutionId')); | ||
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; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -618,6 +685,6 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* List incidents for a given session | ||
* List all instructors for a course | ||
* @method | ||
* @name Client#listIncidents | ||
* @param {string} sessionId - | ||
* @name Client#listInstructors | ||
* @param {string} courseId - | ||
* @param {string} page - | ||
@@ -627,3 +694,3 @@ * @param {string} pageSize - | ||
*/ | ||
Client.prototype.listIncidents = function(parameters) { | ||
Client.prototype.listInstructors = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -635,3 +702,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
var path = '/v1/courses/{course_id}/instructors'; | ||
@@ -643,6 +710,6 @@ 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; | ||
@@ -672,10 +739,11 @@ } | ||
/** | ||
* Creates an incident for a given session | ||
* Get session details for a given exam | ||
* @method | ||
* @name Client#createIncident | ||
* @name Client#getSession | ||
* @param {string} token - | ||
* @param {string} examId - | ||
* @param {string} sessionId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.createIncident = function(parameters) { | ||
Client.prototype.getSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -687,3 +755,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}'; | ||
@@ -695,2 +763,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('{exam_id}', parameters['examId']); | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
@@ -703,6 +787,2 @@ | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -716,3 +796,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); | ||
@@ -722,10 +802,13 @@ return deferred.promise; | ||
/** | ||
* Will return an array of videos that contained signed urls and other metadata | ||
* Sign an agreement | ||
* @method | ||
* @name Client#getVideos | ||
* @param {string} userId - | ||
* @name Client#signAgreements | ||
* @param {string} token - | ||
* @param {string} sessionId - | ||
* @param {string} agreementId - | ||
* @param {string} versionId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.getVideos = function(parameters) { | ||
Client.prototype.signAgreements = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -737,3 +820,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/{userId}/videos'; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/versions/{version_id}/sign'; | ||
@@ -745,45 +828,31 @@ var body; | ||
path = path.replace('{userId}', parameters['userId']); | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
if (parameters['userId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: userId')); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters.$queryParameters) { | ||
Object.keys(parameters.$queryParameters) | ||
.forEach(function(parameterName) { | ||
var parameter = parameters.$queryParameters[parameterName]; | ||
queryParameters[parameterName] = parameter; | ||
}); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
return deferred.promise; | ||
} | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
path = path.replace('{agreement_id}', parameters['agreementId']); | ||
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['agreementId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: agreementId')); | ||
return deferred.promise; | ||
} | ||
var deferred = Q.defer(); | ||
var domain = this.domain; | ||
var path = '/v1/proctors/login'; | ||
path = path.replace('{version_id}', parameters['versionId']); | ||
var body; | ||
var queryParameters = {}; | ||
var headers = {}; | ||
var form = {}; | ||
if (parameters['versionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: versionId')); | ||
return deferred.promise; | ||
} | ||
@@ -807,6 +876,5 @@ if (parameters['body'] !== undefined) { | ||
/** | ||
* List all instructors for a course | ||
* Get all the incident types | ||
* @method | ||
* @name Client#listInstructors | ||
* @param {string} courseId - | ||
* @name Client#getIncidentTypes | ||
* @param {string} page - | ||
@@ -816,3 +884,3 @@ * @param {string} pageSize - | ||
*/ | ||
Client.prototype.listInstructors = function(parameters) { | ||
Client.prototype.getIncidentTypes = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -824,3 +892,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/instructors'; | ||
var path = '/v1/incidents/types'; | ||
@@ -832,9 +900,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; | ||
} | ||
if (parameters['page'] !== undefined) { | ||
@@ -861,13 +922,9 @@ queryParameters['page'] = parameters['page']; | ||
/** | ||
* Sign an agreement | ||
* List all exams for a course | ||
* @method | ||
* @name Client#signAgreements | ||
* @param {string} token - | ||
* @param {string} sessionId - | ||
* @param {string} agreementId - | ||
* @param {string} versionId - | ||
* @param {} body - | ||
* @name Client#listExams | ||
* @param {string} courseId - | ||
* | ||
*/ | ||
Client.prototype.signAgreements = function(parameters) { | ||
Client.prototype.listExams = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -879,3 +936,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/versions/{version_id}/sign'; | ||
var path = '/v1/courses/{course_id}/exams'; | ||
@@ -887,36 +944,9 @@ 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; | ||
} | ||
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('{agreement_id}', parameters['agreementId']); | ||
if (parameters['agreementId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: agreementId')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{version_id}', parameters['versionId']); | ||
if (parameters['versionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: versionId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -930,3 +960,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); | ||
@@ -936,9 +966,10 @@ return deferred.promise; | ||
/** | ||
* Will return detailed information about an institution | ||
* Get student details | ||
* @method | ||
* @name Client#getInstitution | ||
* @name Client#getStudent | ||
* @param {string} institutionId - | ||
* @param {string} studentId - | ||
* | ||
*/ | ||
Client.prototype.getInstitution = function(parameters) { | ||
Client.prototype.getStudent = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -950,3 +981,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}'; | ||
var path = '/v1/institutions/{institution_id}/students/{student_id}'; | ||
@@ -965,2 +996,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) { | ||
@@ -979,10 +1017,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Gets the zookeeper session history | ||
* Get instructor details | ||
* @method | ||
* @name Client#getProcesses | ||
* @param {string} sessionId - | ||
* @param {string} zookeeperId - | ||
* @name Client#getInstructor | ||
* @param {string} courseId - | ||
* @param {string} instructorId - | ||
* | ||
*/ | ||
Client.prototype.getProcesses = function(parameters) { | ||
Client.prototype.getInstructor = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -994,3 +1032,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
var path = '/v1/courses/{course_id}/instructors/{instructor_id}'; | ||
@@ -1002,15 +1040,13 @@ 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']; | ||
} | ||
path = path.replace('{instructor_id}', parameters['instructorId']); | ||
if (parameters['zookeeperId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: zookeeperId')); | ||
if (parameters['instructorId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: instructorId')); | ||
return deferred.promise; | ||
@@ -1032,10 +1068,11 @@ } | ||
/** | ||
* Updates the session with the current running processes | ||
* List incidents for a given session | ||
* @method | ||
* @name Client#sessionProcesses | ||
* @name Client#listIncidents | ||
* @param {string} sessionId - | ||
* @param {} body - | ||
* @param {string} page - | ||
* @param {string} pageSize - | ||
* | ||
*/ | ||
Client.prototype.sessionProcesses = function(parameters) { | ||
Client.prototype.listIncidents = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1047,3 +1084,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
@@ -1062,46 +1099,10 @@ var body; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
if (parameters.$queryParameters) { | ||
Object.keys(parameters.$queryParameters) | ||
.forEach(function(parameterName) { | ||
var parameter = parameters.$queryParameters[parameterName]; | ||
queryParameters[parameterName] = parameter; | ||
}); | ||
if (parameters['pageSize'] !== undefined) { | ||
queryParameters['page_size'] = parameters['pageSize']; | ||
} | ||
this.request('PUT', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
return deferred.promise; | ||
}; | ||
/** | ||
* Will return return a list of courses for an institution | ||
* @method | ||
* @name Client#listCourses | ||
* @param {string} institutionId - | ||
* | ||
*/ | ||
Client.prototype.listCourses = function(parameters) { | ||
if (parameters === undefined) { | ||
parameters = {}; | ||
} | ||
var deferred = Q.defer(); | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/courses'; | ||
var body; | ||
var queryParameters = {}; | ||
var headers = {}; | ||
var form = {}; | ||
path = path.replace('{institution_id}', parameters['institutionId']); | ||
if (parameters['institutionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institutionId')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1120,9 +1121,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* This endpoint is used to get an image list for an proctor | ||
* Creates an incident for a given session | ||
* @method | ||
* @name Client#listProctorImages | ||
* @param {string} userId - | ||
* @name Client#createIncident | ||
* @param {string} sessionId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.listProctorImages = function(parameters) { | ||
Client.prototype.createIncident = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1134,3 +1136,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/proctor/{user_id}/images'; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
@@ -1142,9 +1144,13 @@ var body; | ||
path = path.replace('{user_id}', parameters['userId']); | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['userId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: userId')); | ||
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) { | ||
@@ -1158,3 +1164,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); | ||
@@ -1164,10 +1170,9 @@ return deferred.promise; | ||
/** | ||
* 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) { | ||
@@ -1179,3 +1184,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/proctor/{user_id}/images'; | ||
var path = '/v1/institutions/{institution_id}'; | ||
@@ -1187,13 +1192,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) { | ||
@@ -1207,3 +1208,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); | ||
@@ -1213,9 +1214,9 @@ return deferred.promise; | ||
/** | ||
* List students for a given exam | ||
* List sessions for a given exam | ||
* @method | ||
* @name Client#listStudents | ||
* @name Client#listSessions | ||
* @param {string} examId - | ||
* | ||
*/ | ||
Client.prototype.listStudents = function(parameters) { | ||
Client.prototype.listSessions = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1227,3 +1228,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/students'; | ||
var path = '/v1/exams/{exam_id}/sessions'; | ||
@@ -1255,11 +1256,9 @@ var body; | ||
/** | ||
* Get history of current session | ||
* Will return return a list of courses for an institution | ||
* @method | ||
* @name Client#getAgreementHistory | ||
* @param {string} token - | ||
* @param {string} sessionId - | ||
* @param {string} agreementId - | ||
* @name Client#listCourses | ||
* @param {string} institutionId - | ||
* | ||
*/ | ||
Client.prototype.getAgreementHistory = function(parameters) { | ||
Client.prototype.listCourses = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1271,3 +1270,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/history'; | ||
var path = '/v1/institutions/{institution_id}/courses'; | ||
@@ -1279,25 +1278,9 @@ var body; | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
path = path.replace('{institution_id}', parameters['institutionId']); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
if (parameters['institutionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institutionId')); | ||
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('{agreement_id}', parameters['agreementId']); | ||
if (parameters['agreementId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: agreementId')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1364,11 +1347,8 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* This endpoint is used to get an image list for an user | ||
* Used to make sure that the api is current only | ||
* @method | ||
* @name Client#listImages | ||
* @param {string} sessionId - | ||
* @param {string} clientId - | ||
* @param {string} type - | ||
* @name Client#health | ||
* | ||
*/ | ||
Client.prototype.listImages = function(parameters) { | ||
Client.prototype.health = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1380,3 +1360,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
var path = '/v1'; | ||
@@ -1388,22 +1368,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['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) { | ||
@@ -1422,11 +1382,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* This endpoint is used to upload images for a user | ||
* Will return an array of videos that contained signed urls and other metadata | ||
* @method | ||
* @name Client#uploadImage | ||
* @param {string} token - | ||
* @param {string} sessionId - | ||
* @name Client#getVideos | ||
* @param {string} userId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.uploadImage = function(parameters) { | ||
Client.prototype.getVideos = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1438,3 +1397,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
var path = '/v1/{userId}/videos'; | ||
@@ -1446,18 +1405,9 @@ var body; | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
path = path.replace('{userId}', parameters['userId']); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
if (parameters['userId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: userId')); | ||
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; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
@@ -1480,10 +1430,9 @@ body = parameters['body']; | ||
/** | ||
* Will return start and end time for a users media | ||
* List students for a given exam | ||
* @method | ||
* @name Client#videoSetup | ||
* @param {string} userId - | ||
* @param {} body - | ||
* @name Client#listStudents | ||
* @param {string} examId - | ||
* | ||
*/ | ||
Client.prototype.videoSetup = function(parameters) { | ||
Client.prototype.listStudents = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1495,3 +1444,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/{userId}/videoSetup'; | ||
var path = '/v1/exams/{exam_id}/students'; | ||
@@ -1503,13 +1452,9 @@ var body; | ||
path = path.replace('{userId}', parameters['userId']); | ||
path = path.replace('{exam_id}', parameters['examId']); | ||
if (parameters['userId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: userId')); | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1523,3 +1468,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); | ||
@@ -1529,5 +1474,5 @@ return deferred.promise; | ||
/** | ||
* Join an existing session and get permissions | ||
* Start a new session and create permissions | ||
* @method | ||
* @name Client#joinSession | ||
* @name Client#startSession | ||
* @param {string} sessionId - Access Key | ||
@@ -1537,3 +1482,3 @@ * @param {} body - | ||
*/ | ||
Client.prototype.joinSession = function(parameters) { | ||
Client.prototype.startSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1545,3 +1490,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/join'; | ||
var path = '/v1/sessions/{session_id}/start'; | ||
@@ -1577,10 +1522,11 @@ var body; | ||
/** | ||
* Cancel session for a given exam | ||
* Get history of current session | ||
* @method | ||
* @name Client#cancelSession | ||
* @param {string} examId - | ||
* @name Client#getAgreementHistory | ||
* @param {string} token - | ||
* @param {string} sessionId - | ||
* @param {string} agreementId - | ||
* | ||
*/ | ||
Client.prototype.cancelSession = function(parameters) { | ||
Client.prototype.getAgreementHistory = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1592,3 +1538,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}/cancel'; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/history'; | ||
@@ -1600,6 +1546,8 @@ var body; | ||
path = path.replace('{exam_id}', parameters['examId']); | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
return deferred.promise; | ||
@@ -1615,2 +1563,9 @@ } | ||
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) { | ||
@@ -1624,3 +1579,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); | ||
@@ -1630,8 +1585,8 @@ return deferred.promise; | ||
/** | ||
* Used to make sure that the api is current only | ||
* Will return a full list of all institutions | ||
* @method | ||
* @name Client#health | ||
* @name Client#listInstitutions | ||
* | ||
*/ | ||
Client.prototype.health = function(parameters) { | ||
Client.prototype.listInstitutions = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1643,3 +1598,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1'; | ||
var path = '/v1/institutions'; | ||
@@ -1663,3 +1618,48 @@ var body; | ||
}; | ||
/** | ||
* Will return start and end time for a users media | ||
* @method | ||
* @name Client#videoSetup | ||
* @param {string} userId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.videoSetup = function(parameters) { | ||
if (parameters === undefined) { | ||
parameters = {}; | ||
} | ||
var deferred = Q.defer(); | ||
var domain = this.domain; | ||
var path = '/v1/{userId}/videoSetup'; | ||
var body; | ||
var queryParameters = {}; | ||
var headers = {}; | ||
var form = {}; | ||
path = path.replace('{userId}', parameters['userId']); | ||
if (parameters['userId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: userId')); | ||
return deferred.promise; | ||
} | ||
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; | ||
@@ -1666,0 +1666,0 @@ })(); |
@@ -1,1 +0,1 @@ | ||
{"name":"@smarterservices/sp-public-client","version":"0.0.76","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.77","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} |