sei-sdk
v0.2.1
Published
A Caveon SEI helper library
Downloads
11
Readme
sei-node
A Caveon SEI helper library
Most functions are async and return a promise
Install
npm install sei-sdk
Include the library
var sei = require('./sei-node/');
Create the client
Option 1
var clientToken = sei.createClientWithIntegration({ token: <INTEGRATION_TOKEN>, examId: <SEI_EXAM_ID> });
clientToken.exam.get({ include: 'settings' }).then(function (exam) {
console.log('exam', exam);
}, function (err) {
console.log(err);
});
Option 2
sei.createClient({ username: <SEI_ID>, password: <SEI_SECRET>, examId: <SEI_EXAM_ID> }).then(function (client) {
return client.exam.get({ include: 'settings' });
}).then(function (exam) {
console.log('exam', exam);
}, function (err) {
console.log(err);
});
Option 3
DON'T CHOOSE THIS OPTION IT WILL BE REMOVED
var clientBasic = sei.createClientWithBasicAuth({ username: <SEI_ID>, password: <SEI_SECRET>, examId: <SEI_EXAM_ID>, roleSecret: <SEI_ROLE_SECRET> });
clientBasic.exam.get({ include: 'settings' }).then(function (exam) {
console.log('exam', exam);
}, function (err) {
console.log(err);
});
Make any request
var examRequest = {
method: 'GET',
url: '/exams/' + <SEI_EXAM_ID>
};
// include optional headers
clientToken.makeRequest(examRequest).then(function (exam) {
console.log('made request');
console.log(exam);
});