@itentialopensource/adapter-webex_teams 0.5.4 → 0.6.0

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.
Files changed (55) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +12 -12
  3. package/AUTH.md +39 -0
  4. package/BROKER.md +199 -0
  5. package/CALLS.md +169 -0
  6. package/CHANGELOG.md +41 -18
  7. package/CODE_OF_CONDUCT.md +12 -17
  8. package/CONTRIBUTING.md +88 -74
  9. package/ENHANCE.md +69 -0
  10. package/PROPERTIES.md +641 -0
  11. package/README.md +247 -395
  12. package/SUMMARY.md +9 -0
  13. package/SYSTEMINFO.md +11 -0
  14. package/TROUBLESHOOT.md +47 -0
  15. package/adapter.js +898 -35
  16. package/adapterBase.js +1331 -50
  17. package/entities/.generic/action.json +214 -0
  18. package/entities/.generic/schema.json +28 -0
  19. package/entities/.system/action.json +3 -3
  20. package/entities/.system/schemaTokenReq.json +24 -0
  21. package/entities/.system/schemaTokenResp.json +1 -1
  22. package/error.json +12 -0
  23. package/package.json +47 -23
  24. package/pronghorn.json +642 -0
  25. package/propertiesDecorators.json +14 -0
  26. package/propertiesSchema.json +507 -13
  27. package/refs?service=git-upload-pack +0 -0
  28. package/report/adapterInfo.json +10 -0
  29. package/report/updateReport1594310783472.json +95 -0
  30. package/report/updateReport1615908902547.json +95 -0
  31. package/report/updateReport1653575821854.json +120 -0
  32. package/sampleProperties.json +115 -11
  33. package/storage/metrics.json +692 -0
  34. package/test/integration/adapterTestBasicGet.js +85 -0
  35. package/test/integration/adapterTestConnectivity.js +93 -0
  36. package/test/integration/adapterTestIntegration.js +42 -105
  37. package/test/unit/adapterBaseTestUnit.js +949 -0
  38. package/test/unit/adapterTestUnit.js +683 -144
  39. package/utils/adapterInfo.js +206 -0
  40. package/utils/addAuth.js +94 -0
  41. package/utils/artifactize.js +9 -14
  42. package/utils/basicGet.js +50 -0
  43. package/utils/checkMigrate.js +63 -0
  44. package/utils/entitiesToDB.js +179 -0
  45. package/utils/findPath.js +74 -0
  46. package/utils/modify.js +154 -0
  47. package/utils/packModificationScript.js +1 -1
  48. package/utils/patches2bundledDeps.js +90 -0
  49. package/utils/pre-commit.sh +4 -1
  50. package/utils/removeHooks.js +20 -0
  51. package/utils/tbScript.js +184 -0
  52. package/utils/tbUtils.js +469 -0
  53. package/utils/testRunner.js +16 -16
  54. package/utils/troubleshootingAdapter.js +190 -0
  55. package/gl-code-quality-report.json +0 -1
package/adapter.js CHANGED
@@ -10,12 +10,10 @@
10
10
 
11
11
  /* Required libraries. */
12
12
  const path = require('path');
13
- // const xmldom = require('xmldom');
14
13
 
15
14
  /* Fetch in the other needed components for the this Adaptor */
16
15
  const AdapterBaseCl = require(path.join(__dirname, 'adapterBase.js'));
17
16
 
18
-
19
17
  /**
20
18
  * This is the adapter/interface into WebexTeams
21
19
  */
@@ -25,69 +23,303 @@ class WebexTeams extends AdapterBaseCl {
25
23
  /**
26
24
  * Bitbucket Adapter
27
25
  * @constructor
26
+ */
27
+ /* Working on changing the way we do Emit methods due to size and time constrainsts
28
28
  constructor(prongid, properties) {
29
29
  // Instantiate the AdapterBase super class
30
30
  super(prongid, properties);
31
31
 
32
+ const restFunctionNames = this.getWorkflowFunctions();
33
+
34
+ // Dynamically bind emit functions
35
+ for (let i = 0; i < restFunctionNames.length; i += 1) {
36
+ // Bind function to have name fnNameEmit for fnName
37
+ const version = restFunctionNames[i].match(/__v[0-9]+/);
38
+ const baseFnName = restFunctionNames[i].replace(/__v[0-9]+/, '');
39
+ const fnNameEmit = version ? `${baseFnName}Emit${version}` : `${baseFnName}Emit`;
40
+ this[fnNameEmit] = function (...args) {
41
+ // extract the callback
42
+ const callback = args[args.length - 1];
43
+ // slice the callback from args so we can insert our own
44
+ const functionArgs = args.slice(0, args.length - 1);
45
+ // create a random name for the listener
46
+ const eventName = `${restFunctionNames[i]}:${Math.random().toString(36)}`;
47
+ // tell the calling class to start listening
48
+ callback({ event: eventName, status: 'received' });
49
+ // store parent for use of this context later
50
+ const parent = this;
51
+ // store emission function
52
+ const func = function (val, err) {
53
+ parent.removeListener(eventName, func);
54
+ parent.emit(eventName, val, err);
55
+ };
56
+ // Use apply to call the function in a specific context
57
+ this[restFunctionNames[i]].apply(this, functionArgs.concat([func])); // eslint-disable-line prefer-spread
58
+ };
59
+ }
60
+
32
61
  // Uncomment if you have things to add to the constructor like using your own properties.
33
62
  // Otherwise the constructor in the adapterBase will be used.
34
63
  // Capture my own properties - they need to be defined in propertiesSchema.json
35
- if (this.allProps && this.allProps.myownproperty) {
36
- mypropvariable = this.allProps.myownproperty;
37
- }
64
+ // if (this.allProps && this.allProps.myownproperty) {
65
+ // mypropvariable = this.allProps.myownproperty;
66
+ // }
38
67
  }
39
68
  */
40
69
 
41
-
42
70
  /**
43
71
  * @callback healthCallback
44
- * @param {Object} result - the result of the get request (contains an id and a status)
72
+ * @param {Object} reqObj - the request to send into the healthcheck
73
+ * @param {Callback} callback - The results of the call
45
74
  */
75
+ healthCheck(reqObj, callback) {
76
+ // you can modify what is passed into the healthcheck by changing things in the newReq
77
+ let newReq = null;
78
+ if (reqObj) {
79
+ newReq = Object.assign(...reqObj);
80
+ }
81
+ super.healthCheck(newReq, callback);
82
+ }
83
+
46
84
  /**
47
- * @callback getCallback
48
- * @param {Object} result - the result of the get request (entity/ies)
49
- * @param {String} error - any error that occurred
85
+ * @iapGetAdapterWorkflowFunctions
50
86
  */
87
+ iapGetAdapterWorkflowFunctions(inIgnore) {
88
+ let myIgnore = [
89
+ 'healthCheck',
90
+ 'iapGetAdapterWorkflowFunctions',
91
+ 'iapHasAdapterEntity',
92
+ 'iapVerifyAdapterCapability',
93
+ 'iapUpdateAdapterEntityCache',
94
+ 'hasEntities',
95
+ 'getAuthorization'
96
+ ];
97
+ if (!inIgnore && Array.isArray(inIgnore)) {
98
+ myIgnore = inIgnore;
99
+ } else if (!inIgnore && typeof inIgnore === 'string') {
100
+ myIgnore = [inIgnore];
101
+ }
102
+
103
+ // The generic adapter functions should already be ignored (e.g. healthCheck)
104
+ // you can add specific methods that you do not want to be workflow functions to ignore like below
105
+ // myIgnore.push('myMethodNotInWorkflow');
106
+
107
+ return super.iapGetAdapterWorkflowFunctions(myIgnore);
108
+ }
109
+
51
110
  /**
52
- * @callback createCallback
53
- * @param {Object} item - the newly created entity
54
- * @param {String} error - any error that occurred
111
+ * iapUpdateAdapterConfiguration is used to update any of the adapter configuration files. This
112
+ * allows customers to make changes to adapter configuration without having to be on the
113
+ * file system.
114
+ *
115
+ * @function iapUpdateAdapterConfiguration
116
+ * @param {string} configFile - the name of the file being updated (required)
117
+ * @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required)
118
+ * @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
119
+ * @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
120
+ * @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
121
+ * @param {Callback} callback - The results of the call
55
122
  */
123
+ iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
124
+ const meth = 'adapter-iapUpdateAdapterConfiguration';
125
+ const origin = `${this.id}-${meth}`;
126
+ log.trace(origin);
127
+
128
+ super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback);
129
+ }
130
+
56
131
  /**
57
- * @callback updateCallback
58
- * @param {String} status - the status of the update action
59
- * @param {String} error - any error that occurred
132
+ * See if the API path provided is found in this adapter
133
+ *
134
+ * @function iapFindAdapterPath
135
+ * @param {string} apiPath - the api path to check on
136
+ * @param {Callback} callback - The results of the call
60
137
  */
