@smarterservices/sp-public-client
Advanced tools
Comparing version 0.1.15 to 0.1.16
974
index.js
@@ -66,11 +66,9 @@ /*jshint -W069 */ | ||
/** | ||
* Will return an array of videos that contained signed urls and other metadata | ||
* Used to login and authenticate proctors | ||
* @method | ||
* @name Client#getVideos | ||
* @param {string} token - | ||
* @param {string} userId - | ||
* @name Client#proctorLogin | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.getVideos = function(parameters) { | ||
Client.prototype.proctorLogin = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -82,3 +80,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/{userId}/videos'; | ||
var path = '/v1/proctors/login'; | ||
@@ -90,18 +88,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('{userId}', parameters['userId']); | ||
if (parameters['userId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: userId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['body'] !== undefined) { | ||
@@ -124,10 +106,11 @@ body = parameters['body']; | ||
/** | ||
* Get instructor details | ||
* List all instructors for a course | ||
* @method | ||
* @name Client#getInstructor | ||
* @name Client#listInstructors | ||
* @param {string} courseId - | ||
* @param {string} instructorId - | ||
* @param {string} page - | ||
* @param {string} pageSize - | ||
* | ||
*/ | ||
Client.prototype.getInstructor = function(parameters) { | ||
Client.prototype.listInstructors = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -139,3 +122,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/instructors/{instructor_id}'; | ||
var path = '/v1/courses/{course_id}/instructors'; | ||
@@ -154,7 +137,8 @@ var body; | ||
path = path.replace('{instructor_id}', parameters['instructorId']); | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
if (parameters['instructorId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: instructorId')); | ||
return deferred.promise; | ||
if (parameters['pageSize'] !== undefined) { | ||
queryParameters['page_size'] = parameters['pageSize']; | ||
} | ||
@@ -175,10 +159,10 @@ | ||
/** | ||
* This endpoint is used to delete an event for a session | ||
* Join an existing session and get permissions | ||
* @method | ||
* @name Client#deleteEvent | ||
* @param {string} sessionId - | ||
* @param {string} eventId - | ||
* @name Client#joinSession | ||
* @param {string} sessionId - Access Key | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.deleteEvent = function(parameters) { | ||
Client.prototype.joinSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -190,3 +174,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/{sessionId}/events/{eventId}'; | ||
var path = '/v1/sessions/{session_id}/join'; | ||
@@ -198,3 +182,3 @@ var body; | ||
path = path.replace('{sessionId}', parameters['sessionId']); | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
@@ -206,7 +190,4 @@ if (parameters['sessionId'] === undefined) { | ||
path = path.replace('{eventId}', parameters['eventId']); | ||
if (parameters['eventId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: eventId')); | ||
return deferred.promise; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
@@ -222,3 +203,3 @@ | ||
this.request('DELETE', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -228,10 +209,11 @@ return deferred.promise; | ||
/** | ||
* Returns the media token needed for the client to connect to the session. | ||
* Get agreements to sign | ||
* @method | ||
* @name Client#getMediaToken | ||
* @name Client#getAgreements | ||
* @param {string} token - | ||
* @param {string} sessionId - | ||
* @param {string} clientId - | ||
* @param {string} locationId - | ||
* | ||
*/ | ||
Client.prototype.getMediaToken = function(parameters) { | ||
Client.prototype.getAgreements = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -243,3 +225,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/clients/{client_id}/mediatoken'; | ||
var path = '/v1/sessions/{session_id}/agreements/location/{location_id}'; | ||
@@ -251,2 +233,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']); | ||
@@ -259,6 +250,6 @@ | ||
path = path.replace('{client_id}', parameters['clientId']); | ||
path = path.replace('{location_id}', parameters['locationId']); | ||
if (parameters['clientId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: clientId')); | ||
if (parameters['locationId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: locationId')); | ||
return deferred.promise; | ||
@@ -280,10 +271,11 @@ } | ||
/** | ||
* Start a new session and create permissions | ||
* Get exam details | ||
* @method | ||
* @name Client#startSession | ||
* @param {string} sessionId - Access Key | ||
* @param {} body - | ||
* @name Client#getExam | ||
* @param {string} courseId - | ||
* @param {string} examId - | ||
* @param {string} enrollmentId - | ||
* | ||
*/ | ||
Client.prototype.startSession = function(parameters) { | ||
Client.prototype.getExam = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -295,3 +287,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/start'; | ||
var path = '/v1/courses/{course_id}/exams/{exam_id}'; | ||
@@ -303,61 +295,25 @@ 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['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
path = path.replace('{exam_id}', parameters['examId']); | ||
if (parameters.$queryParameters) { | ||
Object.keys(parameters.$queryParameters) | ||
.forEach(function(parameterName) { | ||
var parameter = parameters.$queryParameters[parameterName]; | ||
queryParameters[parameterName] = parameter; | ||
}); | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
return deferred.promise; | ||
} | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
return deferred.promise; | ||
}; | ||
/** | ||
* delete incident for a given session | ||
* @method | ||
* @name Client#listIncidents | ||
* @param {string} sessionId - | ||
* @param {string} incidentNumber - | ||
* | ||
*/ | ||
Client.prototype.listIncidents = function(parameters) { | ||
if (parameters === undefined) { | ||
parameters = {}; | ||
if (parameters['enrollmentId'] !== undefined) { | ||
queryParameters['enrollment_id'] = parameters['enrollmentId']; | ||
} | ||
var deferred = Q.defer(); | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/incidents/{incident_number}'; | ||
var body; | ||
var queryParameters = {}; | ||
var headers = {}; | ||
var form = {}; | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
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; | ||
} | ||
path = path.replace('{incident_number}', parameters['incidentNumber']); | ||
if (parameters['incidentNumber'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: incidentNumber')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -371,3 +327,3 @@ Object.keys(parameters.$queryParameters) | ||
this.request('DELETE', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -377,6 +333,5 @@ return deferred.promise; | ||
/** | ||
* Updates an incident for a given session | ||
* This endpoint is used to post a new event for a session | ||
* @method | ||
* @name Client#createIncident | ||
* @param {string} incidentNumber - | ||
* @name Client#postEvent | ||
* @param {string} sessionId - | ||
@@ -386,3 +341,3 @@ * @param {} body - | ||
*/ | ||
Client.prototype.createIncident = function(parameters) { | ||
Client.prototype.postEvent = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -394,3 +349,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/incidents/{incident_number}'; | ||
var path = '/v1/{sessionId}/event'; | ||
@@ -402,11 +357,4 @@ var body; | ||
path = path.replace('{incident_number}', parameters['incidentNumber']); | ||
path = path.replace('{sessionId}', parameters['sessionId']); | ||
if (parameters['incidentNumber'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: incidentNumber')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
if (parameters['sessionId'] === undefined) { | ||
@@ -429,3 +377,3 @@ deferred.reject(new Error('Missing required parameter: sessionId')); | ||
this.request('PUT', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -435,9 +383,13 @@ return deferred.promise; | ||
/** | ||
* List sessions for a given exam | ||
* Sign an agreement | ||
* @method | ||
* @name Client#listSessions | ||
* @param {string} examId - | ||
* @name Client#signAgreements | ||
* @param {string} token - | ||
* @param {string} sessionId - | ||
* @param {string} agreementId - | ||
* @param {string} versionId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.listSessions = function(parameters) { | ||
Client.prototype.signAgreements = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -449,3 +401,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/sessions'; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/versions/{version_id}/sign'; | ||
@@ -457,95 +409,29 @@ 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; | ||
} | ||
if (parameters.$queryParameters) { | ||
Object.keys(parameters.$queryParameters) | ||
.forEach(function(parameterName) { | ||
var parameter = parameters.$queryParameters[parameterName]; | ||
queryParameters[parameterName] = parameter; | ||
}); | ||
} | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
return deferred.promise; | ||
}; | ||
/** | ||
* List all exams for a course | ||
* @method | ||
* @name Client#listExams | ||
* @param {string} courseId - | ||
* | ||
*/ | ||
Client.prototype.listExams = function(parameters) { | ||
if (parameters === undefined) { | ||
parameters = {}; | ||
} | ||
var deferred = Q.defer(); | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/exams'; | ||
var body; | ||
var queryParameters = {}; | ||
var headers = {}; | ||
var form = {}; | ||
path = path.replace('{course_id}', parameters['courseId']); | ||
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; | ||
} | ||
if (parameters.$queryParameters) { | ||
Object.keys(parameters.$queryParameters) | ||
.forEach(function(parameterName) { | ||
var parameter = parameters.$queryParameters[parameterName]; | ||
queryParameters[parameterName] = parameter; | ||
}); | ||
} | ||
path = path.replace('{agreement_id}', parameters['agreementId']); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
return deferred.promise; | ||
}; | ||
/** | ||
* This endpoint is used to update an event for a session | ||
* @method | ||
* @name Client#updateEvent | ||
* @param {string} eventId - | ||
* @param {string} sessionId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.updateEvent = function(parameters) { | ||
if (parameters === undefined) { | ||
parameters = {}; | ||
} | ||
var deferred = Q.defer(); | ||
var domain = this.domain; | ||
var path = '/v1/{sessionId}/event/{eventId}'; | ||
var body; | ||
var queryParameters = {}; | ||
var headers = {}; | ||
var form = {}; | ||
path = path.replace('{eventId}', parameters['eventId']); | ||
if (parameters['eventId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: eventId')); | ||
if (parameters['agreementId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: agreementId')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{sessionId}', parameters['sessionId']); | ||
path = path.replace('{version_id}', parameters['versionId']); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
if (parameters['versionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: versionId')); | ||
return deferred.promise; | ||
@@ -566,3 +452,3 @@ } | ||
this.request('PUT', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -657,10 +543,10 @@ return deferred.promise; | ||
/** | ||
* Will return return details about a single course | ||
* Get student details | ||
* @method | ||
* @name Client#getCourse | ||
* @param {string} courseId - | ||
* @name Client#getStudent | ||
* @param {string} institutionId - | ||
* @param {string} studentId - | ||
* | ||
*/ | ||
Client.prototype.getCourse = function(parameters) { | ||
Client.prototype.getStudent = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -672,3 +558,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/courses/{course_id}'; | ||
var path = '/v1/institutions/{institution_id}/students/{student_id}'; | ||
@@ -680,13 +566,13 @@ var body; | ||
path = path.replace('{course_id}', parameters['courseId']); | ||
path = path.replace('{institution_id}', parameters['institutionId']); | ||
if (parameters['courseId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: courseId')); | ||
if (parameters['institutionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institutionId')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{institution_id}', parameters['institutionId']); | ||
path = path.replace('{student_id}', parameters['studentId']); | ||
if (parameters['institutionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institutionId')); | ||
if (parameters['studentId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: studentId')); | ||
return deferred.promise; | ||
@@ -708,9 +594,8 @@ } | ||
/** | ||
* Used to login and authenticate proctors | ||
* Get all corrective_action_types | ||
* @method | ||
* @name Client#proctorLogin | ||
* @param {} body - | ||
* @name Client#getCorrectiveActionTypes | ||
* | ||
*/ | ||
Client.prototype.proctorLogin = function(parameters) { | ||
Client.prototype.getCorrectiveActionTypes = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -722,3 +607,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/proctors/login'; | ||
var path = '/v1/incidents/corrective_action_types'; | ||
@@ -730,6 +615,2 @@ var body; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -743,3 +624,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); | ||
@@ -749,10 +630,9 @@ return deferred.promise; | ||
/** | ||
* This endpoint is used to post a new event for a session | ||
* Will return detailed information about an institution | ||
* @method | ||
* @name Client#postEvent | ||
* @param {string} sessionId - | ||
* @param {} body - | ||
* @name Client#getInstitution | ||
* @param {string} institutionId - | ||
* | ||
*/ | ||
Client.prototype.postEvent = function(parameters) { | ||
Client.prototype.getInstitution = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -764,3 +644,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/{sessionId}/event'; | ||
var path = '/v1/institutions/{institution_id}'; | ||
@@ -772,13 +652,9 @@ var body; | ||
path = path.replace('{sessionId}', parameters['sessionId']); | ||
path = path.replace('{institution_id}', parameters['institutionId']); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
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) { | ||
@@ -792,3 +668,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); | ||
@@ -798,9 +674,9 @@ return deferred.promise; | ||
/** | ||
* List students for a given exam | ||
* Will return return a list of courses for an institution | ||
* @method | ||
* @name Client#listStudents | ||
* @param {string} examId - | ||
* @name Client#listCourses | ||
* @param {string} institutionId - | ||
* | ||
*/ | ||
Client.prototype.listStudents = function(parameters) { | ||
Client.prototype.listCourses = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -812,3 +688,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/students'; | ||
var path = '/v1/institutions/{institution_id}/courses'; | ||
@@ -820,6 +696,6 @@ var body; | ||
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; | ||
@@ -841,10 +717,8 @@ } | ||
/** | ||
* Cancel session for a given exam | ||
* Used to make sure that the api is current only | ||
* @method | ||
* @name Client#cancelSession | ||
* @param {string} examId - | ||
* @param {string} sessionId - | ||
* @name Client#health | ||
* | ||
*/ | ||
Client.prototype.cancelSession = function(parameters) { | ||
Client.prototype.health = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -856,3 +730,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}/cancel'; | ||
var path = '/v1'; | ||
@@ -864,16 +738,2 @@ var body; | ||
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']); | ||
if (parameters['sessionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: sessionId')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -887,3 +747,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); | ||
@@ -893,13 +753,11 @@ return deferred.promise; | ||
/** | ||
* Sign an agreement | ||
* Will return an array of videos that contained signed urls and other metadata | ||
* @method | ||
* @name Client#signAgreements | ||
* @name Client#getVideos | ||
* @param {string} token - | ||
* @param {string} sessionId - | ||
* @param {string} agreementId - | ||
* @param {string} versionId - | ||
* @param {string} userId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.signAgreements = function(parameters) { | ||
Client.prototype.getVideos = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -911,3 +769,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/agreements/{agreement_id}/versions/{version_id}/sign'; | ||
var path = '/v1/{userId}/videos'; | ||
@@ -928,23 +786,9 @@ 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; | ||
} | ||
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) { | ||
@@ -967,10 +811,10 @@ body = parameters['body']; | ||
/** | ||
* Get all the incident types | ||
* Creates an incident for a given session | ||
* @method | ||
* @name Client#getIncidentTypes | ||
* @param {string} page - | ||
* @param {string} pageSize - | ||
* @name Client#createIncident | ||
* @param {string} sessionId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.getIncidentTypes = function(parameters) { | ||
Client.prototype.createIncident = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -982,3 +826,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/incidents/types'; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
@@ -990,8 +834,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']; | ||
} | ||
@@ -1007,3 +854,3 @@ | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -1013,6 +860,6 @@ return deferred.promise; | ||
/** | ||
* List all instructors for a course | ||
* List incidents for a given session | ||
* @method | ||
* @name Client#listInstructors | ||
* @param {string} courseId - | ||
* @name Client#listIncidents | ||
* @param {string} sessionId - | ||
* @param {string} page - | ||
@@ -1022,3 +869,3 @@ * @param {string} pageSize - | ||
*/ | ||
Client.prototype.listInstructors = function(parameters) { | ||
Client.prototype.listIncidents = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1030,3 +877,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/instructors'; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
@@ -1038,6 +885,6 @@ 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; | ||
@@ -1067,9 +914,8 @@ } | ||
/** | ||
* Will return return a list of courses for an institution | ||
* Will return a full list of all institutions | ||
* @method | ||
* @name Client#listCourses | ||
* @param {string} institutionId - | ||
* @name Client#listInstitutions | ||
* | ||
*/ | ||
Client.prototype.listCourses = function(parameters) { | ||
Client.prototype.listInstitutions = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1081,3 +927,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/courses'; | ||
var path = '/v1/institutions'; | ||
@@ -1089,9 +935,2 @@ 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.$queryParameters) { | ||
@@ -1110,11 +949,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Get exam details | ||
* Gets the zookeeper session history | ||
* @method | ||
* @name Client#getExam | ||
* @param {string} courseId - | ||
* @param {string} examId - | ||
* @param {string} enrollmentId - | ||
* @name Client#getProcesses | ||
* @param {string} sessionId - | ||
* @param {string} zookeeperId - | ||
* | ||
*/ | ||
Client.prototype.getExam = function(parameters) { | ||
Client.prototype.getProcesses = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1126,3 +964,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/courses/{course_id}/exams/{exam_id}'; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
@@ -1134,25 +972,63 @@ 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['zookeeperId'] !== undefined) { | ||
queryParameters['zookeeper_id'] = parameters['zookeeperId']; | ||
} | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
if (parameters['zookeeperId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: zookeeperId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['enrollmentId'] !== undefined) { | ||
queryParameters['enrollment_id'] = parameters['enrollmentId']; | ||
if (parameters.$queryParameters) { | ||
Object.keys(parameters.$queryParameters) | ||
.forEach(function(parameterName) { | ||
var parameter = parameters.$queryParameters[parameterName]; | ||
queryParameters[parameterName] = parameter; | ||
}); | ||
} | ||
if (parameters['enrollmentId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: enrollmentId')); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
return deferred.promise; | ||
}; | ||
/** | ||
* Updates the session with the current running processes | ||
* @method | ||
* @name Client#sessionProcesses | ||
* @param {string} sessionId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.sessionProcesses = function(parameters) { | ||
if (parameters === undefined) { | ||
parameters = {}; | ||
} | ||
var deferred = Q.defer(); | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
var body; | ||
var queryParameters = {}; | ||
var headers = {}; | ||
var form = {}; | ||
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) { | ||
@@ -1166,3 +1042,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); | ||
@@ -1172,8 +1048,10 @@ return deferred.promise; | ||
/** | ||
* Will return a full list of all institutions | ||
* Get all the incident types | ||
* @method | ||
* @name Client#listInstitutions | ||
* @name Client#getIncidentTypes | ||
* @param {string} page - | ||
* @param {string} pageSize - | ||
* | ||
*/ | ||
Client.prototype.listInstitutions = function(parameters) { | ||
Client.prototype.getIncidentTypes = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1185,3 +1063,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions'; | ||
var path = '/v1/incidents/types'; | ||
@@ -1193,2 +1071,10 @@ var body; | ||
if (parameters['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
if (parameters['pageSize'] !== undefined) { | ||
queryParameters['page_size'] = parameters['pageSize']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1207,10 +1093,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Creates an incident for a given session | ||
* Returns the media token needed for the client to connect to the session. | ||
* @method | ||
* @name Client#createIncident | ||
* @name Client#getMediaToken | ||
* @param {string} sessionId - | ||
* @param {} body - | ||
* @param {string} clientId - | ||
* | ||
*/ | ||
Client.prototype.createIncident = function(parameters) { | ||
Client.prototype.getMediaToken = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1222,3 +1108,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
var path = '/v1/sessions/{session_id}/clients/{client_id}/mediatoken'; | ||
@@ -1237,4 +1123,7 @@ var body; | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
path = path.replace('{client_id}', parameters['clientId']); | ||
if (parameters['clientId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: clientId')); | ||
return deferred.promise; | ||
} | ||
@@ -1250,3 +1139,3 @@ | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -1256,11 +1145,10 @@ return deferred.promise; | ||
/** | ||
* List incidents for a given session | ||
* Get instructor details | ||
* @method | ||
* @name Client#listIncidents | ||
* @param {string} sessionId - | ||
* @param {string} page - | ||
* @param {string} pageSize - | ||
* @name Client#getInstructor | ||
* @param {string} courseId - | ||
* @param {string} instructorId - | ||
* | ||
*/ | ||
Client.prototype.listIncidents = function(parameters) { | ||
Client.prototype.getInstructor = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1272,3 +1160,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/incidents'; | ||
var path = '/v1/courses/{course_id}/instructors/{instructor_id}'; | ||
@@ -1280,15 +1168,14 @@ 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['page'] !== undefined) { | ||
queryParameters['page'] = parameters['page']; | ||
} | ||
path = path.replace('{instructor_id}', parameters['instructorId']); | ||
if (parameters['pageSize'] !== undefined) { | ||
queryParameters['page_size'] = parameters['pageSize']; | ||
if (parameters['instructorId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: instructorId')); | ||
return deferred.promise; | ||
} | ||
@@ -1309,12 +1196,10 @@ | ||
/** | ||
* This endpoint is used to get events for a session | ||
* This endpoint is used to delete an event for a session | ||
* @method | ||
* @name Client#getEvents | ||
* @name Client#deleteEvent | ||
* @param {string} sessionId - | ||
* @param {string} userId - | ||
* @param {string} type - | ||
* @param {number} severity - | ||
* @param {string} eventId - | ||
* | ||
*/ | ||
Client.prototype.getEvents = function(parameters) { | ||
Client.prototype.deleteEvent = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1326,3 +1211,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/{sessionId}/events'; | ||
var path = '/v1/{sessionId}/events/{eventId}'; | ||
@@ -1341,14 +1226,9 @@ var body; | ||
if (parameters['userId'] !== undefined) { | ||
queryParameters['userId'] = parameters['userId']; | ||
} | ||
path = path.replace('{eventId}', parameters['eventId']); | ||
if (parameters['type'] !== undefined) { | ||
queryParameters['type'] = parameters['type']; | ||
if (parameters['eventId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: eventId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['severity'] !== undefined) { | ||
queryParameters['severity'] = parameters['severity']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1362,3 +1242,3 @@ Object.keys(parameters.$queryParameters) | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('DELETE', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -1368,10 +1248,10 @@ return deferred.promise; | ||
/** | ||
* Join an existing session and get permissions | ||
* Cancel session for a given exam | ||
* @method | ||
* @name Client#joinSession | ||
* @param {string} sessionId - Access Key | ||
* @param {} body - | ||
* @name Client#cancelSession | ||
* @param {string} examId - | ||
* @param {string} sessionId - | ||
* | ||
*/ | ||
Client.prototype.joinSession = function(parameters) { | ||
Client.prototype.cancelSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1383,3 +1263,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/join'; | ||
var path = '/v1/exams/{exam_id}/sessions/{session_id}/cancel'; | ||
@@ -1391,2 +1271,9 @@ var body; | ||
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']); | ||
@@ -1399,6 +1286,2 @@ | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1417,10 +1300,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* This endpoint is used to get playback tokens for a user | ||
* Start a new session and create permissions | ||
* @method | ||
* @name Client#playbackToken | ||
* @param {string} sessionId - | ||
* @name Client#startSession | ||
* @param {string} sessionId - Access Key | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.playbackToken = function(parameters) { | ||
Client.prototype.startSession = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1432,3 +1315,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{sessionId}/playback/token'; | ||
var path = '/v1/sessions/{session_id}/start'; | ||
@@ -1440,3 +1323,3 @@ var body; | ||
path = path.replace('{sessionId}', parameters['sessionId']); | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
@@ -1520,8 +1403,9 @@ if (parameters['sessionId'] === undefined) { | ||
/** | ||
* Get all corrective_action_types | ||
* List all exams for a course | ||
* @method | ||
* @name Client#getCorrectiveActionTypes | ||
* @name Client#listExams | ||
* @param {string} courseId - | ||
* | ||
*/ | ||
Client.prototype.getCorrectiveActionTypes = function(parameters) { | ||
Client.prototype.listExams = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1533,3 +1417,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/incidents/corrective_action_types'; | ||
var path = '/v1/courses/{course_id}/exams'; | ||
@@ -1541,2 +1425,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; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1555,10 +1446,10 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Gets the zookeeper session history | ||
* Will return return details about a single course | ||
* @method | ||
* @name Client#getProcesses | ||
* @param {string} sessionId - | ||
* @param {string} zookeeperId - | ||
* @name Client#getCourse | ||
* @param {string} courseId - | ||
* @param {string} institutionId - | ||
* | ||
*/ | ||
Client.prototype.getProcesses = function(parameters) { | ||
Client.prototype.getCourse = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1570,3 +1461,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
var path = '/v1/institutions/{institution_id}/courses/{course_id}'; | ||
@@ -1578,15 +1469,53 @@ 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('{institution_id}', parameters['institutionId']); | ||
if (parameters['institutionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institutionId')); | ||
return deferred.promise; | ||
} | ||
if (parameters['zookeeperId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: zookeeperId')); | ||
if (parameters.$queryParameters) { | ||
Object.keys(parameters.$queryParameters) | ||
.forEach(function(parameterName) { | ||
var parameter = parameters.$queryParameters[parameterName]; | ||
queryParameters[parameterName] = parameter; | ||
}); | ||
} | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
return deferred.promise; | ||
}; | ||
/** | ||
* List students for a given exam | ||
* @method | ||
* @name Client#listStudents | ||
* @param {string} examId - | ||
* | ||
*/ | ||
Client.prototype.listStudents = function(parameters) { | ||
if (parameters === undefined) { | ||
parameters = {}; | ||
} | ||
var deferred = Q.defer(); | ||
var domain = this.domain; | ||
var path = '/v1/exams/{exam_id}/students'; | ||
var body; | ||
var queryParameters = {}; | ||
var headers = {}; | ||
var form = {}; | ||
path = path.replace('{exam_id}', parameters['examId']); | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
return deferred.promise; | ||
@@ -1608,5 +1537,5 @@ } | ||
/** | ||
* Updates the session with the current running processes | ||
* This endpoint is used to get playback tokens for a user | ||
* @method | ||
* @name Client#sessionProcesses | ||
* @name Client#playbackToken | ||
* @param {string} sessionId - | ||
@@ -1616,3 +1545,3 @@ * @param {} body - | ||
*/ | ||
Client.prototype.sessionProcesses = function(parameters) { | ||
Client.prototype.playbackToken = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1624,3 +1553,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/processes'; | ||
var path = '/v1/sessions/{sessionId}/playback/token'; | ||
@@ -1632,3 +1561,3 @@ var body; | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
path = path.replace('{sessionId}', parameters['sessionId']); | ||
@@ -1652,3 +1581,3 @@ if (parameters['sessionId'] === undefined) { | ||
this.request('PUT', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -1658,8 +1587,9 @@ return deferred.promise; | ||
/** | ||
* Used to make sure that the api is current only | ||
* List sessions for a given exam | ||
* @method | ||
* @name Client#health | ||
* @name Client#listSessions | ||
* @param {string} examId - | ||
* | ||
*/ | ||
Client.prototype.health = function(parameters) { | ||
Client.prototype.listSessions = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1671,3 +1601,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1'; | ||
var path = '/v1/exams/{exam_id}/sessions'; | ||
@@ -1679,2 +1609,9 @@ var body; | ||
path = path.replace('{exam_id}', parameters['examId']); | ||
if (parameters['examId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: examId')); | ||
return deferred.promise; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1751,6 +1688,6 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* This endpoint is used to upload images for a user | ||
* This endpoint is used to update an event for a session | ||
* @method | ||
* @name Client#uploadImage | ||
* @param {string} token - | ||
* @name Client#updateEvent | ||
* @param {string} eventId - | ||
* @param {string} sessionId - | ||
@@ -1760,3 +1697,3 @@ * @param {} body - | ||
*/ | ||
Client.prototype.uploadImage = function(parameters) { | ||
Client.prototype.updateEvent = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1768,3 +1705,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
var path = '/v1/{sessionId}/event/{eventId}'; | ||
@@ -1776,12 +1713,10 @@ var body; | ||
if (parameters['token'] !== undefined) { | ||
headers['token'] = parameters['token']; | ||
} | ||
path = path.replace('{eventId}', parameters['eventId']); | ||
if (parameters['token'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: token')); | ||
if (parameters['eventId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: eventId')); | ||
return deferred.promise; | ||
} | ||
path = path.replace('{session_id}', parameters['sessionId']); | ||
path = path.replace('{sessionId}', parameters['sessionId']); | ||
@@ -1805,3 +1740,3 @@ if (parameters['sessionId'] === undefined) { | ||
this.request('POST', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('PUT', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -1811,11 +1746,10 @@ return deferred.promise; | ||
/** | ||
* This endpoint is used to get an image list for an user | ||
* delete incident for a given session | ||
* @method | ||
* @name Client#listImages | ||
* @name Client#listIncidents | ||
* @param {string} sessionId - | ||
* @param {string} clientId - | ||
* @param {string} type - | ||
* @param {string} incidentNumber - | ||
* | ||
*/ | ||
Client.prototype.listImages = function(parameters) { | ||
Client.prototype.listIncidents = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1827,3 +1761,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
var path = '/v1/sessions/{session_id}/incidents/{incident_number}'; | ||
@@ -1842,15 +1776,9 @@ var body; | ||
if (parameters['clientId'] !== undefined) { | ||
queryParameters['client_id'] = parameters['clientId']; | ||
} | ||
path = path.replace('{incident_number}', parameters['incidentNumber']); | ||
if (parameters['clientId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: clientId')); | ||
if (parameters['incidentNumber'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: incidentNumber')); | ||
return deferred.promise; | ||
} | ||
if (parameters['type'] !== undefined) { | ||
queryParameters['type'] = parameters['type']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -1864,3 +1792,3 @@ Object.keys(parameters.$queryParameters) | ||
this.request('GET', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
this.request('DELETE', domain + path, parameters, body, headers, queryParameters, form, deferred); | ||
@@ -1870,10 +1798,11 @@ return deferred.promise; | ||
/** | ||
* Get student details | ||
* Updates an incident for a given session | ||
* @method | ||
* @name Client#getStudent | ||
* @param {string} institutionId - | ||
* @param {string} studentId - | ||
* @name Client#createIncident | ||
* @param {string} incidentNumber - | ||
* @param {string} sessionId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.getStudent = function(parameters) { | ||
Client.prototype.createIncident = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1885,3 +1814,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}/students/{student_id}'; | ||
var path = '/v1/sessions/{session_id}/incidents/{incident_number}'; | ||
@@ -1893,16 +1822,20 @@ var body; | ||
path = path.replace('{institution_id}', parameters['institutionId']); | ||
path = path.replace('{incident_number}', parameters['incidentNumber']); | ||
if (parameters['institutionId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: institutionId')); | ||
if (parameters['incidentNumber'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: incidentNumber')); | ||
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) { | ||
@@ -1916,3 +1849,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); | ||
@@ -1980,11 +1913,11 @@ return deferred.promise; | ||
/** | ||
* Get agreements to sign | ||
* This endpoint is used to upload images for a user | ||
* @method | ||
* @name Client#getAgreements | ||
* @name Client#uploadImage | ||
* @param {string} token - | ||
* @param {string} sessionId - | ||
* @param {string} locationId - | ||
* @param {} body - | ||
* | ||
*/ | ||
Client.prototype.getAgreements = function(parameters) { | ||
Client.prototype.uploadImage = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -1996,3 +1929,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/agreements/location/{location_id}'; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
@@ -2020,9 +1953,61 @@ var body; | ||
path = path.replace('{location_id}', parameters['locationId']); | ||
if (parameters['body'] !== undefined) { | ||
body = parameters['body']; | ||
} | ||
if (parameters['locationId'] === undefined) { | ||
deferred.reject(new Error('Missing required parameter: locationId')); | ||
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; | ||
}; | ||
/** | ||
* This endpoint is used to get an image list for an user | ||
* @method | ||
* @name Client#listImages | ||
* @param {string} sessionId - | ||
* @param {string} clientId - | ||
* @param {string} type - | ||
* | ||
*/ | ||
Client.prototype.listImages = function(parameters) { | ||
if (parameters === undefined) { | ||
parameters = {}; | ||
} | ||
var deferred = Q.defer(); | ||
var domain = this.domain; | ||
var path = '/v1/sessions/{session_id}/images'; | ||
var body; | ||
var queryParameters = {}; | ||
var headers = {}; | ||
var form = {}; | ||
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) { | ||
@@ -2041,9 +2026,12 @@ Object.keys(parameters.$queryParameters) | ||
/** | ||
* Will return detailed information about an institution | ||
* This endpoint is used to get events for a session | ||
* @method | ||
* @name Client#getInstitution | ||
* @param {string} institutionId - | ||
* @name Client#getEvents | ||
* @param {string} sessionId - | ||
* @param {string} userId - | ||
* @param {string} type - | ||
* @param {number} severity - | ||
* | ||
*/ | ||
Client.prototype.getInstitution = function(parameters) { | ||
Client.prototype.getEvents = function(parameters) { | ||
if (parameters === undefined) { | ||
@@ -2055,3 +2043,3 @@ parameters = {}; | ||
var domain = this.domain; | ||
var path = '/v1/institutions/{institution_id}'; | ||
var path = '/v1/{sessionId}/events'; | ||
@@ -2063,9 +2051,21 @@ var body; | ||
path = path.replace('{institution_id}', parameters['institutionId']); | ||
path = path.replace('{sessionId}', 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; | ||
} | ||
if (parameters['userId'] !== undefined) { | ||
queryParameters['userId'] = parameters['userId']; | ||
} | ||
if (parameters['type'] !== undefined) { | ||
queryParameters['type'] = parameters['type']; | ||
} | ||
if (parameters['severity'] !== undefined) { | ||
queryParameters['severity'] = parameters['severity']; | ||
} | ||
if (parameters.$queryParameters) { | ||
@@ -2072,0 +2072,0 @@ Object.keys(parameters.$queryParameters) |
@@ -1,1 +0,1 @@ | ||
{"name":"@smarterservices/sp-public-client","version":"0.1.15","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.1.16","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} |