@smarterservices/sp-public-client
Advanced tools
Comparing version 0.0.62 to 0.0.63
688
index.js
@@ -66,11 +66,10 @@ /*jshint -W069 */ | ||
/** | ||
* List all instructors for a course | ||
* Will return return details about a single course | ||
* @method | ||
* @name Client#listInstructors | ||
* @name Client#getCourse | ||
* @param {string} course_id - | ||
* @param {string} page - | ||
* @param {string} page_size - | ||
* @param {string} institution_id - | ||
* | ||
*/ | ||
Client.prototype.listInstructors = function(parameters) { | ||
Client.prototype.getCourse = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -82,3 +81,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/instructors'; | ||
var path = '/v1/institutions/{institution_id}/courses/{course_id}'; | ||
@@ -97,8 +96,7 @@ var body; | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
path = path.replace('{institution_id}', parameters['institution_id']); | ||
if (parameters['page_size'] !== undefined) { | ||
queryParameters['page_size'] = parameters['page_size']; | ||
if (parameters['institution_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institution_id')); | ||
return deferred.promise; | ||
} | ||
@@ -119,10 +117,10 @@ | ||
/** | ||
* Gets the zookeeper session history | ||
* Start a new session and create permissions | ||
* @method | ||
* @name Client#getProcesses | ||
* @param {string} session_id - | ||
* @param {string} zookeeper_id - | ||
* @name Client#startSession | ||
* @param {string} session_id - Access Key | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.getProcesses = function(parameters) { | ||
Client.prototype.startSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -134,3 +132,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
var path = '/v1/sessions/{session_id}/start'; | ||
@@ -149,11 +147,6 @@ var body; | ||
if (parameters['zookeeper_id'] !== undefined) { | ||
queryParameters['zookeeper_id'] = parameters['zookeeper_id']; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters['zookeeper_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: zookeeper_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -167,3 +160,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); | ||
@@ -173,10 +166,10 @@ return deferred.promise; | ||
/** | ||
* Updates the session with the current running processes | ||
* Returns the media token needed for the client to connect to the session. | ||
* @method | ||
* @name Client#sessionProcesses | ||
* @name Client#getMediaToken | ||
* @param {string} session_id - | ||
* @param {} body - | ||
* @param {string} client_id - | ||
* | ||
*/ | ||
Client.prototype.sessionProcesses = function(parameters) { | ||
Client.prototype.getMediaToken = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -188,3 +181,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
var path = '/v1/sessions/{session_id}/clients/{client_id}/mediatoken'; | ||
@@ -203,4 +196,7 @@ var body; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
path = path.replace('{client_id}', parameters['client_id']); | ||
if (parameters['client_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: client_id')); | ||
return deferred.promise; | ||
} | ||
@@ -216,3 +212,3 @@ | ||
this.request('PUT', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -222,10 +218,9 @@ return deferred.promise; | ||
/** | ||
* Get instructor details | ||
* This endpoint is used to get an image list for an proctor | ||
* @method | ||
* @name Client#getInstructor | ||
* @param {string} course_id - | ||
* @param {string} instructor_id - | ||
* @name Client#listProctorImages | ||
* @param {string} user_id - | ||
* | ||
*/ | ||
Client.prototype.getInstructor = function(parameters) { | ||
Client.prototype.listProctorImages = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -237,3 +232,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/instructors/{instructor_id}'; | ||
var path = '/v1/proctor/{user_id}/images'; | ||
@@ -245,16 +240,9 @@ var body; | ||
path = path.replace('{course_id}', parameters['course_id']); | ||
path = path.replace('{user_id}', parameters['user_id']); | ||
if (parameters['course_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: course_id')); | ||
if (parameters['user_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: user_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) { | ||
@@ -273,9 +261,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* This endpoint is used to get an image list for an proctor | ||
* This endpoint is used to upload headshot for a proctor | ||
* @method | ||
* @name Client#listProctorImages | ||
* @name Client#uploadProctorImage | ||
* @param {string} user_id - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.listProctorImages = function(parameters) { | ||
Client.prototype.uploadProctorImage = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -301,2 +290,6 @@ parameters = {}; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -310,3 +303,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); | ||
@@ -316,10 +309,11 @@ return deferred.promise; | ||
/** | ||
* This endpoint is used to upload headshot for a proctor | ||
* List incidents for a given session | ||
* @method | ||
* @name Client#uploadProctorImage | ||
* @param {string} user_id - | ||
* @param {} body - | ||
* @name Client#listIncidents | ||
* @param {string} session_id - | ||
* @param {string} page - | ||
* @param {string} page_size - | ||
* | ||
*/ | ||
Client.prototype.uploadProctorImage = function(parameters) { | ||
Client.prototype.listIncidents = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -331,3 +325,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/proctor/{user_id}/images'; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
@@ -339,13 +333,17 @@ 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['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
if (parameters['page_size'] !== undefined) { | ||
queryParameters['page_size'] = parameters['page_size']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -359,3 +357,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); | ||
@@ -365,8 +363,10 @@ return deferred.promise; | ||
/** | ||
* Used to make sure that the api is current only | ||
* Creates an incident for a given session | ||
* @method | ||
* @name Client#health | ||
* @name Client#createIncident | ||
* @param {string} session_id - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.health = function(parameters) { | ||
Client.prototype.createIncident = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -378,3 +378,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1'; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
@@ -386,2 +386,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) { | ||
@@ -395,3 +406,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); | ||
@@ -401,10 +412,9 @@ return deferred.promise; | ||
/** | ||
* Get student details | ||
* Will return detailed information about an institution | ||
* @method | ||
* @name Client#getStudent | ||
* @name Client#getInstitution | ||
* @param {string} institution_id - | ||
* @param {string} student_id - | ||
* | ||
*/ | ||
Client.prototype.getStudent = function(parameters) { | ||
Client.prototype.getInstitution = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -416,3 +426,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/students/{student_id}'; | ||
var path = '/v1/institutions/{institution_id}'; | ||
@@ -431,9 +441,2 @@ var body; | ||
path = path.replace('{student_id}', parameters['student_id']); | ||
if (parameters['student_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: student_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -510,9 +513,9 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Will return detailed information about an institution | ||
* List students for a given exam | ||
* @method | ||
* @name Client#getInstitution | ||
* @param {string} institution_id - | ||
* @name Client#listStudents | ||
* @param {string} exam_id - | ||
* | ||
*/ | ||
Client.prototype.getInstitution = function(parameters) { | ||
Client.prototype.listStudents = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -524,3 +527,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}'; | ||
var path = '/v1/exams/{exam_id}/students'; | ||
@@ -532,6 +535,6 @@ var body; | ||
path = path.replace('{institution_id}', parameters['institution_id']); | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
if (parameters['institution_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institution_id')); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
return deferred.promise; | ||
@@ -553,10 +556,43 @@ } | ||
/** | ||
* Returns the media token needed for the client to connect to the session. | ||
* Used to make sure that the api is current only | ||
* @method | ||
* @name Client#getMediaToken | ||
* @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) { | ||
Object.keys(parameters.$queryParameters) | ||
.forEach(function(parameterName) { | ||
var parameter = parameters.$queryParameters[parameterName]; | ||
queryParameters[parameterName] = parameter; | ||
}); | ||
} | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
return deferred.promise; | ||
}; | ||
/** | ||
* This endpoint is used to get an image list for an user | ||
* @method | ||
* @name Client#listImages | ||
* @param {string} session_id - | ||
* @param {string} client_id - | ||
* @param {string} type - | ||
* | ||
*/ | ||
Client.prototype.getMediaToken = function(parameters) { | ||
Client.prototype.listImages = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -568,3 +604,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/clients/{client_id}/mediatoken'; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
@@ -583,3 +619,5 @@ var body; | ||
path = path.replace('{client_id}', parameters['client_id']); | ||
if (parameters['client_id'] !== undefined) { | ||
queryParameters['client_id'] = parameters['client_id']; | ||
} | ||
@@ -591,2 +629,6 @@ if (parameters['client_id'] === undefined) { | ||
if (parameters['type'] !== undefined) { | ||
queryParameters['type'] = parameters['type']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -605,13 +647,11 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Sign an agreement | ||
* This endpoint is used to upload images for a user | ||
* @method | ||
* @name Client#signAgreements | ||
* @name Client#uploadImage | ||
* @param {string} token - | ||
* @param {string} session_id - | ||
* @param {string} agreement_id - | ||
* @param {string} version_id - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.signAgreements = function(parameters) { | ||
Client.prototype.uploadImage = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -623,3 +663,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}/images'; | ||
@@ -647,16 +687,2 @@ var body; | ||
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) { | ||
@@ -679,11 +705,10 @@ body = parameters['body']; | ||
/** | ||
* Get agreements to sign | ||
* Get all the incident types | ||
* @method | ||
* @name Client#getAgreements | ||
* @param {string} token - | ||
* @param {string} session_id - | ||
* @param {string} location_id - | ||
* @name Client#getIncidentTypes | ||
* @param {string} page - | ||
* @param {string} page_size - | ||
* | ||
*/ | ||
Client.prototype.getAgreements = function(parameters) { | ||
Client.prototype.getIncidentTypes = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -695,3 +720,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/agreements/location/{location_id}'; | ||
var path = '/v1/incidents/types'; | ||
@@ -703,25 +728,10 @@ var body; | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
return deferred.promise; | ||
if (parameters['page_size'] !== undefined) { | ||
queryParameters['page_size'] = parameters['page_size']; | ||
} | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{location_id}', parameters['location_id']); | ||
if (parameters['location_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: location_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -785,9 +795,9 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* List students for a given exam | ||
* Used to login and authenticate proctors | ||
* @method | ||
* @name Client#listStudents | ||
* @param {string} exam_id - | ||
* @name Client#proctorLogin | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.listStudents = function(parameters) { | ||
Client.prototype.proctorLogin = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -799,3 +809,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/students'; | ||
var path = '/v1/proctors/login'; | ||
@@ -807,7 +817,4 @@ var body; | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
return deferred.promise; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
@@ -823,3 +830,3 @@ | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -829,10 +836,11 @@ return deferred.promise; | ||
/** | ||
* Will return return details about a single course | ||
* Get session details for a given exam | ||
* @method | ||
* @name Client#getCourse | ||
* @param {string} course_id - | ||
* @param {string} institution_id - | ||
* @name Client#getSession | ||
* @param {string} token - | ||
* @param {string} exam_id - | ||
* @param {string} session_id - | ||
* | ||
*/ | ||
Client.prototype.getCourse = function(parameters) { | ||
Client.prototype.getSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -844,3 +852,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/courses/{course_id}'; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}'; | ||
@@ -852,53 +860,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('{institution_id}', parameters['institution_id']); | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
if (parameters['institution_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institution_id')); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
Object.keys(parameters.$queryParameters) | ||
.forEach(function(parameterName) { | ||
var parameter = parameters.$queryParameters[parameterName]; | ||
queryParameters[parameterName] = parameter; | ||
}); | ||
} | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
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['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
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) { | ||
@@ -912,3 +892,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); | ||
@@ -918,9 +898,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} institution_id - | ||
* @param {string} student_id - | ||
* | ||
*/ | ||
Client.prototype.listCourses = function(parameters) { | ||
Client.prototype.getStudent = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -932,3 +913,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/courses'; | ||
var path = '/v1/institutions/{institution_id}/students/{student_id}'; | ||
@@ -947,2 +928,9 @@ var body; | ||
path = path.replace('{student_id}', parameters['student_id']); | ||
if (parameters['student_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: student_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -961,11 +949,11 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Get session details for a given exam | ||
* Get agreements to sign | ||
* @method | ||
* @name Client#getSession | ||
* @name Client#getAgreements | ||
* @param {string} token - | ||
* @param {string} exam_id - | ||
* @param {string} session_id - | ||
* @param {string} location_id - | ||
* | ||
*/ | ||
Client.prototype.getSession = function(parameters) { | ||
Client.prototype.getAgreements = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -977,3 +965,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}'; | ||
var path = '/v1/sessions/{session_id}/agreements/location/{location_id}'; | ||
@@ -994,13 +982,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; | ||
} | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
path = path.replace('{location_id}', parameters['location_id']); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
if (parameters['location_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: location_id')); | ||
return deferred.promise; | ||
@@ -1022,11 +1010,9 @@ } | ||
/** | ||
* Get history of current session | ||
* List sessions for a given exam | ||
* @method | ||
* @name Client#getAgreementHistory | ||
* @param {string} token - | ||
* @param {string} session_id - | ||
* @param {string} agreement_id - | ||
* @name Client#listSessions | ||
* @param {string} exam_id - | ||
* | ||
*/ | ||
Client.prototype.getAgreementHistory = function(parameters) { | ||
Client.prototype.listSessions = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1038,3 +1024,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/history'; | ||
var path = '/v1/exams/{exam_id}/sessions'; | ||
@@ -1046,25 +1032,9 @@ var body; | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
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; | ||
} | ||
path = path.replace('{agreement_id}', parameters['agreement_id']); | ||
if (parameters['agreement_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: agreement_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1083,10 +1053,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Start a new session and create permissions | ||
* Cancel session for a given exam | ||
* @method | ||
* @name Client#startSession | ||
* @param {string} session_id - Access Key | ||
* @param {} body - | ||
* @name Client#cancelSession | ||
* @param {string} exam_id - | ||
* @param {string} session_id - | ||
* | ||
*/ | ||
Client.prototype.startSession = function(parameters) { | ||
Client.prototype.cancelSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1098,3 +1068,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/start'; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}/cancel'; | ||
@@ -1106,2 +1076,9 @@ var body; | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
@@ -1114,6 +1091,2 @@ | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1164,10 +1137,9 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Get all the incident types | ||
* List all exams for a course | ||
* @method | ||
* @name Client#getIncidentTypes | ||
* @param {string} page - | ||
* @param {string} page_size - | ||
* @name Client#listExams | ||
* @param {string} course_id - | ||
* | ||
*/ | ||
Client.prototype.getIncidentTypes = function(parameters) { | ||
Client.prototype.listExams = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1179,3 +1151,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/incidents/types'; | ||
var path = '/v1/courses/{course_id}/exams'; | ||
@@ -1187,8 +1159,7 @@ var body; | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
path = path.replace('{course_id}', parameters['course_id']); | ||
if (parameters['page_size'] !== undefined) { | ||
queryParameters['page_size'] = parameters['page_size']; | ||
if (parameters['course_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: course_id')); | ||
return deferred.promise; | ||
} | ||
@@ -1209,9 +1180,9 @@ | ||
/** | ||
* List sessions for a given exam | ||
* Will return return a list of courses for an institution | ||
* @method | ||
* @name Client#listSessions | ||
* @param {string} exam_id - | ||
* @name Client#listCourses | ||
* @param {string} institution_id - | ||
* | ||
*/ | ||
Client.prototype.listSessions = function(parameters) { | ||
Client.prototype.listCourses = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1223,3 +1194,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/sessions'; | ||
var path = '/v1/institutions/{institution_id}/courses'; | ||
@@ -1231,6 +1202,6 @@ var body; | ||
path = path.replace('{exam_id}', parameters['exam_id']); | ||
path = path.replace('{institution_id}', parameters['institution_id']); | ||
if (parameters['exam_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: exam_id')); | ||
if (parameters['institution_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institution_id')); | ||
return deferred.promise; | ||
@@ -1252,11 +1223,11 @@ } | ||
/** | ||
* List incidents for a given session | ||
* Get history of current session | ||
* @method | ||
* @name Client#listIncidents | ||
* @name Client#getAgreementHistory | ||
* @param {string} token - | ||
* @param {string} session_id - | ||
* @param {string} page - | ||
* @param {string} page_size - | ||
* @param {string} agreement_id - | ||
* | ||
*/ | ||
Client.prototype.listIncidents = function(parameters) { | ||
Client.prototype.getAgreementHistory = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1268,3 +1239,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/history'; | ||
@@ -1276,2 +1247,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']); | ||
@@ -1284,8 +1264,7 @@ | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
path = path.replace('{agreement_id}', parameters['agreement_id']); | ||
if (parameters['page_size'] !== undefined) { | ||
queryParameters['page_size'] = parameters['page_size']; | ||
if (parameters['agreement_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: agreement_id')); | ||
return deferred.promise; | ||
} | ||
@@ -1306,10 +1285,10 @@ | ||
/** | ||
* Creates an incident for a given session | ||
* Gets the zookeeper session history | ||
* @method | ||
* @name Client#createIncident | ||
* @name Client#getProcesses | ||
* @param {string} session_id - | ||
* @param {} body - | ||
* @param {string} zookeeper_id - | ||
* | ||
*/ | ||
Client.prototype.createIncident = function(parameters) { | ||
Client.prototype.getProcesses = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1321,3 +1300,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
@@ -1336,6 +1315,11 @@ var body; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
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) { | ||
@@ -1349,3 +1333,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); | ||
@@ -1355,9 +1339,10 @@ return deferred.promise; | ||
/** | ||
* List all exams for a course | ||
* Updates the session with the current running processes | ||
* @method | ||
* @name Client#listExams | ||
* @param {string} course_id - | ||
* @name Client#sessionProcesses | ||
* @param {string} session_id - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.listExams = function(parameters) { | ||
Client.prototype.sessionProcesses = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1369,3 +1354,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/exams'; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
@@ -1377,9 +1362,13 @@ var body; | ||
path = path.replace('{course_id}', parameters['course_id']); | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['course_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: course_id')); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1393,3 +1382,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); | ||
@@ -1399,10 +1388,13 @@ return deferred.promise; | ||
/** | ||
* Cancel session for a given exam | ||
* Sign an agreement | ||
* @method | ||
* @name Client#cancelSession | ||
* @param {string} exam_id - | ||
* @name Client#signAgreements | ||
* @param {string} token - | ||
* @param {string} session_id - | ||
* @param {string} agreement_id - | ||
* @param {string} version_id - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.cancelSession = function(parameters) { | ||
Client.prototype.signAgreements = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1414,3 +1406,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}/versions/{version_id}/sign'; | ||
@@ -1422,6 +1414,8 @@ 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; | ||
@@ -1437,2 +1431,20 @@ } | ||
path = path.replace('{agreement_id}', parameters['agreement_id']); | ||
if (parameters['agreement_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: agreement_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{version_id}', parameters['version_id']); | ||
if (parameters['version_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: version_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1451,11 +1463,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* This endpoint is used to get an image list for an user | ||
* Get instructor details | ||
* @method | ||
* @name Client#listImages | ||
* @param {string} session_id - | ||
* @param {string} client_id - | ||
* @param {string} type - | ||
* @name Client#getInstructor | ||
* @param {string} course_id - | ||
* @param {string} instructor_id - | ||
* | ||
*/ | ||
Client.prototype.listImages = function(parameters) { | ||
Client.prototype.getInstructor = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1467,3 +1478,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
var path = '/v1/courses/{course_id}/instructors/{instructor_id}'; | ||
@@ -1475,22 +1486,16 @@ var body; | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
path = path.replace('{course_id}', parameters['course_id']); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
if (parameters['course_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: course_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['client_id'] !== undefined) { | ||
queryParameters['client_id'] = parameters['client_id']; | ||
} | ||
path = path.replace('{instructor_id}', parameters['instructor_id']); | ||
if (parameters['client_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: client_id')); | ||
if (parameters['instructor_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: instructor_id')); | ||
return deferred.promise; | ||
} | ||
if (parameters['type'] !== undefined) { | ||
queryParameters['type'] = parameters['type']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1509,11 +1514,11 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* This endpoint is used to upload images for a user | ||
* List all instructors for a course | ||
* @method | ||
* @name Client#uploadImage | ||
* @param {string} token - | ||
* @param {string} session_id - | ||
* @param {} body - | ||
* @name Client#listInstructors | ||
* @param {string} course_id - | ||
* @param {string} page - | ||
* @param {string} page_size - | ||
* | ||
*/ | ||
Client.prototype.uploadImage = function(parameters) { | ||
Client.prototype.listInstructors = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1525,3 +1530,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
var path = '/v1/courses/{course_id}/instructors'; | ||
@@ -1533,20 +1538,15 @@ var body; | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
path = path.replace('{course_id}', parameters['course_id']); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
if (parameters['course_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: course_id')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{session_id}', parameters['session_id']); | ||
if (parameters['session_id'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: session_id')); | ||
return deferred.promise; | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
if (parameters['page_size'] !== undefined) { | ||
queryParameters['page_size'] = parameters['page_size']; | ||
} | ||
@@ -1562,3 +1562,3 @@ | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -1565,0 +1565,0 @@ return deferred.promise; |
@@ -1,1 +0,1 @@ | ||
{"name":"@smarterservices/sp-public-client","version":"0.0.62","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.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} |