@unboundcx/sdk 4.13.19 → 4.13.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/services/portals.js +263 -104
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.21",
|
|
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",
|
package/services/portals.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { internalRequest } from
|
|
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:
|
|
48
|
-
kind: { type:
|
|
49
|
-
domain: { type:
|
|
50
|
-
slug: { type:
|
|
51
|
-
settings: { type:
|
|
52
|
-
isPublic: { type:
|
|
53
|
-
customCss: { type:
|
|
54
|
-
customJs: { type:
|
|
55
|
-
favicon: { type:
|
|
56
|
-
logo: { type:
|
|
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,
|
|
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
|
-
{
|
|
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:
|
|
110
|
-
name: { type:
|
|
111
|
-
domain: { type:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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(
|
|
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:
|
|
166
|
+
portalId: { type: "string", required: true },
|
|
150
167
|
},
|
|
151
168
|
);
|
|
152
169
|
|
|
153
|
-
const result = await internalRequest(
|
|
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:
|
|
188
|
+
portalId: { type: "string", required: true },
|
|
168
189
|
},
|
|
169
190
|
);
|
|
170
191
|
|
|
171
|
-
const result = await internalRequest(
|
|
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:
|
|
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(
|
|
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,
|
|
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:
|
|
262
|
+
portalId: { type: "string", required: true },
|
|
233
263
|
},
|
|
234
264
|
);
|
|
235
265
|
|
|
236
|
-
const result = await internalRequest(
|
|
237
|
-
|
|
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:
|
|
287
|
+
portalId: { type: "string", required: true },
|
|
253
288
|
},
|
|
254
289
|
);
|
|
255
290
|
|
|
256
|
-
return internalRequest(this.sdk, `/portals/${portalId}/pages`,
|
|
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:
|
|
275
|
-
path: { type:
|
|
276
|
-
title: { type:
|
|
277
|
-
type: { type:
|
|
278
|
-
requiresLogin: { type:
|
|
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`,
|
|
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:
|
|
302
|
-
pageId: { type:
|
|
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
|
-
|
|
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:
|
|
348
|
-
pageId: { type:
|
|
349
|
-
path: { type:
|
|
350
|
-
title: { type:
|
|
351
|
-
type: { type:
|
|
352
|
-
isPublished: { type:
|
|
353
|
-
publishedVersionId: { type:
|
|
354
|
-
draftVersionId: { type:
|
|
355
|
-
requiresLogin: { type:
|
|
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
|
-
|
|
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:
|
|
390
|
-
pageId: { type:
|
|
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
|
-
|
|
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:
|
|
413
|
-
pageId: { type:
|
|
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
|
-
|
|
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:
|
|
448
|
-
pageId: { type:
|
|
449
|
-
designStorageId: { type:
|
|
450
|
-
htmlStorageId: { type:
|
|
451
|
-
layoutId: { type:
|
|
452
|
-
objectName: { type:
|
|
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
|
-
|
|
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:
|
|
487
|
-
pageId: { type:
|
|
488
|
-
tree: { type:
|
|
489
|
-
html: { type:
|
|
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
|
-
|
|
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:
|
|
521
|
-
pageId: { type:
|
|
522
|
-
tree: { type:
|
|
523
|
-
html: { type:
|
|
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,35 +566,50 @@ export class PortalsService {
|
|
|
531
566
|
return internalRequest(
|
|
532
567
|
this.sdk,
|
|
533
568
|
`/portals/${portalId}/pages/${pageId}/publish`,
|
|
534
|
-
|
|
569
|
+
"POST",
|
|
535
570
|
{ body },
|
|
536
571
|
);
|
|
537
572
|
}
|
|
538
573
|
|
|
539
574
|
/**
|
|
540
|
-
* Staff-only portal credential status for a person. Never
|
|
575
|
+
* Staff-only portal credential + access status for a person. Never
|
|
576
|
+
* includes hashes or tokens.
|
|
541
577
|
*
|
|
542
578
|
* @param {string} peopleId
|
|
543
579
|
* @returns {Promise<{
|
|
580
|
+
* status: "none"|"invited"|"active"|"locked",
|
|
544
581
|
* hasPassword: boolean,
|
|
545
582
|
* ssoLinked: boolean,
|
|
546
583
|
* lastLoginAt: string|null,
|
|
547
584
|
* lastLoginMethod: string|null,
|
|
548
|
-
* mustReset: boolean
|
|
549
|
-
*
|
|
585
|
+
* mustReset: boolean,
|
|
586
|
+
* invitedAt: string|null,
|
|
587
|
+
* lockedUntil: string|null,
|
|
588
|
+
* portals: Array<{
|
|
589
|
+
* id: string,
|
|
590
|
+
* name: string,
|
|
591
|
+
* kind: "support"|"partner",
|
|
592
|
+
* hostedDomain: string,
|
|
593
|
+
* domain: string|null,
|
|
594
|
+
* matches: boolean
|
|
595
|
+
* }>
|
|
596
|
+
* }>} `portals` lists only support/partner portals on the account (a
|
|
597
|
+
* portal with no login surface, e.g. `marketing`, is never included);
|
|
598
|
+
* `matches` is whether this person currently passes that portal's
|
|
599
|
+
* people-access filter.
|
|
550
600
|
*/
|
|
551
601
|
async getPeopleAccess(peopleId) {
|
|
552
602
|
this.sdk.validateParams(
|
|
553
603
|
{ peopleId },
|
|
554
604
|
{
|
|
555
|
-
peopleId: { type:
|
|
605
|
+
peopleId: { type: "string", required: true },
|
|
556
606
|
},
|
|
557
607
|
);
|
|
558
608
|
|
|
559
609
|
return internalRequest(
|
|
560
610
|
this.sdk,
|
|
561
611
|
`/portals/people/${encodeURIComponent(peopleId)}/access`,
|
|
562
|
-
|
|
612
|
+
"GET",
|
|
563
613
|
);
|
|
564
614
|
}
|
|
565
615
|
|
|
@@ -579,14 +629,114 @@ export class PortalsService {
|
|
|
579
629
|
this.sdk.validateParams(
|
|
580
630
|
{ peopleId },
|
|
581
631
|
{
|
|
582
|
-
peopleId: { type:
|
|
632
|
+
peopleId: { type: "string", required: true },
|
|
583
633
|
},
|
|
584
634
|
);
|
|
585
635
|
|
|
586
636
|
return internalRequest(
|
|
587
637
|
this.sdk,
|
|
588
638
|
`/portals/people/${encodeURIComponent(peopleId)}/access/force-reset`,
|
|
589
|
-
|
|
639
|
+
"POST",
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Invites a person to sign in to a support/partner portal: upserts their
|
|
645
|
+
* portal credential (`mustReset=1`), stamps `invitedAt`/`invitedBy`, and
|
|
646
|
+
* sends the account's `portal-welcome` email with a fresh 30-minute
|
|
647
|
+
* single-use set-password link.
|
|
648
|
+
*
|
|
649
|
+
* The person must pass the target portal's people-access filter — see
|
|
650
|
+
* `getPeopleAccess(peopleId).portals[].matches` — or the call 400s.
|
|
651
|
+
*
|
|
652
|
+
* @param {string} peopleId
|
|
653
|
+
* @param {object} params
|
|
654
|
+
* @param {string} params.portalId - The support/partner portal to invite them to.
|
|
655
|
+
* @returns {Promise<{
|
|
656
|
+
* status: "invited",
|
|
657
|
+
* hasPassword: boolean,
|
|
658
|
+
* ssoLinked: boolean,
|
|
659
|
+
* lastLoginAt: string|null,
|
|
660
|
+
* lastLoginMethod: string|null,
|
|
661
|
+
* mustReset: boolean,
|
|
662
|
+
* invitedAt: string,
|
|
663
|
+
* lockedUntil: string|null
|
|
664
|
+
* }>}
|
|
665
|
+
*/
|
|
666
|
+
async invitePerson(peopleId, { portalId }) {
|
|
667
|
+
this.sdk.validateParams(
|
|
668
|
+
{ peopleId, portalId },
|
|
669
|
+
{
|
|
670
|
+
peopleId: { type: "string", required: true },
|
|
671
|
+
portalId: { type: "string", required: true },
|
|
672
|
+
},
|
|
673
|
+
);
|
|
674
|
+
|
|
675
|
+
return internalRequest(
|
|
676
|
+
this.sdk,
|
|
677
|
+
`/portals/people/${encodeURIComponent(peopleId)}/invite`,
|
|
678
|
+
"POST",
|
|
679
|
+
{ body: { portalId } },
|
|
680
|
+
);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Sends a person a fresh password-reset email for a support/partner
|
|
685
|
+
* portal (the account's `portal-password-reset` template) with a new
|
|
686
|
+
* 30-minute single-use set-password link. Works whether they were
|
|
687
|
+
* previously invited or already active.
|
|
688
|
+
*
|
|
689
|
+
* @param {string} peopleId
|
|
690
|
+
* @param {object} params
|
|
691
|
+
* @param {string} params.portalId - The support/partner portal to send the reset for.
|
|
692
|
+
* @returns {Promise<{
|
|
693
|
+
* status: "none"|"invited"|"active"|"locked",
|
|
694
|
+
* hasPassword: boolean,
|
|
695
|
+
* ssoLinked: boolean,
|
|
696
|
+
* lastLoginAt: string|null,
|
|
697
|
+
* lastLoginMethod: string|null,
|
|
698
|
+
* mustReset: boolean,
|
|
699
|
+
* invitedAt: string|null,
|
|
700
|
+
* lockedUntil: string|null
|
|
701
|
+
* }>}
|
|
702
|
+
*/
|
|
703
|
+
async resetPersonPassword(peopleId, { portalId }) {
|
|
704
|
+
this.sdk.validateParams(
|
|
705
|
+
{ peopleId, portalId },
|
|
706
|
+
{
|
|
707
|
+
peopleId: { type: "string", required: true },
|
|
708
|
+
portalId: { type: "string", required: true },
|
|
709
|
+
},
|
|
710
|
+
);
|
|
711
|
+
|
|
712
|
+
return internalRequest(
|
|
713
|
+
this.sdk,
|
|
714
|
+
`/portals/people/${encodeURIComponent(peopleId)}/reset-password`,
|
|
715
|
+
"POST",
|
|
716
|
+
{ body: { portalId } },
|
|
717
|
+
);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Revokes a person's portal access (soft-deletes their credential across
|
|
722
|
+
* every portal on the account). Idempotent — revoking someone with no
|
|
723
|
+
* credential is a no-op, not an error.
|
|
724
|
+
*
|
|
725
|
+
* @param {string} peopleId
|
|
726
|
+
* @returns {Promise<{ ok: true }>}
|
|
727
|
+
*/
|
|
728
|
+
async revokePeopleAccess(peopleId) {
|
|
729
|
+
this.sdk.validateParams(
|
|
730
|
+
{ peopleId },
|
|
731
|
+
{
|
|
732
|
+
peopleId: { type: "string", required: true },
|
|
733
|
+
},
|
|
734
|
+
);
|
|
735
|
+
|
|
736
|
+
return internalRequest(
|
|
737
|
+
this.sdk,
|
|
738
|
+
`/portals/people/${encodeURIComponent(peopleId)}/access`,
|
|
739
|
+
"DELETE",
|
|
590
740
|
);
|
|
591
741
|
}
|
|
592
742
|
|
|
@@ -599,7 +749,7 @@ export class PortalsService {
|
|
|
599
749
|
* @returns {Promise<{ statuses: Array<{ status: string, customerLabel: string|null }> }>}
|
|
600
750
|
*/
|
|
601
751
|
async listTicketStatuses() {
|
|
602
|
-
return internalRequest(this.sdk,
|
|
752
|
+
return internalRequest(this.sdk, "/portals/ticket-statuses", "GET");
|
|
603
753
|
}
|
|
604
754
|
|
|
605
755
|
/**
|
|
@@ -613,11 +763,11 @@ export class PortalsService {
|
|
|
613
763
|
this.sdk.validateParams(
|
|
614
764
|
{ statuses },
|
|
615
765
|
{
|
|
616
|
-
statuses: { type:
|
|
766
|
+
statuses: { type: "array", required: true },
|
|
617
767
|
},
|
|
618
768
|
);
|
|
619
769
|
|
|
620
|
-
return internalRequest(this.sdk,
|
|
770
|
+
return internalRequest(this.sdk, "/portals/ticket-statuses", "PUT", {
|
|
621
771
|
body: { statuses },
|
|
622
772
|
});
|
|
623
773
|
}
|
|
@@ -648,11 +798,11 @@ export class PortalsService {
|
|
|
648
798
|
this.sdk.validateParams(
|
|
649
799
|
{ portalId },
|
|
650
800
|
{
|
|
651
|
-
portalId: { type:
|
|
801
|
+
portalId: { type: "string", required: true },
|
|
652
802
|
},
|
|
653
803
|
);
|
|
654
804
|
|
|
655
|
-
return internalRequest(this.sdk, `/portals/${portalId}/sso`,
|
|
805
|
+
return internalRequest(this.sdk, `/portals/${portalId}/sso`, "GET");
|
|
656
806
|
}
|
|
657
807
|
|
|
658
808
|
/**
|
|
@@ -676,20 +826,29 @@ export class PortalsService {
|
|
|
676
826
|
*/
|
|
677
827
|
async upsertSsoConnection(
|
|
678
828
|
portalId,
|
|
679
|
-
{
|
|
829
|
+
{
|
|
830
|
+
name,
|
|
831
|
+
issuer,
|
|
832
|
+
clientId,
|
|
833
|
+
clientSecret,
|
|
834
|
+
tenant,
|
|
835
|
+
scopes,
|
|
836
|
+
status,
|
|
837
|
+
requireVerifiedEmail,
|
|
838
|
+
} = {},
|
|
680
839
|
) {
|
|
681
840
|
this.sdk.validateParams(
|
|
682
841
|
{ portalId, issuer, clientId },
|
|
683
842
|
{
|
|
684
|
-
portalId: { type:
|
|
685
|
-
issuer: { type:
|
|
686
|
-
clientId: { type:
|
|
687
|
-
name: { type:
|
|
688
|
-
clientSecret: { type:
|
|
689
|
-
tenant: { type:
|
|
690
|
-
scopes: { type:
|
|
691
|
-
status: { type:
|
|
692
|
-
requireVerifiedEmail: { type:
|
|
843
|
+
portalId: { type: "string", required: true },
|
|
844
|
+
issuer: { type: "string", required: true },
|
|
845
|
+
clientId: { type: "string", required: true },
|
|
846
|
+
name: { type: "string", required: false },
|
|
847
|
+
clientSecret: { type: "string", required: false },
|
|
848
|
+
tenant: { type: "string", required: false },
|
|
849
|
+
scopes: { type: "string", required: false },
|
|
850
|
+
status: { type: "string", required: false },
|
|
851
|
+
requireVerifiedEmail: { type: "boolean", required: false },
|
|
693
852
|
},
|
|
694
853
|
);
|
|
695
854
|
|
|
@@ -703,7 +862,7 @@ export class PortalsService {
|
|
|
703
862
|
body.requireVerifiedEmail = requireVerifiedEmail;
|
|
704
863
|
}
|
|
705
864
|
|
|
706
|
-
return internalRequest(this.sdk, `/portals/${portalId}/sso`,
|
|
865
|
+
return internalRequest(this.sdk, `/portals/${portalId}/sso`, "PUT", {
|
|
707
866
|
body,
|
|
708
867
|
});
|
|
709
868
|
}
|
|
@@ -718,10 +877,10 @@ export class PortalsService {
|
|
|
718
877
|
this.sdk.validateParams(
|
|
719
878
|
{ portalId },
|
|
720
879
|
{
|
|
721
|
-
portalId: { type:
|
|
880
|
+
portalId: { type: "string", required: true },
|
|
722
881
|
},
|
|
723
882
|
);
|
|
724
883
|
|
|
725
|
-
return internalRequest(this.sdk, `/portals/${portalId}/sso`,
|
|
884
|
+
return internalRequest(this.sdk, `/portals/${portalId}/sso`, "DELETE");
|
|
726
885
|
}
|
|
727
886
|
}
|