visualvault-api 1.1.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.
@@ -0,0 +1,1889 @@
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
+