138
+ iapFindAdapterPath(apiPath, callback) {
139
+ const meth = 'adapter-iapFindAdapterPath';
140
+ const origin = `${this.id}-${meth}`;
141
+ log.trace(origin);
142
+
143
+ super.iapFindAdapterPath(apiPath, callback);
144
+ }
145
+
61
146
  /**
62
- * @callback deleteCallback
63
- * @param {String} status - the status of the delete action
64
- * @param {String} error - any error that occurred
147
+ * @summary Suspends adapter
148
+ *
149
+ * @function iapSuspendAdapter
150
+ * @param {Callback} callback - callback function
151
+ */
152
+ iapSuspendAdapter(mode, callback) {
153
+ const meth = 'adapter-iapSuspendAdapter';
154
+ const origin = `${this.id}-${meth}`;
155
+ log.trace(origin);
156
+
157
+ try {
158
+ return super.iapSuspendAdapter(mode, callback);
159
+ } catch (error) {
160
+ log.error(`${origin}: ${error}`);
161
+ return callback(null, error);
162
+ }
163
+ }
164
+
165
+ /**
166
+ * @summary Unsuspends adapter
167
+ *
168
+ * @function iapUnsuspendAdapter
169
+ * @param {Callback} callback - callback function
170
+ */
171
+ iapUnsuspendAdapter(callback) {
172
+ const meth = 'adapter-iapUnsuspendAdapter';
173
+ const origin = `${this.id}-${meth}`;
174
+ log.trace(origin);
175
+
176
+ try {
177
+ return super.iapUnsuspendAdapter(callback);
178
+ } catch (error) {
179
+ log.error(`${origin}: ${error}`);
180
+ return callback(null, error);
181
+ }
182
+ }
183
+
184
+ /**
185
+ * @summary Get the Adaoter Queue
186
+ *
187
+ * @function iapGetAdapterQueue
188
+ * @param {Callback} callback - callback function
189
+ */
190
+ iapGetAdapterQueue(callback) {
191
+ const meth = 'adapter-iapGetAdapterQueue';
192
+ const origin = `${this.id}-${meth}`;
193
+ log.trace(origin);
194
+
195
+ return super.iapGetAdapterQueue(callback);
196
+ }
197
+
198
+ /**
199
+ * @summary Runs troubleshoot scripts for adapter
200
+ *
201
+ * @function iapTroubleshootAdapter
202
+ * @param {Object} props - the connection, healthcheck and authentication properties
203
+ *
204
+ * @param {boolean} persistFlag - whether the adapter properties should be updated
205
+ * @param {Callback} callback - The results of the call
206
+ */
207
+ iapTroubleshootAdapter(props, persistFlag, callback) {
208
+ const meth = 'adapter-iapTroubleshootAdapter';
209
+ const origin = `${this.id}-${meth}`;
210
+ log.trace(origin);
211
+
212
+ try {
213
+ return super.iapTroubleshootAdapter(props, persistFlag, this, callback);
214
+ } catch (error) {
215
+ log.error(`${origin}: ${error}`);
216
+ return callback(null, error);
217
+ }
218
+ }
219
+
220
+ /**
221
+ * @summary runs healthcheck script for adapter
222
+ *
223
+ * @function iapRunAdapterHealthcheck
224
+ * @param {Adapter} adapter - adapter instance to troubleshoot
225
+ * @param {Callback} callback - callback function
226
+ */
227
+ iapRunAdapterHealthcheck(callback) {
228
+ const meth = 'adapter-iapRunAdapterHealthcheck';
229
+ const origin = `${this.id}-${meth}`;
230
+ log.trace(origin);
231
+
232
+ try {
233
+ return super.iapRunAdapterHealthcheck(this, callback);
234
+ } catch (error) {
235
+ log.error(`${origin}: ${error}`);
236
+ return callback(null, error);
237
+ }
238
+ }
239
+
240
+ /**
241
+ * @summary runs connectivity check script for adapter
242
+ *
243
+ * @function iapRunAdapterConnectivity
244
+ * @param {Callback} callback - callback function
245
+ */
246
+ iapRunAdapterConnectivity(callback) {
247
+ const meth = 'adapter-iapRunAdapterConnectivity';
248
+ const origin = `${this.id}-${meth}`;
249
+ log.trace(origin);
250
+
251
+ try {
252
+ return super.iapRunAdapterConnectivity(callback);
253
+ } catch (error) {
254
+ log.error(`${origin}: ${error}`);
255
+ return callback(null, error);
256
+ }
257
+ }
258
+
259
+ /**
260
+ * @summary runs basicGet script for adapter
261
+ *
262
+ * @function iapRunAdapterBasicGet
263
+ * @param {Callback} callback - callback function
264
+ */
265
+ iapRunAdapterBasicGet(callback) {
266
+ const meth = 'adapter-iapRunAdapterBasicGet';
267
+ const origin = `${this.id}-${meth}`;
268
+ log.trace(origin);
269
+
270
+ try {
271
+ return super.iapRunAdapterBasicGet(callback);
272
+ } catch (error) {
273
+ log.error(`${origin}: ${error}`);
274
+ return callback(null, error);
275
+ }
276
+ }
277
+
278
+ /**
279
+ * @summary moves entites into Mongo DB
280
+ *
281
+ * @function iapMoveAdapterEntitiesToDB
282
+ * @param {getCallback} callback - a callback function to return the result (Generics)
283
+ * or the error
65
284
  */
