visualvault-api 1.1.0 → 1.2.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.
@@ -1,1889 +1,1974 @@
1
- var vvRestApi;
2
- var DocApi = require('./DocApi');
3
- var FormsApi = require('./FormsApi');
4
- var StudioApi = require('./StudioApi');
5
- var NotificationsApi = require('./NotificationsApi');
6
- var common = require('./common');
7
- var logger = require('./log');
8
- var Q = require('q');
9
-
10
- (function (vvRestApi) {
11
- var vvClient = (function () {
12
-
13
- function vvClient(sessionToken) {
14
- // var yamlConfig = require('./config.yml');
15
- var yaml = require('js-yaml');
16
- var fs = require('fs');
17
- this.yamlConfig = yaml.safeLoad(fs.readFileSync(__dirname + '/config.yml', 'utf8'));
18
-
19
- this._httpHelper = new common.httpHelper(sessionToken, this.yamlConfig);
20
- this.constants = new constants.constantsInitializer();
21
- this.configuration = new configuration.configurationManager(this._httpHelper);
22
-
23
- this.customQuery = new customQuery.customQueryManager(this._httpHelper);
24
- this.documents = new documents.documentsManager(this._httpHelper);
25
- this.email = new email.emailManager(this._httpHelper);
26
- this.files = new files.filesManager(this._httpHelper);
27
- this.forms = new forms.formsManager(this._httpHelper);
28
- this.groups = new groups.groupsManager(this._httpHelper);
29
- this.library = new library.libraryManager(this._httpHelper);
30
- this.sites = new sites.sitesManager(this._httpHelper);
31
- this.users = new users.usersManager(this._httpHelper);
32
- this.scheduledProcess = new scheduledProcess.scheduledProcessManager(this._httpHelper);
33
- this.scripts = new scripts.scriptsManager(this._httpHelper);
34
- this.projects = new projects.projectsManager(this._httpHelper);
35
- this.customer = new customer.customerManager(this._httpHelper);
36
- this.customerDatabase = new customerDatabase.customerDatabaseManager(this._httpHelper);
37
- this.indexFields = new indexFields.indexFieldsManager(this._httpHelper);
38
- this.outsideProcesses = new outsideProcesses.outsideProcessesManager(this._httpHelper);
39
- this.securityMembers = new securityMembers.securityMembersManager(this._httpHelper);
40
- this.layouts = new layouts.layoutsManager(this._httpHelper);
41
- this.reports = new reports.reportsManager(this._httpHelper);
42
-
43
- this._docApi = null;
44
- Object.defineProperties(this, {
45
- docApi: {
46
- get: function () {
47
- if (this._docApi != null && this._docApi.isEnabled && this._docApi.baseUrl) {
48
- return this._docApi;
49
- } else {
50
- throw new ReferenceError("Forms Api not enabled");
51
- }
52
- }
53
- }
54
- });
55
-
56
- this._formsApi = null;
57
- Object.defineProperties(this, {
58
- formsApi: {
59
- get: function () {
60
- if (this._formsApi != null && this._formsApi.isEnabled && this._formsApi.baseUrl) {
61
- return this._formsApi;
62
- } else {
63
- throw new ReferenceError("Forms Api not enabled");
64
- }
65
- }
66
- }
67
- });
68
-
69
- this._studioApi = null;
70
- Object.defineProperties(this, {
71
- studioApi: {
72
- get: function () {
73
- if (this._studioApi != null && this._studioApi.isEnabled && this._studioApi.baseUrl) {
74
- return this._studioApi;
75
- } else {
76
- throw new ReferenceError("Studio Api not enabled");
77
- }
78
- }
79
- }
80
- });
81
-
82
- this._notificationsApi = null;
83
- Object.defineProperties(this, {
84
- notificationsApi: {
85
- get: function () {
86
- if (this._notificationsApi != null && this._notificationsApi.isEnabled && this._notificationsApi.baseUrl) {
87
- return this._notificationsApi;
88
- } else {
89
- throw new ReferenceError("Notifications Api not enabled");
90
- }
91
- }
92
- }
93
- });
94
-
95
- }
96
-
97
- vvClient.prototype.createDocApi = async function (sessionToken) {
98
-
99
- //get doc api config
100
- var docApiConfigResponse = JSON.parse(await this.configuration.getDocApiConfig());
101
-
102
- if (docApiConfigResponse && docApiConfigResponse['data']) {
103
- var docApiSession = sessionToken.createCopy();
104
- docApiSession.baseUrl = docApiConfigResponse.data['apiUrl'];
105
- docApiSession.apiUrl = this.yamlConfig.DocApiUri;
106
- if (docApiSession['tokenType'] == 'jwt') {
107
- this._docApi = new DocApi(docApiSession, docApiConfigResponse.data);
108
- } else if (this.users) {
109
- var jwtResponse = JSON.parse(await this.users.getUserJwt(docApiSession.audience));
110
-
111
- if (jwtResponse['data'] && jwtResponse['data']['token']) {
112
- docApiSession.convertToJwt(jwtResponse['data']);
113
- this._docApi = new DocApi(docApiSession, docApiConfigResponse.data);
114
- }
115
- }
116
- }
117
- }
118
-
119
- vvClient.prototype.createFormsApi = async function (sessionToken) {
120
-
121
- //get forms api config
122
- var formsApiConfigResponse = JSON.parse(await this.configuration.getFormsApiConfig());
123
-
124
- if (formsApiConfigResponse && formsApiConfigResponse['data']) {
125
- var formsApiSession = sessionToken.createCopy();
126
- formsApiSession.baseUrl = formsApiConfigResponse.data['formsApiUrl'];
127
- formsApiSession.apiUrl = this.yamlConfig.FormsApiUri;
128
- if (formsApiSession['tokenType'] == 'jwt') {
129
- this._formsApi = new FormsApi(formsApiSession, formsApiConfigResponse.data);
130
- } else if (this.users) {
131
- var jwtResponse = JSON.parse(await this.users.getUserJwt(formsApiSession.audience));
132
-
133
- if (jwtResponse['data'] && jwtResponse['data']['token']) {
134
- formsApiSession.convertToJwt(jwtResponse['data']);
135
- this._formsApi = new FormsApi(formsApiSession, formsApiConfigResponse.data);
136
- }
137
- }
138
- }
139
- }
140
-
141
- vvClient.prototype.createStudioApi = async function (sessionToken) {
142
-
143
- //get doc api config
144
- var studioApiConfigResponse = JSON.parse(await this.configuration.getStudioApiConfig());
145
-
146
- if (studioApiConfigResponse && studioApiConfigResponse['data']) {
147
- var studioApiSession = sessionToken.createCopy();
148
- studioApiSession.baseUrl = studioApiConfigResponse.data['studioApiUrl'];
149
- studioApiSession.apiUrl = '';
150
- if (studioApiSession['tokenType'] == 'jwt') {
151
- this._studioApi = new StudioApi(studioApiSession, studioApiConfigResponse.data);
152
- } else if (this.users) {
153
- var jwtResponse = JSON.parse(await this.users.getUserJwt(studioApiSession.audience));
154
-
155
- if (jwtResponse['data'] && jwtResponse['data']['token']) {
156
- studioApiSession.convertToJwt(jwtResponse['data']);
157
- this._studioApi = new StudioApi(studioApiSession, studioApiConfigResponse.data);
158
- }
159
- }
160
- }
161
- }
162
-
163
- vvClient.prototype.createNotificationsApi = async function (sessionToken) {
164
-
165
- //get forms api config
166
- var notificationsApiConfigResponse = JSON.parse(await this.configuration.getNotificationsApiConfig());
167
-
168
- if (notificationsApiConfigResponse && notificationsApiConfigResponse['data']) {
169
- var notificationsApiSession = sessionToken.createCopy();
170
- notificationsApiSession.baseUrl = notificationsApiConfigResponse.data['apiUrl'];
171
- notificationsApiSession.apiUrl = this.yamlConfig.NotificationsApiUri;
172
- if (notificationsApiSession['tokenType'] == 'jwt') {
173
- this._notificationsApi = new NotificationsApi(notificationsApiSession, notificationsApiConfigResponse.data);
174
- } else if (this.users) {
175
- var jwtResponse = JSON.parse(await this.users.getUserJwt(notificationsApiSession.audience));
176
-
177
- if (jwtResponse['data'] && jwtResponse['data']['token']) {
178
- notificationsApiSession.convertToJwt(jwtResponse['data']);
179
- this._notificationsApi = new NotificationsApi(notificationsApiSession, notificationsApiConfigResponse.data);
180
- }
181
- }
182
- }
183
- }
184
-
185
- vvClient.prototype._convertToJwt = async function (sessionToken) {
186
- var jwtResponse = JSON.parse(await this.users.getUserJwt(sessionToken.audience));
187
- if (jwtResponse['data'] && jwtResponse['data']['token']) {
188
- sessionToken.convertToJwt(jwtResponse['data'])
189
- } else {
190
- console.warn('Failed to get JWT');
191
- }
192
- }
193
-
194
- vvClient.prototype.endsWith = function (source, suffix) {
195
- return source.indexOf(suffix, source.length - suffix.length) !== -1;
196
- };
197
-
198
- vvClient.prototype.getSecurityToken = function () {
199
- return this._httpHelper._sessionToken.accessToken;
200
- };
201
-
202
- vvClient.prototype.isAuthenticated = function () {
203
- return this._httpHelper._sessionToken.isAuthenticated;
204
- };
205
-
206
- vvClient.prototype.getBaseUrl = function () {
207
- return this._httpHelper._sessionToken.baseUrl;
208
- };
209
-
210
- return vvClient;
211
- })();
212
- vvRestApi.vvClient = vvClient;
213
-
214
- var auth = (function () {
215
- //Pull in the authorize methods from common and extend it with the getVaultApi methods
216
- var authorize = common.authorize;
217
-
218
- authorize.prototype.getVaultApi = function (clientId, clientSecret, userId, password, audience, baseVaultUrl, customerAlias, databaseAlias) {
219
- console.log('getVaultApi has been called');
220
-
221
- // var config = require('./config.yml');
222
- var config = this.jsyaml.safeLoad(this.fs.readFileSync(__dirname + '/config.yml', 'utf8'));
223
-
224
- if (this.endsWith(baseVaultUrl, '/')) {
225
- baseVaultUrl = baseVaultUrl.substring(0, baseVaultUrl.length - 1);
226
- }
227
-
228
- baseVaultUrl = baseVaultUrl;
229
-
230
- var apiUrl = config.ApiUri.replace('{custalias}', customerAlias).replace('{custdbalias}', databaseAlias);
231
- var authenticationUrl = config.AutheticateUri;
232
-
233
- return this.acquireSecurityToken(clientId, clientSecret, userId, password, audience, baseVaultUrl, apiUrl, customerAlias, databaseAlias, authenticationUrl)
234
- .then(function(sessionToken) {
235
- var client = new vvClient(sessionToken);
236
-
237
- return client._convertToJwt(sessionToken)
238
- .then(() => {
239
- return Promise.all([
240
- client.createDocApi(sessionToken),
241
- client.createFormsApi(sessionToken),
242
- client.createStudioApi(sessionToken),
243
- client.createNotificationsApi(sessionToken),
244
- ]);
245
- })
246
- .then(() => {
247
- return client;
248
- })
249
- .catch(() => {
250
- return client;
251
- });
252
- });
253
- };
254
-
255
- authorize.prototype.getVaultApiFromJwt = function (jwt, baseVaultUrl, customerAlias, databaseAlias, expirationDate) {
256
- console.log('getVaultApiFromJwt has been called');
257
-
258
- // var config = require('./config.yml');
259
- var config = this.jsyaml.safeLoad(this.fs.readFileSync(__dirname + '/config.yml', 'utf8'));
260
-
261
- baseVaultUrl = baseVaultUrl;
262
-
263
- if (this.endsWith(baseVaultUrl, '/')) {
264
- baseVaultUrl = baseVaultUrl.substring(0, baseVaultUrl.length - 1);
265
- }
266
-
267
- var apiUrl = config.ApiUri.replace('{custalias}', customerAlias).replace('{custdbalias}', databaseAlias);
268
- var authenticationUrl = apiUrl + config.ResourceUri.UsersGetJwt;
269
-
270
- //Create the session token directly from JWT if the passed in expiration date is not near expiration (within next 30 seconds)
271
- if (expirationDate && expirationDate >= new Date(new Date().getTime() + 30 * 1000)) {
272
- var sessionToken = new common.sessionToken();
273
-
274
- sessionToken.accessToken = jwt;
275
- sessionToken.baseUrl = baseVaultUrl;
276
- sessionToken.apiUrl = apiUrl;
277
- sessionToken.authenticationUrl = authenticationUrl;
278
- sessionToken.customerAlias = customerAlias;
279
- sessionToken.databaseAlias = databaseAlias;
280
- sessionToken.expirationDate = expirationDate;
281
- sessionToken.isAuthenticated = true;
282
- sessionToken.isJwt = true;
283
-
284
- var client = new vvClient(sessionToken);
285
-
286
- return Promise.all([
287
- client.createDocApi(sessionToken),
288
- client.createFormsApi(sessionToken),
289
- client.createStudioApi(sessionToken),
290
- ])
291
- .then(() => {
292
- return client;
293
- })
294
- .catch(() => {
295
- return client;
296
- });
297
- } else {
298
- //expiration date was not passed in or is about to expire - attempt to use JWT to acquire a new JWT
299
- return this.acquireJwt(jwt, baseVaultUrl, apiUrl, authenticationUrl, customerAlias, databaseAlias).then(function(token) {
300
- var client = new vvClient(token);
301
-
302
- return Promise.all([
303
- client.createDocApi(token),
304
- client.createFormsApi(token),
305
- client.createStudioApi(token),
306
- ])
307
- .then(() => {
308
- return client;
309
- })
310
- .catch(() => {
311
- return client;
312
- });
313
- });
314
- }
315
- }
316
-
317
- authorize.prototype.endsWith = function (source, suffix) {
318
- return source.indexOf(suffix, source.length - suffix.length) !== -1;
319
- };
320
-
321
- return authorize;
322
- })();
323
- vvRestApi.authorize = auth;
324
-
325
- (function (configuration) {
326
- var configurationManager = (function () {
327
- function configurationManager(httpHelper) {
328
- this._httpHelper = httpHelper;
329
- }
330
-
331
- configurationManager.prototype.getDocApiConfig = function () {
332
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.ConfigurationDocApi);
333
-
334
- var opts = { method: 'GET' };
335
- var params = {};
336
- var data = {};
337
-
338
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
339
- };
340
-
341
- configurationManager.prototype.getFormsApiConfig = function () {
342
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.ConfigurationFormsApi);
343
-
344
- var opts = { method: 'GET' };
345
- var params = {};
346
- var data = {};
347
-
348
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
349
- };
350
-
351
- configurationManager.prototype.getStudioApiConfig = function () {
352
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.ConfigurationStudioApi);
353
-
354
- var opts = { method: 'GET' };
355
- var params = {};
356
- var data = {};
357
-
358
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
359
- };
360
-
361
- configurationManager.prototype.getNotificationsApiConfig = function () {
362
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.ConfigurationNotificationApi);
363
-
364
- var opts = { method: 'GET' };
365
- var params = {};
366
- var data = {};
367
-
368
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
369
- };
370
-
371
- return configurationManager;
372
- })();
373
- configuration.configurationManager = configurationManager;
374
- })(vvRestApi.configuration || (vvRestApi.configuration = {}));
375
- var configuration = vvRestApi.configuration;
376
-
377
- (function (constants) {
378
- var constantsInitializer = (function () {
379
- function constantsInitializer() {
380
-
381
- }
382
-
383
- constantsInitializer.prototype.alertEventIds = {
384
- //Folder Events
385
- folderSecurityModified: "F06FD123-2C52-4F43-9122-34335A5BD8C6", //"CategorySecurity"
386
- childFolderSecurityModified: "30167D46-86CF-4E89-B1AE-FC00BB378F67", //"CategorySecurityCascade"
387
- folderDocumentAdded: "3702CFBF-555C-4032-BFB2-E25829788BAC", //"NewCategoryDoc"
388
- childFolderDocumentAdded: "28946E3C-AEAF-402B-BCE3-8DEAC3D19877", //"NewCategoryDocCascade"
389
-
390
- //Document Events
391
- documentCheckedIn: "D47804AB-AEE9-4002-BAB5-9F1AC0366076", //"CheckIn"
392
- documentCheckedOut: "4BBA55C1-7AF6-48FF-BFBE-EC7A58EB7F01", //"CheckOut"
393
- documentDetailsModified: "3B9D493F-2B45-4877-ABC1-5CA74F92723D", //"DocumentDetails"
394
- documentSecurityModified: "BAC187DC-78A8-4A8B-B50F-DB5D5AEE11B9", //"DocumentSecurity"
395
- documentViewed: "140B9E97-8D93-48D0-837B-AB4FD419B6D6", //"DocumentViewed"
396
-
397
- //Project Events
398
- projectDocumentAddedOrRemoved: "300DB724-5C51-4C38-B2E2-FFE19634A373", //"NewProjectDoc"
399
- projectViewed: "92F0C5F4-68DC-4309-9ABF-13B8E2198F79" //"ProjectView"
400
- }
401
-
402
- constantsInitializer.prototype.securityRoles = {
403
- //RoleType
404
- Owner: "Owner",
405
- Editor: "Editor",
406
- Viewer: "Viewer"
407
- }
408
-
409
- constantsInitializer.prototype.securityMemberType = {
410
- //MemberType
411
- User: "User",
412
- Group: "Group"
413
- }
414
-
415
- constantsInitializer.prototype.relationType = {
416
- Parent: "Parent",
417
- Child: "Child",
418
- Peer: "Peer"
419
- }
420
-
421
- return constantsInitializer;
422
- })();
423
-
424
- constants.constantsInitializer = constantsInitializer;
425
- })(vvRestApi.constants || (vvRestApi.constants = {}))
426
- var constants = vvRestApi.constants;
427
-
428
- (function (email) {
429
- var emailManager = (function () {
430
- function emailManager(httpHelper) {
431
- this._httpHelper = httpHelper;
432
- }
433
- emailManager.prototype.postEmails = function (params, data) {
434
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.Emails);
435
-
436
- var opts = { method: 'POST' };
437
-
438
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
439
- };
440
- emailManager.prototype.postEmailsWithAttachments = function (params, data, fileObjs) {
441
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.Emails);
442
-
443
- var opts = { method: 'POSTSTREAM' };
444
-
445
- return this._httpHelper.doVvClientRequest(url, opts, params, data, fileObjs);
446
- };
447
- return emailManager;
448
- })();
449
-
450
- email.emailManager = emailManager;
451
- })(vvRestApi.email || (vvRestApi.email = {}));
452
- var email = vvRestApi.email;
453
-
454
- (function (forms) {
455
-
456
- var returnField = (function () {
457
- function returnField(id, name, value, isError, errorMessage) {
458
- this.id = id;
459
- this.name = name;
460
- this.value = value;
461
- this.isError = isError;
462
- this.errorMessage = errorMessage;
463
- }
464
- return returnField;
465
- })();
466
- forms.returnField = returnField;
467
-
468
-
469
-
470
-
471
- var formFieldCollection = (function () {
472
- function formFieldCollection(ffColl) {
473
- this._ffColl = ffColl;
474
- }
475
-
476
- formFieldCollection.prototype.getFormFieldByName = function (name) {
477
- var fieldName = name.toLowerCase();
478
- var field = null;
479
-
480
- for (var i = 0; i < this._ffColl.length; i++) {
481
- if (this._ffColl[i].name.toLowerCase() == fieldName) {
482
- field = this._ffColl[i];
483
- break;
484
- }
485
- }
486
-
487
- return field;
488
- };
489
-
490
- formFieldCollection.prototype.getFormFieldById = function (id) {
491
- var fieldId = id.toLowerCase();
492
- var field = null;
493
-
494
- for (var i = 0; i < this._ffColl.length; i++) {
495
- if (this._ffColl[i].id.toLowerCase() == fieldId) {
496
- field = this._ffColl[i];
497
- break;
498
- }
499
- }
500
-
501
- return field;
502
- };
503
-
504
- formFieldCollection.prototype.getFieldArray = function () {
505
- return this._ffColl;
506
- };
507
-
508
- return formFieldCollection;
509
- })();
510
- forms.formFieldCollection = formFieldCollection;
511
-
512
- var formsManager = (function () {
513
- function formsManager(httpHelper) {
514
- this._httpHelper = httpHelper;
515
- }
516
-
517
- formsManager.prototype.returnField = function (id, name, value, isError, errorMessage) {
518
- this.id = id;
519
- this.name = name;
520
- this.value = value;
521
- this.isError = isError;
522
- this.errorMessage = errorMessage;
523
- };
524
-
525
- formsManager.prototype.getFormTemplates = function (params) {
526
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.FormTemplates);
527
-
528
- var opts = { method: 'GET' };
529
-
530
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
531
- };
532
-
533
- formsManager.prototype.getFormTemplateIdByName = function (templateName) {
534
- //return released form template id by name
535
- var deferred = Q.defer();
536
-
537
- var params = {};
538
- params.fields = "id, name, description, revision, revisionId";
539
- params.q = "name eq '" + templateName + "'";
540
-
541
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.FormTemplates);
542
- var opts = { method: 'GET' };
543
- var templateId;
544
- var templateRevisionId;
545
-
546
- var fm = this;
547
-
548
- this._httpHelper.doVvClientRequest(url, opts, params, null).then(function (resp) {
549
- var templateResp = JSON.parse(resp);
550
- if (templateResp.data.length > 0) {
551
- templateId = templateResp['data'][0]['id'];
552
- templateRevisionId = templateResp['data'][0]['revisionId'];
553
- }
554
-
555
- var responseData = {};
556
- responseData.formsManager = fm;
557
- responseData.templateIdGuid = templateId;
558
- responseData.templateRevisionIdGuid = templateRevisionId;
559
-
560
- deferred.resolve(responseData);
561
-
562
- }).fail(function (error) {
563
- logger.info("failed getting Form Template Id by Name " + error);
564
-
565
- var responseData = {};
566
- responseData.formsManager = fm;
567
- responseData.templateIdGuid = '';
568
- responseData.templateRevisionIdGuid = '';
569
-
570
- deferred.resolve(responseData);
571
- });
572
-
573
- return deferred.promise;
574
- };
575
-
576
- formsManager.prototype.getForms = async function (params, formTemplateId) {
577
-
578
- //if formTemplateId is not a Guid assume its a template name and fetch the Guid
579
- if (!this.isGuid(formTemplateId)) {
580
- let resp = await this.getFormTemplateIdByName(formTemplateId);
581
- var formsManager = resp.formsManager;
582
- var templateIdGuid = resp.templateIdGuid;
583
- var resourceUri = formsManager._httpHelper._config.ResourceUri.Forms.replace('{id}', templateIdGuid);
584
- var url = formsManager._httpHelper.getUrl(resourceUri);
585
- var opts = { method: 'GET' };
586
-
587
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
588
-
589
- } else {
590
- var resourceUri = this._httpHelper._config.ResourceUri.Forms.replace('{id}', formTemplateId);
591
- var url = this._httpHelper.getUrl(resourceUri);
592
- var opts = { method: 'GET' };
593
-
594
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
595
- }
596
-
597
- };
598
-
599
- formsManager.prototype.setFieldImage = function (formId, fieldId, imageId) {
600
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstanceImage.replace('{id}', formId);
601
- var url = this._httpHelper.getUrl(resourceUri);
602
-
603
- var data = { fieldId: fieldId, imageId: imageId };
604
- var params = { fieldId: fieldId, imageId: imageId };
605
-
606
- var opts = { method: 'PUT' };
607
-
608
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
609
- };
610
-
611
- formsManager.prototype.importFormTemplate = function (data, formTemplateId, buffer) {
612
- var resourceUri = this._httpHelper._config.ResourceUri.FormTemplatesImport.replace('{id}', formTemplateId);
613
- var url = this._httpHelper.getUrl(resourceUri);
614
- var opts = { method: 'PUTSTREAM' };
615
-
616
- return this._httpHelper.doVvClientRequest(url, opts, null, data, buffer);
617
- };
618
-
619
- formsManager.prototype.postForms = async function (params, data, formTemplateId) {
620
-
621
- //if formTemplateId is not a Guid assume its a template name and fetch the Guid
622
- if (!this.isGuid(formTemplateId)) {
623
- let resp = await this.getFormTemplateIdByName(formTemplateId);
624
- var formsManager = resp.formsManager;
625
- var templateIdGuid = resp.templateIdGuid;
626
- var resourceUri = formsManager._httpHelper._config.ResourceUri.Forms.replace('{id}', templateIdGuid);
627
- var url = formsManager._httpHelper.getUrl(resourceUri);
628
- var opts = { method: 'POST' };
629
-
630
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
631
-
632
- } else {
633
- var resourceUri = this._httpHelper._config.ResourceUri.Forms.replace('{id}', formTemplateId);
634
- var url = this._httpHelper.getUrl(resourceUri);
635
- var opts = { method: 'POST' };
636
-
637
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
638
- }
639
-
640
- };
641
-
642
- formsManager.prototype.postFormRevision = async function (params, data, formTemplateId, formId) {
643
-
644
- //if formTemplateId is not a Guid assume its a template name and fetch the Guid
645
- if (!this.isGuid(formTemplateId)) {
646
- let resp = await this.getFormTemplateIdByName(formTemplateId);
647
-
648
- var formsManager = resp.formsManager;
649
- var templateIdGuid = resp.templateIdGuid;
650
- var resourceUri = formsManager._httpHelper._config.ResourceUri.Forms.replace('{id}', templateIdGuid);
651
- var url = formsManager._httpHelper.getUrl(resourceUri + '/' + formId);
652
- var opts = { method: 'POST' };
653
-
654
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
655
- } else {
656
- var resourceUri = this._httpHelper._config.ResourceUri.Forms.replace('{id}', formTemplateId);
657
- var url = this._httpHelper.getUrl(resourceUri + '/' + formId);
658
- var opts = { method: 'POST' };
659
-
660
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
661
- }
662
- };
663
-
664
- formsManager.prototype.postFormRevisionByFormId = function (params, data, formId) {
665
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.FormsId).replace('{id}', formId);
666
-
667
- var opts = { method: 'POST' };
668
-
669
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
670
- }
671
-
672
- formsManager.prototype.updateFormInstanceOriginator = function (formInstanceId, newOriginatorUsID) {
673
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstanceUpdateOriginator.replace('{id}', formInstanceId);
674
- var url = this._httpHelper.getUrl(resourceUri);
675
-
676
- var params = {
677
- userId: newOriginatorUsID,
678
- };
679
- var data = null;
680
-
681
- var opts = { method: "PUT" };
682
-
683
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
684
-
685
- }
686
-
687
- formsManager.prototype.relateForm = function (formId, relateToId) {
688
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
689
- var url = this._httpHelper.getUrl(resourceUri + '/relateForm');
690
-
691
- var params = { relateToId: relateToId };
692
- var data = null;
693
-
694
- var opts = { method: 'PUT' };
695
-
696
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
697
- };
698
-
699
- formsManager.prototype.relateFormByDocId = function (formId, relateToDocId) {
700
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
701
- var url = this._httpHelper.getUrl(resourceUri + '/relateForm');
702
-
703
- var params = { relateToDocId: relateToDocId };
704
- var data = null;
705
-
706
- var opts = { method: 'PUT' };
707
-
708
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
709
- };
710
-
711
- formsManager.prototype.relateDocument = function (formId, relateToId) {
712
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
713
- var url = this._httpHelper.getUrl(resourceUri + '/relateDocument');
714
-
715
- var params = { relateToId: relateToId };
716
- var data = null;
717
-
718
- var opts = { method: 'PUT' };
719
-
720
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
721
- };
722
-
723
- formsManager.prototype.relateDocumentByDocId = function (formId, relateToDocId) {
724
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
725
- var url = this._httpHelper.getUrl(resourceUri + '/relateDocument');
726
-
727
- var params = { relateToDocId: relateToDocId };
728
- var data = null;
729
-
730
- var opts = { method: 'PUT' };
731
-
732
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
733
- };
734
-
735
- formsManager.prototype.relateProject = function (formId, relateToId) {
736
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
737
- var url = this._httpHelper.getUrl(resourceUri + '/relateProject');
738
-
739
- var params = { relateToId: relateToId };
740
- var data = null;
741
-
742
- var opts = { method: 'PUT' };
743
-
744
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
745
- };
746
-
747
- formsManager.prototype.relateProjectByName = function (formId, relateToProjectName) {
748
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
749
- var url = this._httpHelper.getUrl(resourceUri + '/relateProject');
750
-
751
- var params = { relateToProjectName: relateToProjectName };
752
- var data = null;
753
-
754
- var opts = { method: 'PUT' };
755
-
756
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
757
- };
758
-
759
- formsManager.prototype.unrelateForm = function (formId, relateToId) {
760
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
761
- var url = this._httpHelper.getUrl(resourceUri + '/unrelateForm');
762
-
763
- var params = { relateToId: relateToId };
764
- var data = null;
765
-
766
- var opts = { method: 'PUT' };
767
-
768
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
769
- };
770
-
771
- formsManager.prototype.unrelateFormByDocId = function (formId, relateToDocId) {
772
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
773
- var url = this._httpHelper.getUrl(resourceUri + '/unrelateForm');
774
-
775
- var params = { relateToDocId: relateToDocId };
776
- var data = null;
777
-
778
- var opts = { method: 'PUT' };
779
-
780
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
781
- };
782
-
783
- formsManager.prototype.unrelateDocument = function (formId, relateToId) {
784
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
785
- var url = this._httpHelper.getUrl(resourceUri + '/unrelateDocument');
786
-
787
- var params = { relateToId: relateToId };
788
- var data = null;
789
-
790
- var opts = { method: 'PUT' };
791
-
792
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
793
- };
794
-
795
- formsManager.prototype.unrelateDocumentByDocId = function (formId, relateToDocId) {
796
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
797
- var url = this._httpHelper.getUrl(resourceUri + '/unrelateDocument');
798
-
799
- var params = { relateToDocId: relateToDocId };
800
- var data = null;
801
-
802
- var opts = { method: 'PUT' };
803
-
804
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
805
- };
806
-
807
- formsManager.prototype.unrelateProject = function (formId, relateToId) {
808
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
809
- var url = this._httpHelper.getUrl(resourceUri + '/unrelateProject');
810
-
811
- var params = { relateToId: relateToId };
812
- var data = null;
813
-
814
- var opts = { method: 'PUT' };
815
-
816
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
817
- };
818
-
819
- formsManager.prototype.unrelateProjectByName = function (formId, relateToProjectName) {
820
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
821
- var url = this._httpHelper.getUrl(resourceUri + '/unrelateProject');
822
-
823
- var params = { relateToProjectName: relateToProjectName };
824
- var data = null;
825
-
826
- var opts = { method: 'PUT' };
827
-
828
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
829
- };
830
-
831
- formsManager.prototype.getFormRelatedDocs = function (formId, params) {
832
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstanceRelatedDocs.replace('{id}', formId);
833
- var url = this._httpHelper.getUrl(resourceUri);
834
-
835
- var opts = { method: 'GET' };
836
-
837
- if (params === undefined) {
838
- params = null;
839
- }
840
-
841
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
842
- };
843
-
844
- formsManager.prototype.getFormRelatedForms = function (formId, params) {
845
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstanceRelatedForms.replace('{id}', formId);
846
- var url = this._httpHelper.getUrl(resourceUri);
847
-
848
- var opts = { method: 'GET' };
849
-
850
- if (params === undefined) {
851
- params = null;
852
- }
853
-
854
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
855
- };
856
-
857
- formsManager.prototype.isGuid = function (stringToTest) {
858
- if (stringToTest[0] === "{") {
859
- stringToTest = stringToTest.substring(1, stringToTest.length - 1);
860
- }
861
- var regexGuid = /^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$/gi;
862
- return regexGuid.test(stringToTest);
863
- }
864
-
865
- formsManager.prototype.getFormInstanceById = function (templateId, instanceId) {
866
- var resourceUri = this._httpHelper._config.ResourceUri.FormId.replace('{id}', templateId).replace('{formId}', instanceId);
867
- var url = this._httpHelper.getUrl(resourceUri);
868
- var opts = { method: 'GET' };
869
-
870
- return this._httpHelper.doVvClientRequest(url, opts, null, null);
871
- };
872
-
873
- formsManager.prototype.getFormInstancePDF = function (templateId, instanceId) {
874
- var resourceUri = this._httpHelper._config.ResourceUri.FormIdPdf.replace('{id}', templateId).replace('{formId}', instanceId);
875
- var url = this._httpHelper.getUrl(resourceUri);
876
- var opts = { method: 'GETSTREAM' };
877
-
878
- return this._httpHelper.doVvClientRequest(url, opts, null, null);
879
- };
880
-
881
- formsManager.prototype.getFormTemplateFields = function (templateId) {
882
- var resourceUri = this._httpHelper._config.ResourceUri.FormDesignerFormsTemplatesIdFields.replace('{id}', templateId);
883
- var url = this._httpHelper.getUrl(resourceUri);
884
- var opts = { method: 'GET' };
885
-
886
- return this._httpHelper.doVvClientRequest(url, opts, null, null);
887
- }
888
-
889
- formsManager.prototype.deleteFormInstance = function (instanceId) {
890
- var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', instanceId);
891
- var url = this._httpHelper.getUrl(resourceUri);
892
- var opts = { method: 'DELETE' };
893
-
894
- return this._httpHelper.doVvClientRequest(url, opts, null, null);
895
- }
896
-
897
- return formsManager;
898
- })();
899
- forms.formsManager = formsManager;
900
-
901
- })(vvRestApi.forms || (vvRestApi.forms = {}));
902
- var forms = vvRestApi.forms;
903
-
904
- (function (groups) {
905
- var groupsManager = (function () {
906
- function groupsManager(httpHelper) {
907
- this._httpHelper = httpHelper;
908
- }
909
-
910
- groupsManager.prototype.getGroups = function (params) {
911
- var resourceUri = this._httpHelper._config.ResourceUri.GetGroups;
912
- var url = this._httpHelper.getUrl(resourceUri);
913
- var opts = { method: 'GET' };
914
-
915
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
916
- };
917
-
918
- groupsManager.prototype.getGroupsUsers = function (params, groupId) {
919
- var resourceUri = this._httpHelper._config.ResourceUri.GroupsUsers.replace('{id}', groupId);
920
- var url = this._httpHelper.getUrl(resourceUri);
921
-
922
- var opts = { method: 'GET' };
923
-
924
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
925
- };
926
-
927
- groupsManager.prototype.getGroupUser = function (params, groupId, userId) {
928
- var resourceUri = this._httpHelper._config.ResourceUri.GroupsAddUser.replace('{groupId}', groupId).replace('{userId}', userId);
929
- var url = this._httpHelper.getUrl(resourceUri);
930
-
931
- var opts = { method: 'GET' };
932
-
933
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
934
- }
935
-
936
- groupsManager.prototype.addUserToGroup = function (params, groupId, userId) {
937
- var resourceUri = this._httpHelper._config.ResourceUri.GroupsAddUser.replace('{groupId}', groupId).replace('{userId}', userId);
938
- var url = this._httpHelper.getUrl(resourceUri);
939
- var opts = { method: 'PUT' };
940
-
941
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
942
- };
943
-
944
- groupsManager.prototype.removeUserFromGroup = function (params, groupId, userId) {
945
- var resourceUri = this._httpHelper._config.ResourceUri.GroupsAddUser.replace('{groupId}', groupId).replace('{userId}', userId);
946
- var url = this._httpHelper.getUrl(resourceUri);
947
- var opts = { method: 'DELETE' };
948
-
949
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
950
- }
951
-
952
- return groupsManager;
953
- })();
954
- groups.groupsManager = groupsManager;
955
- })(vvRestApi.groups || (vvRestApi.groups = {}));
956
- var groups = vvRestApi.groups;
957
-
958
- (function (library) {
959
- var libraryManager = (function () {
960
- function libraryManager(httpHelper) {
961
- this._httpHelper = httpHelper;
962
- }
963
- libraryManager.prototype.getFolders = function (params) {
964
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.Folders);
965
-
966
- var opts = { method: 'GET' };
967
-
968
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
969
- };
970
-
971
- libraryManager.prototype.postFolderByPath = function (params, data, folderPath) {
972
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.Folders);
973
-
974
- data.folderpath = folderPath;
975
- var opts = { method: 'POST' };
976
-
977
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
978
- };
979
-
980
- //Valid fields to be defined on the "data" parameter to be updated on the folder: name, description
981
- libraryManager.prototype.putFolder = function (params, data, folderId) {
982
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.FoldersId.replace('{id}', folderId));
983
-
984
- var opts = { method: 'PUT' };
985
-
986
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
987
- }
988
-
989
- libraryManager.prototype.deleteFolder = function (folderId) {
990
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.FoldersId.replace('{id}', folderId));
991
-
992
- var opts = { method: 'DELETE' };
993
-
994
- return this._httpHelper.doVvClientRequest(url, opts, null, null);
995
- }
996
-
997
- libraryManager.prototype.copyFolder = function (params, data) {
998
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.FoldersCopy);
999
-
1000
- var opts = { method: 'POST' };
1001
-
1002
- return this._httpHelper.doVvClientRequest(url, opts, null, data);
1003
- }
1004
-
1005
- libraryManager.prototype.moveFolder = function (params, data) {
1006
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.FoldersMove);
1007
-
1008
- var opts = { method: 'PUT' };
1009
-
1010
- return this._httpHelper.doVvClientRequest(url, opts, null, data);
1011
- }
1012
-
1013
- libraryManager.prototype.getDocuments = function (params, folderId) {
1014
- var resourceUri = this._httpHelper._config.ResourceUri.Documents.replace('{id}', folderId);
1015
- var url = this._httpHelper.getUrl(resourceUri);
1016
-
1017
- var opts = { method: 'GET' };
1018
-
1019
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1020
- };
1021
-
1022
- libraryManager.prototype.updateFolderIndexFieldOverrideSettings = function (folderId, fieldId, queryId, displayField, valueField, dropDownListId, required, defaultValue) {
1023
- var data = {
1024
- queryId: queryId,
1025
- queryValueField: valueField,
1026
- queryDisplayField: displayField,
1027
- dropDownListId: dropDownListId,
1028
- required: required,
1029
- defaultValue: defaultValue
1030
- }
1031
-
1032
- var resourceUri = this._httpHelper._config.ResourceUri.FoldersIdIndexFieldsId.replace('{id}', folderId).replace('{indexFieldId}', fieldId);
1033
- var url = this._httpHelper.getUrl(resourceUri);
1034
- var opts = { method: 'PUT' };
1035
- return this._httpHelper.doVvClientRequest(url, opts, null, data);
1036
- };
1037
-
1038
- libraryManager.prototype.getFolderIndexFields = function (params, folderId) {
1039
- var resourceUri = this._httpHelper._config.ResourceUri.FolderIndexFields.replace('{id}', folderId);
1040
- var url = this._httpHelper.getUrl(resourceUri);
1041
-
1042
- var opts = { method: 'GET' };
1043
-
1044
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1045
- }
1046
-
1047
- libraryManager.prototype.postFolderAlertSubscription = function (folderId, eventId, userId) {
1048
- var resourceUri = this._httpHelper._config.ResourceUri.FolderAlertsId.replace('{folderId}', folderId).replace('{eventId}', eventId);
1049
- var url = this._httpHelper.getUrl(resourceUri);
1050
- var opts = { method: 'POST' };
1051
-
1052
- var params = {
1053
- usId: userId
1054
- };
1055
-
1056
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1057
- }
1058
-
1059
- libraryManager.prototype.deleteFolderAlertSubscription = function (folderId, eventId, userId) {
1060
- var resourceUri = this._httpHelper._config.ResourceUri.FolderAlertsId.replace('{folderId}', folderId).replace('{eventId}', eventId);
1061
- var url = this._httpHelper.getUrl(resourceUri);
1062
- var opts = { method: 'DELETE' };
1063
-
1064
- var params = {
1065
- usId: userId
1066
- };
1067
-
1068
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1069
- }
1070
-
1071
- libraryManager.prototype.getFolderSecurityMembers = function (params, folderId) {
1072
- var resourceUri = this._httpHelper._config.ResourceUri.FolderSecurity.replace('{folderId}', folderId);
1073
- var url = this._httpHelper.getUrl(resourceUri);
1074
- var opts = { method: 'GET' };
1075
-
1076
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1077
- }
1078
-
1079
- libraryManager.prototype.putFolderSecurityMember = function (folderId, memberId, memberType, securityRole, cascadeSecurityChanges) {
1080
- var resourceUri = this._httpHelper._config.ResourceUri.FolderSecurityId.replace('{folderId}', folderId).replace('{memberId}', memberId);
1081
- var url = this._httpHelper.getUrl(resourceUri);
1082
- var opts = { method: 'PUT' };
1083
-
1084
- var data = {
1085
- memberType: memberType,
1086
- securityRole: securityRole,
1087
- cascadeSecurityChanges: cascadeSecurityChanges
1088
- };
1089
-
1090
- return this._httpHelper.doVvClientRequest(url, opts, null, data);
1091
- }
1092
-
1093
- libraryManager.prototype.deleteFolderSecurityMember = function (folderId, memberId, cascadeSecurityChanges) {
1094
- var resourceUri = this._httpHelper._config.ResourceUri.FolderSecurityId.replace('{folderId}', folderId).replace('{memberId}', memberId);
1095
- var url = this._httpHelper.getUrl(resourceUri);
1096
- var opts = { method: 'DELETE' };
1097
-
1098
- var params = {
1099
- cascadeSecurityChanges: cascadeSecurityChanges
1100
- };
1101
-
1102
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1103
- }
1104
-
1105
- return libraryManager;
1106
- })();
1107
- library.libraryManager = libraryManager;
1108
- })(vvRestApi.library || (vvRestApi.library = {}));
1109
- var library = vvRestApi.library;
1110
-
1111
- (function (sites) {
1112
- var sitesManager = (function () {
1113
- function sitesManager(httpHelper) {
1114
- this._httpHelper = httpHelper;
1115
- }
1116
- sitesManager.prototype.getSites = function (params) {
1117
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.Sites);
1118
-
1119
- var opts = { method: 'GET' };
1120
-
1121
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1122
- };
1123
-
1124
- sitesManager.prototype.postSites = function (params, data) {
1125
- var resourceUri = this._httpHelper._config.ResourceUri.Sites;
1126
- var url = this._httpHelper.getUrl(resourceUri);
1127
-
1128
- var opts = { method: 'POST' };
1129
-
1130
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
1131
- };
1132
-
1133
- sitesManager.prototype.putSites = function (params, data, siteId) {
1134
- var resourceUri = this._httpHelper._config.ResourceUri.Sites;
1135
- var url = this._httpHelper.getUrl(resourceUri + '/' + siteId);
1136
-
1137
- var opts = { method: 'PUT' };
1138
-
1139
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
1140
- };
1141
-
1142
- sitesManager.prototype.getGroups = function (params, siteId) {
1143
- var resourceUri = this._httpHelper._config.ResourceUri.Groups.replace('{id}', siteId);
1144
- var url = this._httpHelper.getUrl(resourceUri);
1145
-
1146
- var opts = { method: 'GET' };
1147
-
1148
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1149
- };
1150
-
1151
- sitesManager.prototype.postGroups = function (params, data, siteId) {
1152
- var resourceUri = this._httpHelper._config.ResourceUri.Groups.replace('{id}', siteId);
1153
- var url = this._httpHelper.getUrl(resourceUri);
1154
-
1155
- var opts = { method: 'POST' };
1156
-
1157
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
1158
- };
1159
-
1160
- sitesManager.prototype.putGroups = function (params, data, siteId, grId) {
1161
- var resourceUri = this._httpHelper._config.ResourceUri.Groups.replace('{id}', siteId);
1162
- var url = this._httpHelper.getUrl(resourceUri + '/' + grId);
1163
-
1164
- var opts = { method: 'PUT' };
1165
-
1166
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
1167
- };
1168
-
1169
- sitesManager.prototype.changeUserSite = function (userId, newSiteId) {
1170
- var resourceUri = this._httpHelper._config.ResourceUri.ChangeUserSite;
1171
- var url = this._httpHelper.getUrl(resourceUri);
1172
-
1173
- var opts = { method: 'PUT' };
1174
-
1175
- var data = {
1176
- UserId: userId,
1177
- NewSiteId: newSiteId
1178
- }
1179
-
1180
- return this._httpHelper.doVvClientRequest(url, opts, null, data);
1181
- };
1182
-
1183
- return sitesManager;
1184
- })();
1185
- sites.sitesManager = sitesManager;
1186
- })(vvRestApi.sites || (vvRestApi.sites = {}));
1187
- var sites = vvRestApi.sites;
1188
-
1189
- (function (users) {
1190
- var usersManager = (function () {
1191
- function usersManager(httpHelper) {
1192
- this._httpHelper = httpHelper;
1193
- }
1194
- usersManager.prototype.getUsers = function (params, siteId) {
1195
- var resourceUri = this._httpHelper._config.ResourceUri.Users.replace('{id}', siteId);
1196
- var url = this._httpHelper.getUrl(resourceUri);
1197
-
1198
- var opts = { method: 'GET' };
1199
-
1200
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1201
- };
1202
-
1203
- usersManager.prototype.postUsers = function (params, data, siteId) {
1204
- var resourceUri = this._httpHelper._config.ResourceUri.Users.replace('{id}', siteId);
1205
- var url = this._httpHelper.getUrl(resourceUri);
1206
-
1207
- var opts = { method: 'POST' };
1208
-
1209
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
1210
- };
1211
-
1212
- usersManager.prototype.putUsers = function (params, data, siteId, usId) {
1213
- var resourceUri = this._httpHelper._config.ResourceUri.Users.replace('{id}', siteId);
1214
- var url = this._httpHelper.getUrl(resourceUri + '/' + usId);
1215
-
1216
- var opts = { method: 'PUT' };
1217
-
1218
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
1219
- };
1220
-
1221
- usersManager.prototype.putUsersEndpoint = function (params, data, usId) {
1222
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.User + '/' + usId);
1223
- var opts = { method: 'PUT' };
1224
-
1225
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
1226
- };
1227
-
1228
- usersManager.prototype.getUser = function (params) {
1229
- var resourceUri = this._httpHelper._config.ResourceUri.User;
1230
- var url = this._httpHelper.getUrl(resourceUri);
1231
- var opts = { method: 'GET' };
1232
-
1233
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1234
- };
1235
-
1236
- usersManager.prototype.getUserById = function (params, usId) {
1237
- var resourceUri = this._httpHelper._config.ResourceUri.UserById.replace('{id}', usId);
1238
- var url = this._httpHelper.getUrl(resourceUri);
1239
- var opts = { method: 'GET' };
1240
-
1241
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1242
- };
1243
-
1244
- usersManager.prototype.getUserGroups = function (params, usId) {
1245
- var resourceUri = this._httpHelper._config.ResourceUri.UserGroups.replace('{id}', usId);
1246
- var url = this._httpHelper.getUrl(resourceUri);
1247
- var opts = { method: 'GET' };
1248
-
1249
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1250
- }
1251
-
1252
- usersManager.prototype.getUserSupervisors = function (params, usId) {
1253
- var resourceUri = this._httpHelper._config.ResourceUri.UserSupervisors.replace('{id}', usId);
1254
- var url = this._httpHelper.getUrl(resourceUri);
1255
- var opts = { method: 'GET' };
1256
-
1257
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1258
- }
1259
-
1260
- usersManager.prototype.getUserSupervisees = function (params, usId) {
1261
- var resourceUri = this._httpHelper._config.ResourceUri.UserSupervisees.replace('{id}', usId);
1262
- var url = this._httpHelper.getUrl(resourceUri);
1263
- var opts = { method: 'GET' };
1264
-
1265
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1266
- }
1267
-
1268
- usersManager.prototype.getUserLoginToken = function (usId) {
1269
- var resourceUri = this._httpHelper._config.ResourceUri.UserWebToken.replace('{id}', usId);
1270
- var url = this._httpHelper.getUrl(resourceUri);
1271
- var opts = { method: 'GET' };
1272
-
1273
- var params = []; //empty array
1274
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1275
- }
1276
-
1277
- usersManager.prototype.getUserJwt = function (audience) {
1278
- var resourceUri = this._httpHelper._config.ResourceUri.UsersGetJwt;
1279
- var url = this._httpHelper.getUrl(resourceUri);
1280
- var opts = { method: 'GET' };
1281
- var params = {};
1282
- if (audience) {
1283
- params['audience'] = audience;
1284
- }
1285
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1286
- }
1287
-
1288
- usersManager.prototype.resetPassword = function (usId, sendEmail = true) {
1289
- var resourceUri = this._httpHelper._config.ResourceUri.UsersPassword.replace('{id}', usId);
1290
- var url = this._httpHelper.getUrl(resourceUri);
1291
- var opts = { method: 'PUT' };
1292
- var params = []; //empty array
1293
-
1294
- var data = {
1295
- resetPassword: true,
1296
- sendEmail: sendEmail
1297
- };
1298
-
1299
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
1300
- }
1301
-
1302
- usersManager.prototype.updateUserId = function (usId, newUserId) {
1303
- var resourceUri = this._httpHelper._config.ResourceUri.UsersIdUserId.replace('{id}', usId);
1304
- var url = this._httpHelper.getUrl(resourceUri);
1305
- var opts = { method: 'PUT' };
1306
- var params = []; //empty array
1307
-
1308
- var data = {
1309
- userId: newUserId
1310
- };
1311
-
1312
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
1313
- }
1314
-
1315
- return usersManager;
1316
- })();
1317
- users.usersManager = usersManager;
1318
- })(vvRestApi.users || (vvRestApi.users = {}));
1319
- var users = vvRestApi.users;
1320
-
1321
-
1322
-
1323
- (function (scheduledProcess) {
1324
- var scheduledProcessManager = (function () {
1325
- function scheduledProcessManager(httpHelper) {
1326
- this._httpHelper = httpHelper;
1327
- }
1328
-
1329
- scheduledProcessManager.prototype.postCompletion = function (id, action, result, message) {
1330
- //build url for call to the scheduledProcess controller
1331
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.ScheduledProcess) + '/' + id;
1332
-
1333
- //indicate this is a POST
1334
- var opts = { method: 'POST' };
1335
-
1336
- //create the querystring parameters
1337
- var params = {
1338
- action: action
1339
- }
1340
-
1341
- //determine if a result will be returned
1342
- if (result !== null && (typeof result == 'boolean' || result.length > 0)) {
1343
- params.result = result.toString();
1344
- }
1345
-
1346
- //determine if a message will be returned
1347
- if (message && message.length > 0) {
1348
- params.message = message;
1349
- }
1350
-
1351
- //place call and return promise object
1352
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1353
- };
1354
-
1355
- scheduledProcessManager.prototype.runAllScheduledProcesses = function () {
1356
- //build url for call to the scheduledProcess controller
1357
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.ScheduledProcess) + '/Run';
1358
-
1359
- //indicate this is a PUT
1360
- var opts = { method: 'PUT' };
1361
-
1362
- //place call and return promise object
1363
- return this._httpHelper.doVvClientRequest(url, opts, null, null);
1364
- };
1365
-
1366
- return scheduledProcessManager;
1367
- })();
1368
- scheduledProcess.scheduledProcessManager = scheduledProcessManager;
1369
- })(vvRestApi.scheduledProcess || (vvRestApi.scheduledProcess = {}));
1370
- var scheduledProcess = vvRestApi.scheduledProcess;
1371
-
1372
-
1373
- //customQuery manager
1374
- (function (customQuery) {
1375
- var customQueryManager = (function () {
1376
- function customQueryManager(httpHelper) {
1377
- this._httpHelper = httpHelper;
1378
- }
1379
-
1380
- customQueryManager.prototype.getCustomQueryResultsByName = function (queryName, params) {
1381
- //build url for call to the scheduledProcess controller
1382
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.CustomQuery);
1383
-
1384
- //indicate this is a GET
1385
- var opts = { method: 'GET' };
1386
-
1387
- //add the query name to the params
1388
- if (!params) {
1389
- params = {};
1390
- }
1391
- params.queryName = queryName;
1392
-
1393
-
1394
- //place call and return promise object
1395
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1396
- };
1397
-
1398
- customQueryManager.prototype.getCustomQueryResultsById = function (id, params) {
1399
- //build url for call to the scheduledProcess controller
1400
- var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.CustomQuery + '/' + id);
1401
-
1402
- //indicate this is a GET
1403
- var opts = { method: 'GET' };
1404
-
1405
- if (!params) {
1406
- params = {};
1407
- }
1408
-
1409
- //place call and return promise object
1410
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1411
- };
1412
-
1413
- return customQueryManager;
1414
- })();
1415
- customQuery.customQueryManager = customQueryManager;
1416
- })(vvRestApi.customQuery || (vvRestApi.customQuery = {}));
1417
- var customQuery = vvRestApi.customQuery;
1418
-
1419
-
1420
- //customer manager
1421
- (function (customer) {
1422
- var customerManager = (function () {
1423
- function customerManager(httpHelper) {
1424
- this._httpHelper = httpHelper;
1425
- }
1426
-
1427
- customerManager.prototype.createCustomerInvite = function (data) {
1428
- //build url
1429
- var baseUrl = this._httpHelper._sessionToken.baseUrl;
1430
-
1431
- var url = baseUrl + "/api/v1/" + this._httpHelper._config.ResourceUri.CustomerInvite;
1432
-
1433
- url = url.replace(/\/api\/\//g, '/api/');
1434
-
1435
- url = url.replace(/\/v1\/\//g, '/v1/');
1436
-
1437
- var opts = { method: 'POST' };
1438
-
1439
- return this._httpHelper.doVvClientRequest(url, opts, '', data);
1440
- };
1441
-
1442
- customerManager.prototype.assignUser = function (customerId, data) {
1443
- var baseUrl = this._httpHelper._sessionToken.baseUrl;
1444
-
1445
- var url = baseUrl + "/api/v1/" + this._httpHelper._config.ResourceUri.CustomerAssignUser.replace('{customerId}', customerId);;
1446
-
1447
- var opts = { method: 'PUT' };
1448
-
1449
- return this._httpHelper.doVvClientRequest(url, opts, '', data);
1450
- }
1451
-
1452
- return customerManager;
1453
- })();
1454
- customer.customerManager = customerManager;
1455
- })(vvRestApi.customer || (vvRestApi.customer = {}));
1456
- var customer = vvRestApi.customer;
1457
-
1458
- //customerDatabase manager
1459
- (function (customerDatabase) {
1460
- var customerDatabaseManager = (function () {
1461
- function customerDatabaseManager(httpHelper) {
1462
- this._httpHelper = httpHelper;
1463
- }
1464
-
1465
- customerDatabaseManager.prototype.assignUser = function (customerId, data) {
1466
- var baseUrl = this._httpHelper._sessionToken.baseUrl;
1467
-
1468
- var url = baseUrl + "/api/v1/" + this._httpHelper._config.ResourceUri.CustomerDatabaseAssignUser.replace('{databaseId}', customerId);;
1469
-
1470
- var opts = { method: 'PUT' };
1471
-
1472
- return this._httpHelper.doVvClientRequest(url, opts, '', data);
1473
- };
1474
-
1475
- customerDatabaseManager.prototype.removeUser = function (authenticationUserId, databaseId) {
1476
- var baseUrl = this._httpHelper._sessionToken.baseUrl;
1477
- var url = baseUrl + "/api/v1" + this._httpHelper._config.ResourceUri.UserDelete.replace('{databaseId}', databaseId);
1478
- url = url.replace("{authenticationUserId}", authenticationUserId);
1479
- console.log(url);
1480
- var opts = { method: 'DELETE' };
1481
- var params = []; //empty array
1482
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1483
- }
1484
-
1485
- return customerDatabaseManager;
1486
- })();
1487
- customerDatabase.customerDatabaseManager = customerDatabaseManager;
1488
- })(vvRestApi.customerDatabase || (vvRestApi.customerDatabase = {}));
1489
- var customerDatabase = vvRestApi.customerDatabase;
1490
-
1491
- // files manager
1492
- (function (files) {
1493
- var filesManager = (function () {
1494
- function filesManager(httpHelper) {
1495
- this._httpHelper = httpHelper;
1496
- }
1497
-
1498
- filesManager.prototype.getFileBytesQuery = function (query) {
1499
- var resourceUri = this._httpHelper._config.ResourceUri.FilesQuery + query;
1500
- var url = this._httpHelper.getUrl(resourceUri);
1501
- var opts = { method: 'GETSTREAM' };
1502
- return this._httpHelper.doVvClientRequest(url, opts, null, null);
1503
- };
1504
-
1505
- filesManager.prototype.getFileBytesId = function (id) {
1506
- var resourceUri = this._httpHelper._config.ResourceUri.FilesId.replace('{id}', id);
1507
- var url = this._httpHelper.getUrl(resourceUri);
1508
- var opts = { method: 'GETSTREAM' };
1509
- return this._httpHelper.doVvClientRequest(url, opts, null, null);
1510
- };
1511
-
1512
- filesManager.prototype.postFile = function (data, buffer) {
1513
- var resourceUri = this._httpHelper._config.ResourceUri.Files;
1514
- var url = this._httpHelper.getUrl(resourceUri);
1515
- var opts = { method: 'POSTSTREAM' };
1516
-
1517
- return this._httpHelper.doVvClientRequest(url, opts, null, data, buffer);
1518
- };
1519
-
1520
- return filesManager;
1521
- })();
1522
- files.filesManager = filesManager;
1523
-
1524
- })(vvRestApi.files || (vvRestApi.files = {}));
1525
- var files = vvRestApi.files;
1526
-
1527
- // scripts manager
1528
- (function (scripts) {
1529
- var scriptsManager = (function () {
1530
- function scriptsManager(httpHelper) {
1531
- this._httpHelper = httpHelper;
1532
- }
1533
-
1534
- scriptsManager.prototype.runWebService = function (serviceName, serviceData, usId) {
1535
- var resourceUri = this._httpHelper._config.ResourceUri.Scripts + '?name=' + serviceName
1536
- if (typeof (usId) != 'undefined' && usId != null) {
1537
- resourceUri += `&usId=${usId}`;
1538
- }
1539
-
1540
- var url = this._httpHelper.getUrl(resourceUri);
1541
- var opts = { method: 'POST' };
1542
- return this._httpHelper.doVvClientRequest(url, opts, null, serviceData);
1543
- };
1544
-
1545
- scriptsManager.prototype.completeWorkflowWebService = function (executionId, workflowVariables) {
1546
- var resourceUri = this._httpHelper._config.ResourceUri.ScriptsCompleteWf
1547
- var url = this._httpHelper.getUrl(resourceUri);
1548
- var opts = { method: 'POST' };
1549
-
1550
- var postData = {};
1551
- postData["executionId"] = executionId;
1552
- postData["workflowVariables"] = workflowVariables;
1553
-
1554
- return this._httpHelper.doVvClientRequest(url, opts, null, postData);
1555
- };
1556
-
1557
- return scriptsManager;
1558
- })();
1559
- scripts.scriptsManager = scriptsManager;
1560
-
1561
- })(vvRestApi.scripts || (vvRestApi.scripts = {}));
1562
- var scripts = vvRestApi.scripts;
1563
-
1564
- // documents manager
1565
- (function (documents) {
1566
- var documentsManager = (function () {
1567
- function documentsManager(httpHelper) {
1568
- this._httpHelper = httpHelper;
1569
- }
1570
-
1571
- documentsManager.prototype.postDoc = function (data) {
1572
- var resourceUri = this._httpHelper._config.ResourceUri.DocumentsPost;
1573
- var url = this._httpHelper.getUrl(resourceUri);
1574
- var opts = { method: 'POST' };
1575
- return this._httpHelper.doVvClientRequest(url, opts, null, data);
1576
- };
1577
-
1578
- documentsManager.prototype.postDocWithFile = function (data, fileData) {
1579
- var resourceUri = this._httpHelper._config.ResourceUri.DocumentsPost;
1580
- var url = this._httpHelper.getUrl(resourceUri);
1581
- var opts = { method: 'POSTSTREAM' };
1582
- return this._httpHelper.doVvClientRequest(url, opts, null, data, fileData);
1583
- };
1584
-
1585
- documentsManager.prototype.copyDocument = function (params, data, documentId) {
1586
- var resourceUri = this._httpHelper._config.ResourceUri.DocumentsIdCopy.replace('{id}', documentId);
1587
- var url = this._httpHelper.getUrl(resourceUri);
1588
- var opts = { method: 'POST' };
1589
-
1590
- return this._httpHelper.doVvClientRequest(url, opts, null, data);
1591
- }
1592
-
1593
- documentsManager.prototype.moveDocument = function (params, data, documentId) {
1594
- var resourceUri = this._httpHelper._config.ResourceUri.DocumentsIdMove.replace('{id}', documentId);
1595
- var url = this._httpHelper.getUrl(resourceUri);
1596
- var opts = { method: 'PUT' };
1597
- return this._httpHelper.doVvClientRequest(url, opts, params, data);
1598
- }
1599
-
1600
- documentsManager.prototype.deleteDocument = function (params, revisionId) {
1601
- var resourceUri = this._httpHelper._config.ResourceUri.DocumentsId.replace('{id}', revisionId);
1602
- var url = this._httpHelper.getUrl(resourceUri);
1603
- var opts = { method: 'DELETE' };
1604
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1605
- }
1606
-
1607
- documentsManager.prototype.getDocumentRevision = function (params, revisionId) {
1608
- var resourceUri = this._httpHelper._config.ResourceUri.DocumentsId.replace('{id}', revisionId);
1609
- var url = this._httpHelper.getUrl(resourceUri);
1610
- var opts = { method: 'GET' };
1611
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1612
- }
1613
-
1614
- documentsManager.prototype.getDocuments = function (params) {
1615
- var resourceUri = this._httpHelper._config.ResourceUri.DocumentsPost;
1616
- var url = this._httpHelper.getUrl(resourceUri);
1617
- var opts = { method: 'GET' };
1618
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1619
- }
1620
-
1621
- documentsManager.prototype.putDocumentIndexFields = function (data, documentId) {
1622
- var resourceUri = this._httpHelper._config.ResourceUri.DocumentIndexFields.replace('{id}', documentId);
1623
- var url = this._httpHelper.getUrl(resourceUri);
1624
- var opts = { method: 'PUT' };
1625
- return this._httpHelper.doVvClientRequest(url, opts, null, data);
1626
- };
1627
-
1628
- documentsManager.prototype.postDocumentAlertSubscription = function (documentId, eventId, userId) {
1629
- var resourceUri = this._httpHelper._config.ResourceUri.DocumentAlertsId.replace('{documentId}', documentId).replace('{eventId}', eventId);
1630
- var url = this._httpHelper.getUrl(resourceUri);
1631
- var opts = { method: 'POST' };
1632
-
1633
- var params = {
1634
- usId: userId
1635
- };
1636
-
1637
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1638
- }
1639
-
1640
- documentsManager.prototype.deleteDocumentAlertSubscription = function (documentId, eventId, userId) {
1641
- var resourceUri = this._httpHelper._config.ResourceUri.DocumentAlertsId.replace('{documentId}', documentId).replace('{eventId}', eventId);
1642
- var url = this._httpHelper.getUrl(resourceUri);
1643
- var opts = { method: 'DELETE' };
1644
-
1645
- var params = {
1646
- usId: userId
1647
- };
1648
-
1649
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1650
- }
1651
-
1652
- documentsManager.prototype.getDocumentRevisionOcrProperties = function (params, revisionId) {
1653
- var resourceUri = this._httpHelper._config.ResourceUri.DocumentsIdOcr.replace('{id}', revisionId);
1654
- var url = this._httpHelper.getUrl(resourceUri);
1655
- var opts = { method: 'GET' };
1656
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1657
- }
1658
-
1659
- documentsManager.prototype.relateDocuments = function (revisionId, relateToRevisionId, relateType) {
1660
- var resourceUri = this._httpHelper._config.ResourceUri.DocumentsIdRelateDocument.replace('{id}', revisionId);
1661
- var url = this._httpHelper.getUrl(resourceUri);
1662
- var opts = { method: 'PUT' };
1663
-
1664
- var data = {
1665
- relateToId: relateToRevisionId,
1666
- relateType: relateType
1667
- };
1668
-
1669
- return this._httpHelper.doVvClientRequest(url, opts, null, data);
1670
- };
1671
-
1672
- documentsManager.prototype.updateDocumentExpiration = function (documentId, expirationDate) {
1673
- var resourceUri = this._httpHelper._config.ResourceUri.DocumentsIdExpiration.replace('{id}', documentId);
1674
- var url = this._httpHelper.getUrl(resourceUri);
1675
- var opts = { method: 'PUT' };
1676
-
1677
- var data = {
1678
- expirationDate: expirationDate
1679
- };
1680
-
1681
- return this._httpHelper.doVvClientRequest(url, opts, null, data);
1682
- }
1683
-
1684
- return documentsManager;
1685
- })();
1686
- documents.documentsManager = documentsManager;
1687
-
1688
- })(vvRestApi.documents || (vvRestApi.documents = {}));
1689
- var documents = vvRestApi.documents;
1690
-
1691
- // projects manager
1692
- (function (projects) {
1693
- var projectsManager = (function () {
1694
- function projectsManager(httpHelper) {
1695
- this._httpHelper = httpHelper;
1696
- }
1697
-
1698
- projectsManager.prototype.postProjectAlertSubscription = function (projectId, eventId, userId) {
1699
- var resourceUri = this._httpHelper._config.ResourceUri.ProjectAlertsId.replace('{projectId}', projectId).replace('{eventId}', eventId);
1700
- var url = this._httpHelper.getUrl(resourceUri);
1701
- var opts = { method: 'POST' };
1702
-
1703
- var params = {
1704
- usId: userId
1705
- };
1706
-
1707
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1708
- }
1709
-
1710
- projectsManager.prototype.deleteProjectAlertSubscription = function (projectId, eventId, userId) {
1711
- var resourceUri = this._httpHelper._config.ResourceUri.ProjectAlertsId.replace('{projectId}', projectId).replace('{eventId}', eventId);
1712
- var url = this._httpHelper.getUrl(resourceUri);
1713
- var opts = { method: 'DELETE' };
1714
-
1715
- var params = {
1716
- usId: userId
1717
- };
1718
-
1719
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1720
- }
1721
-
1722
- return projectsManager;
1723
- })();
1724
- projects.projectsManager = projectsManager;
1725
-
1726
- })(vvRestApi.projects || (vvRestApi.projects = {}));
1727
- var projects = vvRestApi.projects;
1728
-
1729
- // indexFields manager
1730
- (function (indexFields) {
1731
- var indexFieldsManager = (function () {
1732
- function indexFieldsManager(httpHelper) {
1733
- this._httpHelper = httpHelper;
1734
- }
1735
-
1736
- indexFieldsManager.prototype.getIndexFields = function (params) {
1737
- var resourceUri = this._httpHelper._config.ResourceUri.IndexFields;
1738
- var url = this._httpHelper.getUrl(resourceUri);
1739
- var opts = { method: 'GET' };
1740
-
1741
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1742
- }
1743
-
1744
- return indexFieldsManager;
1745
- })();
1746
- indexFields.indexFieldsManager = indexFieldsManager;
1747
-
1748
- })(vvRestApi.indexFields || (vvRestApi.indexFields = {}));
1749
- var indexFields = vvRestApi.indexFields;
1750
-
1751
- //Outside process manager
1752
- (function (outsideProcesses) {
1753
- var outsideProcessesManager = (function () {
1754
- function outsideProcessesManager(httpHelper) {
1755
- this._httpHelper = httpHelper;
1756
- }
1757
-
1758
- outsideProcessesManager.prototype.getOutsideProcesses = function (params) {
1759
- var resourceUri = this._httpHelper._config.ResourceUri.OutsideProcesses;
1760
- var url = this._httpHelper.getUrl(resourceUri);
1761
- var opts = { method: 'GET' };
1762
-
1763
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1764
- }
1765
-
1766
- return outsideProcessesManager;
1767
- })();
1768
- outsideProcesses.outsideProcessesManager = outsideProcessesManager;
1769
-
1770
- })(vvRestApi.outsideProcesses || (vvRestApi.outsideProcesses = {}));
1771
- var outsideProcesses = vvRestApi.outsideProcesses;
1772
-
1773
- //Security members manager
1774
- (function (securityMembers) {
1775
- var securityMembersManager = (function () {
1776
- function securityMembersManager(httpHelper) {
1777
- this._httpHelper = httpHelper;
1778
- }
1779
-
1780
- securityMembersManager.prototype.addSecurityMember = function (parentId, memberId, roleType, isGroup) {
1781
- var resourceUri = this._httpHelper._config.ResourceUri.SecurityMembers;
1782
- var url = this._httpHelper.getUrl(resourceUri);
1783
- var opts = { method: 'POST' };
1784
-
1785
- var postData = {
1786
- parentId: parentId,
1787
- memberId: memberId,
1788
- role: roleType,
1789
- isGroup: isGroup
1790
- };
1791
-
1792
- return this._httpHelper.doVvClientRequest(url, opts, null, postData);
1793
- };
1794
-
1795
- securityMembersManager.prototype.getSecurityMembersForParentId = function (parentId) {
1796
- var resourceUri = this._httpHelper._config.ResourceUri.SecurityMembers;
1797
- var url = this._httpHelper.getUrl(resourceUri);
1798
- var opts = { method: 'GET' };
1799
-
1800
- var params = {
1801
- parentId: parentId
1802
- };
1803
-
1804
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1805
- };
1806
-
1807
- securityMembersManager.prototype.removeSecurityMember = function (parentId, memberId) {
1808
- var resourceUri = this._httpHelper._config.ResourceUri.SecurityMembers;
1809
- var url = this._httpHelper.getUrl(resourceUri);
1810
- var opts = { method: 'DELETE' };
1811
-
1812
- var params = {
1813
- parentId: parentId,
1814
- memberId: memberId
1815
- };
1816
-
1817
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1818
- };
1819
-
1820
- securityMembersManager.prototype.updateSecurityMember = function (parentId, memberId, roleType) {
1821
- var resourceUri = this._httpHelper._config.ResourceUri.SecurityMembers;
1822
- var url = this._httpHelper.getUrl(resourceUri);
1823
- var opts = { method: 'PUT' };
1824
-
1825
- var postData = {
1826
- parentId: parentId,
1827
- memberId: memberId,
1828
- role: roleType
1829
- };
1830
-
1831
- return this._httpHelper.doVvClientRequest(url, opts, null, postData);
1832
- };
1833
-
1834
- return securityMembersManager;
1835
- })();
1836
- securityMembers.securityMembersManager = securityMembersManager;
1837
-
1838
- })(vvRestApi.securityMembers || (vvRestApi.securityMembers = {}));
1839
- var securityMembers = vvRestApi.securityMembers;
1840
-
1841
- //layouts manager
1842
- (function (layouts) {
1843
- var layoutsManager = (function () {
1844
- function layoutsManager(httpHelper) {
1845
- this._httpHelper = httpHelper;
1846
- }
1847
-
1848
- layoutsManager.prototype.getLayout = function () {
1849
- var resourceUri = this._httpHelper._config.ResourceUri.Layout;
1850
- var url = this._httpHelper.getUrl(resourceUri);
1851
- var opts = { method: 'GET' };
1852
-
1853
- return this._httpHelper.doVvClientRequest(url, opts, {}, null);
1854
- };
1855
-
1856
- return layoutsManager;
1857
- })();
1858
- layouts.layoutsManager = layoutsManager;
1859
-
1860
- })(vvRestApi.layouts || (vvRestApi.layouts = {}));
1861
- var layouts = vvRestApi.layouts;
1862
-
1863
- //reports manager
1864
- (function (reports) {
1865
- var reportsManager = (function () {
1866
- function reportsManager(httpHelper) {
1867
- this._httpHelper = httpHelper;
1868
- }
1869
-
1870
- reportsManager.prototype.getReportPDF = function (reportId, params) {
1871
- var resourceUri = this._httpHelper._config.ResourceUri.ReportServerPDF.replace('{id}', reportId);
1872
- var url = this._httpHelper.getUrl(resourceUri);
1873
- var opts = { method: 'GETSTREAM' };
1874
-
1875
- return this._httpHelper.doVvClientRequest(url, opts, params, null);
1876
- };
1877
-
1878
- return reportsManager;
1879
- })();
1880
- reports.reportsManager = reportsManager;
1881
-
1882
- })(vvRestApi.reports || (vvRestApi.reports = {}));
1883
- var reports = vvRestApi.reports;
1884
-
1885
- })(vvRestApi || (vvRestApi = {}));
1886
-
1887
-
1888
- module.exports = vvRestApi;
1889
-
1
+ var vvRestApi;
2
+ var DocApi = require('./DocApi');
3
+ var FormsApi = require('./FormsApi');
4
+ var ObjectsApi = require('./ObjectsApi');
5
+ var StudioApi = require('./StudioApi');
6
+ var NotificationsApi = require('./NotificationsApi');
7
+ var common = require('./common');
8
+ var logger = require('./log');
9
+ var Q = require('q');
10
+
11
+ (function (vvRestApi) {
12
+ var vvClient = (function () {
13
+
14
+ function vvClient(sessionToken) {
15
+ // var yamlConfig = require('./config.yml');
16
+ var yaml = require('js-yaml');
17
+ var fs = require('fs');
18
+ this.yamlConfig = yaml.safeLoad(fs.readFileSync(__dirname + '/config.yml', 'utf8'));
19
+
20
+ this._httpHelper = new common.httpHelper(sessionToken, this.yamlConfig);
21
+ this.constants = new constants.constantsInitializer();
22
+ this.configuration = new configuration.configurationManager(this._httpHelper);
23
+
24
+ this.customQuery = new customQuery.customQueryManager(this._httpHelper);
25
+ this.documents = new documents.documentsManager(this._httpHelper);
26
+ this.email = new email.emailManager(this._httpHelper);
27
+ this.files = new files.filesManager(this._httpHelper);
28
+ this.forms = new forms.formsManager(this._httpHelper);
29
+ this.groups = new groups.groupsManager(this._httpHelper);
30
+ this.library = new library.libraryManager(this._httpHelper);
31
+ this.sites = new sites.sitesManager(this._httpHelper);
32
+ this.users = new users.usersManager(this._httpHelper);
33
+ this.scheduledProcess = new scheduledProcess.scheduledProcessManager(this._httpHelper);
34
+ this.scripts = new scripts.scriptsManager(this._httpHelper);
35
+ this.projects = new projects.projectsManager(this._httpHelper);
36
+ this.customer = new customer.customerManager(this._httpHelper);
37
+ this.customerDatabase = new customerDatabase.customerDatabaseManager(this._httpHelper);
38
+ this.indexFields = new indexFields.indexFieldsManager(this._httpHelper);
39
+ this.outsideProcesses = new outsideProcesses.outsideProcessesManager(this._httpHelper);
40
+ this.securityMembers = new securityMembers.securityMembersManager(this._httpHelper);
41
+ this.layouts = new layouts.layoutsManager(this._httpHelper);
42
+ this.reports = new reports.reportsManager(this._httpHelper);
43
+ this.currentUser = new currentUser.currentUserManager(this._httpHelper);
44
+
45
+ this._docApi = null;
46
+ Object.defineProperties(this, {
47
+ docApi: {
48
+ get: function () {
49
+ if (this._docApi != null && this._docApi.isEnabled && this._docApi.baseUrl) {
50
+ return this._docApi;
51
+ } else {
52
+ throw new ReferenceError("Document Api not enabled");
53
+ }
54
+ }
55
+ }
56
+ });
57
+
58
+ this._formsApi = null;
59
+ Object.defineProperties(this, {
60
+ formsApi: {
61
+ get: function () {
62
+ if (this._formsApi != null && this._formsApi.isEnabled && this._formsApi.baseUrl) {
63
+ return this._formsApi;
64
+ } else {
65
+ throw new ReferenceError("Forms Api not enabled");
66
+ }
67
+ }
68
+ }
69
+ });
70
+
71
+ this._objectsApi = null;
72
+ Object.defineProperties(this, {
73
+ objectsApi: {
74
+ get: function () {
75
+ if (this._objectsApi != null && this._objectsApi.isEnabled && this._objectsApi.baseUrl) {
76
+ return this._objectsApi;
77
+ } else {
78
+ throw new ReferenceError("Objects Api not enabled");
79
+ }
80
+ }
81
+ }
82
+ });
83
+
84
+ this._studioApi = null;
85
+ Object.defineProperties(this, {
86
+ studioApi: {
87
+ get: function () {
88
+ if (this._studioApi != null && this._studioApi.isEnabled && this._studioApi.baseUrl) {
89
+ return this._studioApi;
90
+ } else {
91
+ throw new ReferenceError("Studio Api not enabled");
92
+ }
93
+ }
94
+ }
95
+ });
96
+
97
+ this._notificationsApi = null;
98
+ Object.defineProperties(this, {
99
+ notificationsApi: {
100
+ get: function () {
101
+ if (this._notificationsApi != null && this._notificationsApi.isEnabled && this._notificationsApi.baseUrl) {
102
+ return this._notificationsApi;
103
+ } else {
104
+ throw new ReferenceError("Notifications Api not enabled");
105
+ }
106
+ }
107
+ }
108
+ });
109
+
110
+ }
111
+
112
+ vvClient.prototype.createDocApi = async function (sessionToken) {
113
+
114
+ //get doc api config
115
+ var docApiConfigResponse = JSON.parse(await this.configuration.getDocApiConfig());
116
+
117
+ if (docApiConfigResponse && docApiConfigResponse['data']) {
118
+ var docApiSession = sessionToken.createCopy();
119
+ docApiSession.baseUrl = docApiConfigResponse.data['apiUrl'];
120
+ docApiSession.apiUrl = this.yamlConfig.DocApiUri;
121
+ if (docApiSession['tokenType'] == 'jwt') {
122
+ this._docApi = new DocApi(docApiSession, docApiConfigResponse.data);
123
+ } else if (this.users) {
124
+ var jwtResponse = JSON.parse(await this.users.getUserJwt(docApiSession.audience));
125
+
126
+ if (jwtResponse['data'] && jwtResponse['data']['token']) {
127
+ docApiSession.convertToJwt(jwtResponse['data']);
128
+ this._docApi = new DocApi(docApiSession, docApiConfigResponse.data);
129
+ }
130
+ }
131
+ }
132
+ }
133
+
134
+ vvClient.prototype.createFormsApi = async function (sessionToken) {
135
+
136
+ //get forms api config
137
+ var formsApiConfigResponse = JSON.parse(await this.configuration.getFormsApiConfig());
138
+
139
+ if (formsApiConfigResponse && formsApiConfigResponse['data']) {
140
+ var formsApiSession = sessionToken.createCopy();
141
+ formsApiSession.baseUrl = formsApiConfigResponse.data['formsApiUrl'];
142
+ formsApiSession.apiUrl = this.yamlConfig.FormsApiUri;
143
+ if (formsApiSession['tokenType'] == 'jwt') {
144
+ this._formsApi = new FormsApi(formsApiSession, formsApiConfigResponse.data);
145
+ } else if (this.users) {
146
+ var jwtResponse = JSON.parse(await this.users.getUserJwt(formsApiSession.audience));
147
+
148
+ if (jwtResponse['data'] && jwtResponse['data']['token']) {
149
+ formsApiSession.convertToJwt(jwtResponse['data']);
150
+ this._formsApi = new FormsApi(formsApiSession, formsApiConfigResponse.data);
151
+ }
152
+ }
153
+ }
154
+ }
155
+
156
+ vvClient.prototype.createObjectsApi = async function (sessionToken) {
157
+
158
+ //get objects api config
159
+ var objectsApiConfigResponse = JSON.parse(await this.configuration.getObjectsApiConfig());
160
+
161
+ if (objectsApiConfigResponse && objectsApiConfigResponse['data']) {
162
+ var objectsApiSession = sessionToken.createCopy();
163
+ objectsApiSession.baseUrl = objectsApiConfigResponse.data['apiUrl'];
164
+ objectsApiSession.apiUrl = '';
165
+ if (objectsApiSession['tokenType'] == 'jwt') {
166
+ this._objectsApi = new ObjectsApi(objectsApiSession, objectsApiConfigResponse.data);
167
+ } else if (this.users) {
168
+ var jwtResponse = JSON.parse(await this.users.getUserJwt(objectsApiSession.audience));
169
+
170
+ if (jwtResponse['data'] && jwtResponse['data']['token']) {
171
+ objectsApiSession.convertToJwt(jwtResponse['data']);
172
+ this._objectsApi = new ObjectsApi(objectsApiSession, objectsApiConfigResponse.data);
173
+ }
174
+ }
175
+ }
176
+ }
177
+
178
+ vvClient.prototype.createStudioApi = async function (sessionToken) {
179
+
180
+ //get studio api config
181
+ var studioApiConfigResponse = JSON.parse(await this.configuration.getStudioApiConfig());
182
+
183
+ if (studioApiConfigResponse && studioApiConfigResponse['data']) {
184
+ var studioApiSession = sessionToken.createCopy();
185
+ studioApiSession.baseUrl = studioApiConfigResponse.data['studioApiUrl'];
186
+ studioApiSession.apiUrl = '';
187
+ if (studioApiSession['tokenType'] == 'jwt') {
188
+ this._studioApi = new StudioApi(studioApiSession, studioApiConfigResponse.data);
189
+ } else if (this.users) {
190
+ var jwtResponse = JSON.parse(await this.users.getUserJwt(studioApiSession.audience));
191
+
192
+ if (jwtResponse['data'] && jwtResponse['data']['token']) {
193
+ studioApiSession.convertToJwt(jwtResponse['data']);
194
+ this._studioApi = new StudioApi(studioApiSession, studioApiConfigResponse.data);
195
+ }
196
+ }
197
+ }
198
+ }
199
+
200
+ vvClient.prototype.createNotificationsApi = async function (sessionToken) {
201
+
202
+ //get notifications api config
203
+ var notificationsApiConfigResponse = JSON.parse(await this.configuration.getNotificationsApiConfig());
204
+
205
+ if (notificationsApiConfigResponse && notificationsApiConfigResponse['data']) {
206
+ var notificationsApiSession = sessionToken.createCopy();
207
+ notificationsApiSession.baseUrl = notificationsApiConfigResponse.data['apiUrl'];
208
+ notificationsApiSession.apiUrl = this.yamlConfig.NotificationsApiUri;
209
+ if (notificationsApiSession['tokenType'] == 'jwt') {
210
+ this._notificationsApi = new NotificationsApi(notificationsApiSession, notificationsApiConfigResponse.data);
211
+ } else if (this.users) {
212
+ var jwtResponse = JSON.parse(await this.users.getUserJwt(notificationsApiSession.audience));
213
+
214
+ if (jwtResponse['data'] && jwtResponse['data']['token']) {
215
+ notificationsApiSession.convertToJwt(jwtResponse['data']);
216
+ this._notificationsApi = new NotificationsApi(notificationsApiSession, notificationsApiConfigResponse.data);
217
+ }
218
+ }
219
+ }
220
+ }
221
+
222
+ vvClient.prototype._convertToJwt = async function (sessionToken) {
223
+ var jwtResponse = JSON.parse(await this.users.getUserJwt(sessionToken.audience));
224
+ if (jwtResponse['data'] && jwtResponse['data']['token']) {
225
+ sessionToken.convertToJwt(jwtResponse['data'])
226
+ } else {
227
+ console.warn('Failed to get JWT');
228
+ }
229
+ }
230
+
231
+ vvClient.prototype.endsWith = function (source, suffix) {
232
+ return source.indexOf(suffix, source.length - suffix.length) !== -1;
233
+ };
234
+
235
+ vvClient.prototype.getSecurityToken = function () {
236
+ return this._httpHelper._sessionToken.accessToken;
237
+ };
238
+
239
+ vvClient.prototype.isAuthenticated = function () {
240
+ return this._httpHelper._sessionToken.isAuthenticated;
241
+ };
242
+
243
+ vvClient.prototype.getBaseUrl = function () {
244
+ return this._httpHelper._sessionToken.baseUrl;
245
+ };
246
+
247
+ return vvClient;
248
+ })();
249
+ vvRestApi.vvClient = vvClient;
250
+
251
+ var auth = (function () {
252
+ //Pull in the authorize methods from common and extend it with the getVaultApi methods
253
+ var authorize = common.authorize;
254
+
255
+ authorize.prototype.getVaultApi = function (clientId, clientSecret, userId, password, audience, baseVaultUrl, customerAlias, databaseAlias) {
256
+ console.log('getVaultApi has been called');
257
+
258
+ // var config = require('./config.yml');
259
+ var config = this.jsyaml.safeLoad(this.fs.readFileSync(__dirname + '/config.yml', 'utf8'));
260
+
261
+ if (this.endsWith(baseVaultUrl, '/')) {
262
+ baseVaultUrl = baseVaultUrl.substring(0, baseVaultUrl.length - 1);
263
+ }
264
+
265
+ baseVaultUrl = baseVaultUrl;
266
+
267
+ var apiUrl = config.ApiUri.replace('{custalias}', customerAlias).replace('{custdbalias}', databaseAlias);
268
+ var authenticationUrl = config.AutheticateUri;
269
+
270
+ return this.acquireSecurityToken(clientId, clientSecret, userId, password, audience, baseVaultUrl, apiUrl, customerAlias, databaseAlias, authenticationUrl)
271
+ .then(function(sessionToken) {
272
+ var client = new vvClient(sessionToken);
273
+
274
+ return client._convertToJwt(sessionToken)
275
+ .then(() => {
276
+ return Promise.all([
277
+ client.createDocApi(sessionToken),
278
+ client.createFormsApi(sessionToken),
279
+ client.createObjectsApi(sessionToken),
280
+ client.createStudioApi(sessionToken),
281
+ client.createNotificationsApi(sessionToken),
282
+ ]);
283
+ })
284
+ .then(() => {
285
+ return client;
286
+ })
287
+ .catch(() => {
288
+ return client;
289
+ });
290
+ });
291
+ };
292
+
293
+ authorize.prototype.getVaultApiFromJwt = function (jwt, baseVaultUrl, customerAlias, databaseAlias, expirationDate) {
294
+ console.log('getVaultApiFromJwt has been called');
295
+
296
+ // var config = require('./config.yml');
297
+ var config = this.jsyaml.safeLoad(this.fs.readFileSync(__dirname + '/config.yml', 'utf8'));
298
+
299
+ baseVaultUrl = baseVaultUrl;
300
+
301
+ if (this.endsWith(baseVaultUrl, '/')) {
302
+ baseVaultUrl = baseVaultUrl.substring(0, baseVaultUrl.length - 1);
303
+ }
304
+
305
+ var apiUrl = config.ApiUri.replace('{custalias}', customerAlias).replace('{custdbalias}', databaseAlias);
306
+ var authenticationUrl = apiUrl + config.ResourceUri.UsersGetJwt;
307
+
308
+ //Create the session token directly from JWT if the passed in expiration date is not near expiration (within next 30 seconds)
309
+ if (expirationDate && expirationDate >= new Date(new Date().getTime() + 30 * 1000)) {
310
+ var sessionToken = new common.sessionToken();
311
+
312
+ sessionToken.accessToken = jwt;
313
+ sessionToken.baseUrl = baseVaultUrl;
314
+ sessionToken.apiUrl = apiUrl;
315
+ sessionToken.authenticationUrl = authenticationUrl;
316
+ sessionToken.customerAlias = customerAlias;
317
+ sessionToken.databaseAlias = databaseAlias;
318
+ sessionToken.expirationDate = expirationDate;
319
+ sessionToken.isAuthenticated = true;
320
+ sessionToken.isJwt = true;
321
+
322
+ var client = new vvClient(sessionToken);
323
+
324
+ return Promise.all([
325
+ client.createDocApi(sessionToken),
326
+ client.createFormsApi(sessionToken),
327
+ client.createObjectsApi(sessionToken),
328
+ client.createStudioApi(sessionToken),
329
+ ])
330
+ .then(() => {
331
+ return client;
332
+ })
333
+ .catch(() => {
334
+ return client;
335
+ });
336
+ } else {
337
+ //expiration date was not passed in or is about to expire - attempt to use JWT to acquire a new JWT
338
+ return this.acquireJwt(jwt, baseVaultUrl, apiUrl, authenticationUrl, customerAlias, databaseAlias).then(function(token) {
339
+ var client = new vvClient(token);
340
+
341
+ return Promise.all([
342
+ client.createDocApi(token),
343
+ client.createFormsApi(token),
344
+ client.createObjectsApi(token),
345
+ client.createStudioApi(token),
346
+ ])
347
+ .then(() => {
348
+ return client;
349
+ })
350
+ .catch(() => {
351
+ return client;
352
+ });
353
+ });
354
+ }
355
+ }
356
+
357
+ authorize.prototype.endsWith = function (source, suffix) {
358
+ return source.indexOf(suffix, source.length - suffix.length) !== -1;
359
+ };
360
+
361
+ return authorize;
362
+ })();
363
+ vvRestApi.authorize = auth;
364
+
365
+ (function (configuration) {
366
+ var configurationManager = (function () {
367
+ function configurationManager(httpHelper) {
368
+ this._httpHelper = httpHelper;
369
+ }
370
+
371
+ configurationManager.prototype.getDocApiConfig = function () {
372
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.ConfigurationDocApi);
373
+
374
+ var opts = { method: 'GET' };
375
+ var params = {};
376
+ var data = {};
377
+
378
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
379
+ };
380
+
381
+ configurationManager.prototype.getFormsApiConfig = function () {
382
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.ConfigurationFormsApi);
383
+
384
+ var opts = { method: 'GET' };
385
+ var params = {};
386
+ var data = {};
387
+
388
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
389
+ };
390
+
391
+ configurationManager.prototype.getObjectsApiConfig = function () {
392
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.ConfigurationObjectsApi);
393
+
394
+ var opts = { method: 'GET' };
395
+ var params = {};
396
+ var data = {};
397
+
398
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
399
+ };
400
+
401
+ configurationManager.prototype.getStudioApiConfig = function () {
402
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.ConfigurationStudioApi);
403
+
404
+ var opts = { method: 'GET' };
405
+ var params = {};
406
+ var data = {};
407
+
408
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
409
+ };
410
+
411
+ configurationManager.prototype.getNotificationsApiConfig = function () {
412
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.ConfigurationNotificationApi);
413
+
414
+ var opts = { method: 'GET' };
415
+ var params = {};
416
+ var data = {};
417
+
418
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
419
+ };
420
+
421
+ return configurationManager;
422
+ })();
423
+ configuration.configurationManager = configurationManager;
424
+ })(vvRestApi.configuration || (vvRestApi.configuration = {}));
425
+ var configuration = vvRestApi.configuration;
426
+
427
+ (function (constants) {
428
+ var constantsInitializer = (function () {
429
+ function constantsInitializer() {
430
+
431
+ }
432
+
433
+ constantsInitializer.prototype.alertEventIds = {
434
+ //Folder Events
435
+ folderSecurityModified: "F06FD123-2C52-4F43-9122-34335A5BD8C6", //"CategorySecurity"
436
+ childFolderSecurityModified: "30167D46-86CF-4E89-B1AE-FC00BB378F67", //"CategorySecurityCascade"
437
+ folderDocumentAdded: "3702CFBF-555C-4032-BFB2-E25829788BAC", //"NewCategoryDoc"
438
+ childFolderDocumentAdded: "28946E3C-AEAF-402B-BCE3-8DEAC3D19877", //"NewCategoryDocCascade"
439
+
440
+ //Document Events
441
+ documentCheckedIn: "D47804AB-AEE9-4002-BAB5-9F1AC0366076", //"CheckIn"
442
+ documentCheckedOut: "4BBA55C1-7AF6-48FF-BFBE-EC7A58EB7F01", //"CheckOut"
443
+ documentDetailsModified: "3B9D493F-2B45-4877-ABC1-5CA74F92723D", //"DocumentDetails"
444
+ documentSecurityModified: "BAC187DC-78A8-4A8B-B50F-DB5D5AEE11B9", //"DocumentSecurity"
445
+ documentViewed: "140B9E97-8D93-48D0-837B-AB4FD419B6D6", //"DocumentViewed"
446
+
447
+ //Project Events
448
+ projectDocumentAddedOrRemoved: "300DB724-5C51-4C38-B2E2-FFE19634A373", //"NewProjectDoc"
449
+ projectViewed: "92F0C5F4-68DC-4309-9ABF-13B8E2198F79" //"ProjectView"
450
+ }
451
+
452
+ constantsInitializer.prototype.securityRoles = {
453
+ //RoleType
454
+ Owner: "Owner",
455
+ Editor: "Editor",
456
+ Viewer: "Viewer"
457
+ }
458
+
459
+ constantsInitializer.prototype.securityMemberType = {
460
+ //MemberType
461
+ User: "User",
462
+ Group: "Group"
463
+ }
464
+
465
+ constantsInitializer.prototype.relationType = {
466
+ Parent: "Parent",
467
+ Child: "Child",
468
+ Peer: "Peer"
469
+ }
470
+
471
+ return constantsInitializer;
472
+ })();
473
+
474
+ constants.constantsInitializer = constantsInitializer;
475
+ })(vvRestApi.constants || (vvRestApi.constants = {}))
476
+ var constants = vvRestApi.constants;
477
+
478
+ (function (email) {
479
+ var emailManager = (function () {
480
+ function emailManager(httpHelper) {
481
+ this._httpHelper = httpHelper;
482
+ }
483
+ emailManager.prototype.postEmails = function (params, data) {
484
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.Emails);
485
+
486
+ var opts = { method: 'POST' };
487
+
488
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
489
+ };
490
+ emailManager.prototype.postEmailsWithAttachments = function (params, data, fileObjs) {
491
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.Emails);
492
+
493
+ var opts = { method: 'POSTSTREAM' };
494
+
495
+ return this._httpHelper.doVvClientRequest(url, opts, params, data, fileObjs);
496
+ };
497
+ return emailManager;
498
+ })();
499
+
500
+ email.emailManager = emailManager;
501
+ })(vvRestApi.email || (vvRestApi.email = {}));
502
+ var email = vvRestApi.email;
503
+
504
+ (function (forms) {
505
+
506
+ var returnField = (function () {
507
+ function returnField(id, name, value, isError, errorMessage) {
508
+ this.id = id;
509
+ this.name = name;
510
+ this.value = value;
511
+ this.isError = isError;
512
+ this.errorMessage = errorMessage;
513
+ }
514
+ return returnField;
515
+ })();
516
+ forms.returnField = returnField;
517
+
518
+
519
+
520
+
521
+ var formFieldCollection = (function () {
522
+ function formFieldCollection(ffColl) {
523
+ this._ffColl = ffColl;
524
+ }
525
+
526
+ formFieldCollection.prototype.getFormFieldByName = function (name) {
527
+ var fieldName = name.toLowerCase();
528
+ var field = null;
529
+
530
+ for (var i = 0; i < this._ffColl.length; i++) {
531
+ if (this._ffColl[i].name.toLowerCase() == fieldName) {
532
+ field = this._ffColl[i];
533
+ break;
534
+ }
535
+ }
536
+
537
+ return field;
538
+ };
539
+
540
+ formFieldCollection.prototype.getFormFieldById = function (id) {
541
+ var fieldId = id.toLowerCase();
542
+ var field = null;
543
+
544
+ for (var i = 0; i < this._ffColl.length; i++) {
545
+ if (this._ffColl[i].id.toLowerCase() == fieldId) {
546
+ field = this._ffColl[i];
547
+ break;
548
+ }
549
+ }
550
+
551
+ return field;
552
+ };
553
+
554
+ formFieldCollection.prototype.getFieldArray = function () {
555
+ return this._ffColl;
556
+ };
557
+
558
+ return formFieldCollection;
559
+ })();
560
+ forms.formFieldCollection = formFieldCollection;
561
+
562
+ var formsManager = (function () {
563
+ function formsManager(httpHelper) {
564
+ this._httpHelper = httpHelper;
565
+ }
566
+
567
+ formsManager.prototype.returnField = function (id, name, value, isError, errorMessage) {
568
+ this.id = id;
569
+ this.name = name;
570
+ this.value = value;
571
+ this.isError = isError;
572
+ this.errorMessage = errorMessage;
573
+ };
574
+
575
+ formsManager.prototype.getFormTemplates = function (params) {
576
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.FormTemplates);
577
+
578
+ var opts = { method: 'GET' };
579
+
580
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
581
+ };
582
+
583
+ formsManager.prototype.getFormTemplateIdByName = function (templateName) {
584
+ //return released form template id by name
585
+ var deferred = Q.defer();
586
+
587
+ var params = {};
588
+ params.fields = "id, name, description, revision, revisionId";
589
+ params.q = "name eq '" + templateName + "'";
590
+
591
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.FormTemplates);
592
+ var opts = { method: 'GET' };
593
+ var templateId;
594
+ var templateRevisionId;
595
+
596
+ var fm = this;
597
+
598
+ this._httpHelper.doVvClientRequest(url, opts, params, null).then(function (resp) {
599
+ var templateResp = JSON.parse(resp);
600
+ if (templateResp.data.length > 0) {
601
+ templateId = templateResp['data'][0]['id'];
602
+ templateRevisionId = templateResp['data'][0]['revisionId'];
603
+ }
604
+
605
+ var responseData = {};
606
+ responseData.formsManager = fm;
607
+ responseData.templateIdGuid = templateId;
608
+ responseData.templateRevisionIdGuid = templateRevisionId;
609
+
610
+ deferred.resolve(responseData);
611
+
612
+ }).fail(function (error) {
613
+ logger.info("failed getting Form Template Id by Name " + error);
614
+
615
+ var responseData = {};
616
+ responseData.formsManager = fm;
617
+ responseData.templateIdGuid = '';
618
+ responseData.templateRevisionIdGuid = '';
619
+
620
+ deferred.resolve(responseData);
621
+ });
622
+
623
+ return deferred.promise;
624
+ };
625
+
626
+ formsManager.prototype.getForms = async function (params, formTemplateId) {
627
+
628
+ //if formTemplateId is not a Guid assume its a template name and fetch the Guid
629
+ if (!this.isGuid(formTemplateId)) {
630
+ let resp = await this.getFormTemplateIdByName(formTemplateId);
631
+ var formsManager = resp.formsManager;
632
+ var templateIdGuid = resp.templateIdGuid;
633
+ var resourceUri = formsManager._httpHelper._config.ResourceUri.Forms.replace('{id}', templateIdGuid);
634
+ var url = formsManager._httpHelper.getUrl(resourceUri);
635
+ var opts = { method: 'GET' };
636
+
637
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
638
+
639
+ } else {
640
+ var resourceUri = this._httpHelper._config.ResourceUri.Forms.replace('{id}', formTemplateId);
641
+ var url = this._httpHelper.getUrl(resourceUri);
642
+ var opts = { method: 'GET' };
643
+
644
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
645
+ }
646
+
647
+ };
648
+
649
+ formsManager.prototype.setFieldImage = function (formId, fieldId, imageId) {
650
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstanceImage.replace('{id}', formId);
651
+ var url = this._httpHelper.getUrl(resourceUri);
652
+
653
+ var data = { fieldId: fieldId, imageId: imageId };
654
+ var params = { fieldId: fieldId, imageId: imageId };
655
+
656
+ var opts = { method: 'PUT' };
657
+
658
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
659
+ };
660
+
661
+ formsManager.prototype.importFormTemplate = function (data, formTemplateId, buffer) {
662
+ var resourceUri = this._httpHelper._config.ResourceUri.FormTemplatesImport.replace('{id}', formTemplateId);
663
+ var url = this._httpHelper.getUrl(resourceUri);
664
+ var opts = { method: 'PUTSTREAM' };
665
+
666
+ return this._httpHelper.doVvClientRequest(url, opts, null, data, buffer);
667
+ };
668
+
669
+ formsManager.prototype.postForms = async function (params, data, formTemplateId) {
670
+
671
+ //if formTemplateId is not a Guid assume its a template name and fetch the Guid
672
+ if (!this.isGuid(formTemplateId)) {
673
+ let resp = await this.getFormTemplateIdByName(formTemplateId);
674
+ var formsManager = resp.formsManager;
675
+ var templateIdGuid = resp.templateIdGuid;
676
+ var resourceUri = formsManager._httpHelper._config.ResourceUri.Forms.replace('{id}', templateIdGuid);
677
+ var url = formsManager._httpHelper.getUrl(resourceUri);
678
+ var opts = { method: 'POST' };
679
+
680
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
681
+
682
+ } else {
683
+ var resourceUri = this._httpHelper._config.ResourceUri.Forms.replace('{id}', formTemplateId);
684
+ var url = this._httpHelper.getUrl(resourceUri);
685
+ var opts = { method: 'POST' };
686
+
687
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
688
+ }
689
+
690
+ };
691
+
692
+ formsManager.prototype.postFormRevision = async function (params, data, formTemplateId, formId) {
693
+
694
+ //if formTemplateId is not a Guid assume its a template name and fetch the Guid
695
+ if (!this.isGuid(formTemplateId)) {
696
+ let resp = await this.getFormTemplateIdByName(formTemplateId);
697
+
698
+ var formsManager = resp.formsManager;
699
+ var templateIdGuid = resp.templateIdGuid;
700
+ var resourceUri = formsManager._httpHelper._config.ResourceUri.Forms.replace('{id}', templateIdGuid);
701
+ var url = formsManager._httpHelper.getUrl(resourceUri + '/' + formId);
702
+ var opts = { method: 'POST' };
703
+
704
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
705
+ } else {
706
+ var resourceUri = this._httpHelper._config.ResourceUri.Forms.replace('{id}', formTemplateId);
707
+ var url = this._httpHelper.getUrl(resourceUri + '/' + formId);
708
+ var opts = { method: 'POST' };
709
+
710
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
711
+ }
712
+ };
713
+
714
+ formsManager.prototype.postFormRevisionByFormId = function (params, data, formId) {
715
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.FormsId).replace('{id}', formId);
716
+
717
+ var opts = { method: 'POST' };
718
+
719
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
720
+ }
721
+
722
+ formsManager.prototype.updateFormInstanceOriginator = function (formInstanceId, newOriginatorUsID) {
723
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstanceUpdateOriginator.replace('{id}', formInstanceId);
724
+ var url = this._httpHelper.getUrl(resourceUri);
725
+
726
+ var params = {
727
+ userId: newOriginatorUsID,
728
+ };
729
+ var data = null;
730
+
731
+ var opts = { method: "PUT" };
732
+
733
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
734
+
735
+ }
736
+
737
+ formsManager.prototype.relateForm = function (formId, relateToId) {
738
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
739
+ var url = this._httpHelper.getUrl(resourceUri + '/relateForm');
740
+
741
+ var params = { relateToId: relateToId };
742
+ var data = null;
743
+
744
+ var opts = { method: 'PUT' };
745
+
746
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
747
+ };
748
+
749
+ formsManager.prototype.relateFormByDocId = function (formId, relateToDocId) {
750
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
751
+ var url = this._httpHelper.getUrl(resourceUri + '/relateForm');
752
+
753
+ var params = { relateToDocId: relateToDocId };
754
+ var data = null;
755
+
756
+ var opts = { method: 'PUT' };
757
+
758
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
759
+ };
760
+
761
+ formsManager.prototype.relateDocument = function (formId, relateToId) {
762
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
763
+ var url = this._httpHelper.getUrl(resourceUri + '/relateDocument');
764
+
765
+ var params = { relateToId: relateToId };
766
+ var data = null;
767
+
768
+ var opts = { method: 'PUT' };
769
+
770
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
771
+ };
772
+
773
+ formsManager.prototype.relateDocumentByDocId = function (formId, relateToDocId) {
774
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
775
+ var url = this._httpHelper.getUrl(resourceUri + '/relateDocument');
776
+
777
+ var params = { relateToDocId: relateToDocId };
778
+ var data = null;
779
+
780
+ var opts = { method: 'PUT' };
781
+
782
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
783
+ };
784
+
785
+ formsManager.prototype.relateProject = function (formId, relateToId) {
786
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
787
+ var url = this._httpHelper.getUrl(resourceUri + '/relateProject');
788
+
789
+ var params = { relateToId: relateToId };
790
+ var data = null;
791
+
792
+ var opts = { method: 'PUT' };
793
+
794
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
795
+ };
796
+
797
+ formsManager.prototype.relateProjectByName = function (formId, relateToProjectName) {
798
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
799
+ var url = this._httpHelper.getUrl(resourceUri + '/relateProject');
800
+
801
+ var params = { relateToProjectName: relateToProjectName };
802
+ var data = null;
803
+
804
+ var opts = { method: 'PUT' };
805
+
806
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
807
+ };
808
+
809
+ formsManager.prototype.unrelateForm = function (formId, relateToId) {
810
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
811
+ var url = this._httpHelper.getUrl(resourceUri + '/unrelateForm');
812
+
813
+ var params = { relateToId: relateToId };
814
+ var data = null;
815
+
816
+ var opts = { method: 'PUT' };
817
+
818
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
819
+ };
820
+
821
+ formsManager.prototype.unrelateFormByDocId = function (formId, relateToDocId) {
822
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
823
+ var url = this._httpHelper.getUrl(resourceUri + '/unrelateForm');
824
+
825
+ var params = { relateToDocId: relateToDocId };
826
+ var data = null;
827
+
828
+ var opts = { method: 'PUT' };
829
+
830
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
831
+ };
832
+
833
+ formsManager.prototype.unrelateDocument = function (formId, relateToId) {
834
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
835
+ var url = this._httpHelper.getUrl(resourceUri + '/unrelateDocument');
836
+
837
+ var params = { relateToId: relateToId };
838
+ var data = null;
839
+
840
+ var opts = { method: 'PUT' };
841
+
842
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
843
+ };
844
+
845
+ formsManager.prototype.unrelateDocumentByDocId = function (formId, relateToDocId) {
846
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
847
+ var url = this._httpHelper.getUrl(resourceUri + '/unrelateDocument');
848
+
849
+ var params = { relateToDocId: relateToDocId };
850
+ var data = null;
851
+
852
+ var opts = { method: 'PUT' };
853
+
854
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
855
+ };
856
+
857
+ formsManager.prototype.unrelateProject = function (formId, relateToId) {
858
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
859
+ var url = this._httpHelper.getUrl(resourceUri + '/unrelateProject');
860
+
861
+ var params = { relateToId: relateToId };
862
+ var data = null;
863
+
864
+ var opts = { method: 'PUT' };
865
+
866
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
867
+ };
868
+
869
+ formsManager.prototype.unrelateProjectByName = function (formId, relateToProjectName) {
870
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', formId);
871
+ var url = this._httpHelper.getUrl(resourceUri + '/unrelateProject');
872
+
873
+ var params = { relateToProjectName: relateToProjectName };
874
+ var data = null;
875
+
876
+ var opts = { method: 'PUT' };
877
+
878
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
879
+ };
880
+
881
+ formsManager.prototype.getFormRelatedDocs = function (formId, params) {
882
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstanceRelatedDocs.replace('{id}', formId);
883
+ var url = this._httpHelper.getUrl(resourceUri);
884
+
885
+ var opts = { method: 'GET' };
886
+
887
+ if (params === undefined) {
888
+ params = null;
889
+ }
890
+
891
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
892
+ };
893
+
894
+ formsManager.prototype.getFormRelatedForms = function (formId, params) {
895
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstanceRelatedForms.replace('{id}', formId);
896
+ var url = this._httpHelper.getUrl(resourceUri);
897
+
898
+ var opts = { method: 'GET' };
899
+
900
+ if (params === undefined) {
901
+ params = null;
902
+ }
903
+
904
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
905
+ };
906
+
907
+ formsManager.prototype.isGuid = function (stringToTest) {
908
+ if (stringToTest[0] === "{") {
909
+ stringToTest = stringToTest.substring(1, stringToTest.length - 1);
910
+ }
911
+ var regexGuid = /^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$/gi;
912
+ return regexGuid.test(stringToTest);
913
+ }
914
+
915
+ formsManager.prototype.getFormInstanceById = function (templateId, instanceId) {
916
+ var resourceUri = this._httpHelper._config.ResourceUri.FormId.replace('{id}', templateId).replace('{formId}', instanceId);
917
+ var url = this._httpHelper.getUrl(resourceUri);
918
+ var opts = { method: 'GET' };
919
+
920
+ return this._httpHelper.doVvClientRequest(url, opts, null, null);
921
+ };
922
+
923
+ formsManager.prototype.getFormInstancePDF = function (templateId, instanceId) {
924
+ var resourceUri = this._httpHelper._config.ResourceUri.FormIdPdf.replace('{id}', templateId).replace('{formId}', instanceId);
925
+ var url = this._httpHelper.getUrl(resourceUri);
926
+ var opts = { method: 'GETSTREAM' };
927
+
928
+ return this._httpHelper.doVvClientRequest(url, opts, null, null);
929
+ };
930
+
931
+ formsManager.prototype.getFormTemplateFields = function (templateId) {
932
+ var resourceUri = this._httpHelper._config.ResourceUri.FormDesignerFormsTemplatesIdFields.replace('{id}', templateId);
933
+ var url = this._httpHelper.getUrl(resourceUri);
934
+ var opts = { method: 'GET' };
935
+
936
+ return this._httpHelper.doVvClientRequest(url, opts, null, null);
937
+ }
938
+
939
+ formsManager.prototype.deleteFormInstance = function (instanceId) {
940
+ var resourceUri = this._httpHelper._config.ResourceUri.FormInstance.replace('{id}', instanceId);
941
+ var url = this._httpHelper.getUrl(resourceUri);
942
+ var opts = { method: 'DELETE' };
943
+
944
+ return this._httpHelper.doVvClientRequest(url, opts, null, null);
945
+ }
946
+
947
+ return formsManager;
948
+ })();
949
+ forms.formsManager = formsManager;
950
+
951
+ })(vvRestApi.forms || (vvRestApi.forms = {}));
952
+ var forms = vvRestApi.forms;
953
+
954
+ (function (groups) {
955
+ var groupsManager = (function () {
956
+ function groupsManager(httpHelper) {
957
+ this._httpHelper = httpHelper;
958
+ }
959
+
960
+ groupsManager.prototype.getGroups = function (params) {
961
+ var resourceUri = this._httpHelper._config.ResourceUri.GetGroups;
962
+ var url = this._httpHelper.getUrl(resourceUri);
963
+ var opts = { method: 'GET' };
964
+
965
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
966
+ };
967
+
968
+ groupsManager.prototype.getGroupsUsers = function (params, groupId) {
969
+ var resourceUri = this._httpHelper._config.ResourceUri.GroupsUsers.replace('{id}', groupId);
970
+ var url = this._httpHelper.getUrl(resourceUri);
971
+
972
+ var opts = { method: 'GET' };
973
+
974
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
975
+ };
976
+
977
+ groupsManager.prototype.getGroupUser = function (params, groupId, userId) {
978
+ var resourceUri = this._httpHelper._config.ResourceUri.GroupsAddUser.replace('{groupId}', groupId).replace('{userId}', userId);
979
+ var url = this._httpHelper.getUrl(resourceUri);
980
+
981
+ var opts = { method: 'GET' };
982
+
983
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
984
+ }
985
+
986
+ groupsManager.prototype.addUserToGroup = function (params, groupId, userId) {
987
+ var resourceUri = this._httpHelper._config.ResourceUri.GroupsAddUser.replace('{groupId}', groupId).replace('{userId}', userId);
988
+ var url = this._httpHelper.getUrl(resourceUri);
989
+ var opts = { method: 'PUT' };
990
+
991
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
992
+ };
993
+
994
+ groupsManager.prototype.removeUserFromGroup = function (params, groupId, userId) {
995
+ var resourceUri = this._httpHelper._config.ResourceUri.GroupsAddUser.replace('{groupId}', groupId).replace('{userId}', userId);
996
+ var url = this._httpHelper.getUrl(resourceUri);
997
+ var opts = { method: 'DELETE' };
998
+
999
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1000
+ }
1001
+
1002
+ return groupsManager;
1003
+ })();
1004
+ groups.groupsManager = groupsManager;
1005
+ })(vvRestApi.groups || (vvRestApi.groups = {}));
1006
+ var groups = vvRestApi.groups;
1007
+
1008
+ (function (library) {
1009
+ var libraryManager = (function () {
1010
+ function libraryManager(httpHelper) {
1011
+ this._httpHelper = httpHelper;
1012
+ }
1013
+ libraryManager.prototype.getFolders = function (params) {
1014
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.Folders);
1015
+
1016
+ var opts = { method: 'GET' };
1017
+
1018
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1019
+ };
1020
+
1021
+ libraryManager.prototype.postFolderByPath = function (params, data, folderPath) {
1022
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.Folders);
1023
+
1024
+ data.folderpath = folderPath;
1025
+ var opts = { method: 'POST' };
1026
+
1027
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
1028
+ };
1029
+
1030
+ //Valid fields to be defined on the "data" parameter to be updated on the folder: name, description
1031
+ libraryManager.prototype.putFolder = function (params, data, folderId) {
1032
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.FoldersId.replace('{id}', folderId));
1033
+
1034
+ var opts = { method: 'PUT' };
1035
+
1036
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
1037
+ }
1038
+
1039
+ libraryManager.prototype.deleteFolder = function (folderId) {
1040
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.FoldersId.replace('{id}', folderId));
1041
+
1042
+ var opts = { method: 'DELETE' };
1043
+
1044
+ return this._httpHelper.doVvClientRequest(url, opts, null, null);
1045
+ }
1046
+
1047
+ libraryManager.prototype.copyFolder = function (params, data) {
1048
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.FoldersCopy);
1049
+
1050
+ var opts = { method: 'POST' };
1051
+
1052
+ return this._httpHelper.doVvClientRequest(url, opts, null, data);
1053
+ }
1054
+
1055
+ libraryManager.prototype.moveFolder = function (params, data) {
1056
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.FoldersMove);
1057
+
1058
+ var opts = { method: 'PUT' };
1059
+
1060
+ return this._httpHelper.doVvClientRequest(url, opts, null, data);
1061
+ }
1062
+
1063
+ libraryManager.prototype.getDocuments = function (params, folderId) {
1064
+ var resourceUri = this._httpHelper._config.ResourceUri.Documents.replace('{id}', folderId);
1065
+ var url = this._httpHelper.getUrl(resourceUri);
1066
+
1067
+ var opts = { method: 'GET' };
1068
+
1069
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1070
+ };
1071
+
1072
+ libraryManager.prototype.updateFolderIndexFieldOverrideSettings = function (folderId, fieldId, queryId, displayField, valueField, dropDownListId, required, defaultValue) {
1073
+ var data = {
1074
+ queryId: queryId,
1075
+ queryValueField: valueField,
1076
+ queryDisplayField: displayField,
1077
+ dropDownListId: dropDownListId,
1078
+ required: required,
1079
+ defaultValue: defaultValue
1080
+ }
1081
+
1082
+ var resourceUri = this._httpHelper._config.ResourceUri.FoldersIdIndexFieldsId.replace('{id}', folderId).replace('{indexFieldId}', fieldId);
1083
+ var url = this._httpHelper.getUrl(resourceUri);
1084
+ var opts = { method: 'PUT' };
1085
+ return this._httpHelper.doVvClientRequest(url, opts, null, data);
1086
+ };
1087
+
1088
+ libraryManager.prototype.getFolderIndexFields = function (params, folderId) {
1089
+ var resourceUri = this._httpHelper._config.ResourceUri.FolderIndexFields.replace('{id}', folderId);
1090
+ var url = this._httpHelper.getUrl(resourceUri);
1091
+
1092
+ var opts = { method: 'GET' };
1093
+
1094
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1095
+ }
1096
+
1097
+ libraryManager.prototype.postFolderAlertSubscription = function (folderId, eventId, userId) {
1098
+ var resourceUri = this._httpHelper._config.ResourceUri.FolderAlertsId.replace('{folderId}', folderId).replace('{eventId}', eventId);
1099
+ var url = this._httpHelper.getUrl(resourceUri);
1100
+ var opts = { method: 'POST' };
1101
+
1102
+ var params = {
1103
+ usId: userId
1104
+ };
1105
+
1106
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1107
+ }
1108
+
1109
+ libraryManager.prototype.deleteFolderAlertSubscription = function (folderId, eventId, userId) {
1110
+ var resourceUri = this._httpHelper._config.ResourceUri.FolderAlertsId.replace('{folderId}', folderId).replace('{eventId}', eventId);
1111
+ var url = this._httpHelper.getUrl(resourceUri);
1112
+ var opts = { method: 'DELETE' };
1113
+
1114
+ var params = {
1115
+ usId: userId
1116
+ };
1117
+
1118
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1119
+ }
1120
+
1121
+ libraryManager.prototype.getFolderSecurityMembers = function (params, folderId) {
1122
+ var resourceUri = this._httpHelper._config.ResourceUri.FolderSecurity.replace('{folderId}', folderId);
1123
+ var url = this._httpHelper.getUrl(resourceUri);
1124
+ var opts = { method: 'GET' };
1125
+
1126
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1127
+ }
1128
+
1129
+ libraryManager.prototype.putFolderSecurityMember = function (folderId, memberId, memberType, securityRole, cascadeSecurityChanges) {
1130
+ var resourceUri = this._httpHelper._config.ResourceUri.FolderSecurityId.replace('{folderId}', folderId).replace('{memberId}', memberId);
1131
+ var url = this._httpHelper.getUrl(resourceUri);
1132
+ var opts = { method: 'PUT' };
1133
+
1134
+ var data = {
1135
+ memberType: memberType,
1136
+ securityRole: securityRole,
1137
+ cascadeSecurityChanges: cascadeSecurityChanges
1138
+ };
1139
+
1140
+ return this._httpHelper.doVvClientRequest(url, opts, null, data);
1141
+ }
1142
+
1143
+ libraryManager.prototype.deleteFolderSecurityMember = function (folderId, memberId, cascadeSecurityChanges) {
1144
+ var resourceUri = this._httpHelper._config.ResourceUri.FolderSecurityId.replace('{folderId}', folderId).replace('{memberId}', memberId);
1145
+ var url = this._httpHelper.getUrl(resourceUri);
1146
+ var opts = { method: 'DELETE' };
1147
+
1148
+ var params = {
1149
+ cascadeSecurityChanges: cascadeSecurityChanges
1150
+ };
1151
+
1152
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1153
+ }
1154
+
1155
+ return libraryManager;
1156
+ })();
1157
+ library.libraryManager = libraryManager;
1158
+ })(vvRestApi.library || (vvRestApi.library = {}));
1159
+ var library = vvRestApi.library;
1160
+
1161
+ (function (sites) {
1162
+ var sitesManager = (function () {
1163
+ function sitesManager(httpHelper) {
1164
+ this._httpHelper = httpHelper;
1165
+ }
1166
+ sitesManager.prototype.getSites = function (params) {
1167
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.Sites);
1168
+
1169
+ var opts = { method: 'GET' };
1170
+
1171
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1172
+ };
1173
+
1174
+ sitesManager.prototype.postSites = function (params, data) {
1175
+ var resourceUri = this._httpHelper._config.ResourceUri.Sites;
1176
+ var url = this._httpHelper.getUrl(resourceUri);
1177
+
1178
+ var opts = { method: 'POST' };
1179
+
1180
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
1181
+ };
1182
+
1183
+ sitesManager.prototype.putSites = function (params, data, siteId) {
1184
+ var resourceUri = this._httpHelper._config.ResourceUri.Sites;
1185
+ var url = this._httpHelper.getUrl(resourceUri + '/' + siteId);
1186
+
1187
+ var opts = { method: 'PUT' };
1188
+
1189
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
1190
+ };
1191
+
1192
+ sitesManager.prototype.getGroups = function (params, siteId) {
1193
+ var resourceUri = this._httpHelper._config.ResourceUri.Groups.replace('{id}', siteId);
1194
+ var url = this._httpHelper.getUrl(resourceUri);
1195
+
1196
+ var opts = { method: 'GET' };
1197
+
1198
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1199
+ };
1200
+
1201
+ sitesManager.prototype.postGroups = function (params, data, siteId) {
1202
+ var resourceUri = this._httpHelper._config.ResourceUri.Groups.replace('{id}', siteId);
1203
+ var url = this._httpHelper.getUrl(resourceUri);
1204
+
1205
+ var opts = { method: 'POST' };
1206
+
1207
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
1208
+ };
1209
+
1210
+ sitesManager.prototype.putGroups = function (params, data, siteId, grId) {
1211
+ var resourceUri = this._httpHelper._config.ResourceUri.Groups.replace('{id}', siteId);
1212
+ var url = this._httpHelper.getUrl(resourceUri + '/' + grId);
1213
+
1214
+ var opts = { method: 'PUT' };
1215
+
1216
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
1217
+ };
1218
+
1219
+ sitesManager.prototype.changeUserSite = function (userId, newSiteId) {
1220
+ var resourceUri = this._httpHelper._config.ResourceUri.ChangeUserSite;
1221
+ var url = this._httpHelper.getUrl(resourceUri);
1222
+
1223
+ var opts = { method: 'PUT' };
1224
+
1225
+ var data = {
1226
+ UserId: userId,
1227
+ NewSiteId: newSiteId
1228
+ }
1229
+
1230
+ return this._httpHelper.doVvClientRequest(url, opts, null, data);
1231
+ };
1232
+
1233
+ return sitesManager;
1234
+ })();
1235
+ sites.sitesManager = sitesManager;
1236
+ })(vvRestApi.sites || (vvRestApi.sites = {}));
1237
+ var sites = vvRestApi.sites;
1238
+
1239
+ (function (users) {
1240
+ var usersManager = (function () {
1241
+ function usersManager(httpHelper) {
1242
+ this._httpHelper = httpHelper;
1243
+ }
1244
+ usersManager.prototype.getUsers = function (params, siteId) {
1245
+ var resourceUri = this._httpHelper._config.ResourceUri.Users.replace('{id}', siteId);
1246
+ var url = this._httpHelper.getUrl(resourceUri);
1247
+
1248
+ var opts = { method: 'GET' };
1249
+
1250
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1251
+ };
1252
+
1253
+ usersManager.prototype.postUsers = function (params, data, siteId) {
1254
+ var resourceUri = this._httpHelper._config.ResourceUri.Users.replace('{id}', siteId);
1255
+ var url = this._httpHelper.getUrl(resourceUri);
1256
+
1257
+ var opts = { method: 'POST' };
1258
+
1259
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
1260
+ };
1261
+
1262
+ usersManager.prototype.putUsers = function (params, data, siteId, usId) {
1263
+ var resourceUri = this._httpHelper._config.ResourceUri.Users.replace('{id}', siteId);
1264
+ var url = this._httpHelper.getUrl(resourceUri + '/' + usId);
1265
+
1266
+ var opts = { method: 'PUT' };
1267
+
1268
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
1269
+ };
1270
+
1271
+ usersManager.prototype.putUsersEndpoint = function (params, data, usId) {
1272
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.User + '/' + usId);
1273
+ var opts = { method: 'PUT' };
1274
+
1275
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
1276
+ };
1277
+
1278
+ usersManager.prototype.getUser = function (params) {
1279
+ var resourceUri = this._httpHelper._config.ResourceUri.User;
1280
+ var url = this._httpHelper.getUrl(resourceUri);
1281
+ var opts = { method: 'GET' };
1282
+
1283
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1284
+ };
1285
+
1286
+ usersManager.prototype.getUserById = function (params, usId) {
1287
+ var resourceUri = this._httpHelper._config.ResourceUri.UserById.replace('{id}', usId);
1288
+ var url = this._httpHelper.getUrl(resourceUri);
1289
+ var opts = { method: 'GET' };
1290
+
1291
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1292
+ };
1293
+
1294
+ usersManager.prototype.getUserGroups = function (params, usId) {
1295
+ var resourceUri = this._httpHelper._config.ResourceUri.UserGroups.replace('{id}', usId);
1296
+ var url = this._httpHelper.getUrl(resourceUri);
1297
+ var opts = { method: 'GET' };
1298
+
1299
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1300
+ }
1301
+
1302
+ usersManager.prototype.getUserSupervisors = function (params, usId) {
1303
+ var resourceUri = this._httpHelper._config.ResourceUri.UserSupervisors.replace('{id}', usId);
1304
+ var url = this._httpHelper.getUrl(resourceUri);
1305
+ var opts = { method: 'GET' };
1306
+
1307
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1308
+ }
1309
+
1310
+ usersManager.prototype.getUserSupervisees = function (params, usId) {
1311
+ var resourceUri = this._httpHelper._config.ResourceUri.UserSupervisees.replace('{id}', usId);
1312
+ var url = this._httpHelper.getUrl(resourceUri);
1313
+ var opts = { method: 'GET' };
1314
+
1315
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1316
+ }
1317
+
1318
+ usersManager.prototype.getUserLoginToken = function (usId) {
1319
+ var resourceUri = this._httpHelper._config.ResourceUri.UserWebToken.replace('{id}', usId);
1320
+ var url = this._httpHelper.getUrl(resourceUri);
1321
+ var opts = { method: 'GET' };
1322
+
1323
+ var params = []; //empty array
1324
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1325
+ }
1326
+
1327
+ usersManager.prototype.getUserJwt = function (audience) {
1328
+ var resourceUri = this._httpHelper._config.ResourceUri.UsersGetJwt;
1329
+ var url = this._httpHelper.getUrl(resourceUri);
1330
+ var opts = { method: 'GET' };
1331
+ var params = {};
1332
+ if (audience) {
1333
+ params['audience'] = audience;
1334
+ }
1335
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1336
+ }
1337
+
1338
+ usersManager.prototype.resetPassword = function (usId, sendEmail = true) {
1339
+ var resourceUri = this._httpHelper._config.ResourceUri.UsersPassword.replace('{id}', usId);
1340
+ var url = this._httpHelper.getUrl(resourceUri);
1341
+ var opts = { method: 'PUT' };
1342
+ var params = []; //empty array
1343
+
1344
+ var data = {
1345
+ resetPassword: true,
1346
+ sendEmail: sendEmail
1347
+ };
1348
+
1349
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
1350
+ }
1351
+
1352
+ usersManager.prototype.updateUserId = function (usId, newUserId) {
1353
+ var resourceUri = this._httpHelper._config.ResourceUri.UsersIdUserId.replace('{id}', usId);
1354
+ var url = this._httpHelper.getUrl(resourceUri);
1355
+ var opts = { method: 'PUT' };
1356
+ var params = []; //empty array
1357
+
1358
+ var data = {
1359
+ userId: newUserId
1360
+ };
1361
+
1362
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
1363
+ }
1364
+
1365
+ return usersManager;
1366
+ })();
1367
+ users.usersManager = usersManager;
1368
+ })(vvRestApi.users || (vvRestApi.users = {}));
1369
+ var users = vvRestApi.users;
1370
+
1371
+ /**
1372
+ * Manager for current authenticated user operations.
1373
+ * @module currentUser
1374
+ */
1375
+ (function (currentUser) {
1376
+ var currentUserManager = (function () {
1377
+ /**
1378
+ * Creates a new currentUserManager instance.
1379
+ * @constructor
1380
+ * @param {Object} httpHelper - The HTTP helper instance for making API requests.
1381
+ */
1382
+ function currentUserManager(httpHelper) {
1383
+ this._httpHelper = httpHelper;
1384
+ this._currentUser = null;
1385
+ }
1386
+
1387
+ /**
1388
+ * Gets the currently authenticated user's information.
1389
+ * @param {Object} [params] - Optional query parameters.
1390
+ * @returns {Promise<Object>} A promise that resolves with the current user's information.
1391
+ */
1392
+ currentUserManager.prototype.getCurrentUser = function (params) {
1393
+ var resourceUri = this._httpHelper._config.ResourceUri.UsersMe;
1394
+ var url = this._httpHelper.getUrl(resourceUri);
1395
+ var opts = { method: 'GET' };
1396
+
1397
+ return this._httpHelper.doVvClientRequest(url, opts, params, null).then(function (response) {
1398
+ return response;
1399
+ });
1400
+ };
1401
+
1402
+ return currentUserManager;
1403
+ })();
1404
+ currentUser.currentUserManager = currentUserManager;
1405
+ })(vvRestApi.currentUser || (vvRestApi.currentUser = {}));
1406
+ var currentUser = vvRestApi.currentUser;
1407
+
1408
+ (function (scheduledProcess) {
1409
+ var scheduledProcessManager = (function () {
1410
+ function scheduledProcessManager(httpHelper) {
1411
+ this._httpHelper = httpHelper;
1412
+ }
1413
+
1414
+ scheduledProcessManager.prototype.postCompletion = function (id, action, result, message) {
1415
+ //build url for call to the scheduledProcess controller
1416
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.ScheduledProcess) + '/' + id;
1417
+
1418
+ //indicate this is a POST
1419
+ var opts = { method: 'POST' };
1420
+
1421
+ //create the querystring parameters
1422
+ var params = {
1423
+ action: action
1424
+ }
1425
+
1426
+ //determine if a result will be returned
1427
+ if (result !== null && (typeof result == 'boolean' || result.length > 0)) {
1428
+ params.result = result.toString();
1429
+ }
1430
+
1431
+ //determine if a message will be returned
1432
+ if (message && message.length > 0) {
1433
+ params.message = message;
1434
+ }
1435
+
1436
+ //place call and return promise object
1437
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1438
+ };
1439
+
1440
+ scheduledProcessManager.prototype.runAllScheduledProcesses = function () {
1441
+ //build url for call to the scheduledProcess controller
1442
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.ScheduledProcess) + '/Run';
1443
+
1444
+ //indicate this is a PUT
1445
+ var opts = { method: 'PUT' };
1446
+
1447
+ //place call and return promise object
1448
+ return this._httpHelper.doVvClientRequest(url, opts, null, null);
1449
+ };
1450
+
1451
+ return scheduledProcessManager;
1452
+ })();
1453
+ scheduledProcess.scheduledProcessManager = scheduledProcessManager;
1454
+ })(vvRestApi.scheduledProcess || (vvRestApi.scheduledProcess = {}));
1455
+ var scheduledProcess = vvRestApi.scheduledProcess;
1456
+
1457
+
1458
+ //customQuery manager
1459
+ (function (customQuery) {
1460
+ var customQueryManager = (function () {
1461
+ function customQueryManager(httpHelper) {
1462
+ this._httpHelper = httpHelper;
1463
+ }
1464
+
1465
+ customQueryManager.prototype.getCustomQueryResultsByName = function (queryName, params) {
1466
+ //build url for call to the scheduledProcess controller
1467
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.CustomQuery);
1468
+
1469
+ //indicate this is a GET
1470
+ var opts = { method: 'GET' };
1471
+
1472
+ //add the query name to the params
1473
+ if (!params) {
1474
+ params = {};
1475
+ }
1476
+ params.queryName = queryName;
1477
+
1478
+
1479
+ //place call and return promise object
1480
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1481
+ };
1482
+
1483
+ customQueryManager.prototype.getCustomQueryResultsById = function (id, params) {
1484
+ //build url for call to the scheduledProcess controller
1485
+ var url = this._httpHelper.getUrl(this._httpHelper._config.ResourceUri.CustomQuery + '/' + id);
1486
+
1487
+ //indicate this is a GET
1488
+ var opts = { method: 'GET' };
1489
+
1490
+ if (!params) {
1491
+ params = {};
1492
+ }
1493
+
1494
+ //place call and return promise object
1495
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1496
+ };
1497
+
1498
+ return customQueryManager;
1499
+ })();
1500
+ customQuery.customQueryManager = customQueryManager;
1501
+ })(vvRestApi.customQuery || (vvRestApi.customQuery = {}));
1502
+ var customQuery = vvRestApi.customQuery;
1503
+
1504
+
1505
+ //customer manager
1506
+ (function (customer) {
1507
+ var customerManager = (function () {
1508
+ function customerManager(httpHelper) {
1509
+ this._httpHelper = httpHelper;
1510
+ }
1511
+
1512
+ customerManager.prototype.createCustomerInvite = function (data) {
1513
+ //build url
1514
+ var baseUrl = this._httpHelper._sessionToken.baseUrl;
1515
+
1516
+ var url = baseUrl + "/api/v1/" + this._httpHelper._config.ResourceUri.CustomerInvite;
1517
+
1518
+ url = url.replace(/\/api\/\//g, '/api/');
1519
+
1520
+ url = url.replace(/\/v1\/\//g, '/v1/');
1521
+
1522
+ var opts = { method: 'POST' };
1523
+
1524
+ return this._httpHelper.doVvClientRequest(url, opts, '', data);
1525
+ };
1526
+
1527
+ customerManager.prototype.assignUser = function (customerId, data) {
1528
+ var baseUrl = this._httpHelper._sessionToken.baseUrl;
1529
+
1530
+ var url = baseUrl + "/api/v1/" + this._httpHelper._config.ResourceUri.CustomerAssignUser.replace('{customerId}', customerId);;
1531
+
1532
+ var opts = { method: 'PUT' };
1533
+
1534
+ return this._httpHelper.doVvClientRequest(url, opts, '', data);
1535
+ }
1536
+
1537
+ return customerManager;
1538
+ })();
1539
+ customer.customerManager = customerManager;
1540
+ })(vvRestApi.customer || (vvRestApi.customer = {}));
1541
+ var customer = vvRestApi.customer;
1542
+
1543
+ //customerDatabase manager
1544
+ (function (customerDatabase) {
1545
+ var customerDatabaseManager = (function () {
1546
+ function customerDatabaseManager(httpHelper) {
1547
+ this._httpHelper = httpHelper;
1548
+ }
1549
+
1550
+ customerDatabaseManager.prototype.assignUser = function (customerId, data) {
1551
+ var baseUrl = this._httpHelper._sessionToken.baseUrl;
1552
+
1553
+ var url = baseUrl + "/api/v1/" + this._httpHelper._config.ResourceUri.CustomerDatabaseAssignUser.replace('{databaseId}', customerId);;
1554
+
1555
+ var opts = { method: 'PUT' };
1556
+
1557
+ return this._httpHelper.doVvClientRequest(url, opts, '', data);
1558
+ };
1559
+
1560
+ customerDatabaseManager.prototype.removeUser = function (authenticationUserId, databaseId) {
1561
+ var baseUrl = this._httpHelper._sessionToken.baseUrl;
1562
+ var url = baseUrl + "/api/v1" + this._httpHelper._config.ResourceUri.UserDelete.replace('{databaseId}', databaseId);
1563
+ url = url.replace("{authenticationUserId}", authenticationUserId);
1564
+ console.log(url);
1565
+ var opts = { method: 'DELETE' };
1566
+ var params = []; //empty array
1567
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1568
+ }
1569
+
1570
+ return customerDatabaseManager;
1571
+ })();
1572
+ customerDatabase.customerDatabaseManager = customerDatabaseManager;
1573
+ })(vvRestApi.customerDatabase || (vvRestApi.customerDatabase = {}));
1574
+ var customerDatabase = vvRestApi.customerDatabase;
1575
+
1576
+ // files manager
1577
+ (function (files) {
1578
+ var filesManager = (function () {
1579
+ function filesManager(httpHelper) {
1580
+ this._httpHelper = httpHelper;
1581
+ }
1582
+
1583
+ filesManager.prototype.getFileBytesQuery = function (query) {
1584
+ var resourceUri = this._httpHelper._config.ResourceUri.FilesQuery + query;
1585
+ var url = this._httpHelper.getUrl(resourceUri);
1586
+ var opts = { method: 'GETSTREAM' };
1587
+ return this._httpHelper.doVvClientRequest(url, opts, null, null);
1588
+ };
1589
+
1590
+ filesManager.prototype.getFileBytesId = function (id) {
1591
+ var resourceUri = this._httpHelper._config.ResourceUri.FilesId.replace('{id}', id);
1592
+ var url = this._httpHelper.getUrl(resourceUri);
1593
+ var opts = { method: 'GETSTREAM' };
1594
+ return this._httpHelper.doVvClientRequest(url, opts, null, null);
1595
+ };
1596
+
1597
+ filesManager.prototype.postFile = function (data, buffer) {
1598
+ var resourceUri = this._httpHelper._config.ResourceUri.Files;
1599
+ var url = this._httpHelper.getUrl(resourceUri);
1600
+ var opts = { method: 'POSTSTREAM' };
1601
+
1602
+ return this._httpHelper.doVvClientRequest(url, opts, null, data, buffer);
1603
+ };
1604
+
1605
+ return filesManager;
1606
+ })();
1607
+ files.filesManager = filesManager;
1608
+
1609
+ })(vvRestApi.files || (vvRestApi.files = {}));
1610
+ var files = vvRestApi.files;
1611
+
1612
+ // scripts manager
1613
+ (function (scripts) {
1614
+ var scriptsManager = (function () {
1615
+ function scriptsManager(httpHelper) {
1616
+ this._httpHelper = httpHelper;
1617
+ }
1618
+
1619
+ scriptsManager.prototype.runWebService = function (serviceName, serviceData, usId) {
1620
+ var resourceUri = this._httpHelper._config.ResourceUri.Scripts + '?name=' + serviceName
1621
+ if (typeof (usId) != 'undefined' && usId != null) {
1622
+ resourceUri += `&usId=${usId}`;
1623
+ }
1624
+
1625
+ var url = this._httpHelper.getUrl(resourceUri);
1626
+ var opts = { method: 'POST' };
1627
+ return this._httpHelper.doVvClientRequest(url, opts, null, serviceData);
1628
+ };
1629
+
1630
+ scriptsManager.prototype.completeWorkflowWebService = function (executionId, workflowVariables) {
1631
+ var resourceUri = this._httpHelper._config.ResourceUri.ScriptsCompleteWf
1632
+ var url = this._httpHelper.getUrl(resourceUri);
1633
+ var opts = { method: 'POST' };
1634
+
1635
+ var postData = {};
1636
+ postData["executionId"] = executionId;
1637
+ postData["workflowVariables"] = workflowVariables;
1638
+
1639
+ return this._httpHelper.doVvClientRequest(url, opts, null, postData);
1640
+ };
1641
+
1642
+ return scriptsManager;
1643
+ })();
1644
+ scripts.scriptsManager = scriptsManager;
1645
+
1646
+ })(vvRestApi.scripts || (vvRestApi.scripts = {}));
1647
+ var scripts = vvRestApi.scripts;
1648
+
1649
+ // documents manager
1650
+ (function (documents) {
1651
+ var documentsManager = (function () {
1652
+ function documentsManager(httpHelper) {
1653
+ this._httpHelper = httpHelper;
1654
+ }
1655
+
1656
+ documentsManager.prototype.postDoc = function (data) {
1657
+ var resourceUri = this._httpHelper._config.ResourceUri.DocumentsPost;
1658
+ var url = this._httpHelper.getUrl(resourceUri);
1659
+ var opts = { method: 'POST' };
1660
+ return this._httpHelper.doVvClientRequest(url, opts, null, data);
1661
+ };
1662
+
1663
+ documentsManager.prototype.postDocWithFile = function (data, fileData) {
1664
+ var resourceUri = this._httpHelper._config.ResourceUri.DocumentsPost;
1665
+ var url = this._httpHelper.getUrl(resourceUri);
1666
+ var opts = { method: 'POSTSTREAM' };
1667
+ return this._httpHelper.doVvClientRequest(url, opts, null, data, fileData);
1668
+ };
1669
+
1670
+ documentsManager.prototype.copyDocument = function (params, data, documentId) {
1671
+ var resourceUri = this._httpHelper._config.ResourceUri.DocumentsIdCopy.replace('{id}', documentId);
1672
+ var url = this._httpHelper.getUrl(resourceUri);
1673
+ var opts = { method: 'POST' };
1674
+
1675
+ return this._httpHelper.doVvClientRequest(url, opts, null, data);
1676
+ }
1677
+
1678
+ documentsManager.prototype.moveDocument = function (params, data, documentId) {
1679
+ var resourceUri = this._httpHelper._config.ResourceUri.DocumentsIdMove.replace('{id}', documentId);
1680
+ var url = this._httpHelper.getUrl(resourceUri);
1681
+ var opts = { method: 'PUT' };
1682
+ return this._httpHelper.doVvClientRequest(url, opts, params, data);
1683
+ }
1684
+
1685
+ documentsManager.prototype.deleteDocument = function (params, revisionId) {
1686
+ var resourceUri = this._httpHelper._config.ResourceUri.DocumentsId.replace('{id}', revisionId);
1687
+ var url = this._httpHelper.getUrl(resourceUri);
1688
+ var opts = { method: 'DELETE' };
1689
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1690
+ }
1691
+
1692
+ documentsManager.prototype.getDocumentRevision = function (params, revisionId) {
1693
+ var resourceUri = this._httpHelper._config.ResourceUri.DocumentsId.replace('{id}', revisionId);
1694
+ var url = this._httpHelper.getUrl(resourceUri);
1695
+ var opts = { method: 'GET' };
1696
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1697
+ }
1698
+
1699
+ documentsManager.prototype.getDocuments = function (params) {
1700
+ var resourceUri = this._httpHelper._config.ResourceUri.DocumentsPost;
1701
+ var url = this._httpHelper.getUrl(resourceUri);
1702
+ var opts = { method: 'GET' };
1703
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1704
+ }
1705
+
1706
+ documentsManager.prototype.putDocumentIndexFields = function (data, documentId) {
1707
+ var resourceUri = this._httpHelper._config.ResourceUri.DocumentIndexFields.replace('{id}', documentId);
1708
+ var url = this._httpHelper.getUrl(resourceUri);
1709
+ var opts = { method: 'PUT' };
1710
+ return this._httpHelper.doVvClientRequest(url, opts, null, data);
1711
+ };
1712
+
1713
+ documentsManager.prototype.postDocumentAlertSubscription = function (documentId, eventId, userId) {
1714
+ var resourceUri = this._httpHelper._config.ResourceUri.DocumentAlertsId.replace('{documentId}', documentId).replace('{eventId}', eventId);
1715
+ var url = this._httpHelper.getUrl(resourceUri);
1716
+ var opts = { method: 'POST' };
1717
+
1718
+ var params = {
1719
+ usId: userId
1720
+ };
1721
+
1722
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1723
+ }
1724
+
1725
+ documentsManager.prototype.deleteDocumentAlertSubscription = function (documentId, eventId, userId) {
1726
+ var resourceUri = this._httpHelper._config.ResourceUri.DocumentAlertsId.replace('{documentId}', documentId).replace('{eventId}', eventId);
1727
+ var url = this._httpHelper.getUrl(resourceUri);
1728
+ var opts = { method: 'DELETE' };
1729
+
1730
+ var params = {
1731
+ usId: userId
1732
+ };
1733
+
1734
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1735
+ }
1736
+
1737
+ documentsManager.prototype.getDocumentRevisionOcrProperties = function (params, revisionId) {
1738
+ var resourceUri = this._httpHelper._config.ResourceUri.DocumentsIdOcr.replace('{id}', revisionId);
1739
+ var url = this._httpHelper.getUrl(resourceUri);
1740
+ var opts = { method: 'GET' };
1741
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1742
+ }
1743
+
1744
+ documentsManager.prototype.relateDocuments = function (revisionId, relateToRevisionId, relateType) {
1745
+ var resourceUri = this._httpHelper._config.ResourceUri.DocumentsIdRelateDocument.replace('{id}', revisionId);
1746
+ var url = this._httpHelper.getUrl(resourceUri);
1747
+ var opts = { method: 'PUT' };
1748
+
1749
+ var data = {
1750
+ relateToId: relateToRevisionId,
1751
+ relateType: relateType
1752
+ };
1753
+
1754
+ return this._httpHelper.doVvClientRequest(url, opts, null, data);
1755
+ };
1756
+
1757
+ documentsManager.prototype.updateDocumentExpiration = function (documentId, expirationDate) {
1758
+ var resourceUri = this._httpHelper._config.ResourceUri.DocumentsIdExpiration.replace('{id}', documentId);
1759
+ var url = this._httpHelper.getUrl(resourceUri);
1760
+ var opts = { method: 'PUT' };
1761
+
1762
+ var data = {
1763
+ expirationDate: expirationDate
1764
+ };
1765
+
1766
+ return this._httpHelper.doVvClientRequest(url, opts, null, data);
1767
+ }
1768
+
1769
+ return documentsManager;
1770
+ })();
1771
+ documents.documentsManager = documentsManager;
1772
+
1773
+ })(vvRestApi.documents || (vvRestApi.documents = {}));
1774
+ var documents = vvRestApi.documents;
1775
+
1776
+ // projects manager
1777
+ (function (projects) {
1778
+ var projectsManager = (function () {
1779
+ function projectsManager(httpHelper) {
1780
+ this._httpHelper = httpHelper;
1781
+ }
1782
+
1783
+ projectsManager.prototype.postProjectAlertSubscription = function (projectId, eventId, userId) {
1784
+ var resourceUri = this._httpHelper._config.ResourceUri.ProjectAlertsId.replace('{projectId}', projectId).replace('{eventId}', eventId);
1785
+ var url = this._httpHelper.getUrl(resourceUri);
1786
+ var opts = { method: 'POST' };
1787
+
1788
+ var params = {
1789
+ usId: userId
1790
+ };
1791
+
1792
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1793
+ }
1794
+
1795
+ projectsManager.prototype.deleteProjectAlertSubscription = function (projectId, eventId, userId) {
1796
+ var resourceUri = this._httpHelper._config.ResourceUri.ProjectAlertsId.replace('{projectId}', projectId).replace('{eventId}', eventId);
1797
+ var url = this._httpHelper.getUrl(resourceUri);
1798
+ var opts = { method: 'DELETE' };
1799
+
1800
+ var params = {
1801
+ usId: userId
1802
+ };
1803
+
1804
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1805
+ }
1806
+
1807
+ return projectsManager;
1808
+ })();
1809
+ projects.projectsManager = projectsManager;
1810
+
1811
+ })(vvRestApi.projects || (vvRestApi.projects = {}));
1812
+ var projects = vvRestApi.projects;
1813
+
1814
+ // indexFields manager
1815
+ (function (indexFields) {
1816
+ var indexFieldsManager = (function () {
1817
+ function indexFieldsManager(httpHelper) {
1818
+ this._httpHelper = httpHelper;
1819
+ }
1820
+
1821
+ indexFieldsManager.prototype.getIndexFields = function (params) {
1822
+ var resourceUri = this._httpHelper._config.ResourceUri.IndexFields;
1823
+ var url = this._httpHelper.getUrl(resourceUri);
1824
+ var opts = { method: 'GET' };
1825
+
1826
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1827
+ }
1828
+
1829
+ return indexFieldsManager;
1830
+ })();
1831
+ indexFields.indexFieldsManager = indexFieldsManager;
1832
+
1833
+ })(vvRestApi.indexFields || (vvRestApi.indexFields = {}));
1834
+ var indexFields = vvRestApi.indexFields;
1835
+
1836
+ //Outside process manager
1837
+ (function (outsideProcesses) {
1838
+ var outsideProcessesManager = (function () {
1839
+ function outsideProcessesManager(httpHelper) {
1840
+ this._httpHelper = httpHelper;
1841
+ }
1842
+
1843
+ outsideProcessesManager.prototype.getOutsideProcesses = function (params) {
1844
+ var resourceUri = this._httpHelper._config.ResourceUri.OutsideProcesses;
1845
+ var url = this._httpHelper.getUrl(resourceUri);
1846
+ var opts = { method: 'GET' };
1847
+
1848
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1849
+ }
1850
+
1851
+ return outsideProcessesManager;
1852
+ })();
1853
+ outsideProcesses.outsideProcessesManager = outsideProcessesManager;
1854
+
1855
+ })(vvRestApi.outsideProcesses || (vvRestApi.outsideProcesses = {}));
1856
+ var outsideProcesses = vvRestApi.outsideProcesses;
1857
+
1858
+ //Security members manager
1859
+ (function (securityMembers) {
1860
+ var securityMembersManager = (function () {
1861
+ function securityMembersManager(httpHelper) {
1862
+ this._httpHelper = httpHelper;
1863
+ }
1864
+
1865
+ securityMembersManager.prototype.addSecurityMember = function (parentId, memberId, roleType, isGroup) {
1866
+ var resourceUri = this._httpHelper._config.ResourceUri.SecurityMembers;
1867
+ var url = this._httpHelper.getUrl(resourceUri);
1868
+ var opts = { method: 'POST' };
1869
+
1870
+ var postData = {
1871
+ parentId: parentId,
1872
+ memberId: memberId,
1873
+ role: roleType,
1874
+ isGroup: isGroup
1875
+ };
1876
+
1877
+ return this._httpHelper.doVvClientRequest(url, opts, null, postData);
1878
+ };
1879
+
1880
+ securityMembersManager.prototype.getSecurityMembersForParentId = function (parentId) {
1881
+ var resourceUri = this._httpHelper._config.ResourceUri.SecurityMembers;
1882
+ var url = this._httpHelper.getUrl(resourceUri);
1883
+ var opts = { method: 'GET' };
1884
+
1885
+ var params = {
1886
+ parentId: parentId
1887
+ };
1888
+
1889
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1890
+ };
1891
+
1892
+ securityMembersManager.prototype.removeSecurityMember = function (parentId, memberId) {
1893
+ var resourceUri = this._httpHelper._config.ResourceUri.SecurityMembers;
1894
+ var url = this._httpHelper.getUrl(resourceUri);
1895
+ var opts = { method: 'DELETE' };
1896
+
1897
+ var params = {
1898
+ parentId: parentId,
1899
+ memberId: memberId
1900
+ };
1901
+
1902
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1903
+ };
1904
+
1905
+ securityMembersManager.prototype.updateSecurityMember = function (parentId, memberId, roleType) {
1906
+ var resourceUri = this._httpHelper._config.ResourceUri.SecurityMembers;
1907
+ var url = this._httpHelper.getUrl(resourceUri);
1908
+ var opts = { method: 'PUT' };
1909
+
1910
+ var postData = {
1911
+ parentId: parentId,
1912
+ memberId: memberId,
1913
+ role: roleType
1914
+ };
1915
+
1916
+ return this._httpHelper.doVvClientRequest(url, opts, null, postData);
1917
+ };
1918
+
1919
+ return securityMembersManager;
1920
+ })();
1921
+ securityMembers.securityMembersManager = securityMembersManager;
1922
+
1923
+ })(vvRestApi.securityMembers || (vvRestApi.securityMembers = {}));
1924
+ var securityMembers = vvRestApi.securityMembers;
1925
+
1926
+ //layouts manager
1927
+ (function (layouts) {
1928
+ var layoutsManager = (function () {
1929
+ function layoutsManager(httpHelper) {
1930
+ this._httpHelper = httpHelper;
1931
+ }
1932
+
1933
+ layoutsManager.prototype.getLayout = function () {
1934
+ var resourceUri = this._httpHelper._config.ResourceUri.Layout;
1935
+ var url = this._httpHelper.getUrl(resourceUri);
1936
+ var opts = { method: 'GET' };
1937
+
1938
+ return this._httpHelper.doVvClientRequest(url, opts, {}, null);
1939
+ };
1940
+
1941
+ return layoutsManager;
1942
+ })();
1943
+ layouts.layoutsManager = layoutsManager;
1944
+
1945
+ })(vvRestApi.layouts || (vvRestApi.layouts = {}));
1946
+ var layouts = vvRestApi.layouts;
1947
+
1948
+ //reports manager
1949
+ (function (reports) {
1950
+ var reportsManager = (function () {
1951
+ function reportsManager(httpHelper) {
1952
+ this._httpHelper = httpHelper;
1953
+ }
1954
+
1955
+ reportsManager.prototype.getReportPDF = function (reportId, params) {
1956
+ var resourceUri = this._httpHelper._config.ResourceUri.ReportServerPDF.replace('{id}', reportId);
1957
+ var url = this._httpHelper.getUrl(resourceUri);
1958
+ var opts = { method: 'GETSTREAM' };
1959
+
1960
+ return this._httpHelper.doVvClientRequest(url, opts, params, null);
1961
+ };
1962
+
1963
+ return reportsManager;
1964
+ })();
1965
+ reports.reportsManager = reportsManager;
1966
+
1967
+ })(vvRestApi.reports || (vvRestApi.reports = {}));
1968
+ var reports = vvRestApi.reports;
1969
+
1970
+ })(vvRestApi || (vvRestApi = {}));
1971
+
1972
+
1973
+ module.exports = vvRestApi;
1974
+