@unboundcx/sdk 4.13.19 → 4.13.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/services/portals.js +145 -101
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "4.13.19",
3
+ "version": "4.13.20",
4
4
  "description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,4 +1,4 @@
1
- import { internalRequest } from '../base.js';
1
+ import { internalRequest } from "../base.js";
2
2
  export class PortalsService {
3
3
  constructor(sdk) {
4
4
  this.sdk = sdk;
@@ -44,16 +44,16 @@ export class PortalsService {
44
44
  this.sdk.validateParams(
45
45
  { name, kind, domain, slug },
46
46
  {
47
- name: { type: 'string', required: true },
48
- kind: { type: 'string', required: false },
49
- domain: { type: 'string', required: false },
50
- slug: { type: 'string', required: false },
51
- settings: { type: 'object', required: false },
52
- isPublic: { type: 'boolean', required: false },
53
- customCss: { type: 'string', required: false },
54
- customJs: { type: 'string', required: false },
55
- favicon: { type: 'string', required: false },
56
- logo: { type: 'string', required: false },
47
+ name: { type: "string", required: true },
48
+ kind: { type: "string", required: false },
49
+ domain: { type: "string", required: false },
50
+ slug: { type: "string", required: false },
51
+ settings: { type: "object", required: false },
52
+ isPublic: { type: "boolean", required: false },
53
+ customCss: { type: "string", required: false },
54
+ customJs: { type: "string", required: false },
55
+ favicon: { type: "string", required: false },
56
+ logo: { type: "string", required: false },
57
57
  },
58
58
  );
59
59
 
@@ -72,7 +72,7 @@ export class PortalsService {
72
72
  body: portalData,
73
73
  };
74
74
 
75
- const result = await internalRequest(this.sdk, '/portals', 'POST', params);
75
+ const result = await internalRequest(this.sdk, "/portals", "POST", params);
76
76
  return result;
77
77
  }
78
78
 
@@ -101,26 +101,38 @@ export class PortalsService {
101
101
  */
102
102
  async update(
103
103
  portalId,
104
- { name, domain, settings, isPublic, customCss, customJs, favicon, logo },
104
+ {
105
+ name,
106
+ domain,
107
+ slug,
108
+ settings,
109
+ isPublic,
110
+ customCss,
111
+ customJs,
112
+ favicon,
113
+ logo,
114
+ },
105
115
  ) {
106
116
  this.sdk.validateParams(
107
117
  { portalId },
108
118
  {
109
- portalId: { type: 'string', required: true },
110
- name: { type: 'string', required: false },
111
- domain: { type: 'string', required: false },
112
- settings: { type: 'object', required: false },
113
- isPublic: { type: 'boolean', required: false },
114
- customCss: { type: 'string', required: false },
115
- customJs: { type: 'string', required: false },
116
- favicon: { type: 'string', required: false },
117
- logo: { type: 'string', required: false },
119
+ portalId: { type: "string", required: true },
120
+ name: { type: "string", required: false },
121
+ domain: { type: "string", required: false },
122
+ slug: { type: "string", required: false },
123
+ settings: { type: "object", required: false },
124
+ isPublic: { type: "boolean", required: false },
125
+ customCss: { type: "string", required: false },
126
+ customJs: { type: "string", required: false },
127
+ favicon: { type: "string", required: false },
128
+ logo: { type: "string", required: false },
118
129
  },
119
130
  );
120
131
 
121
132
  const updateData = {};
122
133
  if (name) updateData.name = name;
123
- if (domain) updateData.domain = domain;
134
+ if (domain !== undefined) updateData.domain = domain;
135
+ if (slug !== undefined) updateData.slug = slug;
124
136
  if (settings) updateData.settings = settings;
125
137
  if (isPublic !== undefined) updateData.isPublic = isPublic;
126
138
  if (customCss) updateData.customCss = customCss;
@@ -132,7 +144,12 @@ export class PortalsService {
132
144
  body: updateData,
133
145
  };
134
146
 
135
- const result = await internalRequest(this.sdk, `/portals/${portalId}`, 'PUT', params);
147
+ const result = await internalRequest(
148
+ this.sdk,
149
+ `/portals/${portalId}`,
150
+ "PUT",
151
+ params,
152
+ );
136
153
  return result;
137
154
  }
138
155
 
@@ -146,11 +163,15 @@ export class PortalsService {
146
163
  this.sdk.validateParams(
147
164
  { portalId },
148
165
  {
149
- portalId: { type: 'string', required: true },
166
+ portalId: { type: "string", required: true },
150
167
  },
151
168
  );
152
169
 
153
- const result = await internalRequest(this.sdk, `/portals/${portalId}`, 'DELETE');
170
+ const result = await internalRequest(
171
+ this.sdk,
172
+ `/portals/${portalId}`,
173
+ "DELETE",
174
+ );
154
175
  return result;
155
176
  }
156
177
 
@@ -164,11 +185,15 @@ export class PortalsService {
164
185
  this.sdk.validateParams(
165
186
  { portalId },
166
187
  {
167
- portalId: { type: 'string', required: true },
188
+ portalId: { type: "string", required: true },
168
189
  },
169
190
  );
170
191
 
171
- const result = await internalRequest(this.sdk, `/portals/${portalId}`, 'GET');
192
+ const result = await internalRequest(
193
+ this.sdk,
194
+ `/portals/${portalId}`,
195
+ "GET",
196
+ );
172
197
  return result;
173
198
  }
174
199
 
@@ -187,7 +212,7 @@ export class PortalsService {
187
212
  this.sdk.validateParams(
188
213
  { domain },
189
214
  {
190
- domain: { type: 'string', required: true },
215
+ domain: { type: "string", required: true },
191
216
  },
192
217
  );
193
218
 
@@ -195,7 +220,12 @@ export class PortalsService {
195
220
  query: { domain },
196
221
  };
197
222
 
198
- const result = await internalRequest(this.sdk, '/portals/public', 'GET', params);
223
+ const result = await internalRequest(
224
+ this.sdk,
225
+ "/portals/public",
226
+ "GET",
227
+ params,
228
+ );
199
229
  return result;
200
230
  }
201
231
 
@@ -205,7 +235,7 @@ export class PortalsService {
205
235
  * @returns {Promise<{ portals: object[] }>} An object containing an array of portal records.
206
236
  */
207
237
  async list() {
208
- const result = await internalRequest(this.sdk, '/portals', 'GET');
238
+ const result = await internalRequest(this.sdk, "/portals", "GET");
209
239
  return result;
210
240
  }
211
241
 
@@ -229,13 +259,18 @@ export class PortalsService {
229
259
  this.sdk.validateParams(
230
260
  { portalId },
231
261
  {
232
- portalId: { type: 'string', required: true },
262
+ portalId: { type: "string", required: true },
233
263
  },
234
264
  );
235
265
 
236
- const result = await internalRequest(this.sdk, '/portals/dns/verify', 'GET', {
237
- query: { id: portalId },
238
- });
266
+ const result = await internalRequest(
267
+ this.sdk,
268
+ "/portals/dns/verify",
269
+ "GET",
270
+ {
271
+ query: { id: portalId },
272
+ },
273
+ );
239
274
  return result;
240
275
  }
241
276
 
@@ -249,11 +284,11 @@ export class PortalsService {
249
284
  this.sdk.validateParams(
250
285
  { portalId },
251
286
  {
252
- portalId: { type: 'string', required: true },
287
+ portalId: { type: "string", required: true },
253
288
  },
254
289
  );
255
290
 
256
- return internalRequest(this.sdk, `/portals/${portalId}/pages`, 'GET');
291
+ return internalRequest(this.sdk, `/portals/${portalId}/pages`, "GET");
257
292
  }
258
293
 
259
294
  /**
@@ -271,18 +306,18 @@ export class PortalsService {
271
306
  this.sdk.validateParams(
272
307
  { portalId, path, title, type, requiresLogin },
273
308
  {
274
- portalId: { type: 'string', required: true },
275
- path: { type: 'string', required: true },
276
- title: { type: 'string', required: true },
277
- type: { type: 'string', required: true },
278
- requiresLogin: { type: 'boolean', required: false },
309
+ portalId: { type: "string", required: true },
310
+ path: { type: "string", required: true },
311
+ title: { type: "string", required: true },
312
+ type: { type: "string", required: true },
313
+ requiresLogin: { type: "boolean", required: false },
279
314
  },
280
315
  );
281
316
 
282
317
  const body = { path, title, type };
283
318
  if (requiresLogin !== undefined) body.requiresLogin = requiresLogin;
284
319
 
285
- return internalRequest(this.sdk, `/portals/${portalId}/pages`, 'POST', {
320
+ return internalRequest(this.sdk, `/portals/${portalId}/pages`, "POST", {
286
321
  body,
287
322
  });
288
323
  }
@@ -298,15 +333,15 @@ export class PortalsService {
298
333
  this.sdk.validateParams(
299
334
  { portalId, pageId },
300
335
  {
301
- portalId: { type: 'string', required: true },
302
- pageId: { type: 'string', required: true },
336
+ portalId: { type: "string", required: true },
337
+ pageId: { type: "string", required: true },
303
338
  },
304
339
  );
305
340
 
306
341
  return internalRequest(
307
342
  this.sdk,
308
343
  `/portals/${portalId}/pages/${pageId}`,
309
- 'GET',
344
+ "GET",
310
345
  );
311
346
  }
312
347
 
@@ -344,15 +379,15 @@ export class PortalsService {
344
379
  requiresLogin,
345
380
  },
346
381
  {
347
- portalId: { type: 'string', required: true },
348
- pageId: { type: 'string', required: true },
349
- path: { type: 'string', required: false },
350
- title: { type: 'string', required: false },
351
- type: { type: 'string', required: false },
352
- isPublished: { type: 'boolean', required: false },
353
- publishedVersionId: { type: 'string', required: false },
354
- draftVersionId: { type: 'string', required: false },
355
- requiresLogin: { type: 'boolean', required: false },
382
+ portalId: { type: "string", required: true },
383
+ pageId: { type: "string", required: true },
384
+ path: { type: "string", required: false },
385
+ title: { type: "string", required: false },
386
+ type: { type: "string", required: false },
387
+ isPublished: { type: "boolean", required: false },
388
+ publishedVersionId: { type: "string", required: false },
389
+ draftVersionId: { type: "string", required: false },
390
+ requiresLogin: { type: "boolean", required: false },
356
391
  },
357
392
  );
358
393
 
@@ -370,7 +405,7 @@ export class PortalsService {
370
405
  return internalRequest(
371
406
  this.sdk,
372
407
  `/portals/${portalId}/pages/${pageId}`,
373
- 'PUT',
408
+ "PUT",
374
409
  { body },
375
410
  );
376
411
  }
@@ -386,15 +421,15 @@ export class PortalsService {
386
421
  this.sdk.validateParams(
387
422
  { portalId, pageId },
388
423
  {
389
- portalId: { type: 'string', required: true },
390
- pageId: { type: 'string', required: true },
424
+ portalId: { type: "string", required: true },
425
+ pageId: { type: "string", required: true },
391
426
  },
392
427
  );
393
428
 
394
429
  return internalRequest(
395
430
  this.sdk,
396
431
  `/portals/${portalId}/pages/${pageId}`,
397
- 'DELETE',
432
+ "DELETE",
398
433
  );
399
434
  }
400
435
 
@@ -409,15 +444,15 @@ export class PortalsService {
409
444
  this.sdk.validateParams(
410
445
  { portalId, pageId },
411
446
  {
412
- portalId: { type: 'string', required: true },
413
- pageId: { type: 'string', required: true },
447
+ portalId: { type: "string", required: true },
448
+ pageId: { type: "string", required: true },
414
449
  },
415
450
  );
416
451
 
417
452
  return internalRequest(
418
453
  this.sdk,
419
454
  `/portals/${portalId}/pages/${pageId}/versions`,
420
- 'GET',
455
+ "GET",
421
456
  );
422
457
  }
423
458
 
@@ -444,12 +479,12 @@ export class PortalsService {
444
479
  objectName,
445
480
  },
446
481
  {
447
- portalId: { type: 'string', required: true },
448
- pageId: { type: 'string', required: true },
449
- designStorageId: { type: 'string', required: false },
450
- htmlStorageId: { type: 'string', required: false },
451
- layoutId: { type: 'string', required: false },
452
- objectName: { type: 'string', required: false },
482
+ portalId: { type: "string", required: true },
483
+ pageId: { type: "string", required: true },
484
+ designStorageId: { type: "string", required: false },
485
+ htmlStorageId: { type: "string", required: false },
486
+ layoutId: { type: "string", required: false },
487
+ objectName: { type: "string", required: false },
453
488
  },
454
489
  );
455
490
 
@@ -462,7 +497,7 @@ export class PortalsService {
462
497
  return internalRequest(
463
498
  this.sdk,
464
499
  `/portals/${portalId}/pages/${pageId}/versions`,
465
- 'POST',
500
+ "POST",
466
501
  { body },
467
502
  );
468
503
  }
@@ -483,10 +518,10 @@ export class PortalsService {
483
518
  this.sdk.validateParams(
484
519
  { portalId, pageId, tree, html },
485
520
  {
486
- portalId: { type: 'string', required: true },
487
- pageId: { type: 'string', required: true },
488
- tree: { type: 'object', required: false },
489
- html: { type: 'string', required: false },
521
+ portalId: { type: "string", required: true },
522
+ pageId: { type: "string", required: true },
523
+ tree: { type: "object", required: false },
524
+ html: { type: "string", required: false },
490
525
  },
491
526
  );
492
527
 
@@ -497,7 +532,7 @@ export class PortalsService {
497
532
  return internalRequest(
498
533
  this.sdk,
499
534
  `/portals/${portalId}/pages/${pageId}/draft`,
500
- 'PUT',
535
+ "PUT",
501
536
  { body },
502
537
  );
503
538
  }
@@ -517,10 +552,10 @@ export class PortalsService {
517
552
  this.sdk.validateParams(
518
553
  { portalId, pageId, tree, html },
519
554
  {
520
- portalId: { type: 'string', required: true },
521
- pageId: { type: 'string', required: true },
522
- tree: { type: 'object', required: false },
523
- html: { type: 'string', required: false },
555
+ portalId: { type: "string", required: true },
556
+ pageId: { type: "string", required: true },
557
+ tree: { type: "object", required: false },
558
+ html: { type: "string", required: false },
524
559
  },
525
560
  );
526
561
 
@@ -531,7 +566,7 @@ export class PortalsService {
531
566
  return internalRequest(
532
567
  this.sdk,
533
568
  `/portals/${portalId}/pages/${pageId}/publish`,
534
- 'POST',
569
+ "POST",
535
570
  { body },
536
571
  );
537
572
  }
@@ -552,14 +587,14 @@ export class PortalsService {
552
587
  this.sdk.validateParams(
553
588
  { peopleId },
554
589
  {
555
- peopleId: { type: 'string', required: true },
590
+ peopleId: { type: "string", required: true },
556
591
  },
557
592
  );
558
593
 
559
594
  return internalRequest(
560
595
  this.sdk,
561
596
  `/portals/people/${encodeURIComponent(peopleId)}/access`,
562
- 'GET',
597
+ "GET",
563
598
  );
564
599
  }
565
600
 
@@ -579,14 +614,14 @@ export class PortalsService {
579
614
  this.sdk.validateParams(
580
615
  { peopleId },
581
616
  {
582
- peopleId: { type: 'string', required: true },
617
+ peopleId: { type: "string", required: true },
583
618
  },
584
619
  );
585
620
 
586
621
  return internalRequest(
587
622
  this.sdk,
588
623
  `/portals/people/${encodeURIComponent(peopleId)}/access/force-reset`,
589
- 'POST',
624
+ "POST",
590
625
  );
591
626
  }
592
627
 
@@ -599,7 +634,7 @@ export class PortalsService {
599
634
  * @returns {Promise<{ statuses: Array<{ status: string, customerLabel: string|null }> }>}
600
635
  */
601
636
  async listTicketStatuses() {
602
- return internalRequest(this.sdk, '/portals/ticket-statuses', 'GET');
637
+ return internalRequest(this.sdk, "/portals/ticket-statuses", "GET");
603
638
  }
604
639
 
605
640
  /**
@@ -613,11 +648,11 @@ export class PortalsService {
613
648
  this.sdk.validateParams(
614
649
  { statuses },
615
650
  {
616
- statuses: { type: 'array', required: true },
651
+ statuses: { type: "array", required: true },
617
652
  },
618
653
  );
619
654
 
620
- return internalRequest(this.sdk, '/portals/ticket-statuses', 'PUT', {
655
+ return internalRequest(this.sdk, "/portals/ticket-statuses", "PUT", {
621
656
  body: { statuses },
622
657
  });
623
658
  }
@@ -648,11 +683,11 @@ export class PortalsService {
648
683
  this.sdk.validateParams(
649
684
  { portalId },
650
685
  {
651
- portalId: { type: 'string', required: true },
686
+ portalId: { type: "string", required: true },
652
687
  },
653
688
  );
654
689
 
655
- return internalRequest(this.sdk, `/portals/${portalId}/sso`, 'GET');
690
+ return internalRequest(this.sdk, `/portals/${portalId}/sso`, "GET");
656
691
  }
657
692
 
658
693
  /**
@@ -676,20 +711,29 @@ export class PortalsService {
676
711
  */
677
712
  async upsertSsoConnection(
678
713
  portalId,
679
- { name, issuer, clientId, clientSecret, tenant, scopes, status, requireVerifiedEmail } = {},
714
+ {
715
+ name,
716
+ issuer,
717
+ clientId,
718
+ clientSecret,
719
+ tenant,
720
+ scopes,
721
+ status,
722
+ requireVerifiedEmail,
723
+ } = {},
680
724
  ) {
681
725
  this.sdk.validateParams(
682
726
  { portalId, issuer, clientId },
683
727
  {
684
- portalId: { type: 'string', required: true },
685
- issuer: { type: 'string', required: true },
686
- clientId: { type: 'string', required: true },
687
- name: { type: 'string', required: false },
688
- clientSecret: { type: 'string', required: false },
689
- tenant: { type: 'string', required: false },
690
- scopes: { type: 'string', required: false },
691
- status: { type: 'string', required: false },
692
- requireVerifiedEmail: { type: 'boolean', required: false },
728
+ portalId: { type: "string", required: true },
729
+ issuer: { type: "string", required: true },
730
+ clientId: { type: "string", required: true },
731
+ name: { type: "string", required: false },
732
+ clientSecret: { type: "string", required: false },
733
+ tenant: { type: "string", required: false },
734
+ scopes: { type: "string", required: false },
735
+ status: { type: "string", required: false },
736
+ requireVerifiedEmail: { type: "boolean", required: false },
693
737
  },
694
738
  );
695
739
 
@@ -703,7 +747,7 @@ export class PortalsService {
703
747
  body.requireVerifiedEmail = requireVerifiedEmail;
704
748
  }
705
749
 
706
- return internalRequest(this.sdk, `/portals/${portalId}/sso`, 'PUT', {
750
+ return internalRequest(this.sdk, `/portals/${portalId}/sso`, "PUT", {
707
751
  body,
708
752
  });
709
753
  }
@@ -718,10 +762,10 @@ export class PortalsService {
718
762
  this.sdk.validateParams(
719
763
  { portalId },
720
764
  {
721
- portalId: { type: 'string', required: true },
765
+ portalId: { type: "string", required: true },
722
766
  },
723
767
  );
724
768
 
725
- return internalRequest(this.sdk, `/portals/${portalId}/sso`, 'DELETE');
769
+ return internalRequest(this.sdk, `/portals/${portalId}/sso`, "DELETE");
726
770
  }
727
771
  }