285
+ iapMoveAdapterEntitiesToDB(callback) {
286
+ const meth = 'adapter-iapMoveAdapterEntitiesToDB';
287
+ const origin = `${this.id}-${meth}`;
288
+ log.trace(origin);
289
+
290
+ try {
291
+ return super.iapMoveAdapterEntitiesToDB(callback);
292
+ } catch (err) {
293
+ log.error(`${origin}: ${err}`);
294
+ return callback(null, err);
295
+ }
296
+ }
66
297
 
298
+ /* BROKER CALLS */
67
299
  /**
68
300
  * @summary Determines if this adapter supports the specific entity
69
301
  *
70
- * @function hasEntity
302
+ * @function iapHasAdapterEntity
71
303
  * @param {String} entityType - the entity type to check for
72
304
  * @param {String/Array} entityId - the specific entity we are looking for
73
305
  *
74
306
  * @param {Callback} callback - An array of whether the adapter can has the
75
307
  * desired capability or an error
76
308
  */
77
- hasEntity(entityType, entityId, callback) {
78
- const origin = `${this.id}-adapter-hasEntity`;
309
+ iapHasAdapterEntity(entityType, entityId, callback) {
310
+ const origin = `${this.id}-adapter-iapHasAdapterEntity`;
79
311
  log.trace(origin);
80
312
 
81
313
  // Make the call -
82
- // verifyCapability(entityType, actionType, entityId, callback)
83
- return this.verifyCapability(entityType, null, entityId, callback);
314
+ // iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
315
+ return this.iapVerifyAdapterCapability(entityType, null, entityId, callback);
84
316
  }
85
317
 
86
318
  /**
87
319
  * @summary Provides a way for the adapter to tell north bound integrations
88
320
  * whether the adapter supports type, action and specific entity
89
321
  *
90
- * @function verifyCapability
322
+ * @function iapVerifyAdapterCapability
91
323
  * @param {String} entityType - the entity type to check for
92
324
  * @param {String} actionType - the action type to check for
93
325
  * @param {String/Array} entityId - the specific entity we are looking for
@@ -95,15 +327,15 @@ class WebexTeams extends AdapterBaseCl {
95
327
  * @param {Callback} callback - An array of whether the adapter can has the
96
328
  * desired capability or an error
97
329
  */
98
- verifyCapability(entityType, actionType, entityId, callback) {
99
- const meth = 'adapterBase-verifyCapability';
330
+ iapVerifyAdapterCapability(entityType, actionType, entityId, callback) {
331
+ const meth = 'adapterBase-iapVerifyAdapterCapability';
100
332
  const origin = `${this.id}-${meth}`;
101
333
  log.trace(origin);
102
334
 
103
335
  // if caching
104
336
  if (this.caching) {
105
- // Make the call - verifyCapability(entityType, actionType, entityId, callback)
106
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (results, error) => {
337
+ // Make the call - iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
338
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (results, error) => {
107
339
  if (error) {
108
340
  return callback(null, error);
109
341
  }
@@ -121,7 +353,7 @@ class WebexTeams extends AdapterBaseCl {
121
353
  }
122
354
 
123
355
  // need to check the cache again since it has been updated
124
- return this.requestHandlerInst.verifyCapability(entityType, actionType, entityId, (vcapable, verror) => {
356
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (vcapable, verror) => {
125
357
  if (verror) {
126
358
  return callback(null, verror);
127
359
  }
@@ -154,7 +386,7 @@ class WebexTeams extends AdapterBaseCl {
154
386
  // if no entity id
155
387
  if (!entityId) {
156
388
  // need to check the cache again since it has been updated
157
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
389
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
158
390
  if (verror) {
159
391
  return callback(null, verror);
160
392
  }
@@ -175,7 +407,7 @@ class WebexTeams extends AdapterBaseCl {
175
407
  }
176
408
 
177
409
  // need to check the cache again since it has been updated
178
- return this.requestHandlerInst.verifyCapability(entityType, actionType, null, (vcapable, verror) => {
410
+ return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
179
411
  if (verror) {
180
412
  return callback(null, verror);
181
413
  }
@@ -216,11 +448,11 @@ class WebexTeams extends AdapterBaseCl {
216
448
  /**
217
449
  * @summary Updates the cache for all entities by call the get All entity method
218
450
  *
219
- * @function updateEntityCache
451
+ * @function iapUpdateAdapterEntityCache
220
452
  *
221
453
  */
222
- updateEntityCache() {
223
- const origin = `${this.id}-adapter-updateEntityCache`;
454
+ iapUpdateAdapterEntityCache() {
455
+ const origin = `${this.id}-adapter-iapUpdateAdapterEntityCache`;
224
456
  log.trace(origin);
225
457
 
226
458
  if (this.caching) {
@@ -233,6 +465,385 @@ class WebexTeams extends AdapterBaseCl {
233
465
  }
234
466
  }
235
467
 
468
+ /**
469
+ * @summary Determines if this adapter supports any in a list of entities
470
+ *
471
+ * @function hasEntities
472
+ * @param {String} entityType - the entity type to check for
473
+ * @param {Array} entityList - the list of entities we are looking for
474
+ *
475
+ * @param {Callback} callback - A map where the entity is the key and the
476
+ * value is true or false
477
+ */
478
+ hasEntities(entityType, entityList, callback) {
479
+ const meth = 'adapter-hasEntities';
480
+ const origin = `${this.id}-${meth}`;
481
+ log.trace(origin);
482
+
483
+ try {
484
+ return super.hasEntities(entityType, entityList, callback);
485
+ } catch (err) {
486
+ log.error(`${origin}: ${err}`);
487
+ return callback(null, err);
488
+ }
489
+ }
490
+
491
+ /**
492
+ * @summary Get Appliance that match the deviceName
493
+ *
494
+ * @function getDevice
495
+ * @param {String} deviceName - the deviceName to find (required)
496
+ *
497
+ * @param {getCallback} callback - a callback function to return the result
498
+ * (appliance) or the error
499
+ */
500
+ getDevice(deviceName, callback) {
501
+ const meth = 'adapter-getDevice';
502
+ const origin = `${this.id}-${meth}`;
503
+ log.trace(origin);
504
+
505
+ try {
506
+ return super.getDevice(deviceName, callback);
507
+ } catch (err) {
508
+ log.error(`${origin}: ${err}`);
509
+ return callback(null, err);
510
+ }
511
+ }
512
+
513
+ /**
514
+ * @summary Get Appliances that match the filter
515
+ *
516
+ * @function getDevicesFiltered
517
+ * @param {Object} options - the data to use to filter the appliances (optional)
518
+ *
519
+ * @param {getCallback} callback - a callback function to return the result
520
+ * (appliances) or the error
521
+ */
522
+ getDevicesFiltered(options, callback) {
523
+ const meth = 'adapter-getDevicesFiltered';
524
+ const origin = `${this.id}-${meth}`;
525
+ log.trace(origin);
526
+
527
+ try {
528
+ return super.getDevicesFiltered(options, callback);
529
+ } catch (err) {
530
+ log.error(`${origin}: ${err}`);
531
+ return callback(null, err);
532
+ }
533
+ }
534
+
535
+ /**
536
+ * @summary Gets the status for the provided appliance
537
+ *
538
+ * @function isAlive
539
+ * @param {String} deviceName - the deviceName of the appliance. (required)
540
+ *
541
+ * @param {configCallback} callback - callback function to return the result
542
+ * (appliance isAlive) or the error
543
+ */
544
+ isAlive(deviceName, callback) {
545
+ const meth = 'adapter-isAlive';
546
+ const origin = `${this.id}-${meth}`;
547
+ log.trace(origin);
548
+
549
+ try {
550
+ return super.isAlive(deviceName, callback);
551
+ } catch (err) {
552
+ log.error(`${origin}: ${err}`);
553
+ return callback(null, err);
554
+ }
555
+ }
556
+
557
+ /**
558
+ * @summary Gets a config for the provided Appliance
559
+ *
560
+ * @function getConfig
561
+ * @param {String} deviceName - the deviceName of the appliance. (required)
562
+ * @param {String} format - the desired format of the config. (optional)
563
+ *
564
+ * @param {configCallback} callback - callback function to return the result
565
+ * (appliance config) or the error
566
+ */
567
+ getConfig(deviceName, format, callback) {
568
+ const meth = 'adapter-getConfig';
569
+ const origin = `${this.id}-${meth}`;
570
+ log.trace(origin);
571
+
572
+ try {
573
+ return super.getConfig(deviceName, format, callback);
574
+ } catch (err) {
575
+ log.error(`${origin}: ${err}`);
576
+ return callback(null, err);
577
+ }
578
+ }
579
+
580
+ /**
581
+ * @summary Gets the device count from the system
582
+ *
583
+ * @function iapGetDeviceCount
584
+ *
585
+ * @param {getCallback} callback - callback function to return the result
586
+ * (count) or the error
587
+ */
588
+ iapGetDeviceCount(callback) {
589
+ const meth = 'adapter-iapGetDeviceCount';
590
+ const origin = `${this.id}-${meth}`;
591
+ log.trace(origin);
592
+
593
+ try {
594
+ return super.iapGetDeviceCount(callback);
595
+ } catch (err) {
596
+ log.error(`${origin}: ${err}`);
597
+ return callback(null, err);
598
+ }
599
+ }
600
+
601
+ /* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
602
+ /**
603
+ * Makes the requested generic call
604
+ *
605
+ * @function genericAdapterRequest
606
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
607
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
608
+ * @param {Object} queryData - the parameters to be put on the url (optional).
609
+ * Can be a stringified Object.
610
+ * @param {Object} requestBody - the body to add to the request (optional).
611
+ * Can be a stringified Object.
612
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
613
+ * Can be a stringified Object.
614
+ * @param {getCallback} callback - a callback function to return the result (Generics)
615
+ * or the error
616
+ */
617
+ genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
618
+ const meth = 'adapter-genericAdapterRequest';
619
+ const origin = `${this.id}-${meth}`;
620
+ log.trace(origin);
621
+
622
+ if (this.suspended && this.suspendMode === 'error') {
623
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
624
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
625
+ return callback(null, errorObj);
626
+ }
627
+
628
+ /* HERE IS WHERE YOU VALIDATE DATA */
629
+ if (uriPath === undefined || uriPath === null || uriPath === '') {
630
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
631
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
632
+ return callback(null, errorObj);
633
+ }
634
+ if (restMethod === undefined || restMethod === null || restMethod === '') {
635
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
636
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
637
+ return callback(null, errorObj);
638
+ }
639
+
640
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
641
+ // remove any leading / and split the uripath into path variables
642
+ let myPath = uriPath;
643
+ while (myPath.indexOf('/') === 0) {
644
+ myPath = myPath.substring(1);
645
+ }
646
+ const pathVars = myPath.split('/');
647
+ const queryParamsAvailable = queryData;
648
+ const queryParams = {};
649
+ const bodyVars = requestBody;
650
+
651
+ // loop in template. long callback arg name to avoid identifier conflicts
652
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
653
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
654
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
655
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
656
+ }
657
+ });
658
+
659
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
660
+ const reqObj = {
661
+ payload: bodyVars,
662
+ uriPathVars: pathVars,
663
+ uriQuery: queryParams,
664
+ uriOptions: {}
665
+ };
666
+ // add headers if provided
667
+ if (addlHeaders) {
668
+ reqObj.addlHeaders = addlHeaders;
669
+ }
670
+
671
+ // determine the call and return flag
672
+ let action = 'getGenerics';
673
+ let returnF = true;
674
+ if (restMethod.toUpperCase() === 'POST') {
675
+ action = 'createGeneric';
676
+ } else if (restMethod.toUpperCase() === 'PUT') {
677
+ action = 'updateGeneric';
678
+ } else if (restMethod.toUpperCase() === 'PATCH') {
679
+ action = 'patchGeneric';
680
+ } else if (restMethod.toUpperCase() === 'DELETE') {
681
+ action = 'deleteGeneric';
682
+ returnF = false;
683
+ }
684
+
685
+ try {
686
+ // Make the call -
687
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
688
+ return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
689
+ // if we received an error or their is no response on the results
690
+ // return an error
691
+ if (irReturnError) {
692
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
693
+ return callback(null, irReturnError);
694
+ }
695
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
696
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
697
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
698
+ return callback(null, errorObj);
699
+ }
700
+
701
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
702
+ // return the response
703
+ return callback(irReturnData, null);
704
+ });
705
+ } catch (ex) {
706
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
707
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
708
+ return callback(null, errorObj);
709
+ }
710
+ }
711
+
712
+ /**
713
+ * Makes the requested generic call with no base path or version
714
+ *
715
+ * @function genericAdapterRequestNoBasePath
716
+ * @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
717
+ * @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
718
+ * @param {Object} queryData - the parameters to be put on the url (optional).
719
+ * Can be a stringified Object.
720
+ * @param {Object} requestBody - the body to add to the request (optional).
721
+ * Can be a stringified Object.
722
+ * @param {Object} addlHeaders - additional headers to be put on the call (optional).
723
+ * Can be a stringified Object.
724
+ * @param {getCallback} callback - a callback function to return the result (Generics)
725
+ * or the error
726
+ */
727
+ genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
728
+ const meth = 'adapter-genericAdapterRequestNoBasePath';
729
+ const origin = `${this.id}-${meth}`;
730
+ log.trace(origin);
731
+
732
+ if (this.suspended && this.suspendMode === 'error') {
733
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
734
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
735
+ return callback(null, errorObj);
736
+ }
737
+
738
+ /* HERE IS WHERE YOU VALIDATE DATA */
739
+ if (uriPath === undefined || uriPath === null || uriPath === '') {
740
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
741
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
742
+ return callback(null, errorObj);
743
+ }
744
+ if (restMethod === undefined || restMethod === null || restMethod === '') {
745
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
746
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
747
+ return callback(null, errorObj);
748
+ }
749
+
750
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
751
+ // remove any leading / and split the uripath into path variables
752
+ let myPath = uriPath;
753
+ while (myPath.indexOf('/') === 0) {
754
+ myPath = myPath.substring(1);
755
+ }
756
+ const pathVars = myPath.split('/');
757
+ const queryParamsAvailable = queryData;
758
+ const queryParams = {};
759
+ const bodyVars = requestBody;
760
+
761
+ // loop in template. long callback arg name to avoid identifier conflicts
762
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
763
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
764
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
765
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
766
+ }
767
+ });
768
+
769
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
770
+ const reqObj = {
771
+ payload: bodyVars,
772
+ uriPathVars: pathVars,
773
+ uriQuery: queryParams,
774
+ uriOptions: {}
775
+ };
776
+ // add headers if provided
777
+ if (addlHeaders) {
778
+ reqObj.addlHeaders = addlHeaders;
779
+ }
780
+
781
+ // determine the call and return flag
782
+ let action = 'getGenericsNoBase';
783
+ let returnF = true;
784
+ if (restMethod.toUpperCase() === 'POST') {
785
+ action = 'createGenericNoBase';
786
+ } else if (restMethod.toUpperCase() === 'PUT') {
787
+ action = 'updateGenericNoBase';
788
+ } else if (restMethod.toUpperCase() === 'PATCH') {
789
+ action = 'patchGenericNoBase';
790
+ } else if (restMethod.toUpperCase() === 'DELETE') {
791
+ action = 'deleteGenericNoBase';
792
+ returnF = false;
793
+ }
794
+
795
+ try {
796
+ // Make the call -
797
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
798
+ return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
799
+ // if we received an error or their is no response on the results
800
+ // return an error
801
+ if (irReturnError) {
802
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
803
+ return callback(null, irReturnError);
804
+ }
805
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
806
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequestNoBasePath'], null, null, null);
807
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
808
+ return callback(null, errorObj);
809
+ }
810
+
811
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
812
+ // return the response
813
+ return callback(irReturnData, null);
814
+ });
815
+ } catch (ex) {
816
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
817
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
818
+ return callback(null, errorObj);
819
+ }
820
+ }
821
+
822
+ /**
823
+ * @callback healthCallback
824
+ * @param {Object} result - the result of the get request (contains an id and a status)
825
+ */
826
+ /**
827
+ * @callback getCallback
828
+ * @param {Object} result - the result of the get request (entity/ies)
829
+ * @param {String} error - any error that occurred
830
+ */
831
+ /**
832
+ * @callback createCallback
833
+ * @param {Object} item - the newly created entity
834
+ * @param {String} error - any error that occurred
835
+ */
836
+ /**
837
+ * @callback updateCallback
838
+ * @param {String} status - the status of the update action
839
+ * @param {String} error - any error that occurred
840
+ */
841
+ /**
842
+ * @callback deleteCallback
843
+ * @param {String} status - the status of the delete action
844
+ * @param {String} error - any error that occurred
845
+ */
846
+
236
847
  /**
237
848
  * @summary Search people by email address or display name.
238
849
  *
@@ -249,6 +860,12 @@ class WebexTeams extends AdapterBaseCl {
249
860
  const origin = `${this.id}-${meth}`;
250
861
  log.trace(origin);
251
862
 
863
+ if (this.suspended && this.suspendMode === 'error') {
864
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
865
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
866
+ return callback(null, errorObj);
867
+ }
868
+
252
869
  /* HERE IS WHERE YOU VALIDATE DATA */
253
870
 
254
871
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -312,6 +929,12 @@ class WebexTeams extends AdapterBaseCl {
312
929
  const origin = `${this.id}-${meth}`;
313
930
  log.trace(origin);
314
931
 
932
+ if (this.suspended && this.suspendMode === 'error') {
933
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
934
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
935
+ return callback(null, errorObj);
936
+ }
937
+
315
938
  /* HERE IS WHERE YOU VALIDATE DATA */
316
939
  if (body === undefined || body === null || body === '') {
317
940
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
@@ -380,6 +1003,12 @@ class WebexTeams extends AdapterBaseCl {
380
1003
  const origin = `${this.id}-${meth}`;
381
1004
  log.trace(origin);
382
1005
 
1006
+ if (this.suspended && this.suspendMode === 'error') {
1007
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1008
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1009
+ return callback(null, errorObj);
1010
+ }
1011
+
383
1012
  /* HERE IS WHERE YOU VALIDATE DATA */
384
1013
  if (personId === undefined || personId === null || personId === '') {
385
1014
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['personId'], null, null, null);
@@ -449,6 +1078,12 @@ class WebexTeams extends AdapterBaseCl {
449
1078
  const origin = `${this.id}-${meth}`;
450
1079
  log.trace(origin);
451
1080
 
1081
+ if (this.suspended && this.suspendMode === 'error') {
1082
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1083
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1084
+ return callback(null, errorObj);
1085
+ }
1086
+
452
1087
  /* HERE IS WHERE YOU VALIDATE DATA */
453
1088
  if (personId === undefined || personId === null || personId === '') {
454
1089
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['personId'], null, null, null);
@@ -522,6 +1157,12 @@ class WebexTeams extends AdapterBaseCl {
522
1157
  const origin = `${this.id}-${meth}`;
523
1158
  log.trace(origin);
524
1159
 
1160
+ if (this.suspended && this.suspendMode === 'error') {
1161
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1162
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1163
+ return callback(null, errorObj);
1164
+ }
1165
+
525
1166
  /* HERE IS WHERE YOU VALIDATE DATA */
526
1167
  if (personId === undefined || personId === null || personId === '') {
527
1168
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['personId'], null, null, null);
@@ -589,6 +1230,12 @@ class WebexTeams extends AdapterBaseCl {
589
1230
  const origin = `${this.id}-${meth}`;
590
1231
  log.trace(origin);
591
1232
 
1233
+ if (this.suspended && this.suspendMode === 'error') {
1234
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1235
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1236
+ return callback(null, errorObj);
1237
+ }
1238
+
592
1239
  /* HERE IS WHERE YOU VALIDATE DATA */
593
1240
 
594
1241
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -636,6 +1283,12 @@ class WebexTeams extends AdapterBaseCl {
636
1283
  const origin = `${this.id}-${meth}`;
637
1284
  log.trace(origin);
638
1285
 
1286
+ if (this.suspended && this.suspendMode === 'error') {
1287
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1288
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1289
+ return callback(null, errorObj);
1290
+ }
1291
+
639
1292
  /* HERE IS WHERE YOU VALIDATE DATA */
640
1293
 
641
1294
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -699,6 +1352,12 @@ class WebexTeams extends AdapterBaseCl {
699
1352
  const origin = `${this.id}-${meth}`;
700
1353
  log.trace(origin);
701
1354
 
1355
+ if (this.suspended && this.suspendMode === 'error') {
1356
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1357
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1358
+ return callback(null, errorObj);
1359
+ }
1360
+
702
1361
  /* HERE IS WHERE YOU VALIDATE DATA */
703
1362
  if (body === undefined || body === null || body === '') {
704
1363
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
@@ -767,6 +1426,12 @@ class WebexTeams extends AdapterBaseCl {
767
1426
  const origin = `${this.id}-${meth}`;
768
1427
  log.trace(origin);
769
1428
 
1429
+ if (this.suspended && this.suspendMode === 'error') {
1430
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1431
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1432
+ return callback(null, errorObj);
1433
+ }
1434
+
770
1435
  /* HERE IS WHERE YOU VALIDATE DATA */
771
1436
  if (roomId === undefined || roomId === null || roomId === '') {
772
1437
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['roomId'], null, null, null);
@@ -836,6 +1501,12 @@ class WebexTeams extends AdapterBaseCl {
836
1501
  const origin = `${this.id}-${meth}`;
837
1502
  log.trace(origin);
838
1503
 
1504
+ if (this.suspended && this.suspendMode === 'error') {
1505
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1506
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1507
+ return callback(null, errorObj);
1508
+ }
1509
+
839
1510
  /* HERE IS WHERE YOU VALIDATE DATA */
840
1511
  if (roomId === undefined || roomId === null || roomId === '') {
841
1512
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['roomId'], null, null, null);
@@ -909,6 +1580,12 @@ class WebexTeams extends AdapterBaseCl {
909
1580
  const origin = `${this.id}-${meth}`;
910
1581
  log.trace(origin);
911
1582
 
1583
+ if (this.suspended && this.suspendMode === 'error') {
1584
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1585
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1586
+ return callback(null, errorObj);
1587
+ }
1588
+
912
1589
  /* HERE IS WHERE YOU VALIDATE DATA */
913
1590
  if (roomId === undefined || roomId === null || roomId === '') {
914
1591
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['roomId'], null, null, null);
@@ -980,6 +1657,12 @@ class WebexTeams extends AdapterBaseCl {
980
1657
  const origin = `${this.id}-${meth}`;
981
1658
  log.trace(origin);
982
1659
 
1660
+ if (this.suspended && this.suspendMode === 'error') {
1661
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1662
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1663
+ return callback(null, errorObj);
1664
+ }
1665
+
983
1666
  /* HERE IS WHERE YOU VALIDATE DATA */
984
1667
 
985
1668
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -1043,6 +1726,12 @@ class WebexTeams extends AdapterBaseCl {
1043
1726
  const origin = `${this.id}-${meth}`;
1044
1727
  log.trace(origin);
1045
1728
 
1729
+ if (this.suspended && this.suspendMode === 'error') {
1730
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1731
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1732
+ return callback(null, errorObj);
1733
+ }
1734
+
1046
1735
  /* HERE IS WHERE YOU VALIDATE DATA */
1047
1736
  if (body === undefined || body === null || body === '') {
1048
1737
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
@@ -1111,6 +1800,12 @@ class WebexTeams extends AdapterBaseCl {
1111
1800
  const origin = `${this.id}-${meth}`;
1112
1801
  log.trace(origin);
1113
1802
 
1803
+ if (this.suspended && this.suspendMode === 'error') {
1804
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1805
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1806
+ return callback(null, errorObj);
1807
+ }
1808
+
1114
1809
  /* HERE IS WHERE YOU VALIDATE DATA */
1115
1810
  if (membershipId === undefined || membershipId === null || membershipId === '') {
1116
1811
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['membershipId'], null, null, null);
@@ -1180,6 +1875,12 @@ class WebexTeams extends AdapterBaseCl {
1180
1875
  const origin = `${this.id}-${meth}`;
1181
1876
  log.trace(origin);
1182
1877
 
1878
+ if (this.suspended && this.suspendMode === 'error') {
1879
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1880
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1881
+ return callback(null, errorObj);
1882
+ }
1883
+
1183
1884
  /* HERE IS WHERE YOU VALIDATE DATA */
1184
1885
  if (membershipId === undefined || membershipId === null || membershipId === '') {
1185
1886
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['membershipId'], null, null, null);
@@ -1253,6 +1954,12 @@ class WebexTeams extends AdapterBaseCl {
1253
1954
  const origin = `${this.id}-${meth}`;
1254
1955
  log.trace(origin);
1255
1956
 
1957
+ if (this.suspended && this.suspendMode === 'error') {
1958
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
1959
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
1960
+ return callback(null, errorObj);
1961
+ }
1962
+
1256
1963
  /* HERE IS WHERE YOU VALIDATE DATA */
1257
1964
  if (membershipId === undefined || membershipId === null || membershipId === '') {
1258
1965
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['membershipId'], null, null, null);
@@ -1325,6 +2032,12 @@ class WebexTeams extends AdapterBaseCl {
1325
2032
  const origin = `${this.id}-${meth}`;
1326
2033
  log.trace(origin);
1327
2034
 
2035
+ if (this.suspended && this.suspendMode === 'error') {
2036
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2037
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2038
+ return callback(null, errorObj);
2039
+ }
2040
+
1328
2041
  /* HERE IS WHERE YOU VALIDATE DATA */
1329
2042
  if (roomId === undefined || roomId === null || roomId === '') {
1330
2043
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['roomId'], null, null, null);
@@ -1393,6 +2106,12 @@ class WebexTeams extends AdapterBaseCl {
1393
2106
  const origin = `${this.id}-${meth}`;
1394
2107
  log.trace(origin);
1395
2108
 
2109
+ if (this.suspended && this.suspendMode === 'error') {
2110
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2111
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2112
+ return callback(null, errorObj);
2113
+ }
2114
+
1396
2115
  /* HERE IS WHERE YOU VALIDATE DATA */
1397
2116
  if (body === undefined || body === null || body === '') {
1398
2117
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
@@ -1461,6 +2180,12 @@ class WebexTeams extends AdapterBaseCl {
1461
2180
  const origin = `${this.id}-${meth}`;
1462
2181
  log.trace(origin);
1463
2182
 
2183
+ if (this.suspended && this.suspendMode === 'error') {
2184
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2185
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2186
+ return callback(null, errorObj);
2187
+ }
2188
+
1464
2189
  /* HERE IS WHERE YOU VALIDATE DATA */
1465
2190
  if (messageId === undefined || messageId === null || messageId === '') {
1466
2191
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['messageId'], null, null, null);
@@ -1529,6 +2254,12 @@ class WebexTeams extends AdapterBaseCl {
1529
2254
  const origin = `${this.id}-${meth}`;
1530
2255
  log.trace(origin);
1531
2256
 
2257
+ if (this.suspended && this.suspendMode === 'error') {
2258
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2259
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2260
+ return callback(null, errorObj);
2261
+ }
2262
+
1532
2263
  /* HERE IS WHERE YOU VALIDATE DATA */
1533
2264
  if (messageId === undefined || messageId === null || messageId === '') {
1534
2265
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['messageId'], null, null, null);
@@ -1597,6 +2328,12 @@ class WebexTeams extends AdapterBaseCl {
1597
2328
  const origin = `${this.id}-${meth}`;
1598
2329
  log.trace(origin);
1599
2330
 
2331
+ if (this.suspended && this.suspendMode === 'error') {
2332
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2333
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2334
+ return callback(null, errorObj);
2335
+ }
2336
+
1600
2337
  /* HERE IS WHERE YOU VALIDATE DATA */
1601
2338
 
1602
2339
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -1660,6 +2397,12 @@ class WebexTeams extends AdapterBaseCl {
1660
2397
  const origin = `${this.id}-${meth}`;
1661
2398
  log.trace(origin);
1662
2399
 
2400
+ if (this.suspended && this.suspendMode === 'error') {
2401
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2402
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2403
+ return callback(null, errorObj);
2404
+ }
2405
+
1663
2406
  /* HERE IS WHERE YOU VALIDATE DATA */
1664
2407
  if (body === undefined || body === null || body === '') {
1665
2408
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
@@ -1728,6 +2471,12 @@ class WebexTeams extends AdapterBaseCl {
1728
2471
  const origin = `${this.id}-${meth}`;
1729
2472
  log.trace(origin);
1730
2473
 
2474
+ if (this.suspended && this.suspendMode === 'error') {
2475
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2476
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2477
+ return callback(null, errorObj);
2478
+ }
2479
+
1731
2480
  /* HERE IS WHERE YOU VALIDATE DATA */
1732
2481
  if (teamId === undefined || teamId === null || teamId === '') {
1733
2482
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['teamId'], null, null, null);
@@ -1797,6 +2546,12 @@ class WebexTeams extends AdapterBaseCl {
1797
2546
  const origin = `${this.id}-${meth}`;
1798
2547
  log.trace(origin);
1799
2548
 
2549
+ if (this.suspended && this.suspendMode === 'error') {
2550
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2551
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2552
+ return callback(null, errorObj);
2553
+ }
2554
+
1800
2555
  /* HERE IS WHERE YOU VALIDATE DATA */
1801
2556
  if (teamId === undefined || teamId === null || teamId === '') {
1802
2557
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['teamId'], null, null, null);
@@ -1870,6 +2625,12 @@ class WebexTeams extends AdapterBaseCl {
1870
2625
  const origin = `${this.id}-${meth}`;
1871
2626
  log.trace(origin);
1872
2627
 
2628
+ if (this.suspended && this.suspendMode === 'error') {
2629
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2630
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2631
+ return callback(null, errorObj);
2632
+ }
2633
+
1873
2634
  /* HERE IS WHERE YOU VALIDATE DATA */
1874
2635
  if (teamId === undefined || teamId === null || teamId === '') {
1875
2636
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['teamId'], null, null, null);
@@ -1939,6 +2700,12 @@ class WebexTeams extends AdapterBaseCl {
1939
2700
  const origin = `${this.id}-${meth}`;
1940
2701
  log.trace(origin);
1941
2702
 
2703
+ if (this.suspended && this.suspendMode === 'error') {
2704
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2705
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2706
+ return callback(null, errorObj);
2707
+ }
2708
+
1942
2709
  /* HERE IS WHERE YOU VALIDATE DATA */
1943
2710
  if (teamId === undefined || teamId === null || teamId === '') {
1944
2711
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['teamId'], null, null, null);
@@ -2007,6 +2774,12 @@ class WebexTeams extends AdapterBaseCl {
2007
2774
  const origin = `${this.id}-${meth}`;
2008
2775
  log.trace(origin);
2009
2776
 
2777
+ if (this.suspended && this.suspendMode === 'error') {
2778
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2779
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2780
+ return callback(null, errorObj);
2781
+ }
2782
+
2010
2783
  /* HERE IS WHERE YOU VALIDATE DATA */
2011
2784
  if (body === undefined || body === null || body === '') {
2012
2785
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
@@ -2075,6 +2848,12 @@ class WebexTeams extends AdapterBaseCl {
2075
2848
  const origin = `${this.id}-${meth}`;
2076
2849
  log.trace(origin);
2077
2850
 
2851
+ if (this.suspended && this.suspendMode === 'error') {
2852
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2853
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2854
+ return callback(null, errorObj);
2855
+ }
2856
+
2078
2857
  /* HERE IS WHERE YOU VALIDATE DATA */
2079
2858
  if (membershipId === undefined || membershipId === null || membershipId === '') {
2080
2859
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['membershipId'], null, null, null);
@@ -2144,6 +2923,12 @@ class WebexTeams extends AdapterBaseCl {
2144
2923
  const origin = `${this.id}-${meth}`;
2145
2924
  log.trace(origin);
2146
2925
 
2926
+ if (this.suspended && this.suspendMode === 'error') {
2927
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
2928
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
2929
+ return callback(null, errorObj);
2930
+ }
2931
+
2147
2932
  /* HERE IS WHERE YOU VALIDATE DATA */
2148
2933
  if (membershipId === undefined || membershipId === null || membershipId === '') {
2149
2934
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['membershipId'], null, null, null);
@@ -2217,6 +3002,12 @@ class WebexTeams extends AdapterBaseCl {
2217
3002
  const origin = `${this.id}-${meth}`;
2218
3003
  log.trace(origin);
2219
3004
 
3005
+ if (this.suspended && this.suspendMode === 'error') {
3006
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3007
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3008
+ return callback(null, errorObj);
3009
+ }
3010
+
2220
3011
  /* HERE IS WHERE YOU VALIDATE DATA */
2221
3012
  if (membershipId === undefined || membershipId === null || membershipId === '') {
2222
3013
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['membershipId'], null, null, null);
@@ -2285,6 +3076,12 @@ class WebexTeams extends AdapterBaseCl {
2285
3076
  const origin = `${this.id}-${meth}`;
2286
3077
  log.trace(origin);
2287
3078
 
3079
+ if (this.suspended && this.suspendMode === 'error') {
3080
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3081
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3082
+ return callback(null, errorObj);
3083
+ }
3084
+
2288
3085
  /* HERE IS WHERE YOU VALIDATE DATA */
2289
3086
 
2290
3087
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -2348,6 +3145,12 @@ class WebexTeams extends AdapterBaseCl {
2348
3145
  const origin = `${this.id}-${meth}`;
2349
3146
  log.trace(origin);
2350
3147
 
3148
+ if (this.suspended && this.suspendMode === 'error') {
3149
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3150
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3151
+ return callback(null, errorObj);
3152
+ }
3153
+
2351
3154
  /* HERE IS WHERE YOU VALIDATE DATA */
2352
3155
  if (body === undefined || body === null || body === '') {
2353
3156
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
@@ -2416,6 +3219,12 @@ class WebexTeams extends AdapterBaseCl {
2416
3219
  const origin = `${this.id}-${meth}`;
2417
3220
  log.trace(origin);
2418
3221
 
3222
+ if (this.suspended && this.suspendMode === 'error') {
3223
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3224
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3225
+ return callback(null, errorObj);
3226
+ }
3227
+
2419
3228
  /* HERE IS WHERE YOU VALIDATE DATA */
2420
3229
  if (webhookId === undefined || webhookId === null || webhookId === '') {
2421
3230
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['webhookId'], null, null, null);
@@ -2485,6 +3294,12 @@ class WebexTeams extends AdapterBaseCl {
2485
3294
  const origin = `${this.id}-${meth}`;
2486
3295
  log.trace(origin);
2487
3296
 
3297
+ if (this.suspended && this.suspendMode === 'error') {
3298
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3299
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3300
+ return callback(null, errorObj);
3301
+ }
3302
+
2488
3303
  /* HERE IS WHERE YOU VALIDATE DATA */
2489
3304
  if (webhookId === undefined || webhookId === null || webhookId === '') {
2490
3305
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['webhookId'], null, null, null);
@@ -2558,6 +3373,12 @@ class WebexTeams extends AdapterBaseCl {
2558
3373
  const origin = `${this.id}-${meth}`;
2559
3374
  log.trace(origin);
2560
3375
 
3376
+ if (this.suspended && this.suspendMode === 'error') {
3377
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3378
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3379
+ return callback(null, errorObj);
3380
+ }
3381
+
2561
3382
  /* HERE IS WHERE YOU VALIDATE DATA */
2562
3383
  if (webhookId === undefined || webhookId === null || webhookId === '') {
2563
3384
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['webhookId'], null, null, null);
@@ -2626,6 +3447,12 @@ class WebexTeams extends AdapterBaseCl {
2626
3447
  const origin = `${this.id}-${meth}`;
2627
3448
  log.trace(origin);
2628
3449
 
3450
+ if (this.suspended && this.suspendMode === 'error') {
3451
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3452
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3453
+ return callback(null, errorObj);
3454
+ }
3455
+
2629
3456
  /* HERE IS WHERE YOU VALIDATE DATA */
2630
3457
 
2631
3458
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -2689,6 +3516,12 @@ class WebexTeams extends AdapterBaseCl {
2689
3516
  const origin = `${this.id}-${meth}`;
2690
3517
  log.trace(origin);
2691
3518
 
3519
+ if (this.suspended && this.suspendMode === 'error') {
3520
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3521
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3522
+ return callback(null, errorObj);
3523
+ }
3524
+
2692
3525
  /* HERE IS WHERE YOU VALIDATE DATA */
2693
3526
  if (orgId === undefined || orgId === null || orgId === '') {
2694
3527
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['orgId'], null, null, null);
@@ -2757,6 +3590,12 @@ class WebexTeams extends AdapterBaseCl {
2757
3590
  const origin = `${this.id}-${meth}`;
2758
3591
  log.trace(origin);
2759
3592
 
3593
+ if (this.suspended && this.suspendMode === 'error') {
3594
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3595
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3596
+ return callback(null, errorObj);
3597
+ }
3598
+
2760
3599
  /* HERE IS WHERE YOU VALIDATE DATA */
2761
3600
 
2762
3601
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -2820,6 +3659,12 @@ class WebexTeams extends AdapterBaseCl {
2820
3659
  const origin = `${this.id}-${meth}`;
2821
3660
  log.trace(origin);
2822
3661
 
3662
+ if (this.suspended && this.suspendMode === 'error') {
3663
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3664
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3665
+ return callback(null, errorObj);
3666
+ }
3667
+
2823
3668
  /* HERE IS WHERE YOU VALIDATE DATA */
2824
3669
  if (licenseId === undefined || licenseId === null || licenseId === '') {
2825
3670
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['licenseId'], null, null, null);
@@ -2888,6 +3733,12 @@ class WebexTeams extends AdapterBaseCl {
2888
3733
  const origin = `${this.id}-${meth}`;
2889
3734
  log.trace(origin);
2890
3735
 
3736
+ if (this.suspended && this.suspendMode === 'error') {
3737
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3738
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3739
+ return callback(null, errorObj);
3740
+ }
3741
+
2891
3742
  /* HERE IS WHERE YOU VALIDATE DATA */
2892
3743
 
2893
3744
  /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
@@ -2951,6 +3802,12 @@ class WebexTeams extends AdapterBaseCl {
2951
3802
  const origin = `${this.id}-${meth}`;
2952
3803
  log.trace(origin);
2953
3804
 
3805
+ if (this.suspended && this.suspendMode === 'error') {
3806
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3807
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3808
+ return callback(null, errorObj);
3809
+ }
3810
+
2954
3811
  /* HERE IS WHERE YOU VALIDATE DATA */
2955
3812
  if (roleId === undefined || roleId === null || roleId === '') {
2956
3813
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['roleId'], null, null, null);
@@ -3019,6 +3876,12 @@ class WebexTeams extends AdapterBaseCl {
3019
3876
  const origin = `${this.id}-${meth}`;
3020
3877
  log.trace(origin);
3021
3878
 
3879
+ if (this.suspended && this.suspendMode === 'error') {
3880
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
3881
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
3882
+ return callback(null, errorObj);
3883
+ }
3884
+
3022
3885
  /* HERE IS WHERE YOU VALIDATE DATA */
3023
3886
  if (contentId === undefined || contentId === null || contentId === '') {
3024
3887
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['contentId'], null, null, null);