comprodls-sdk 2.89.0 → 2.90.0-qa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -137
- package/dist/comprodls-sdk.js +5937 -8432
- package/dist/comprodls-sdk.min.js +15 -1
- package/lib/comprodls.js +39 -57
- package/lib/config/index.js +171 -199
- package/lib/helpers/index.js +3 -2
- package/lib/helpers/lib/api/converter.js +1 -2
- package/lib/helpers/lib/api/index.js +19 -94
- package/lib/helpers/lib/errors.js +73 -80
- package/lib/helpers/lib/requestLayer.js +154 -0
- package/lib/helpers/lib/validator.js +65 -52
- package/lib/open_access/index.js +48 -53
- package/lib/services/analytics/index.js +286 -1014
- package/lib/services/attempts/index.js +38 -88
- package/lib/services/auth/index.js +238 -896
- package/lib/services/authextn/index.js +50 -150
- package/lib/services/datasyncmanager/index.js +10 -45
- package/lib/services/drive/index.js +20 -83
- package/lib/services/integrations/index.js +51 -126
- package/lib/services/invitations/index.js +20 -61
- package/lib/services/product/index.js +74 -85
- package/lib/services/pub/index.js +159 -234
- package/lib/services/pushX/index.js +29 -33
- package/lib/services/pushX/pubnubClientWrapper.js +398 -398
- package/lib/services/rules/index.js +14 -67
- package/lib/services/spaces/index.js +106 -294
- package/lib/services/spacesextn/index.js +4 -24
- package/lib/services/superuser/index.js +21 -36
- package/lib/services/taxonomy/index.js +27 -57
- package/lib/services/workflows/index.js +37 -98
- package/lib/services/xapi/index.js +6 -125
- package/lib/token/index.js +73 -67
- package/lib/token/validations.js +45 -48
- package/package.json +1 -2
- package/lib/helpers/lib/api/validations.js +0 -73
- package/lib/helpers/lib/utils.js +0 -24
- package/lib/services/activity/activity.js +0 -209
- package/lib/services/activity/attempt.js +0 -431
- package/lib/services/activity/index.js +0 -28
- package/lib/services/auth/classProduct.js +0 -37
- package/lib/services/collab/index.js +0 -468
|
@@ -32,9 +32,6 @@ var converter = require('../../helpers/lib/api/converter');
|
|
|
32
32
|
|
|
33
33
|
var DLSError = helpers.errors.DLSError;
|
|
34
34
|
|
|
35
|
-
/*********************************
|
|
36
|
-
* Setting Up Module Entry Point
|
|
37
|
-
**********************************/
|
|
38
35
|
module.exports = integrations;
|
|
39
36
|
|
|
40
37
|
var keepaliveAgent = new Agent({
|
|
@@ -44,22 +41,22 @@ var keepaliveAgent = new Agent({
|
|
|
44
41
|
|
|
45
42
|
//Integrations Adaptor Constructor
|
|
46
43
|
function integrations(accountId) {
|
|
47
|
-
|
|
44
|
+
this.accountId = accountId;
|
|
48
45
|
return {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
getGetStreamCredentials: getGetStreamCredentials.bind(this),
|
|
47
|
+
queryDataFromSearch: queryDataFromSearch.bind(this),
|
|
48
|
+
getAuditTrailForAttempts: getAuditTrailForAttempts.bind(this),
|
|
49
|
+
getAuditTrailForEntitlements: getAuditTrailForEntitlements.bind(this),
|
|
50
|
+
getAuditTrailForMicroEntitlements: getAuditTrailForMicroEntitlements.bind(this),
|
|
51
|
+
publishCustomEvents: publishCustomEvents.bind(this),
|
|
52
|
+
createSchedule: createSchedule.bind(this),
|
|
53
|
+
getSchedule: getSchedule.bind(this),
|
|
54
|
+
updateSchedule: updateSchedule.bind(this),
|
|
55
|
+
deleteSchedule: deleteSchedule.bind(this)
|
|
59
56
|
};
|
|
60
57
|
}
|
|
61
58
|
|
|
62
|
-
|
|
59
|
+
/** params: NONE */
|
|
63
60
|
function getGetStreamCredentials() {
|
|
64
61
|
var self = this;
|
|
65
62
|
var dfd = q.defer(), err;
|
|
@@ -77,20 +74,18 @@ function getGetStreamCredentials() {
|
|
|
77
74
|
|
|
78
75
|
requestAPI.end(function (error, response) {
|
|
79
76
|
if(error) {
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
78
|
+
dfd.reject(err);
|
|
82
79
|
}
|
|
83
80
|
else { dfd.resolve(response); }
|
|
84
81
|
});
|
|
85
82
|
return dfd.promise;
|
|
86
83
|
}
|
|
87
84
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
*/
|
|
85
|
+
/**
|
|
86
|
+
* Wiki Link for SDK params
|
|
87
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#querydatafromsearchparams
|
|
88
|
+
*/
|
|
94
89
|
function queryDataFromSearch(options) {
|
|
95
90
|
var self = this;
|
|
96
91
|
var dfd = q.defer();
|
|
@@ -131,17 +126,10 @@ function queryDataFromSearch(options) {
|
|
|
131
126
|
return dfd.promise;
|
|
132
127
|
}
|
|
133
128
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
userid: 'string',
|
|
139
|
-
productcode: 'string',
|
|
140
|
-
item-code: 'string',
|
|
141
|
-
sortOrder: 'asc/desc', // optional
|
|
142
|
-
cursor: 'string'
|
|
143
|
-
}
|
|
144
|
-
*/
|
|
129
|
+
/**
|
|
130
|
+
* Wiki Link for SDK params
|
|
131
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#getaudittrailforattemptsparams
|
|
132
|
+
*/
|
|
145
133
|
function getAuditTrailForAttempts(options) {
|
|
146
134
|
var self = this;
|
|
147
135
|
var dfd = q.defer();
|
|
@@ -186,16 +174,10 @@ function getAuditTrailForAttempts(options) {
|
|
|
186
174
|
return dfd.promise;
|
|
187
175
|
}
|
|
188
176
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
userid: 'string',
|
|
194
|
-
productcode: 'string',
|
|
195
|
-
sortOrder: 'asc/desc', // optional
|
|
196
|
-
cursor: 'string'
|
|
197
|
-
}
|
|
198
|
-
*/
|
|
177
|
+
/**
|
|
178
|
+
* Wiki Link for SDK params
|
|
179
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#getaudittrailforentitlementsparams
|
|
180
|
+
*/
|
|
199
181
|
function getAuditTrailForEntitlements(options) {
|
|
200
182
|
var self = this;
|
|
201
183
|
var dfd = q.defer();
|
|
@@ -241,17 +223,10 @@ function getAuditTrailForEntitlements(options) {
|
|
|
241
223
|
return dfd.promise;
|
|
242
224
|
}
|
|
243
225
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
userid: 'string',
|
|
249
|
-
productcode: 'string',
|
|
250
|
-
sortOrder: 'asc/desc', // optional
|
|
251
|
-
context: 'string',
|
|
252
|
-
cursor: 'string'
|
|
253
|
-
}
|
|
254
|
-
*/
|
|
226
|
+
/**
|
|
227
|
+
* Wiki Link for SDK params
|
|
228
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#getaudittrailformicroentitlementsparams
|
|
229
|
+
*/
|
|
255
230
|
function getAuditTrailForMicroEntitlements(options) {
|
|
256
231
|
var self = this;
|
|
257
232
|
var dfd = q.defer();
|
|
@@ -298,17 +273,8 @@ function getAuditTrailForMicroEntitlements(options) {
|
|
|
298
273
|
}
|
|
299
274
|
|
|
300
275
|
/**
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
* *events: [{
|
|
304
|
-
* *ext_actor_id: 'string',
|
|
305
|
-
* *category: "string",
|
|
306
|
-
* *action: 'string',
|
|
307
|
-
* *data: {...},
|
|
308
|
-
* push: <boolean, default: false
|
|
309
|
-
* ref_id: 'string'
|
|
310
|
-
* }, ...]
|
|
311
|
-
* } options
|
|
276
|
+
* Wiki Link for SDK params
|
|
277
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#publishcustomeventsparams
|
|
312
278
|
*/
|
|
313
279
|
function publishCustomEvents(options) {
|
|
314
280
|
var deferred = q.defer();
|
|
@@ -345,24 +311,10 @@ function publishCustomEvents(options) {
|
|
|
345
311
|
return deferred.promise;
|
|
346
312
|
}
|
|
347
313
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
body: {
|
|
353
|
-
"scheduleid": "", //mandatory
|
|
354
|
-
"orgid": "", // optional
|
|
355
|
-
"actorid": "", //mandatory
|
|
356
|
-
"classid": "", // optional
|
|
357
|
-
"assigned_path_id": "", // optional
|
|
358
|
-
"productcode": "", // optional
|
|
359
|
-
"userid": "", // optional
|
|
360
|
-
"category": "", //mandatory
|
|
361
|
-
"data": {}, // optional
|
|
362
|
-
"schedule_time" : "" //mandatory
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
*/
|
|
314
|
+
/**
|
|
315
|
+
* Wiki Link for SDK params
|
|
316
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#createscheduleparams
|
|
317
|
+
*/
|
|
366
318
|
function createSchedule(options) {
|
|
367
319
|
var deferred = q.defer();
|
|
368
320
|
// Initializing promise
|
|
@@ -401,15 +353,10 @@ function createSchedule(options) {
|
|
|
401
353
|
return deferred.promise;
|
|
402
354
|
}
|
|
403
355
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
category: "string", //optional
|
|
409
|
-
scheduleid: "string", //optional
|
|
410
|
-
cursor: "string" //optional
|
|
411
|
-
}
|
|
412
|
-
*/
|
|
356
|
+
/**
|
|
357
|
+
* Wiki Link for SDK params
|
|
358
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#getscheduleparams
|
|
359
|
+
*/
|
|
413
360
|
function getSchedule(options) {
|
|
414
361
|
var deferred = q.defer();
|
|
415
362
|
// Initializing promise
|
|
@@ -447,25 +394,10 @@ function getSchedule(options) {
|
|
|
447
394
|
return deferred.promise;
|
|
448
395
|
}
|
|
449
396
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
context: "string", //mandatory
|
|
455
|
-
scheduleid: "string", //mandatory
|
|
456
|
-
body: {
|
|
457
|
-
"schedule_time" : "", // optional
|
|
458
|
-
"category": "", //mandatory
|
|
459
|
-
"orgid": "", // optional
|
|
460
|
-
"actorid": "", //mandatory
|
|
461
|
-
"userid": "", // optional
|
|
462
|
-
"classid": "", // optional
|
|
463
|
-
"assigned_path_id": "", // optional
|
|
464
|
-
"productcode": "", // optional
|
|
465
|
-
"data": {} // optional
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
*/
|
|
397
|
+
/**
|
|
398
|
+
* Wiki Link for SDK params
|
|
399
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#updatescheduleparams
|
|
400
|
+
*/
|
|
469
401
|
function updateSchedule(options) {
|
|
470
402
|
var deferred = q.defer();
|
|
471
403
|
// Initializing promise
|
|
@@ -495,7 +427,7 @@ function updateSchedule(options) {
|
|
|
495
427
|
});
|
|
496
428
|
} else {
|
|
497
429
|
err = {};
|
|
498
|
-
err.message = err.description = 'Mandatory param - accountid or context or scheduleid or ' +
|
|
430
|
+
err.message = err.description = 'Mandatory param - accountid or context or scheduleid or ' +
|
|
499
431
|
'body(category or actorid) not found in request options.';
|
|
500
432
|
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
501
433
|
deferred.reject(err);
|
|
@@ -504,17 +436,10 @@ function updateSchedule(options) {
|
|
|
504
436
|
return deferred.promise;
|
|
505
437
|
}
|
|
506
438
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
scheduleid: "string", //mandatory
|
|
512
|
-
body: {
|
|
513
|
-
"category": "", //mandatory
|
|
514
|
-
"actorid": "", //mandatory
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
*/
|
|
439
|
+
/**
|
|
440
|
+
* Wiki Link for SDK params
|
|
441
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#deletescheduleparams
|
|
442
|
+
*/
|
|
518
443
|
function deleteSchedule(options) {
|
|
519
444
|
var deferred = q.defer();
|
|
520
445
|
// Initializing promise
|
|
@@ -534,7 +459,7 @@ function deleteSchedule(options) {
|
|
|
534
459
|
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
535
460
|
|
|
536
461
|
requestAPI
|
|
537
|
-
.agent(keepaliveAgent)
|
|
462
|
+
.agent(keepaliveAgent)
|
|
538
463
|
.end(function (error, response) {
|
|
539
464
|
if (error) {
|
|
540
465
|
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
@@ -545,7 +470,7 @@ function deleteSchedule(options) {
|
|
|
545
470
|
});
|
|
546
471
|
} else {
|
|
547
472
|
err = {};
|
|
548
|
-
err.message = err.description = 'Mandatory param - accountid or context or scheduleid or ' +
|
|
473
|
+
err.message = err.description = 'Mandatory param - accountid or context or scheduleid or ' +
|
|
549
474
|
'body not found in request options.';
|
|
550
475
|
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
551
476
|
deferred.reject(err);
|
|
@@ -25,19 +25,13 @@
|
|
|
25
25
|
|
|
26
26
|
var q = require('q');
|
|
27
27
|
var request = require('superagent');
|
|
28
|
-
|
|
29
28
|
var helpers = require('../../helpers');
|
|
30
|
-
|
|
31
29
|
var DLSError = helpers.errors.DLSError;
|
|
32
30
|
|
|
33
|
-
/*********************************
|
|
34
|
-
* Setting Up Module Entry Point
|
|
35
|
-
**********************************/
|
|
36
31
|
module.exports = invitations;
|
|
37
32
|
|
|
38
33
|
//Invitations Adaptor Constructor
|
|
39
34
|
function invitations() {
|
|
40
|
-
|
|
41
35
|
return {
|
|
42
36
|
sendInvitations: sendInvitations.bind(this),
|
|
43
37
|
getMultiInvitations: getMultiInvitations.bind(this),
|
|
@@ -47,35 +41,10 @@ function invitations() {
|
|
|
47
41
|
};
|
|
48
42
|
}
|
|
49
43
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
class_enrollment: {
|
|
55
|
-
classid: 'string', // required. Correlated with context
|
|
56
|
-
class_role: 'string', // optional
|
|
57
|
-
inviter_email: 'string' // optional
|
|
58
|
-
},
|
|
59
|
-
invitation_data: [
|
|
60
|
-
{
|
|
61
|
-
class_enrollment : { // optional, will override the outer context
|
|
62
|
-
classid: 'string' // required. Correlated with context
|
|
63
|
-
class_role: 'string', // optional
|
|
64
|
-
inviter_email: 'string' // optional
|
|
65
|
-
},
|
|
66
|
-
email: 'string', // required
|
|
67
|
-
dls_account_status: 'string',
|
|
68
|
-
ext_account_status: 'string',
|
|
69
|
-
userid: 'string',
|
|
70
|
-
ext_user_id: 'string',
|
|
71
|
-
first_name: 'string', // required
|
|
72
|
-
last_name: 'string', // required
|
|
73
|
-
ext_data: {},
|
|
74
|
-
rowId: 'string', // required
|
|
75
|
-
role: 'string' /// required
|
|
76
|
-
},...
|
|
77
|
-
]
|
|
78
|
-
}*/
|
|
44
|
+
/**
|
|
45
|
+
* Wiki Link for SDK params
|
|
46
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/20_Invitations-Adapter#sendInvitationsparams
|
|
47
|
+
*/
|
|
79
48
|
function sendInvitations(options) {
|
|
80
49
|
var self = this;
|
|
81
50
|
var dfd = q.defer();
|
|
@@ -118,13 +87,10 @@ function sendInvitations(options) {
|
|
|
118
87
|
return dfd.promise;
|
|
119
88
|
}
|
|
120
89
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"cursor" : "string", // optional
|
|
126
|
-
};
|
|
127
|
-
*/
|
|
90
|
+
/**
|
|
91
|
+
* Wiki Link for SDK params
|
|
92
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/20_Invitations-Adapter#getmultiinvitationsparams
|
|
93
|
+
*/
|
|
128
94
|
function getMultiInvitations(options) {
|
|
129
95
|
var self = this;
|
|
130
96
|
// Initializing promise
|
|
@@ -171,12 +137,10 @@ function getMultiInvitations(options) {
|
|
|
171
137
|
return dfd.promise;
|
|
172
138
|
}
|
|
173
139
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
};
|
|
179
|
-
*/
|
|
140
|
+
/**
|
|
141
|
+
* Wiki Link for SDK params
|
|
142
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/20_Invitations-Adapter#revokesingleinvitationparams
|
|
143
|
+
*/
|
|
180
144
|
function revokeSingleInvitation(options) {
|
|
181
145
|
var self = this;
|
|
182
146
|
// Initializing promise
|
|
@@ -220,12 +184,10 @@ function revokeSingleInvitation(options) {
|
|
|
220
184
|
return dfd.promise;
|
|
221
185
|
}
|
|
222
186
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
};
|
|
228
|
-
*/
|
|
187
|
+
/**
|
|
188
|
+
* Wiki Link for SDK params
|
|
189
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/20_Invitations-Adapter#completesingleinvitationparams
|
|
190
|
+
*/
|
|
229
191
|
function completeSingleInvitation(options) {
|
|
230
192
|
var self = this;
|
|
231
193
|
// Initializing promise
|
|
@@ -270,13 +232,10 @@ function completeSingleInvitation(options) {
|
|
|
270
232
|
return dfd.promise;
|
|
271
233
|
}
|
|
272
234
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
"space_title" : "string" //optional
|
|
278
|
-
};
|
|
279
|
-
*/
|
|
235
|
+
/**
|
|
236
|
+
* Wiki Link for SDK params
|
|
237
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/20_Invitations-Adapter#resendsingleinvitationparams
|
|
238
|
+
*/
|
|
280
239
|
function resendSingleInvitation(options) {
|
|
281
240
|
var self = this;
|
|
282
241
|
// Initializing promise
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* is strictly forbidden unless prior written permission is obtained
|
|
18
18
|
* from Compro Technologies Pvt. Ltd..
|
|
19
19
|
***************************************************************************/
|
|
20
|
+
|
|
20
21
|
/***********************************************************
|
|
21
22
|
* comproDLS SDK Product API Adaptor
|
|
22
23
|
* Functions for calling Product API.
|
|
@@ -27,81 +28,76 @@ var q = require('q');
|
|
|
27
28
|
var helpers = require('../../helpers');
|
|
28
29
|
var DLSError = helpers.errors.DLSError;
|
|
29
30
|
|
|
30
|
-
/*********************************
|
|
31
|
-
* Setting Up Module Entry Point
|
|
32
|
-
**********************************/
|
|
33
31
|
module.exports = product;
|
|
34
32
|
|
|
35
33
|
function product(accountId) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
34
|
+
this.accountId = accountId;
|
|
35
|
+
return {
|
|
36
|
+
getProduct: getProduct.bind(this),
|
|
37
|
+
getGlobalEntitlementsForAUser: getGlobalEntitlementsForAUser.bind(this),
|
|
38
|
+
getMicroEntitlementsForAUser: getMicroEntitlementsForAUser.bind(this),
|
|
39
|
+
|
|
40
|
+
getAllBundles: getAllBundles.bind(this),
|
|
41
|
+
getSingleBundle: getSingleBundle.bind(this),
|
|
42
|
+
|
|
43
|
+
getSingleProductFamily: getSingleProductFamily.bind(this),
|
|
44
|
+
getAllProductFamilies: getAllProductFamilies.bind(this)
|
|
45
|
+
};
|
|
48
46
|
}
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
*
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
//options = {
|
|
55
|
-
// productcode: '', //productcode of product
|
|
56
|
-
// details: boolean, // (optional)
|
|
57
|
-
// stage: string // (optional, ['1', '2', 'final']), default - final
|
|
58
|
-
//}
|
|
48
|
+
/**
|
|
49
|
+
* Wiki Link for SDK params
|
|
50
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/05_PRODUCT-Adapter#getproductparams
|
|
51
|
+
*/
|
|
59
52
|
function getProduct(options) {
|
|
60
|
-
|
|
53
|
+
var dfd = q.defer();
|
|
61
54
|
var self = this;
|
|
62
|
-
|
|
55
|
+
var err = {};
|
|
63
56
|
|
|
64
57
|
if(options && options.productcode) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
//Setup request with URL and Params
|
|
82
|
-
var requestAPI = request.get(url).query(params);
|
|
83
|
-
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
84
|
-
|
|
85
|
-
//Call GET All Products Source Api
|
|
86
|
-
requestAPI.end(function(err, response) {
|
|
87
|
-
if (err) {
|
|
88
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
89
|
-
dfd.reject(err);
|
|
90
|
-
} else {
|
|
91
|
-
dfd.resolve(response.body);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
58
|
+
//Passed all validations, Construct API url
|
|
59
|
+
var url = self.config.DEFAULT_HOSTS['PRODUCT'] +
|
|
60
|
+
self.config.PRODUCT_API_URLS.getProductAPI;
|
|
61
|
+
url = helpers.api.constructAPIUrl(url, {
|
|
62
|
+
accountId: self.accountId,
|
|
63
|
+
productCode: options.productcode
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
//Construct parameters
|
|
67
|
+
var params = {};
|
|
68
|
+
if(options.details) {
|
|
69
|
+
params.details = options.details;
|
|
70
|
+
}
|
|
71
|
+
if(options.stage) {
|
|
72
|
+
params.stage = options.stage;
|
|
94
73
|
}
|
|
95
|
-
|
|
74
|
+
//Setup request with URL and Params
|
|
75
|
+
var requestAPI = request.get(url).query(params);
|
|
76
|
+
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
77
|
+
|
|
78
|
+
//Call GET All Products Source Api
|
|
79
|
+
requestAPI.end(function(err, response) {
|
|
80
|
+
if (err) {
|
|
81
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
82
|
+
dfd.reject(err);
|
|
83
|
+
} else {
|
|
84
|
+
dfd.resolve(response.body);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
96
89
|
err.message = err.description = 'productcode not found in request options';
|
|
97
90
|
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
98
91
|
dfd.reject(err);
|
|
99
92
|
}
|
|
100
93
|
|
|
101
|
-
|
|
94
|
+
return dfd.promise;
|
|
102
95
|
}
|
|
103
96
|
|
|
104
|
-
|
|
97
|
+
/**
|
|
98
|
+
* Wiki Link for SDK params
|
|
99
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/05_PRODUCT-Adapter#getglobalentitlementsforauserparams
|
|
100
|
+
*/
|
|
105
101
|
function getGlobalEntitlementsForAUser(options) {
|
|
106
102
|
var self = this;
|
|
107
103
|
|
|
@@ -140,17 +136,12 @@ function getGlobalEntitlementsForAUser(options) {
|
|
|
140
136
|
dfd.reject(err);
|
|
141
137
|
}
|
|
142
138
|
return dfd.promise;
|
|
143
|
-
|
|
144
139
|
}
|
|
145
140
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
feature_key, //optional
|
|
151
|
-
cursor //optional
|
|
152
|
-
}
|
|
153
|
-
*/
|
|
141
|
+
/**
|
|
142
|
+
* Wiki Link for SDK params
|
|
143
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/05_PRODUCT-Adapter#getmicroentitlementsforauserparams
|
|
144
|
+
*/
|
|
154
145
|
function getMicroEntitlementsForAUser(options) {
|
|
155
146
|
var self = this;
|
|
156
147
|
|
|
@@ -192,13 +183,12 @@ function getMicroEntitlementsForAUser(options) {
|
|
|
192
183
|
dfd.reject(err);
|
|
193
184
|
}
|
|
194
185
|
return dfd.promise;
|
|
195
|
-
|
|
196
186
|
}
|
|
197
187
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
188
|
+
/**
|
|
189
|
+
* Wiki Link for SDK params
|
|
190
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/05_PRODUCT-Adapter#getallbundlesparams
|
|
191
|
+
*/
|
|
202
192
|
function getAllBundles(options) {
|
|
203
193
|
var self = this;
|
|
204
194
|
var dfd = q.defer();
|
|
@@ -234,16 +224,15 @@ function getAllBundles(options) {
|
|
|
234
224
|
return dfd.promise;
|
|
235
225
|
}
|
|
236
226
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
227
|
+
/**
|
|
228
|
+
* Wiki Link for SDK params
|
|
229
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/05_PRODUCT-Adapter#getsinglebundleparams
|
|
230
|
+
*/
|
|
241
231
|
function getSingleBundle(options) {
|
|
242
232
|
var self = this;
|
|
243
233
|
var dfd = q.defer();
|
|
244
234
|
var err;
|
|
245
235
|
|
|
246
|
-
|
|
247
236
|
if(options && options['bundle-code']) {
|
|
248
237
|
|
|
249
238
|
var url = self.config.DEFAULT_HOSTS.PRODUCT + self.config.PRODUCT_API_URLS.getSingleBundle;
|
|
@@ -273,13 +262,13 @@ function getSingleBundle(options) {
|
|
|
273
262
|
dfd.reject(err);
|
|
274
263
|
}
|
|
275
264
|
|
|
276
|
-
|
|
277
265
|
return dfd.promise;
|
|
278
266
|
}
|
|
279
267
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
268
|
+
/**
|
|
269
|
+
* Wiki Link for SDK params
|
|
270
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/05_PRODUCT-Adapter#getallproductfamiliesparams
|
|
271
|
+
*/
|
|
283
272
|
function getAllProductFamilies(options) {
|
|
284
273
|
var self = this;
|
|
285
274
|
var dfd = q.defer();
|
|
@@ -308,10 +297,10 @@ function getAllProductFamilies(options) {
|
|
|
308
297
|
return dfd.promise;
|
|
309
298
|
}
|
|
310
299
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
300
|
+
/**
|
|
301
|
+
* Wiki Link for SDK params
|
|
302
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/05_PRODUCT-Adapter#getsingleproductfamilyparams
|
|
303
|
+
*/
|
|
315
304
|
function getSingleProductFamily(options) {
|
|
316
305
|
var self = this;
|
|
317
306
|
var dfd = q.defer();
|