@nvisy/sdk 0.49.0 → 0.51.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.
- package/CHANGELOG.md +88 -1
- package/dist/{client-BEpBVGGP.d.ts → client-SotZfT6b.d.ts} +354 -299
- package/dist/client-SotZfT6b.d.ts.map +1 -0
- package/dist/datatypes/index.d.ts +2 -2
- package/dist/{error-DNeyT0Z7.js → error-DTQ8nnQc.js} +3 -3
- package/dist/{error-DNeyT0Z7.js.map → error-DTQ8nnQc.js.map} +1 -1
- package/dist/{errors-DzQz1HIR.d.ts → errors-ClHc4LMK.d.ts} +2 -12
- package/dist/errors-ClHc4LMK.d.ts.map +1 -0
- package/dist/{errors-BOLD8iC1.js → errors-D2J3LbE-.js} +2 -16
- package/dist/errors-D2J3LbE-.js.map +1 -0
- package/dist/{index-CNUnM9QG.d.ts → index-BxYFvgTy.d.ts} +12471 -9723
- package/dist/index-BxYFvgTy.d.ts.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +16 -15
- package/dist/index.js.map +1 -1
- package/dist/services/index.d.ts +2 -2
- package/dist/services/index.js +2 -2
- package/dist/{services-COhgjbsy.js → services-CFFmQDgA.js} +657 -547
- package/dist/services-CFFmQDgA.js.map +1 -0
- package/dist/standalone/index.d.ts +1 -1
- package/dist/standalone/index.js +1 -1
- package/dist/webhooks/index.d.ts +2 -2
- package/dist/webhooks/index.js +1 -1
- package/package.json +1 -1
- package/dist/client-BEpBVGGP.d.ts.map +0 -1
- package/dist/errors-BOLD8iC1.js.map +0 -1
- package/dist/errors-DzQz1HIR.d.ts.map +0 -1
- package/dist/index-CNUnM9QG.d.ts.map +0 -1
- package/dist/services-COhgjbsy.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as NvisyError } from "./errors-
|
|
1
|
+
import { n as NvisyError } from "./errors-D2J3LbE-.js";
|
|
2
2
|
|
|
3
3
|
//#region src/services/account.ts
|
|
4
4
|
/**
|
|
@@ -37,28 +37,28 @@ var Account = class {
|
|
|
37
37
|
await this.#api.DELETE("/account/");
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* Get a public account profile by
|
|
41
|
-
* @param
|
|
40
|
+
* Get a public account profile by account id
|
|
41
|
+
* @param accountId - Account id
|
|
42
42
|
* @returns Promise that resolves with the public account details
|
|
43
43
|
* @throws {ApiError} if the request fails
|
|
44
44
|
*/
|
|
45
|
-
async getPublicAccount(
|
|
46
|
-
const { data } = await this.#api.GET("/accounts/{
|
|
45
|
+
async getPublicAccount(accountId) {
|
|
46
|
+
const { data } = await this.#api.GET("/accounts/{accountId}/", { params: { path: { accountId } } });
|
|
47
47
|
return data;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Upload an account's avatar image
|
|
51
|
-
* @param
|
|
51
|
+
* @param accountId - Account id
|
|
52
52
|
* @param avatar - Avatar image to upload
|
|
53
53
|
* @returns Promise that resolves with the updated account
|
|
54
54
|
* @throws {ApiError} if the request fails
|
|
55
55
|
*/
|
|
56
|
-
async uploadAvatar(
|
|
56
|
+
async uploadAvatar(accountId, avatar) {
|
|
57
57
|
const formData = new FormData();
|
|
58
58
|
const name = avatar instanceof File ? avatar.name : "avatar";
|
|
59
59
|
formData.append("avatar", avatar, name);
|
|
60
|
-
const { data } = await this.#api.PUT("/accounts/{
|
|
61
|
-
params: { path: {
|
|
60
|
+
const { data } = await this.#api.PUT("/accounts/{accountId}/avatar/", {
|
|
61
|
+
params: { path: { accountId } },
|
|
62
62
|
body: formData,
|
|
63
63
|
bodySerializer: (formData) => formData,
|
|
64
64
|
headers: { "Content-Type": null }
|
|
@@ -67,12 +67,12 @@ var Account = class {
|
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Delete an account's avatar image
|
|
70
|
-
* @param
|
|
70
|
+
* @param accountId - Account id
|
|
71
71
|
* @returns Promise that resolves when the avatar is deleted
|
|
72
72
|
* @throws {ApiError} if the request fails
|
|
73
73
|
*/
|
|
74
|
-
async deleteAvatar(
|
|
75
|
-
await this.#api.DELETE("/accounts/{
|
|
74
|
+
async deleteAvatar(accountId) {
|
|
75
|
+
await this.#api.DELETE("/accounts/{accountId}/avatar/", { params: { path: { accountId } } });
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* List the account's sign-in methods: its password and linked providers.
|
|
@@ -172,31 +172,31 @@ var Activities = class {
|
|
|
172
172
|
}
|
|
173
173
|
/**
|
|
174
174
|
* List activities for a workspace
|
|
175
|
-
* @param
|
|
175
|
+
* @param workspaceId - Workspace id
|
|
176
176
|
* @param query - Optional filters and pagination (type, actor, from, to,
|
|
177
177
|
* limit, after, includeCount)
|
|
178
178
|
* @returns Promise that resolves with a paginated list of activities
|
|
179
179
|
* @throws {ApiError} if the request fails
|
|
180
180
|
*/
|
|
181
|
-
async listActivities(
|
|
182
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
183
|
-
path: {
|
|
181
|
+
async listActivities(workspaceId, query) {
|
|
182
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/activities/", { params: {
|
|
183
|
+
path: { workspaceId },
|
|
184
184
|
query
|
|
185
185
|
} });
|
|
186
186
|
return data;
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
189
|
* Export the workspace's activity log as a file.
|
|
190
|
-
* @param
|
|
190
|
+
* @param workspaceId - Workspace id
|
|
191
191
|
* @param query - Optional filters (type, actor), date window (from, to), and
|
|
192
192
|
* output format (`csv` default, or `json`)
|
|
193
193
|
* @returns Promise that resolves with the file response
|
|
194
194
|
* @throws {ApiError} if the request fails
|
|
195
195
|
*/
|
|
196
|
-
async exportActivities(
|
|
197
|
-
const { response } = await this.#api.GET("/workspaces/{
|
|
196
|
+
async exportActivities(workspaceId, query) {
|
|
197
|
+
const { response } = await this.#api.GET("/workspaces/{workspaceId}/activities/export", {
|
|
198
198
|
params: {
|
|
199
|
-
path: {
|
|
199
|
+
path: { workspaceId },
|
|
200
200
|
query
|
|
201
201
|
},
|
|
202
202
|
parseAs: "stream"
|
|
@@ -217,24 +217,24 @@ var Analytics = class {
|
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
219
219
|
* Get aggregate analytics for a workspace: storage, detection health, usage.
|
|
220
|
-
* @param
|
|
220
|
+
* @param workspaceId - Workspace id
|
|
221
221
|
* @returns Promise that resolves with the workspace analytics
|
|
222
222
|
* @throws {ApiError} if the request fails
|
|
223
223
|
*/
|
|
224
|
-
async getAnalytics(
|
|
225
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
224
|
+
async getAnalytics(workspaceId) {
|
|
225
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/analytics/", { params: { path: { workspaceId } } });
|
|
226
226
|
return data;
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
229
229
|
* Get a workspace's daily detection activity over a date window.
|
|
230
|
-
* @param
|
|
230
|
+
* @param workspaceId - Workspace id
|
|
231
231
|
* @param query - Optional date window (`from` / `to`, YYYY-MM-DD)
|
|
232
232
|
* @returns Promise that resolves with the detection time series
|
|
233
233
|
* @throws {ApiError} if the request fails
|
|
234
234
|
*/
|
|
235
|
-
async getDetectionTimeSeries(
|
|
236
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
237
|
-
path: {
|
|
235
|
+
async getDetectionTimeSeries(workspaceId, query) {
|
|
236
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/analytics/detections/timeseries/", { params: {
|
|
237
|
+
path: { workspaceId },
|
|
238
238
|
query
|
|
239
239
|
} });
|
|
240
240
|
return data;
|
|
@@ -390,12 +390,13 @@ var Auth = class {
|
|
|
390
390
|
};
|
|
391
391
|
|
|
392
392
|
//#endregion
|
|
393
|
-
//#region src/services/
|
|
393
|
+
//#region src/services/capabilities.ts
|
|
394
394
|
/**
|
|
395
|
-
* Service for reading the deployment's
|
|
396
|
-
*
|
|
395
|
+
* Service for reading the deployment's capabilities: the label taxonomy, the
|
|
396
|
+
* registered recognizers, the connectors it can create, and the auth methods
|
|
397
|
+
* it offers. Read-only; served by the `/capabilities/*` endpoints.
|
|
397
398
|
*/
|
|
398
|
-
var
|
|
399
|
+
var Capabilities = class {
|
|
399
400
|
#api;
|
|
400
401
|
constructor(api) {
|
|
401
402
|
this.#api = api;
|
|
@@ -405,7 +406,7 @@ var Catalog = class {
|
|
|
405
406
|
* @returns Promise that resolves with the label catalog.
|
|
406
407
|
*/
|
|
407
408
|
async listLabels() {
|
|
408
|
-
const { data } = await this.#api.GET("/
|
|
409
|
+
const { data } = await this.#api.GET("/capabilities/labels/");
|
|
409
410
|
return data;
|
|
410
411
|
}
|
|
411
412
|
/**
|
|
@@ -413,7 +414,7 @@ var Catalog = class {
|
|
|
413
414
|
* @returns Promise that resolves with the recognizer catalog.
|
|
414
415
|
*/
|
|
415
416
|
async listRecognizers() {
|
|
416
|
-
const { data } = await this.#api.GET("/
|
|
417
|
+
const { data } = await this.#api.GET("/capabilities/recognizers/");
|
|
417
418
|
return data;
|
|
418
419
|
}
|
|
419
420
|
/**
|
|
@@ -424,177 +425,20 @@ var Catalog = class {
|
|
|
424
425
|
* credentials and are always available. Use it to render the connect UI
|
|
425
426
|
* without probing.
|
|
426
427
|
*
|
|
427
|
-
* @returns Promise that resolves with the connector
|
|
428
|
+
* @returns Promise that resolves with the connector capabilities.
|
|
428
429
|
*/
|
|
429
430
|
async listConnectors() {
|
|
430
|
-
const { data } = await this.#api.GET("/
|
|
431
|
-
return data;
|
|
432
|
-
}
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
//#endregion
|
|
436
|
-
//#region src/services/sse.ts
|
|
437
|
-
/** Parse one already-split frame (its lines) into an event, or null if empty. */
|
|
438
|
-
function parseFrame(frame) {
|
|
439
|
-
let event = "message";
|
|
440
|
-
const data = [];
|
|
441
|
-
for (const line of frame.split("\n")) {
|
|
442
|
-
if (line === "" || line.startsWith(":")) continue;
|
|
443
|
-
const colon = line.indexOf(":");
|
|
444
|
-
const field = colon === -1 ? line : line.slice(0, colon);
|
|
445
|
-
let value = colon === -1 ? "" : line.slice(colon + 1);
|
|
446
|
-
if (value.startsWith(" ")) value = value.slice(1);
|
|
447
|
-
if (field === "event") event = value;
|
|
448
|
-
else if (field === "data") data.push(value);
|
|
449
|
-
}
|
|
450
|
-
if (data.length === 0) return null;
|
|
451
|
-
return {
|
|
452
|
-
event,
|
|
453
|
-
data: data.join("\n")
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Decode a byte stream into SSE events.
|
|
458
|
-
*
|
|
459
|
-
* @param stream - the response body, a stream of UTF-8 bytes
|
|
460
|
-
* @yields each complete SSE event as it arrives
|
|
461
|
-
*/
|
|
462
|
-
async function* parseSseStream(stream) {
|
|
463
|
-
const decoder = new TextDecoder();
|
|
464
|
-
let buffer = "";
|
|
465
|
-
const reader = stream.getReader();
|
|
466
|
-
try {
|
|
467
|
-
while (true) {
|
|
468
|
-
const { done, value } = await reader.read();
|
|
469
|
-
if (done) break;
|
|
470
|
-
buffer += decoder.decode(value, { stream: true });
|
|
471
|
-
buffer = buffer.replace(/\r\n|\r/g, "\n");
|
|
472
|
-
let sep = buffer.indexOf("\n\n");
|
|
473
|
-
while (sep !== -1) {
|
|
474
|
-
const frame = buffer.slice(0, sep);
|
|
475
|
-
buffer = buffer.slice(sep + 2);
|
|
476
|
-
const parsed = parseFrame(frame);
|
|
477
|
-
if (parsed) yield parsed;
|
|
478
|
-
sep = buffer.indexOf("\n\n");
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
buffer += decoder.decode();
|
|
482
|
-
const parsed = parseFrame(buffer.replace(/\r\n|\r/g, "\n"));
|
|
483
|
-
if (parsed) yield parsed;
|
|
484
|
-
} finally {
|
|
485
|
-
reader.releaseLock();
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
//#endregion
|
|
490
|
-
//#region src/services/chat.ts
|
|
491
|
-
/**
|
|
492
|
-
* Service for the workspace assistant chat: sessions and streamed messages.
|
|
493
|
-
*/
|
|
494
|
-
var Chat = class {
|
|
495
|
-
#api;
|
|
496
|
-
constructor(api) {
|
|
497
|
-
this.#api = api;
|
|
498
|
-
}
|
|
499
|
-
/**
|
|
500
|
-
* List the workspace's chat sessions, most recently active first.
|
|
501
|
-
* @param workspaceSlug - Workspace slug
|
|
502
|
-
* @param query - Optional pagination (limit, after)
|
|
503
|
-
* @returns Promise that resolves with a paginated list of chat sessions
|
|
504
|
-
* @throws {ApiError} if the request fails
|
|
505
|
-
*/
|
|
506
|
-
async listSessions(workspaceSlug, query) {
|
|
507
|
-
const { data } = await this.#api.GET("/workspaces/{workspaceSlug}/chat/sessions/", { params: {
|
|
508
|
-
path: { workspaceSlug },
|
|
509
|
-
query
|
|
510
|
-
} });
|
|
431
|
+
const { data } = await this.#api.GET("/capabilities/connectors/");
|
|
511
432
|
return data;
|
|
512
433
|
}
|
|
513
434
|
/**
|
|
514
|
-
*
|
|
515
|
-
* @
|
|
516
|
-
* @param session - Session creation request
|
|
517
|
-
* @returns Promise that resolves with the created chat session
|
|
518
|
-
* @throws {ApiError} if the request fails
|
|
435
|
+
* List which authentication methods this deployment offers.
|
|
436
|
+
* @returns Promise that resolves with the auth capabilities.
|
|
519
437
|
*/
|
|
520
|
-
async
|
|
521
|
-
const { data } = await this.#api.
|
|
522
|
-
params: { path: { workspaceSlug } },
|
|
523
|
-
body: session
|
|
524
|
-
});
|
|
438
|
+
async getAuthCapabilities() {
|
|
439
|
+
const { data } = await this.#api.GET("/capabilities/auth/");
|
|
525
440
|
return data;
|
|
526
441
|
}
|
|
527
|
-
/**
|
|
528
|
-
* Soft-delete a chat session.
|
|
529
|
-
* @param workspaceSlug - Workspace slug
|
|
530
|
-
* @param sessionId - Session ID
|
|
531
|
-
* @throws {ApiError} if the request fails
|
|
532
|
-
*/
|
|
533
|
-
async deleteSession(workspaceSlug, sessionId) {
|
|
534
|
-
await this.#api.DELETE("/workspaces/{workspaceSlug}/chat/sessions/{sessionId}/", { params: { path: {
|
|
535
|
-
workspaceSlug,
|
|
536
|
-
sessionId
|
|
537
|
-
} } });
|
|
538
|
-
}
|
|
539
|
-
/**
|
|
540
|
-
* List a session's messages in chronological order.
|
|
541
|
-
* @param workspaceSlug - Workspace slug
|
|
542
|
-
* @param sessionId - Session ID
|
|
543
|
-
* @returns Promise that resolves with the session's messages
|
|
544
|
-
* @throws {ApiError} if the request fails
|
|
545
|
-
*/
|
|
546
|
-
async listMessages(workspaceSlug, sessionId) {
|
|
547
|
-
const { data } = await this.#api.GET("/workspaces/{workspaceSlug}/chat/sessions/{sessionId}/messages/", { params: { path: {
|
|
548
|
-
workspaceSlug,
|
|
549
|
-
sessionId
|
|
550
|
-
} } });
|
|
551
|
-
return data;
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Open the raw Server-Sent Events stream of the assistant's reply.
|
|
555
|
-
*
|
|
556
|
-
* Returns the underlying `Response` so callers can handle the
|
|
557
|
-
* `text/event-stream` body themselves. Most callers want
|
|
558
|
-
* {@link streamMessage}, which parses each frame into a typed
|
|
559
|
-
* {@link ChatToken}.
|
|
560
|
-
*
|
|
561
|
-
* @param workspaceSlug - Workspace slug
|
|
562
|
-
* @param sessionId - Session ID
|
|
563
|
-
* @param message - The message to send
|
|
564
|
-
* @returns Promise that resolves with the event-stream response
|
|
565
|
-
* @throws {ApiError} if the request fails
|
|
566
|
-
*/
|
|
567
|
-
async sendMessage(workspaceSlug, sessionId, message) {
|
|
568
|
-
const { response } = await this.#api.POST("/workspaces/{workspaceSlug}/chat/sessions/{sessionId}/messages/", {
|
|
569
|
-
params: { path: {
|
|
570
|
-
workspaceSlug,
|
|
571
|
-
sessionId
|
|
572
|
-
} },
|
|
573
|
-
body: message,
|
|
574
|
-
parseAs: "stream"
|
|
575
|
-
});
|
|
576
|
-
return response;
|
|
577
|
-
}
|
|
578
|
-
/**
|
|
579
|
-
* Send a message and stream the assistant's reply as Server-Sent Events.
|
|
580
|
-
*
|
|
581
|
-
* Yields each {@link ChatToken} delta as it arrives, until the reply ends.
|
|
582
|
-
* Break out of the loop to stop reading. For the raw response, use
|
|
583
|
-
* {@link sendMessage}.
|
|
584
|
-
*
|
|
585
|
-
* @param workspaceSlug - Workspace slug
|
|
586
|
-
* @param sessionId - Session ID
|
|
587
|
-
* @param message - The message to send
|
|
588
|
-
* @yields each {@link ChatToken} delta as it arrives
|
|
589
|
-
* @throws {ApiError} if the request fails to open
|
|
590
|
-
* @throws {NvisyError} if the response has no readable body
|
|
591
|
-
*/
|
|
592
|
-
async *streamMessage(workspaceSlug, sessionId, message) {
|
|
593
|
-
const response = await this.sendMessage(workspaceSlug, sessionId, message);
|
|
594
|
-
if (!response.body) throw new NvisyError("Chat stream response has no body");
|
|
595
|
-
for await (const event of parseSseStream(response.body)) if (event.event === "token") yield JSON.parse(event.data);
|
|
596
|
-
else if (event.event === "error") throw new NvisyError(event.data);
|
|
597
|
-
}
|
|
598
442
|
};
|
|
599
443
|
|
|
600
444
|
//#endregion
|
|
@@ -609,58 +453,58 @@ var Connections = class {
|
|
|
609
453
|
}
|
|
610
454
|
/**
|
|
611
455
|
* List connections in a workspace
|
|
612
|
-
* @param
|
|
456
|
+
* @param workspaceId - Workspace id
|
|
613
457
|
* @param query - Optional query parameters (provider, limit, after)
|
|
614
458
|
* @returns Promise that resolves with a paginated list of connections
|
|
615
459
|
* @throws {ApiError} if the request fails
|
|
616
460
|
*/
|
|
617
|
-
async listConnections(
|
|
618
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
619
|
-
path: {
|
|
461
|
+
async listConnections(workspaceId, query) {
|
|
462
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/connections/", { params: {
|
|
463
|
+
path: { workspaceId },
|
|
620
464
|
query
|
|
621
465
|
} });
|
|
622
466
|
return data;
|
|
623
467
|
}
|
|
624
468
|
/**
|
|
625
469
|
* Create a connection in a workspace
|
|
626
|
-
* @param
|
|
470
|
+
* @param workspaceId - Workspace id
|
|
627
471
|
* @param connection - Connection creation request
|
|
628
472
|
* @returns Promise that resolves with the created connection
|
|
629
473
|
* @throws {ApiError} if the request fails
|
|
630
474
|
*/
|
|
631
|
-
async createConnection(
|
|
632
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
633
|
-
params: { path: {
|
|
475
|
+
async createConnection(workspaceId, connection) {
|
|
476
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/", {
|
|
477
|
+
params: { path: { workspaceId } },
|
|
634
478
|
body: connection
|
|
635
479
|
});
|
|
636
480
|
return data;
|
|
637
481
|
}
|
|
638
482
|
/**
|
|
639
483
|
* Get connection details by ID
|
|
640
|
-
* @param
|
|
484
|
+
* @param workspaceId - Workspace id
|
|
641
485
|
* @param connectionId - Connection ID
|
|
642
486
|
* @returns Promise that resolves with the connection details
|
|
643
487
|
* @throws {ApiError} if the request fails
|
|
644
488
|
*/
|
|
645
|
-
async getConnection(
|
|
646
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
647
|
-
|
|
489
|
+
async getConnection(workspaceId, connectionId) {
|
|
490
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/connections/{connectionId}/", { params: { path: {
|
|
491
|
+
workspaceId,
|
|
648
492
|
connectionId
|
|
649
493
|
} } });
|
|
650
494
|
return data;
|
|
651
495
|
}
|
|
652
496
|
/**
|
|
653
497
|
* Update a connection
|
|
654
|
-
* @param
|
|
498
|
+
* @param workspaceId - Workspace id
|
|
655
499
|
* @param connectionId - Connection ID
|
|
656
500
|
* @param updates - Connection update request
|
|
657
501
|
* @returns Promise that resolves with the updated connection
|
|
658
502
|
* @throws {ApiError} if the request fails
|
|
659
503
|
*/
|
|
660
|
-
async updateConnection(
|
|
661
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
504
|
+
async updateConnection(workspaceId, connectionId, updates) {
|
|
505
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/connections/{connectionId}/", {
|
|
662
506
|
params: { path: {
|
|
663
|
-
|
|
507
|
+
workspaceId,
|
|
664
508
|
connectionId
|
|
665
509
|
} },
|
|
666
510
|
body: updates
|
|
@@ -669,27 +513,27 @@ var Connections = class {
|
|
|
669
513
|
}
|
|
670
514
|
/**
|
|
671
515
|
* Delete a connection
|
|
672
|
-
* @param
|
|
516
|
+
* @param workspaceId - Workspace id
|
|
673
517
|
* @param connectionId - Connection ID
|
|
674
518
|
* @returns Promise that resolves when the connection is deleted
|
|
675
519
|
* @throws {ApiError} if the request fails
|
|
676
520
|
*/
|
|
677
|
-
async deleteConnection(
|
|
678
|
-
await this.#api.DELETE("/workspaces/{
|
|
679
|
-
|
|
521
|
+
async deleteConnection(workspaceId, connectionId) {
|
|
522
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/connections/{connectionId}/", { params: { path: {
|
|
523
|
+
workspaceId,
|
|
680
524
|
connectionId
|
|
681
525
|
} } });
|
|
682
526
|
}
|
|
683
527
|
/**
|
|
684
528
|
* Verify a connection's configuration and credentials
|
|
685
|
-
* @param
|
|
529
|
+
* @param workspaceId - Workspace id
|
|
686
530
|
* @param connectionId - Connection ID
|
|
687
531
|
* @returns Promise that resolves with the verification result
|
|
688
532
|
* @throws {ApiError} if the request fails
|
|
689
533
|
*/
|
|
690
|
-
async verifyConnection(
|
|
691
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
692
|
-
|
|
534
|
+
async verifyConnection(workspaceId, connectionId) {
|
|
535
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/{connectionId}/verify/", { params: { path: {
|
|
536
|
+
workspaceId,
|
|
693
537
|
connectionId
|
|
694
538
|
} } });
|
|
695
539
|
return data;
|
|
@@ -701,16 +545,16 @@ var Connections = class {
|
|
|
701
545
|
* provider redirects back and the connection is created. Navigate the
|
|
702
546
|
* browser to the URL (a full-page redirect, not a fetch) to continue.
|
|
703
547
|
*
|
|
704
|
-
* @param
|
|
548
|
+
* @param workspaceId - Workspace id
|
|
705
549
|
* @param provider - The file-service provider to connect
|
|
706
550
|
* @param request - Display name for the connection and optional sync root
|
|
707
551
|
* @returns Promise that resolves with the provider authorize URL
|
|
708
552
|
* @throws {ApiError} if the request fails
|
|
709
553
|
*/
|
|
710
|
-
async startFileServiceOAuth(
|
|
711
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
554
|
+
async startFileServiceOAuth(workspaceId, provider, request) {
|
|
555
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/oauth/{provider}/start/", {
|
|
712
556
|
params: { path: {
|
|
713
|
-
|
|
557
|
+
workspaceId,
|
|
714
558
|
provider
|
|
715
559
|
} },
|
|
716
560
|
body: request
|
|
@@ -724,16 +568,16 @@ var Connections = class {
|
|
|
724
568
|
* already-imported files are skipped. Returns the created sync — poll it for
|
|
725
569
|
* completion.
|
|
726
570
|
*
|
|
727
|
-
* @param
|
|
571
|
+
* @param workspaceId - Workspace id
|
|
728
572
|
* @param connectionId - Connection ID
|
|
729
573
|
* @param request - The picker-selected files to import
|
|
730
574
|
* @returns Promise that resolves with the created connection sync
|
|
731
575
|
* @throws {ApiError} if the request fails
|
|
732
576
|
*/
|
|
733
|
-
async importFiles(
|
|
734
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
577
|
+
async importFiles(workspaceId, connectionId, request) {
|
|
578
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/{connectionId}/import/", {
|
|
735
579
|
params: { path: {
|
|
736
|
-
|
|
580
|
+
workspaceId,
|
|
737
581
|
connectionId
|
|
738
582
|
} },
|
|
739
583
|
body: request
|
|
@@ -747,16 +591,16 @@ var Connections = class {
|
|
|
747
591
|
* file, never overwriting the source. Returns the created sync — poll it for
|
|
748
592
|
* completion.
|
|
749
593
|
*
|
|
750
|
-
* @param
|
|
594
|
+
* @param workspaceId - Workspace id
|
|
751
595
|
* @param connectionId - Connection ID
|
|
752
596
|
* @param request - The workspace file ids to export
|
|
753
597
|
* @returns Promise that resolves with the created connection sync
|
|
754
598
|
* @throws {ApiError} if the request fails
|
|
755
599
|
*/
|
|
756
|
-
async exportFiles(
|
|
757
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
600
|
+
async exportFiles(workspaceId, connectionId, request) {
|
|
601
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/{connectionId}/export/", {
|
|
758
602
|
params: { path: {
|
|
759
|
-
|
|
603
|
+
workspaceId,
|
|
760
604
|
connectionId
|
|
761
605
|
} },
|
|
762
606
|
body: request
|
|
@@ -770,16 +614,16 @@ var Connections = class {
|
|
|
770
614
|
* minted from the connection's stored credentials and is short-lived; the
|
|
771
615
|
* refresh token is never returned.
|
|
772
616
|
*
|
|
773
|
-
* @param
|
|
617
|
+
* @param workspaceId - Workspace id
|
|
774
618
|
* @param connectionId - Connection ID
|
|
775
619
|
* @param request - Optional picker resource (defaults to the connection's)
|
|
776
620
|
* @returns Promise that resolves with the short-lived picker token
|
|
777
621
|
* @throws {ApiError} if the request fails
|
|
778
622
|
*/
|
|
779
|
-
async getPickerToken(
|
|
780
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
623
|
+
async getPickerToken(workspaceId, connectionId, request = {}) {
|
|
624
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/{connectionId}/picker-token/", {
|
|
781
625
|
params: { path: {
|
|
782
|
-
|
|
626
|
+
workspaceId,
|
|
783
627
|
connectionId
|
|
784
628
|
} },
|
|
785
629
|
body: request
|
|
@@ -788,6 +632,60 @@ var Connections = class {
|
|
|
788
632
|
}
|
|
789
633
|
};
|
|
790
634
|
|
|
635
|
+
//#endregion
|
|
636
|
+
//#region src/services/sse.ts
|
|
637
|
+
/** Parse one already-split frame (its lines) into an event, or null if empty. */
|
|
638
|
+
function parseFrame(frame) {
|
|
639
|
+
let event = "message";
|
|
640
|
+
const data = [];
|
|
641
|
+
for (const line of frame.split("\n")) {
|
|
642
|
+
if (line === "" || line.startsWith(":")) continue;
|
|
643
|
+
const colon = line.indexOf(":");
|
|
644
|
+
const field = colon === -1 ? line : line.slice(0, colon);
|
|
645
|
+
let value = colon === -1 ? "" : line.slice(colon + 1);
|
|
646
|
+
if (value.startsWith(" ")) value = value.slice(1);
|
|
647
|
+
if (field === "event") event = value;
|
|
648
|
+
else if (field === "data") data.push(value);
|
|
649
|
+
}
|
|
650
|
+
if (data.length === 0) return null;
|
|
651
|
+
return {
|
|
652
|
+
event,
|
|
653
|
+
data: data.join("\n")
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Decode a byte stream into SSE events.
|
|
658
|
+
*
|
|
659
|
+
* @param stream - the response body, a stream of UTF-8 bytes
|
|
660
|
+
* @yields each complete SSE event as it arrives
|
|
661
|
+
*/
|
|
662
|
+
async function* parseSseStream(stream) {
|
|
663
|
+
const decoder = new TextDecoder();
|
|
664
|
+
let buffer = "";
|
|
665
|
+
const reader = stream.getReader();
|
|
666
|
+
try {
|
|
667
|
+
while (true) {
|
|
668
|
+
const { done, value } = await reader.read();
|
|
669
|
+
if (done) break;
|
|
670
|
+
buffer += decoder.decode(value, { stream: true });
|
|
671
|
+
buffer = buffer.replace(/\r\n|\r/g, "\n");
|
|
672
|
+
let sep = buffer.indexOf("\n\n");
|
|
673
|
+
while (sep !== -1) {
|
|
674
|
+
const frame = buffer.slice(0, sep);
|
|
675
|
+
buffer = buffer.slice(sep + 2);
|
|
676
|
+
const parsed = parseFrame(frame);
|
|
677
|
+
if (parsed) yield parsed;
|
|
678
|
+
sep = buffer.indexOf("\n\n");
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
buffer += decoder.decode();
|
|
682
|
+
const parsed = parseFrame(buffer.replace(/\r\n|\r/g, "\n"));
|
|
683
|
+
if (parsed) yield parsed;
|
|
684
|
+
} finally {
|
|
685
|
+
reader.releaseLock();
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
791
689
|
//#endregion
|
|
792
690
|
//#region src/services/detections.ts
|
|
793
691
|
/**
|
|
@@ -801,33 +699,33 @@ var Detections = class {
|
|
|
801
699
|
}
|
|
802
700
|
/**
|
|
803
701
|
* List all detections in a workspace
|
|
804
|
-
* @param
|
|
702
|
+
* @param workspaceId - Workspace id
|
|
805
703
|
* @param query - Optional pagination and filters (status, fileId,
|
|
806
704
|
* pipelineId, triggerType, triggeredBy, limit, after)
|
|
807
705
|
* @returns Promise that resolves with a paginated list of detections
|
|
808
706
|
* @throws {ApiError} if the request fails
|
|
809
707
|
*/
|
|
810
|
-
async listDetections(
|
|
811
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
812
|
-
path: {
|
|
708
|
+
async listDetections(workspaceId, query) {
|
|
709
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/pipelines/detections/", { params: {
|
|
710
|
+
path: { workspaceId },
|
|
813
711
|
query
|
|
814
712
|
} });
|
|
815
713
|
return data;
|
|
816
714
|
}
|
|
817
715
|
/**
|
|
818
716
|
* List detections for a specific pipeline
|
|
819
|
-
* @param
|
|
820
|
-
* @param
|
|
717
|
+
* @param workspaceId - Workspace id
|
|
718
|
+
* @param pipelineId - Pipeline id
|
|
821
719
|
* @param query - Optional pagination and filters (status, fileId,
|
|
822
720
|
* triggerType, triggeredBy, limit, after)
|
|
823
721
|
* @returns Promise that resolves with a paginated list of detections
|
|
824
722
|
* @throws {ApiError} if the request fails
|
|
825
723
|
*/
|
|
826
|
-
async listPipelineDetections(
|
|
827
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
724
|
+
async listPipelineDetections(workspaceId, pipelineId, query) {
|
|
725
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/pipelines/{pipelineId}/detections/", { params: {
|
|
828
726
|
path: {
|
|
829
|
-
|
|
830
|
-
|
|
727
|
+
workspaceId,
|
|
728
|
+
pipelineId
|
|
831
729
|
},
|
|
832
730
|
query
|
|
833
731
|
} });
|
|
@@ -835,46 +733,60 @@ var Detections = class {
|
|
|
835
733
|
}
|
|
836
734
|
/**
|
|
837
735
|
* Start a new detection over a file for a pipeline
|
|
838
|
-
* @param
|
|
839
|
-
* @param
|
|
736
|
+
* @param workspaceId - Workspace id
|
|
737
|
+
* @param pipelineId - Pipeline id
|
|
840
738
|
* @param detection - Detection creation request
|
|
841
739
|
* @returns Promise that resolves with the created detection
|
|
842
740
|
* @throws {ApiError} if the request fails
|
|
843
741
|
*/
|
|
844
|
-
async createDetection(
|
|
845
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
742
|
+
async createDetection(workspaceId, pipelineId, detection) {
|
|
743
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/pipelines/{pipelineId}/detections/", {
|
|
846
744
|
params: { path: {
|
|
847
|
-
|
|
848
|
-
|
|
745
|
+
workspaceId,
|
|
746
|
+
pipelineId
|
|
849
747
|
} },
|
|
850
748
|
body: detection
|
|
851
749
|
});
|
|
852
750
|
return data;
|
|
853
751
|
}
|
|
854
752
|
/**
|
|
753
|
+
* Start an ad-hoc detection over a document without a saved pipeline.
|
|
754
|
+
* @param workspaceId - Workspace id
|
|
755
|
+
* @param detection - Ad-hoc detection creation request
|
|
756
|
+
* @returns Promise that resolves with the created detection
|
|
757
|
+
* @throws {ApiError} if the request fails
|
|
758
|
+
*/
|
|
759
|
+
async createAdhocDetection(workspaceId, detection) {
|
|
760
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/detections/", {
|
|
761
|
+
params: { path: { workspaceId } },
|
|
762
|
+
body: detection
|
|
763
|
+
});
|
|
764
|
+
return data;
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
855
767
|
* Get detection details by ID
|
|
856
|
-
* @param
|
|
768
|
+
* @param workspaceId - Workspace id
|
|
857
769
|
* @param detectionId - Detection ID
|
|
858
770
|
* @returns Promise that resolves with the detection details
|
|
859
771
|
* @throws {ApiError} if the request fails
|
|
860
772
|
*/
|
|
861
|
-
async getDetection(
|
|
862
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
863
|
-
|
|
773
|
+
async getDetection(workspaceId, detectionId) {
|
|
774
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/detections/{detectionId}/", { params: { path: {
|
|
775
|
+
workspaceId,
|
|
864
776
|
detectionId
|
|
865
777
|
} } });
|
|
866
778
|
return data;
|
|
867
779
|
}
|
|
868
780
|
/**
|
|
869
781
|
* Get a detection's analysis (audit)
|
|
870
|
-
* @param
|
|
782
|
+
* @param workspaceId - Workspace id
|
|
871
783
|
* @param detectionId - Detection ID
|
|
872
784
|
* @returns Promise that resolves with the audit
|
|
873
785
|
* @throws {ApiError} if the request fails
|
|
874
786
|
*/
|
|
875
|
-
async getAnalysis(
|
|
876
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
877
|
-
|
|
787
|
+
async getAnalysis(workspaceId, detectionId) {
|
|
788
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/detections/{detectionId}/analysis/", { params: { path: {
|
|
789
|
+
workspaceId,
|
|
878
790
|
detectionId
|
|
879
791
|
} } });
|
|
880
792
|
return data;
|
|
@@ -887,14 +799,14 @@ var Detections = class {
|
|
|
887
799
|
* can search the extracted content and add entities the analysis missed. A
|
|
888
800
|
* detection whose analysis ran no enricher has no intermediates and 404s.
|
|
889
801
|
*
|
|
890
|
-
* @param
|
|
802
|
+
* @param workspaceId - Workspace id
|
|
891
803
|
* @param detectionId - Detection ID
|
|
892
804
|
* @returns Promise that resolves with the artifact set
|
|
893
805
|
* @throws {ApiError} if the request fails (404 when there are none)
|
|
894
806
|
*/
|
|
895
|
-
async getIntermediates(
|
|
896
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
897
|
-
|
|
807
|
+
async getIntermediates(workspaceId, detectionId) {
|
|
808
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/detections/{detectionId}/intermediates/", { params: { path: {
|
|
809
|
+
workspaceId,
|
|
898
810
|
detectionId
|
|
899
811
|
} } });
|
|
900
812
|
return data;
|
|
@@ -905,17 +817,17 @@ var Detections = class {
|
|
|
905
817
|
* `format` is `csv` (default) — a zip of entities.csv, provenance.csv, and
|
|
906
818
|
* reviews.csv — or `json`, a pretty-printed JSON file.
|
|
907
819
|
*
|
|
908
|
-
* @param
|
|
820
|
+
* @param workspaceId - Workspace id
|
|
909
821
|
* @param detectionId - Detection ID
|
|
910
822
|
* @param query - Optional output format (`csv` default, or `json`)
|
|
911
823
|
* @returns Promise that resolves with the file response
|
|
912
824
|
* @throws {ApiError} if the request fails
|
|
913
825
|
*/
|
|
914
|
-
async downloadAudit(
|
|
915
|
-
const { response } = await this.#api.GET("/workspaces/{
|
|
826
|
+
async downloadAudit(workspaceId, detectionId, query) {
|
|
827
|
+
const { response } = await this.#api.GET("/workspaces/{workspaceId}/detections/{detectionId}/audit/", {
|
|
916
828
|
params: {
|
|
917
829
|
path: {
|
|
918
|
-
|
|
830
|
+
workspaceId,
|
|
919
831
|
detectionId
|
|
920
832
|
},
|
|
921
833
|
query
|
|
@@ -932,15 +844,15 @@ var Detections = class {
|
|
|
932
844
|
* {@link streamEvents}, which parses each frame into a typed
|
|
933
845
|
* {@link DetectionStatusEvent}.
|
|
934
846
|
*
|
|
935
|
-
* @param
|
|
847
|
+
* @param workspaceId - Workspace id
|
|
936
848
|
* @param detectionId - Detection ID
|
|
937
849
|
* @returns Promise that resolves with the event-stream response
|
|
938
850
|
* @throws {ApiError} if the request fails
|
|
939
851
|
*/
|
|
940
|
-
async events(
|
|
941
|
-
const { response } = await this.#api.GET("/workspaces/{
|
|
852
|
+
async events(workspaceId, detectionId) {
|
|
853
|
+
const { response } = await this.#api.GET("/workspaces/{workspaceId}/detections/{detectionId}/events/", {
|
|
942
854
|
params: { path: {
|
|
943
|
-
|
|
855
|
+
workspaceId,
|
|
944
856
|
detectionId
|
|
945
857
|
} },
|
|
946
858
|
parseAs: "stream"
|
|
@@ -954,29 +866,29 @@ var Detections = class {
|
|
|
954
866
|
* once the detection settles. Break out of the loop to close the stream
|
|
955
867
|
* early. For the raw response, use {@link events}.
|
|
956
868
|
*
|
|
957
|
-
* @param
|
|
869
|
+
* @param workspaceId - Workspace id
|
|
958
870
|
* @param detectionId - Detection ID
|
|
959
871
|
* @yields each {@link DetectionStatusEvent} as it arrives
|
|
960
872
|
* @throws {ApiError} if the request fails to open
|
|
961
873
|
* @throws {NvisyError} if the response has no readable body
|
|
962
874
|
*/
|
|
963
|
-
async *streamEvents(
|
|
964
|
-
const response = await this.events(
|
|
875
|
+
async *streamEvents(workspaceId, detectionId) {
|
|
876
|
+
const response = await this.events(workspaceId, detectionId);
|
|
965
877
|
if (!response.body) throw new NvisyError("Event stream response has no body");
|
|
966
878
|
for await (const event of parseSseStream(response.body)) if (event.event === "status") yield JSON.parse(event.data);
|
|
967
879
|
}
|
|
968
880
|
/**
|
|
969
881
|
* List the redactions produced from a detection
|
|
970
|
-
* @param
|
|
882
|
+
* @param workspaceId - Workspace id
|
|
971
883
|
* @param detectionId - Detection ID
|
|
972
884
|
* @param query - Optional pagination (limit, after)
|
|
973
885
|
* @returns Promise that resolves with a paginated list of redactions
|
|
974
886
|
* @throws {ApiError} if the request fails
|
|
975
887
|
*/
|
|
976
|
-
async listRedactions(
|
|
977
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
888
|
+
async listRedactions(workspaceId, detectionId, query) {
|
|
889
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/detections/{detectionId}/redactions/", { params: {
|
|
978
890
|
path: {
|
|
979
|
-
|
|
891
|
+
workspaceId,
|
|
980
892
|
detectionId
|
|
981
893
|
},
|
|
982
894
|
query
|
|
@@ -985,16 +897,16 @@ var Detections = class {
|
|
|
985
897
|
}
|
|
986
898
|
/**
|
|
987
899
|
* Redact a detection, producing a redaction result
|
|
988
|
-
* @param
|
|
900
|
+
* @param workspaceId - Workspace id
|
|
989
901
|
* @param detectionId - Detection ID
|
|
990
902
|
* @param redaction - Redaction request (optional reviewer edits)
|
|
991
903
|
* @returns Promise that resolves with the created redaction result
|
|
992
904
|
* @throws {ApiError} if the request fails
|
|
993
905
|
*/
|
|
994
|
-
async createRedaction(
|
|
995
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
906
|
+
async createRedaction(workspaceId, detectionId, redaction) {
|
|
907
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/detections/{detectionId}/redactions/", {
|
|
996
908
|
params: { path: {
|
|
997
|
-
|
|
909
|
+
workspaceId,
|
|
998
910
|
detectionId
|
|
999
911
|
} },
|
|
1000
912
|
body: redaction
|
|
@@ -1004,31 +916,31 @@ var Detections = class {
|
|
|
1004
916
|
};
|
|
1005
917
|
|
|
1006
918
|
//#endregion
|
|
1007
|
-
//#region src/services/
|
|
919
|
+
//#region src/services/documents.ts
|
|
1008
920
|
/**
|
|
1009
|
-
* Service for handling
|
|
921
|
+
* Service for handling document operations, including review assignment.
|
|
1010
922
|
*/
|
|
1011
|
-
var
|
|
923
|
+
var Documents = class {
|
|
1012
924
|
#api;
|
|
1013
925
|
constructor(api) {
|
|
1014
926
|
this.#api = api;
|
|
1015
927
|
}
|
|
1016
928
|
/**
|
|
1017
|
-
* Upload one or more
|
|
1018
|
-
* @param
|
|
1019
|
-
* @param
|
|
1020
|
-
* @returns Promise that resolves with the uploaded
|
|
929
|
+
* Upload one or more documents to a workspace
|
|
930
|
+
* @param workspaceId - Workspace id
|
|
931
|
+
* @param documents - Document or array of documents to upload
|
|
932
|
+
* @returns Promise that resolves with the uploaded document metadata
|
|
1021
933
|
* @throws {ApiError} if the request fails
|
|
1022
934
|
*/
|
|
1023
|
-
async
|
|
935
|
+
async uploadDocuments(workspaceId, documents) {
|
|
1024
936
|
const formData = new FormData();
|
|
1025
|
-
const
|
|
1026
|
-
for (const
|
|
1027
|
-
const name =
|
|
1028
|
-
formData.append("
|
|
937
|
+
const documentArray = Array.isArray(documents) ? documents : [documents];
|
|
938
|
+
for (const document of documentArray) {
|
|
939
|
+
const name = document instanceof File ? document.name : "document";
|
|
940
|
+
formData.append("documents", document, name);
|
|
1029
941
|
}
|
|
1030
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1031
|
-
params: { path: {
|
|
942
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/documents/", {
|
|
943
|
+
params: { path: { workspaceId } },
|
|
1032
944
|
body: formData,
|
|
1033
945
|
bodySerializer: (formData) => formData,
|
|
1034
946
|
headers: { "Content-Type": null }
|
|
@@ -1036,101 +948,133 @@ var Files = class {
|
|
|
1036
948
|
return data;
|
|
1037
949
|
}
|
|
1038
950
|
/**
|
|
1039
|
-
* List
|
|
1040
|
-
* @param
|
|
951
|
+
* List documents in a workspace
|
|
952
|
+
* @param workspaceId - Workspace id
|
|
1041
953
|
* @param query - Optional query parameters (formats, modality, hash, search,
|
|
1042
954
|
* limit, after)
|
|
1043
|
-
* @returns Promise that resolves with a paginated list of
|
|
955
|
+
* @returns Promise that resolves with a paginated list of documents
|
|
1044
956
|
* @throws {ApiError} if the request fails
|
|
1045
957
|
*/
|
|
1046
|
-
async
|
|
1047
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1048
|
-
path: {
|
|
958
|
+
async listDocuments(workspaceId, query) {
|
|
959
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/documents/", { params: {
|
|
960
|
+
path: { workspaceId },
|
|
1049
961
|
query
|
|
1050
962
|
} });
|
|
1051
963
|
return data;
|
|
1052
964
|
}
|
|
1053
965
|
/**
|
|
1054
|
-
* Get
|
|
1055
|
-
* @param
|
|
1056
|
-
* @param
|
|
1057
|
-
* @returns Promise that resolves with the
|
|
966
|
+
* Get document metadata by ID
|
|
967
|
+
* @param workspaceId - Workspace id
|
|
968
|
+
* @param documentId - Document ID
|
|
969
|
+
* @returns Promise that resolves with the document metadata
|
|
1058
970
|
* @throws {ApiError} if the request fails
|
|
1059
971
|
*/
|
|
1060
|
-
async
|
|
1061
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1062
|
-
|
|
1063
|
-
|
|
972
|
+
async getDocument(workspaceId, documentId) {
|
|
973
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/documents/{documentId}/", { params: { path: {
|
|
974
|
+
workspaceId,
|
|
975
|
+
documentId
|
|
1064
976
|
} } });
|
|
1065
977
|
return data;
|
|
1066
978
|
}
|
|
1067
979
|
/**
|
|
1068
|
-
* Download a
|
|
1069
|
-
* @param
|
|
1070
|
-
* @param
|
|
1071
|
-
* @returns Promise that resolves with the
|
|
980
|
+
* Download a document by ID
|
|
981
|
+
* @param workspaceId - Workspace id
|
|
982
|
+
* @param documentId - Document ID
|
|
983
|
+
* @returns Promise that resolves with the document response
|
|
1072
984
|
* @throws {ApiError} if the request fails
|
|
1073
985
|
*/
|
|
1074
|
-
async
|
|
1075
|
-
const { response } = await this.#api.GET("/workspaces/{
|
|
986
|
+
async downloadDocument(workspaceId, documentId) {
|
|
987
|
+
const { response } = await this.#api.GET("/workspaces/{workspaceId}/documents/{documentId}/content/", {
|
|
1076
988
|
params: { path: {
|
|
1077
|
-
|
|
1078
|
-
|
|
989
|
+
workspaceId,
|
|
990
|
+
documentId
|
|
1079
991
|
} },
|
|
1080
992
|
parseAs: "stream"
|
|
1081
993
|
});
|
|
1082
994
|
return response;
|
|
1083
995
|
}
|
|
1084
996
|
/**
|
|
1085
|
-
* Update a
|
|
1086
|
-
* @param
|
|
1087
|
-
* @param
|
|
1088
|
-
* @param updates -
|
|
1089
|
-
* @returns Promise that resolves with the updated
|
|
997
|
+
* Update a document's metadata
|
|
998
|
+
* @param workspaceId - Workspace id
|
|
999
|
+
* @param documentId - Document ID
|
|
1000
|
+
* @param updates - Document update request
|
|
1001
|
+
* @returns Promise that resolves with the updated document
|
|
1090
1002
|
* @throws {ApiError} if the request fails
|
|
1091
1003
|
*/
|
|
1092
|
-
async
|
|
1093
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
1004
|
+
async updateDocument(workspaceId, documentId, updates) {
|
|
1005
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/documents/{documentId}/", {
|
|
1094
1006
|
params: { path: {
|
|
1095
|
-
|
|
1096
|
-
|
|
1007
|
+
workspaceId,
|
|
1008
|
+
documentId
|
|
1097
1009
|
} },
|
|
1098
1010
|
body: updates
|
|
1099
1011
|
});
|
|
1100
1012
|
return data;
|
|
1101
1013
|
}
|
|
1102
1014
|
/**
|
|
1103
|
-
* Delete a
|
|
1104
|
-
* @param
|
|
1105
|
-
* @param
|
|
1106
|
-
* @returns Promise that resolves when the
|
|
1015
|
+
* Delete a document
|
|
1016
|
+
* @param workspaceId - Workspace id
|
|
1017
|
+
* @param documentId - Document ID
|
|
1018
|
+
* @returns Promise that resolves when the document is deleted
|
|
1107
1019
|
* @throws {ApiError} if the request fails
|
|
1108
1020
|
*/
|
|
1109
|
-
async
|
|
1110
|
-
await this.#api.DELETE("/workspaces/{
|
|
1111
|
-
|
|
1112
|
-
|
|
1021
|
+
async deleteDocument(workspaceId, documentId) {
|
|
1022
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/documents/{documentId}/", { params: { path: {
|
|
1023
|
+
workspaceId,
|
|
1024
|
+
documentId
|
|
1113
1025
|
} } });
|
|
1114
1026
|
}
|
|
1115
1027
|
/**
|
|
1116
|
-
* Delete several
|
|
1028
|
+
* Delete several documents in one call.
|
|
1117
1029
|
*
|
|
1118
|
-
* Idempotent: ids resolving to live
|
|
1119
|
-
* returned in `deleted`; unknown, already-deleted, or out-of-workspace
|
|
1120
|
-
* are returned in `skipped`. Deletion is permanent.
|
|
1030
|
+
* Idempotent: ids resolving to live documents in the workspace are removed
|
|
1031
|
+
* and returned in `deleted`; unknown, already-deleted, or out-of-workspace
|
|
1032
|
+
* ids are returned in `skipped`. Deletion is permanent.
|
|
1121
1033
|
*
|
|
1122
|
-
* @param
|
|
1123
|
-
* @param
|
|
1034
|
+
* @param workspaceId - Workspace id
|
|
1035
|
+
* @param documentIds - The document IDs to delete
|
|
1124
1036
|
* @returns Promise that resolves with the deleted and skipped ids
|
|
1125
1037
|
* @throws {ApiError} if the request fails
|
|
1126
1038
|
*/
|
|
1127
|
-
async
|
|
1128
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1129
|
-
params: { path: {
|
|
1130
|
-
body: {
|
|
1039
|
+
async deleteDocuments(workspaceId, documentIds) {
|
|
1040
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/documents/delete/", {
|
|
1041
|
+
params: { path: { workspaceId } },
|
|
1042
|
+
body: { documentIds }
|
|
1131
1043
|
});
|
|
1132
1044
|
return data;
|
|
1133
1045
|
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Assign a document for review, opening a review thread.
|
|
1048
|
+
* @param workspaceId - Workspace id
|
|
1049
|
+
* @param documentId - Document ID
|
|
1050
|
+
* @param assignment - Review assignment request
|
|
1051
|
+
* @returns Promise that resolves with the review thread
|
|
1052
|
+
* @throws {ApiError} if the request fails
|
|
1053
|
+
*/
|
|
1054
|
+
async assignReview(workspaceId, documentId, assignment) {
|
|
1055
|
+
const { data } = await this.#api.PUT("/workspaces/{workspaceId}/documents/{documentId}/review/assign/", {
|
|
1056
|
+
params: { path: {
|
|
1057
|
+
workspaceId,
|
|
1058
|
+
documentId
|
|
1059
|
+
} },
|
|
1060
|
+
body: assignment
|
|
1061
|
+
});
|
|
1062
|
+
return data;
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* Mark a document's review as verified (resolved).
|
|
1066
|
+
* @param workspaceId - Workspace id
|
|
1067
|
+
* @param documentId - Document ID
|
|
1068
|
+
* @returns Promise that resolves with the review thread
|
|
1069
|
+
* @throws {ApiError} if the request fails
|
|
1070
|
+
*/
|
|
1071
|
+
async verifyReview(workspaceId, documentId) {
|
|
1072
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/documents/{documentId}/review/verify/", { params: { path: {
|
|
1073
|
+
workspaceId,
|
|
1074
|
+
documentId
|
|
1075
|
+
} } });
|
|
1076
|
+
return data;
|
|
1077
|
+
}
|
|
1134
1078
|
};
|
|
1135
1079
|
|
|
1136
1080
|
//#endregion
|
|
@@ -1150,52 +1094,52 @@ var Invites = class {
|
|
|
1150
1094
|
* @returns Promise that resolves with a paginated list of invitations
|
|
1151
1095
|
* @throws {ApiError} if the request fails
|
|
1152
1096
|
*/
|
|
1153
|
-
async listInvites(
|
|
1154
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1155
|
-
path: {
|
|
1097
|
+
async listInvites(workspaceId, query) {
|
|
1098
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/invites/", { params: {
|
|
1099
|
+
path: { workspaceId },
|
|
1156
1100
|
query
|
|
1157
1101
|
} });
|
|
1158
1102
|
return data;
|
|
1159
1103
|
}
|
|
1160
1104
|
/**
|
|
1161
1105
|
* Send an invitation to join a workspace
|
|
1162
|
-
* @param
|
|
1106
|
+
* @param workspaceId - Workspace id
|
|
1163
1107
|
* @param invite - Invitation request
|
|
1164
1108
|
* @returns Promise that resolves with the sent invitation
|
|
1165
1109
|
* @throws {ApiError} if the request fails
|
|
1166
1110
|
*/
|
|
1167
|
-
async sendInvite(
|
|
1168
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1169
|
-
params: { path: {
|
|
1111
|
+
async sendInvite(workspaceId, invite) {
|
|
1112
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/invites/", {
|
|
1113
|
+
params: { path: { workspaceId } },
|
|
1170
1114
|
body: invite
|
|
1171
1115
|
});
|
|
1172
1116
|
return data;
|
|
1173
1117
|
}
|
|
1174
1118
|
/**
|
|
1175
1119
|
* Cancel a pending invitation
|
|
1176
|
-
* @param
|
|
1120
|
+
* @param workspaceId - Workspace id
|
|
1177
1121
|
* @param inviteId - Invite ID
|
|
1178
1122
|
* @returns Promise that resolves when the invitation is canceled
|
|
1179
1123
|
* @throws {ApiError} if the request fails
|
|
1180
1124
|
*/
|
|
1181
|
-
async cancelInvite(
|
|
1182
|
-
await this.#api.DELETE("/workspaces/{
|
|
1183
|
-
|
|
1125
|
+
async cancelInvite(workspaceId, inviteId) {
|
|
1126
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/invites/{inviteId}/", { params: { path: {
|
|
1127
|
+
workspaceId,
|
|
1184
1128
|
inviteId
|
|
1185
1129
|
} } });
|
|
1186
1130
|
}
|
|
1187
1131
|
/**
|
|
1188
1132
|
* Reply to an invitation (accept or decline)
|
|
1189
|
-
* @param
|
|
1133
|
+
* @param workspaceId - Workspace id
|
|
1190
1134
|
* @param inviteId - Invite ID
|
|
1191
1135
|
* @param reply - Reply request
|
|
1192
1136
|
* @returns Promise that resolves with the updated invitation
|
|
1193
1137
|
* @throws {ApiError} if the request fails
|
|
1194
1138
|
*/
|
|
1195
|
-
async replyToInvite(
|
|
1196
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1139
|
+
async replyToInvite(workspaceId, inviteId, reply) {
|
|
1140
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/invites/{inviteId}/", {
|
|
1197
1141
|
params: { path: {
|
|
1198
|
-
|
|
1142
|
+
workspaceId,
|
|
1199
1143
|
inviteId
|
|
1200
1144
|
} },
|
|
1201
1145
|
body: reply
|
|
@@ -1204,14 +1148,14 @@ var Invites = class {
|
|
|
1204
1148
|
}
|
|
1205
1149
|
/**
|
|
1206
1150
|
* Generate a shareable invite code for a workspace
|
|
1207
|
-
* @param
|
|
1151
|
+
* @param workspaceId - Workspace id
|
|
1208
1152
|
* @param options - Invite code generation options
|
|
1209
1153
|
* @returns Promise that resolves with the generated invite code
|
|
1210
1154
|
* @throws {ApiError} if the request fails
|
|
1211
1155
|
*/
|
|
1212
|
-
async generateInviteCode(
|
|
1213
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1214
|
-
params: { path: {
|
|
1156
|
+
async generateInviteCode(workspaceId, options) {
|
|
1157
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/invites/code/", {
|
|
1158
|
+
params: { path: { workspaceId } },
|
|
1215
1159
|
body: options
|
|
1216
1160
|
});
|
|
1217
1161
|
return data;
|
|
@@ -1219,16 +1163,16 @@ var Invites = class {
|
|
|
1219
1163
|
/**
|
|
1220
1164
|
* Reply to an invite code (accept or decline)
|
|
1221
1165
|
* @param inviteCode - The invite code
|
|
1222
|
-
* @param reply -
|
|
1166
|
+
* @param reply - Reply request (accept or decline the invitation)
|
|
1223
1167
|
* @returns Promise that resolves with the member details if accepted, null if declined
|
|
1224
1168
|
* @throws {ApiError} if the request fails
|
|
1225
1169
|
*/
|
|
1226
1170
|
async replyToInviteCode(inviteCode, reply) {
|
|
1227
1171
|
const { data } = await this.#api.POST("/invites/code/{inviteCode}/", {
|
|
1228
1172
|
params: { path: { inviteCode } },
|
|
1229
|
-
body: reply
|
|
1173
|
+
body: reply
|
|
1230
1174
|
});
|
|
1231
|
-
return data;
|
|
1175
|
+
return data ?? null;
|
|
1232
1176
|
}
|
|
1233
1177
|
/**
|
|
1234
1178
|
* Preview an invite code without joining
|
|
@@ -1254,45 +1198,45 @@ var Members = class {
|
|
|
1254
1198
|
}
|
|
1255
1199
|
/**
|
|
1256
1200
|
* List members of a workspace
|
|
1257
|
-
* @param
|
|
1201
|
+
* @param workspaceId - Workspace id
|
|
1258
1202
|
* @param query - Optional query parameters (role, has2fa, sortBy, order, limit, after)
|
|
1259
1203
|
* @returns Promise that resolves with a paginated list of members
|
|
1260
1204
|
* @throws {ApiError} if the request fails
|
|
1261
1205
|
*/
|
|
1262
|
-
async listMembers(
|
|
1263
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1264
|
-
path: {
|
|
1206
|
+
async listMembers(workspaceId, query) {
|
|
1207
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/members/", { params: {
|
|
1208
|
+
path: { workspaceId },
|
|
1265
1209
|
query
|
|
1266
1210
|
} });
|
|
1267
1211
|
return data;
|
|
1268
1212
|
}
|
|
1269
1213
|
/**
|
|
1270
|
-
* Get member details by
|
|
1271
|
-
* @param
|
|
1272
|
-
* @param
|
|
1214
|
+
* Get member details by account id
|
|
1215
|
+
* @param workspaceId - Workspace id
|
|
1216
|
+
* @param accountId - Member account id
|
|
1273
1217
|
* @returns Promise that resolves with the member details
|
|
1274
1218
|
* @throws {ApiError} if the request fails
|
|
1275
1219
|
*/
|
|
1276
|
-
async getMember(
|
|
1277
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1278
|
-
|
|
1279
|
-
|
|
1220
|
+
async getMember(workspaceId, accountId) {
|
|
1221
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/members/{accountId}/", { params: { path: {
|
|
1222
|
+
workspaceId,
|
|
1223
|
+
accountId
|
|
1280
1224
|
} } });
|
|
1281
1225
|
return data;
|
|
1282
1226
|
}
|
|
1283
1227
|
/**
|
|
1284
1228
|
* Update a member's role
|
|
1285
|
-
* @param
|
|
1286
|
-
* @param
|
|
1229
|
+
* @param workspaceId - Workspace id
|
|
1230
|
+
* @param accountId - Member account id
|
|
1287
1231
|
* @param updates - New role for the member
|
|
1288
1232
|
* @returns Promise that resolves with the updated member
|
|
1289
1233
|
* @throws {ApiError} if the request fails
|
|
1290
1234
|
*/
|
|
1291
|
-
async updateMember(
|
|
1292
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
1235
|
+
async updateMember(workspaceId, accountId, updates) {
|
|
1236
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/members/{accountId}/", {
|
|
1293
1237
|
params: { path: {
|
|
1294
|
-
|
|
1295
|
-
|
|
1238
|
+
workspaceId,
|
|
1239
|
+
accountId
|
|
1296
1240
|
} },
|
|
1297
1241
|
body: updates
|
|
1298
1242
|
});
|
|
@@ -1300,25 +1244,25 @@ var Members = class {
|
|
|
1300
1244
|
}
|
|
1301
1245
|
/**
|
|
1302
1246
|
* Remove a member from a workspace
|
|
1303
|
-
* @param
|
|
1304
|
-
* @param
|
|
1247
|
+
* @param workspaceId - Workspace id
|
|
1248
|
+
* @param accountId - Member account id
|
|
1305
1249
|
* @returns Promise that resolves when the member is removed
|
|
1306
1250
|
* @throws {ApiError} if the request fails
|
|
1307
1251
|
*/
|
|
1308
|
-
async removeMember(
|
|
1309
|
-
await this.#api.DELETE("/workspaces/{
|
|
1310
|
-
|
|
1311
|
-
|
|
1252
|
+
async removeMember(workspaceId, accountId) {
|
|
1253
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/members/{accountId}/", { params: { path: {
|
|
1254
|
+
workspaceId,
|
|
1255
|
+
accountId
|
|
1312
1256
|
} } });
|
|
1313
1257
|
}
|
|
1314
1258
|
/**
|
|
1315
1259
|
* Leave a workspace
|
|
1316
|
-
* @param
|
|
1260
|
+
* @param workspaceId - Workspace id
|
|
1317
1261
|
* @returns Promise that resolves when the member has left
|
|
1318
1262
|
* @throws {ApiError} if the request fails
|
|
1319
1263
|
*/
|
|
1320
|
-
async leaveWorkspace(
|
|
1321
|
-
await this.#api.POST("/workspaces/{
|
|
1264
|
+
async leaveWorkspace(workspaceId) {
|
|
1265
|
+
await this.#api.POST("/workspaces/{workspaceId}/members/leave/", { params: { path: { workspaceId } } });
|
|
1322
1266
|
}
|
|
1323
1267
|
};
|
|
1324
1268
|
|
|
@@ -1413,59 +1357,59 @@ var Pipelines = class {
|
|
|
1413
1357
|
}
|
|
1414
1358
|
/**
|
|
1415
1359
|
* List pipelines in a workspace
|
|
1416
|
-
* @param
|
|
1360
|
+
* @param workspaceId - Workspace id
|
|
1417
1361
|
* @param query - Optional query parameters (search, status, limit, after)
|
|
1418
1362
|
* @returns Promise that resolves with a paginated list of pipeline summaries
|
|
1419
1363
|
* @throws {ApiError} if the request fails
|
|
1420
1364
|
*/
|
|
1421
|
-
async listPipelines(
|
|
1422
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1423
|
-
path: {
|
|
1365
|
+
async listPipelines(workspaceId, query) {
|
|
1366
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/pipelines/", { params: {
|
|
1367
|
+
path: { workspaceId },
|
|
1424
1368
|
query
|
|
1425
1369
|
} });
|
|
1426
1370
|
return data;
|
|
1427
1371
|
}
|
|
1428
1372
|
/**
|
|
1429
1373
|
* Create a pipeline in a workspace
|
|
1430
|
-
* @param
|
|
1374
|
+
* @param workspaceId - Workspace id
|
|
1431
1375
|
* @param pipeline - Pipeline creation request
|
|
1432
1376
|
* @returns Promise that resolves with the created pipeline
|
|
1433
1377
|
* @throws {ApiError} if the request fails
|
|
1434
1378
|
*/
|
|
1435
|
-
async createPipeline(
|
|
1436
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1437
|
-
params: { path: {
|
|
1379
|
+
async createPipeline(workspaceId, pipeline) {
|
|
1380
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/pipelines/", {
|
|
1381
|
+
params: { path: { workspaceId } },
|
|
1438
1382
|
body: pipeline
|
|
1439
1383
|
});
|
|
1440
1384
|
return data;
|
|
1441
1385
|
}
|
|
1442
1386
|
/**
|
|
1443
|
-
* Get pipeline details by
|
|
1444
|
-
* @param
|
|
1445
|
-
* @param
|
|
1387
|
+
* Get pipeline details by id
|
|
1388
|
+
* @param workspaceId - Workspace id
|
|
1389
|
+
* @param pipelineId - Pipeline id
|
|
1446
1390
|
* @returns Promise that resolves with the pipeline details
|
|
1447
1391
|
* @throws {ApiError} if the request fails
|
|
1448
1392
|
*/
|
|
1449
|
-
async getPipeline(
|
|
1450
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1451
|
-
|
|
1452
|
-
|
|
1393
|
+
async getPipeline(workspaceId, pipelineId) {
|
|
1394
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/pipelines/{pipelineId}/", { params: { path: {
|
|
1395
|
+
workspaceId,
|
|
1396
|
+
pipelineId
|
|
1453
1397
|
} } });
|
|
1454
1398
|
return data;
|
|
1455
1399
|
}
|
|
1456
1400
|
/**
|
|
1457
1401
|
* Update a pipeline
|
|
1458
|
-
* @param
|
|
1459
|
-
* @param
|
|
1402
|
+
* @param workspaceId - Workspace id
|
|
1403
|
+
* @param pipelineId - Pipeline id
|
|
1460
1404
|
* @param updates - Pipeline update request
|
|
1461
1405
|
* @returns Promise that resolves with the updated pipeline
|
|
1462
1406
|
* @throws {ApiError} if the request fails
|
|
1463
1407
|
*/
|
|
1464
|
-
async updatePipeline(
|
|
1465
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
1408
|
+
async updatePipeline(workspaceId, pipelineId, updates) {
|
|
1409
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/pipelines/{pipelineId}/", {
|
|
1466
1410
|
params: { path: {
|
|
1467
|
-
|
|
1468
|
-
|
|
1411
|
+
workspaceId,
|
|
1412
|
+
pipelineId
|
|
1469
1413
|
} },
|
|
1470
1414
|
body: updates
|
|
1471
1415
|
});
|
|
@@ -1473,15 +1417,15 @@ var Pipelines = class {
|
|
|
1473
1417
|
}
|
|
1474
1418
|
/**
|
|
1475
1419
|
* Delete a pipeline
|
|
1476
|
-
* @param
|
|
1477
|
-
* @param
|
|
1420
|
+
* @param workspaceId - Workspace id
|
|
1421
|
+
* @param pipelineId - Pipeline id
|
|
1478
1422
|
* @returns Promise that resolves when the pipeline is deleted
|
|
1479
1423
|
* @throws {ApiError} if the request fails
|
|
1480
1424
|
*/
|
|
1481
|
-
async deletePipeline(
|
|
1482
|
-
await this.#api.DELETE("/workspaces/{
|
|
1483
|
-
|
|
1484
|
-
|
|
1425
|
+
async deletePipeline(workspaceId, pipelineId) {
|
|
1426
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/pipelines/{pipelineId}/", { params: { path: {
|
|
1427
|
+
workspaceId,
|
|
1428
|
+
pipelineId
|
|
1485
1429
|
} } });
|
|
1486
1430
|
}
|
|
1487
1431
|
};
|
|
@@ -1498,59 +1442,59 @@ var Policies = class {
|
|
|
1498
1442
|
}
|
|
1499
1443
|
/**
|
|
1500
1444
|
* List policies in a workspace
|
|
1501
|
-
* @param
|
|
1445
|
+
* @param workspaceId - Workspace id
|
|
1502
1446
|
* @param query - Optional pagination parameters (limit, after)
|
|
1503
1447
|
* @returns Promise that resolves with a paginated list of policies
|
|
1504
1448
|
* @throws {ApiError} if the request fails
|
|
1505
1449
|
*/
|
|
1506
|
-
async listPolicies(
|
|
1507
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1508
|
-
path: {
|
|
1450
|
+
async listPolicies(workspaceId, query) {
|
|
1451
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/policies/", { params: {
|
|
1452
|
+
path: { workspaceId },
|
|
1509
1453
|
query
|
|
1510
1454
|
} });
|
|
1511
1455
|
return data;
|
|
1512
1456
|
}
|
|
1513
1457
|
/**
|
|
1514
1458
|
* Create a policy in a workspace
|
|
1515
|
-
* @param
|
|
1459
|
+
* @param workspaceId - Workspace id
|
|
1516
1460
|
* @param policy - Policy creation request
|
|
1517
1461
|
* @returns Promise that resolves with the created policy
|
|
1518
1462
|
* @throws {ApiError} if the request fails
|
|
1519
1463
|
*/
|
|
1520
|
-
async createPolicy(
|
|
1521
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1522
|
-
params: { path: {
|
|
1464
|
+
async createPolicy(workspaceId, policy) {
|
|
1465
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/policies/", {
|
|
1466
|
+
params: { path: { workspaceId } },
|
|
1523
1467
|
body: policy
|
|
1524
1468
|
});
|
|
1525
1469
|
return data;
|
|
1526
1470
|
}
|
|
1527
1471
|
/**
|
|
1528
|
-
* Get policy details by
|
|
1529
|
-
* @param
|
|
1530
|
-
* @param
|
|
1472
|
+
* Get policy details by id
|
|
1473
|
+
* @param workspaceId - Workspace id
|
|
1474
|
+
* @param policyId - Policy id
|
|
1531
1475
|
* @returns Promise that resolves with the policy details
|
|
1532
1476
|
* @throws {ApiError} if the request fails
|
|
1533
1477
|
*/
|
|
1534
|
-
async getPolicy(
|
|
1535
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1536
|
-
|
|
1537
|
-
|
|
1478
|
+
async getPolicy(workspaceId, policyId) {
|
|
1479
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/policies/{policyId}/", { params: { path: {
|
|
1480
|
+
workspaceId,
|
|
1481
|
+
policyId
|
|
1538
1482
|
} } });
|
|
1539
1483
|
return data;
|
|
1540
1484
|
}
|
|
1541
1485
|
/**
|
|
1542
1486
|
* Update a policy
|
|
1543
|
-
* @param
|
|
1544
|
-
* @param
|
|
1487
|
+
* @param workspaceId - Workspace id
|
|
1488
|
+
* @param policyId - Policy id
|
|
1545
1489
|
* @param updates - Policy update request
|
|
1546
1490
|
* @returns Promise that resolves with the updated policy
|
|
1547
1491
|
* @throws {ApiError} if the request fails
|
|
1548
1492
|
*/
|
|
1549
|
-
async updatePolicy(
|
|
1550
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
1493
|
+
async updatePolicy(workspaceId, policyId, updates) {
|
|
1494
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/policies/{policyId}/", {
|
|
1551
1495
|
params: { path: {
|
|
1552
|
-
|
|
1553
|
-
|
|
1496
|
+
workspaceId,
|
|
1497
|
+
policyId
|
|
1554
1498
|
} },
|
|
1555
1499
|
body: updates
|
|
1556
1500
|
});
|
|
@@ -1558,15 +1502,15 @@ var Policies = class {
|
|
|
1558
1502
|
}
|
|
1559
1503
|
/**
|
|
1560
1504
|
* Delete a policy
|
|
1561
|
-
* @param
|
|
1562
|
-
* @param
|
|
1505
|
+
* @param workspaceId - Workspace id
|
|
1506
|
+
* @param policyId - Policy id
|
|
1563
1507
|
* @returns Promise that resolves when the policy is deleted
|
|
1564
1508
|
* @throws {ApiError} if the request fails
|
|
1565
1509
|
*/
|
|
1566
|
-
async deletePolicy(
|
|
1567
|
-
await this.#api.DELETE("/workspaces/{
|
|
1568
|
-
|
|
1569
|
-
|
|
1510
|
+
async deletePolicy(workspaceId, policyId) {
|
|
1511
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/policies/{policyId}/", { params: { path: {
|
|
1512
|
+
workspaceId,
|
|
1513
|
+
policyId
|
|
1570
1514
|
} } });
|
|
1571
1515
|
}
|
|
1572
1516
|
};
|
|
@@ -1585,58 +1529,58 @@ var Providers = class {
|
|
|
1585
1529
|
}
|
|
1586
1530
|
/**
|
|
1587
1531
|
* List a workspace's inference providers
|
|
1588
|
-
* @param
|
|
1532
|
+
* @param workspaceId - Workspace id
|
|
1589
1533
|
* @param query - Optional pagination and filters (provider, limit, after)
|
|
1590
1534
|
* @returns Promise that resolves with a paginated list of providers
|
|
1591
1535
|
* @throws {ApiError} if the request fails
|
|
1592
1536
|
*/
|
|
1593
|
-
async listProviders(
|
|
1594
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1595
|
-
path: {
|
|
1537
|
+
async listProviders(workspaceId, query) {
|
|
1538
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/providers/", { params: {
|
|
1539
|
+
path: { workspaceId },
|
|
1596
1540
|
query
|
|
1597
1541
|
} });
|
|
1598
1542
|
return data;
|
|
1599
1543
|
}
|
|
1600
1544
|
/**
|
|
1601
1545
|
* Create an inference provider in a workspace
|
|
1602
|
-
* @param
|
|
1546
|
+
* @param workspaceId - Workspace id
|
|
1603
1547
|
* @param provider - Provider creation request
|
|
1604
1548
|
* @returns Promise that resolves with the created provider
|
|
1605
1549
|
* @throws {ApiError} if the request fails
|
|
1606
1550
|
*/
|
|
1607
|
-
async createProvider(
|
|
1608
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1609
|
-
params: { path: {
|
|
1551
|
+
async createProvider(workspaceId, provider) {
|
|
1552
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/providers/", {
|
|
1553
|
+
params: { path: { workspaceId } },
|
|
1610
1554
|
body: provider
|
|
1611
1555
|
});
|
|
1612
1556
|
return data;
|
|
1613
1557
|
}
|
|
1614
1558
|
/**
|
|
1615
1559
|
* Get provider details by ID
|
|
1616
|
-
* @param
|
|
1560
|
+
* @param workspaceId - Workspace id
|
|
1617
1561
|
* @param providerId - Provider ID
|
|
1618
1562
|
* @returns Promise that resolves with the provider details
|
|
1619
1563
|
* @throws {ApiError} if the request fails
|
|
1620
1564
|
*/
|
|
1621
|
-
async getProvider(
|
|
1622
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1623
|
-
|
|
1565
|
+
async getProvider(workspaceId, providerId) {
|
|
1566
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/providers/{providerId}/", { params: { path: {
|
|
1567
|
+
workspaceId,
|
|
1624
1568
|
providerId
|
|
1625
1569
|
} } });
|
|
1626
1570
|
return data;
|
|
1627
1571
|
}
|
|
1628
1572
|
/**
|
|
1629
1573
|
* Update an inference provider
|
|
1630
|
-
* @param
|
|
1574
|
+
* @param workspaceId - Workspace id
|
|
1631
1575
|
* @param providerId - Provider ID
|
|
1632
1576
|
* @param updates - Provider update request
|
|
1633
1577
|
* @returns Promise that resolves with the updated provider
|
|
1634
1578
|
* @throws {ApiError} if the request fails
|
|
1635
1579
|
*/
|
|
1636
|
-
async updateProvider(
|
|
1637
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
1580
|
+
async updateProvider(workspaceId, providerId, updates) {
|
|
1581
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/providers/{providerId}/", {
|
|
1638
1582
|
params: { path: {
|
|
1639
|
-
|
|
1583
|
+
workspaceId,
|
|
1640
1584
|
providerId
|
|
1641
1585
|
} },
|
|
1642
1586
|
body: updates
|
|
@@ -1645,27 +1589,27 @@ var Providers = class {
|
|
|
1645
1589
|
}
|
|
1646
1590
|
/**
|
|
1647
1591
|
* Delete an inference provider
|
|
1648
|
-
* @param
|
|
1592
|
+
* @param workspaceId - Workspace id
|
|
1649
1593
|
* @param providerId - Provider ID
|
|
1650
1594
|
* @returns Promise that resolves when the provider is deleted
|
|
1651
1595
|
* @throws {ApiError} if the request fails
|
|
1652
1596
|
*/
|
|
1653
|
-
async deleteProvider(
|
|
1654
|
-
await this.#api.DELETE("/workspaces/{
|
|
1655
|
-
|
|
1597
|
+
async deleteProvider(workspaceId, providerId) {
|
|
1598
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/providers/{providerId}/", { params: { path: {
|
|
1599
|
+
workspaceId,
|
|
1656
1600
|
providerId
|
|
1657
1601
|
} } });
|
|
1658
1602
|
}
|
|
1659
1603
|
/**
|
|
1660
1604
|
* Verify an inference provider's configuration and credentials
|
|
1661
|
-
* @param
|
|
1605
|
+
* @param workspaceId - Workspace id
|
|
1662
1606
|
* @param providerId - Provider ID
|
|
1663
1607
|
* @returns Promise that resolves with the verification result
|
|
1664
1608
|
* @throws {ApiError} if the request fails
|
|
1665
1609
|
*/
|
|
1666
|
-
async verifyProvider(
|
|
1667
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1668
|
-
|
|
1610
|
+
async verifyProvider(workspaceId, providerId) {
|
|
1611
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/providers/{providerId}/verify/", { params: { path: {
|
|
1612
|
+
workspaceId,
|
|
1669
1613
|
providerId
|
|
1670
1614
|
} } });
|
|
1671
1615
|
return data;
|
|
@@ -1685,14 +1629,14 @@ var Redactions = class {
|
|
|
1685
1629
|
}
|
|
1686
1630
|
/**
|
|
1687
1631
|
* Get a redaction's review audit
|
|
1688
|
-
* @param
|
|
1632
|
+
* @param workspaceId - Workspace id
|
|
1689
1633
|
* @param redactionId - Redaction ID
|
|
1690
1634
|
* @returns Promise that resolves with the audit
|
|
1691
1635
|
* @throws {ApiError} if the request fails
|
|
1692
1636
|
*/
|
|
1693
|
-
async getReview(
|
|
1694
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1695
|
-
|
|
1637
|
+
async getReview(workspaceId, redactionId) {
|
|
1638
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/redactions/{redactionId}/review", { params: { path: {
|
|
1639
|
+
workspaceId,
|
|
1696
1640
|
redactionId
|
|
1697
1641
|
} } });
|
|
1698
1642
|
return data;
|
|
@@ -1731,14 +1675,14 @@ var Syncs = class {
|
|
|
1731
1675
|
}
|
|
1732
1676
|
/**
|
|
1733
1677
|
* List all syncs across a workspace's connections
|
|
1734
|
-
* @param
|
|
1678
|
+
* @param workspaceId - Workspace id
|
|
1735
1679
|
* @param query - Optional query parameters (provider, status, limit, after)
|
|
1736
1680
|
* @returns Promise that resolves with a paginated list of connection syncs
|
|
1737
1681
|
* @throws {ApiError} if the request fails
|
|
1738
1682
|
*/
|
|
1739
|
-
async listWorkspaceSyncs(
|
|
1740
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1741
|
-
path: {
|
|
1683
|
+
async listWorkspaceSyncs(workspaceId, query) {
|
|
1684
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/syncs/", { params: {
|
|
1685
|
+
path: { workspaceId },
|
|
1742
1686
|
query
|
|
1743
1687
|
} });
|
|
1744
1688
|
return data;
|
|
@@ -1751,30 +1695,30 @@ var Syncs = class {
|
|
|
1751
1695
|
* use {@link Connections.importFiles} and {@link Connections.exportFiles}
|
|
1752
1696
|
* instead. Returns the created sync — poll it for completion.
|
|
1753
1697
|
*
|
|
1754
|
-
* @param
|
|
1698
|
+
* @param workspaceId - Workspace id
|
|
1755
1699
|
* @param connectionId - Connection ID
|
|
1756
1700
|
* @returns Promise that resolves with the started connection sync
|
|
1757
1701
|
* @throws {ApiError} if the request fails
|
|
1758
1702
|
*/
|
|
1759
|
-
async startSync(
|
|
1760
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1761
|
-
|
|
1703
|
+
async startSync(workspaceId, connectionId) {
|
|
1704
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/{connectionId}/sync/", { params: { path: {
|
|
1705
|
+
workspaceId,
|
|
1762
1706
|
connectionId
|
|
1763
1707
|
} } });
|
|
1764
1708
|
return data;
|
|
1765
1709
|
}
|
|
1766
1710
|
/**
|
|
1767
1711
|
* List syncs for a connection
|
|
1768
|
-
* @param
|
|
1712
|
+
* @param workspaceId - Workspace id
|
|
1769
1713
|
* @param connectionId - Connection ID
|
|
1770
1714
|
* @param query - Optional pagination parameters (limit, after)
|
|
1771
1715
|
* @returns Promise that resolves with a paginated list of connection syncs
|
|
1772
1716
|
* @throws {ApiError} if the request fails
|
|
1773
1717
|
*/
|
|
1774
|
-
async listSyncs(
|
|
1775
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1718
|
+
async listSyncs(workspaceId, connectionId, query) {
|
|
1719
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/connections/{connectionId}/syncs/", { params: {
|
|
1776
1720
|
path: {
|
|
1777
|
-
|
|
1721
|
+
workspaceId,
|
|
1778
1722
|
connectionId
|
|
1779
1723
|
},
|
|
1780
1724
|
query
|
|
@@ -1783,15 +1727,15 @@ var Syncs = class {
|
|
|
1783
1727
|
}
|
|
1784
1728
|
/**
|
|
1785
1729
|
* Get a connection sync by ID
|
|
1786
|
-
* @param
|
|
1730
|
+
* @param workspaceId - Workspace id
|
|
1787
1731
|
* @param connectionId - Connection ID
|
|
1788
1732
|
* @param syncId - Sync ID
|
|
1789
1733
|
* @returns Promise that resolves with the connection sync details
|
|
1790
1734
|
* @throws {ApiError} if the request fails
|
|
1791
1735
|
*/
|
|
1792
|
-
async getSync(
|
|
1793
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1794
|
-
|
|
1736
|
+
async getSync(workspaceId, connectionId, syncId) {
|
|
1737
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/connections/{connectionId}/syncs/{syncId}/", { params: { path: {
|
|
1738
|
+
workspaceId,
|
|
1795
1739
|
connectionId,
|
|
1796
1740
|
syncId
|
|
1797
1741
|
} } });
|
|
@@ -1799,15 +1743,15 @@ var Syncs = class {
|
|
|
1799
1743
|
}
|
|
1800
1744
|
/**
|
|
1801
1745
|
* Cancel a running connection sync
|
|
1802
|
-
* @param
|
|
1746
|
+
* @param workspaceId - Workspace id
|
|
1803
1747
|
* @param connectionId - Connection ID
|
|
1804
1748
|
* @param syncId - Sync ID
|
|
1805
1749
|
* @returns Promise that resolves with the canceled connection sync
|
|
1806
1750
|
* @throws {ApiError} if the request fails
|
|
1807
1751
|
*/
|
|
1808
|
-
async cancelSync(
|
|
1809
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1810
|
-
|
|
1752
|
+
async cancelSync(workspaceId, connectionId, syncId) {
|
|
1753
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/{connectionId}/syncs/{syncId}/cancel/", { params: { path: {
|
|
1754
|
+
workspaceId,
|
|
1811
1755
|
connectionId,
|
|
1812
1756
|
syncId
|
|
1813
1757
|
} } });
|
|
@@ -1815,6 +1759,172 @@ var Syncs = class {
|
|
|
1815
1759
|
}
|
|
1816
1760
|
};
|
|
1817
1761
|
|
|
1762
|
+
//#endregion
|
|
1763
|
+
//#region src/services/threads.ts
|
|
1764
|
+
/**
|
|
1765
|
+
* Service for discussion threads and the comments within them.
|
|
1766
|
+
*/
|
|
1767
|
+
var Threads = class {
|
|
1768
|
+
#api;
|
|
1769
|
+
constructor(api) {
|
|
1770
|
+
this.#api = api;
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* List a workspace's threads
|
|
1774
|
+
* @param workspaceId - Workspace id
|
|
1775
|
+
* @param query - Optional pagination and filters (status, limit, after)
|
|
1776
|
+
* @returns Promise that resolves with a paginated list of threads
|
|
1777
|
+
* @throws {ApiError} if the request fails
|
|
1778
|
+
*/
|
|
1779
|
+
async listThreads(workspaceId, query) {
|
|
1780
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/threads/", { params: {
|
|
1781
|
+
path: { workspaceId },
|
|
1782
|
+
query
|
|
1783
|
+
} });
|
|
1784
|
+
return data;
|
|
1785
|
+
}
|
|
1786
|
+
/**
|
|
1787
|
+
* Open a new thread in a workspace
|
|
1788
|
+
* @param workspaceId - Workspace id
|
|
1789
|
+
* @param thread - Thread creation request
|
|
1790
|
+
* @returns Promise that resolves with the created thread
|
|
1791
|
+
* @throws {ApiError} if the request fails
|
|
1792
|
+
*/
|
|
1793
|
+
async openThread(workspaceId, thread) {
|
|
1794
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/threads/", {
|
|
1795
|
+
params: { path: { workspaceId } },
|
|
1796
|
+
body: thread
|
|
1797
|
+
});
|
|
1798
|
+
return data;
|
|
1799
|
+
}
|
|
1800
|
+
/**
|
|
1801
|
+
* Rename a thread
|
|
1802
|
+
* @param workspaceId - Workspace id
|
|
1803
|
+
* @param threadId - Thread ID
|
|
1804
|
+
* @param updates - Thread rename request
|
|
1805
|
+
* @returns Promise that resolves with the updated thread
|
|
1806
|
+
* @throws {ApiError} if the request fails
|
|
1807
|
+
*/
|
|
1808
|
+
async renameThread(workspaceId, threadId, updates) {
|
|
1809
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/threads/{threadId}/", {
|
|
1810
|
+
params: { path: {
|
|
1811
|
+
workspaceId,
|
|
1812
|
+
threadId
|
|
1813
|
+
} },
|
|
1814
|
+
body: updates
|
|
1815
|
+
});
|
|
1816
|
+
return data;
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* Delete a thread
|
|
1820
|
+
* @param workspaceId - Workspace id
|
|
1821
|
+
* @param threadId - Thread ID
|
|
1822
|
+
* @returns Promise that resolves when the thread is deleted
|
|
1823
|
+
* @throws {ApiError} if the request fails
|
|
1824
|
+
*/
|
|
1825
|
+
async deleteThread(workspaceId, threadId) {
|
|
1826
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/threads/{threadId}/", { params: { path: {
|
|
1827
|
+
workspaceId,
|
|
1828
|
+
threadId
|
|
1829
|
+
} } });
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1832
|
+
* Close a thread, ending the discussion.
|
|
1833
|
+
* @param workspaceId - Workspace id
|
|
1834
|
+
* @param threadId - Thread ID
|
|
1835
|
+
* @returns Promise that resolves with the closed thread
|
|
1836
|
+
* @throws {ApiError} if the request fails
|
|
1837
|
+
*/
|
|
1838
|
+
async closeThread(workspaceId, threadId) {
|
|
1839
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/threads/{threadId}/close/", { params: { path: {
|
|
1840
|
+
workspaceId,
|
|
1841
|
+
threadId
|
|
1842
|
+
} } });
|
|
1843
|
+
return data;
|
|
1844
|
+
}
|
|
1845
|
+
/**
|
|
1846
|
+
* Reopen a closed thread.
|
|
1847
|
+
* @param workspaceId - Workspace id
|
|
1848
|
+
* @param threadId - Thread ID
|
|
1849
|
+
* @returns Promise that resolves with the reopened thread
|
|
1850
|
+
* @throws {ApiError} if the request fails
|
|
1851
|
+
*/
|
|
1852
|
+
async reopenThread(workspaceId, threadId) {
|
|
1853
|
+
const { data } = await this.#api.DELETE("/workspaces/{workspaceId}/threads/{threadId}/close/", { params: { path: {
|
|
1854
|
+
workspaceId,
|
|
1855
|
+
threadId
|
|
1856
|
+
} } });
|
|
1857
|
+
return data;
|
|
1858
|
+
}
|
|
1859
|
+
/**
|
|
1860
|
+
* List a thread's timeline: comments interleaved with lifecycle events.
|
|
1861
|
+
* @param workspaceId - Workspace id
|
|
1862
|
+
* @param threadId - Thread ID
|
|
1863
|
+
* @param query - Optional pagination parameters (limit, after)
|
|
1864
|
+
* @returns Promise that resolves with a paginated timeline
|
|
1865
|
+
* @throws {ApiError} if the request fails
|
|
1866
|
+
*/
|
|
1867
|
+
async listTimeline(workspaceId, threadId, query) {
|
|
1868
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/threads/{threadId}/timeline/", { params: {
|
|
1869
|
+
path: {
|
|
1870
|
+
workspaceId,
|
|
1871
|
+
threadId
|
|
1872
|
+
},
|
|
1873
|
+
query
|
|
1874
|
+
} });
|
|
1875
|
+
return data;
|
|
1876
|
+
}
|
|
1877
|
+
/**
|
|
1878
|
+
* Post a comment to a thread
|
|
1879
|
+
* @param workspaceId - Workspace id
|
|
1880
|
+
* @param threadId - Thread ID
|
|
1881
|
+
* @param comment - Comment creation request
|
|
1882
|
+
* @returns Promise that resolves with the created comment
|
|
1883
|
+
* @throws {ApiError} if the request fails
|
|
1884
|
+
*/
|
|
1885
|
+
async createComment(workspaceId, threadId, comment) {
|
|
1886
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/threads/{threadId}/comments/", {
|
|
1887
|
+
params: { path: {
|
|
1888
|
+
workspaceId,
|
|
1889
|
+
threadId
|
|
1890
|
+
} },
|
|
1891
|
+
body: comment
|
|
1892
|
+
});
|
|
1893
|
+
return data;
|
|
1894
|
+
}
|
|
1895
|
+
/**
|
|
1896
|
+
* Edit a comment
|
|
1897
|
+
* @param workspaceId - Workspace id
|
|
1898
|
+
* @param commentId - Comment ID
|
|
1899
|
+
* @param updates - Comment update request
|
|
1900
|
+
* @returns Promise that resolves with the updated comment
|
|
1901
|
+
* @throws {ApiError} if the request fails
|
|
1902
|
+
*/
|
|
1903
|
+
async updateComment(workspaceId, commentId, updates) {
|
|
1904
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/comments/{commentId}/", {
|
|
1905
|
+
params: { path: {
|
|
1906
|
+
workspaceId,
|
|
1907
|
+
commentId
|
|
1908
|
+
} },
|
|
1909
|
+
body: updates
|
|
1910
|
+
});
|
|
1911
|
+
return data;
|
|
1912
|
+
}
|
|
1913
|
+
/**
|
|
1914
|
+
* Delete a comment
|
|
1915
|
+
* @param workspaceId - Workspace id
|
|
1916
|
+
* @param commentId - Comment ID
|
|
1917
|
+
* @returns Promise that resolves when the comment is deleted
|
|
1918
|
+
* @throws {ApiError} if the request fails
|
|
1919
|
+
*/
|
|
1920
|
+
async deleteComment(workspaceId, commentId) {
|
|
1921
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/comments/{commentId}/", { params: { path: {
|
|
1922
|
+
workspaceId,
|
|
1923
|
+
commentId
|
|
1924
|
+
} } });
|
|
1925
|
+
}
|
|
1926
|
+
};
|
|
1927
|
+
|
|
1818
1928
|
//#endregion
|
|
1819
1929
|
//#region src/services/webhooks.ts
|
|
1820
1930
|
/**
|
|
@@ -1827,58 +1937,58 @@ var Webhooks = class {
|
|
|
1827
1937
|
}
|
|
1828
1938
|
/**
|
|
1829
1939
|
* List all webhooks in a workspace
|
|
1830
|
-
* @param
|
|
1940
|
+
* @param workspaceId - Workspace id
|
|
1831
1941
|
* @param query - Optional pagination parameters (limit, after)
|
|
1832
1942
|
* @returns Promise that resolves with a paginated list of webhooks
|
|
1833
1943
|
* @throws {ApiError} if the request fails
|
|
1834
1944
|
*/
|
|
1835
|
-
async listWebhooks(
|
|
1836
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1837
|
-
path: {
|
|
1945
|
+
async listWebhooks(workspaceId, query) {
|
|
1946
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/webhooks/", { params: {
|
|
1947
|
+
path: { workspaceId },
|
|
1838
1948
|
query
|
|
1839
1949
|
} });
|
|
1840
1950
|
return data;
|
|
1841
1951
|
}
|
|
1842
1952
|
/**
|
|
1843
1953
|
* Create a new webhook
|
|
1844
|
-
* @param
|
|
1954
|
+
* @param workspaceId - Workspace id
|
|
1845
1955
|
* @param webhook - Webhook creation request
|
|
1846
1956
|
* @returns Promise that resolves with the created webhook (including secret)
|
|
1847
1957
|
* @throws {ApiError} if the request fails
|
|
1848
1958
|
*/
|
|
1849
|
-
async createWebhook(
|
|
1850
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1851
|
-
params: { path: {
|
|
1959
|
+
async createWebhook(workspaceId, webhook) {
|
|
1960
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/webhooks/", {
|
|
1961
|
+
params: { path: { workspaceId } },
|
|
1852
1962
|
body: webhook
|
|
1853
1963
|
});
|
|
1854
1964
|
return data;
|
|
1855
1965
|
}
|
|
1856
1966
|
/**
|
|
1857
|
-
* Get a specific webhook by
|
|
1858
|
-
* @param
|
|
1967
|
+
* Get a specific webhook by id
|
|
1968
|
+
* @param workspaceId - Workspace id
|
|
1859
1969
|
* @param webhookId - Webhook ID
|
|
1860
1970
|
* @returns Promise that resolves with the webhook details
|
|
1861
1971
|
* @throws {ApiError} if the request fails
|
|
1862
1972
|
*/
|
|
1863
|
-
async getWebhook(
|
|
1864
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1865
|
-
|
|
1973
|
+
async getWebhook(workspaceId, webhookId) {
|
|
1974
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/webhooks/{webhookId}/", { params: { path: {
|
|
1975
|
+
workspaceId,
|
|
1866
1976
|
webhookId
|
|
1867
1977
|
} } });
|
|
1868
1978
|
return data;
|
|
1869
1979
|
}
|
|
1870
1980
|
/**
|
|
1871
1981
|
* Update an existing webhook
|
|
1872
|
-
* @param
|
|
1982
|
+
* @param workspaceId - Workspace id
|
|
1873
1983
|
* @param webhookId - Webhook ID
|
|
1874
1984
|
* @param updates - Webhook update request
|
|
1875
1985
|
* @returns Promise that resolves with the updated webhook
|
|
1876
1986
|
* @throws {ApiError} if the request fails
|
|
1877
1987
|
*/
|
|
1878
|
-
async updateWebhook(
|
|
1879
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
1988
|
+
async updateWebhook(workspaceId, webhookId, updates) {
|
|
1989
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/webhooks/{webhookId}/", {
|
|
1880
1990
|
params: { path: {
|
|
1881
|
-
|
|
1991
|
+
workspaceId,
|
|
1882
1992
|
webhookId
|
|
1883
1993
|
} },
|
|
1884
1994
|
body: updates
|
|
@@ -1887,29 +1997,29 @@ var Webhooks = class {
|
|
|
1887
1997
|
}
|
|
1888
1998
|
/**
|
|
1889
1999
|
* Delete a webhook
|
|
1890
|
-
* @param
|
|
2000
|
+
* @param workspaceId - Workspace id
|
|
1891
2001
|
* @param webhookId - Webhook ID
|
|
1892
2002
|
* @returns Promise that resolves when the webhook is deleted
|
|
1893
2003
|
* @throws {ApiError} if the request fails
|
|
1894
2004
|
*/
|
|
1895
|
-
async deleteWebhook(
|
|
1896
|
-
await this.#api.DELETE("/workspaces/{
|
|
1897
|
-
|
|
2005
|
+
async deleteWebhook(workspaceId, webhookId) {
|
|
2006
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/webhooks/{webhookId}/", { params: { path: {
|
|
2007
|
+
workspaceId,
|
|
1898
2008
|
webhookId
|
|
1899
2009
|
} } });
|
|
1900
2010
|
}
|
|
1901
2011
|
/**
|
|
1902
2012
|
* Test a webhook by sending a test payload
|
|
1903
|
-
* @param
|
|
2013
|
+
* @param workspaceId - Workspace id
|
|
1904
2014
|
* @param webhookId - Webhook ID
|
|
1905
2015
|
* @param options - Test webhook options
|
|
1906
2016
|
* @returns Promise that resolves with the test result
|
|
1907
2017
|
* @throws {ApiError} if the request fails
|
|
1908
2018
|
*/
|
|
1909
|
-
async testWebhook(
|
|
1910
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
2019
|
+
async testWebhook(workspaceId, webhookId, options) {
|
|
2020
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/webhooks/{webhookId}/test/", {
|
|
1911
2021
|
params: { path: {
|
|
1912
|
-
|
|
2022
|
+
workspaceId,
|
|
1913
2023
|
webhookId
|
|
1914
2024
|
} },
|
|
1915
2025
|
body: options ?? {}
|
|
@@ -1940,12 +2050,12 @@ var Workspaces = class {
|
|
|
1940
2050
|
}
|
|
1941
2051
|
/**
|
|
1942
2052
|
* Get workspace details by ID
|
|
1943
|
-
* @param
|
|
2053
|
+
* @param workspaceId - Workspace id
|
|
1944
2054
|
* @returns Promise that resolves with the workspace details
|
|
1945
2055
|
* @throws {ApiError} if the request fails
|
|
1946
2056
|
*/
|
|
1947
|
-
async getWorkspace(
|
|
1948
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
2057
|
+
async getWorkspace(workspaceId) {
|
|
2058
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/", { params: { path: { workspaceId } } });
|
|
1949
2059
|
return data;
|
|
1950
2060
|
}
|
|
1951
2061
|
/**
|
|
@@ -1960,64 +2070,64 @@ var Workspaces = class {
|
|
|
1960
2070
|
}
|
|
1961
2071
|
/**
|
|
1962
2072
|
* Update an existing workspace
|
|
1963
|
-
* @param
|
|
2073
|
+
* @param workspaceId - Workspace id
|
|
1964
2074
|
* @param updates - Workspace update request
|
|
1965
2075
|
* @returns Promise that resolves with the updated workspace
|
|
1966
2076
|
* @throws {ApiError} if the request fails
|
|
1967
2077
|
*/
|
|
1968
|
-
async updateWorkspace(
|
|
1969
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
1970
|
-
params: { path: {
|
|
2078
|
+
async updateWorkspace(workspaceId, updates) {
|
|
2079
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/", {
|
|
2080
|
+
params: { path: { workspaceId } },
|
|
1971
2081
|
body: updates
|
|
1972
2082
|
});
|
|
1973
2083
|
return data;
|
|
1974
2084
|
}
|
|
1975
2085
|
/**
|
|
1976
2086
|
* Delete a workspace
|
|
1977
|
-
* @param
|
|
2087
|
+
* @param workspaceId - Workspace id
|
|
1978
2088
|
* @returns Promise that resolves when the workspace is deleted
|
|
1979
2089
|
* @throws {ApiError} if the request fails
|
|
1980
2090
|
*/
|
|
1981
|
-
async deleteWorkspace(
|
|
1982
|
-
await this.#api.DELETE("/workspaces/{
|
|
2091
|
+
async deleteWorkspace(workspaceId) {
|
|
2092
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/", { params: { path: { workspaceId } } });
|
|
1983
2093
|
}
|
|
1984
2094
|
/**
|
|
1985
2095
|
* Get notification settings for the authenticated user in a workspace
|
|
1986
|
-
* @param
|
|
2096
|
+
* @param workspaceId - Workspace id
|
|
1987
2097
|
* @returns Promise that resolves with the notification settings
|
|
1988
2098
|
* @throws {ApiError} if the request fails
|
|
1989
2099
|
*/
|
|
1990
|
-
async getNotificationSettings(
|
|
1991
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
2100
|
+
async getNotificationSettings(workspaceId) {
|
|
2101
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/notifications/", { params: { path: { workspaceId } } });
|
|
1992
2102
|
return data;
|
|
1993
2103
|
}
|
|
1994
2104
|
/**
|
|
1995
2105
|
* Update notification settings for the authenticated user in a workspace
|
|
1996
|
-
* @param
|
|
2106
|
+
* @param workspaceId - Workspace id
|
|
1997
2107
|
* @param settings - Notification settings update request
|
|
1998
2108
|
* @returns Promise that resolves with the updated notification settings
|
|
1999
2109
|
* @throws {ApiError} if the request fails
|
|
2000
2110
|
*/
|
|
2001
|
-
async updateNotificationSettings(
|
|
2002
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
2003
|
-
params: { path: {
|
|
2111
|
+
async updateNotificationSettings(workspaceId, settings) {
|
|
2112
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/notifications/", {
|
|
2113
|
+
params: { path: { workspaceId } },
|
|
2004
2114
|
body: settings
|
|
2005
2115
|
});
|
|
2006
2116
|
return data;
|
|
2007
2117
|
}
|
|
2008
2118
|
/**
|
|
2009
2119
|
* Upload a workspace's avatar image
|
|
2010
|
-
* @param
|
|
2120
|
+
* @param workspaceId - Workspace id
|
|
2011
2121
|
* @param avatar - Avatar image to upload
|
|
2012
2122
|
* @returns Promise that resolves when the avatar is uploaded
|
|
2013
2123
|
* @throws {ApiError} if the request fails
|
|
2014
2124
|
*/
|
|
2015
|
-
async uploadAvatar(
|
|
2125
|
+
async uploadAvatar(workspaceId, avatar) {
|
|
2016
2126
|
const formData = new FormData();
|
|
2017
2127
|
const name = avatar instanceof File ? avatar.name : "avatar";
|
|
2018
2128
|
formData.append("avatar", avatar, name);
|
|
2019
|
-
await this.#api.PUT("/workspaces/{
|
|
2020
|
-
params: { path: {
|
|
2129
|
+
await this.#api.PUT("/workspaces/{workspaceId}/avatar/", {
|
|
2130
|
+
params: { path: { workspaceId } },
|
|
2021
2131
|
body: formData,
|
|
2022
2132
|
bodySerializer: (formData) => formData,
|
|
2023
2133
|
headers: { "Content-Type": null }
|
|
@@ -2025,15 +2135,15 @@ var Workspaces = class {
|
|
|
2025
2135
|
}
|
|
2026
2136
|
/**
|
|
2027
2137
|
* Delete a workspace's avatar image
|
|
2028
|
-
* @param
|
|
2138
|
+
* @param workspaceId - Workspace id
|
|
2029
2139
|
* @returns Promise that resolves when the avatar is deleted
|
|
2030
2140
|
* @throws {ApiError} if the request fails
|
|
2031
2141
|
*/
|
|
2032
|
-
async deleteAvatar(
|
|
2033
|
-
await this.#api.DELETE("/workspaces/{
|
|
2142
|
+
async deleteAvatar(workspaceId) {
|
|
2143
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/avatar/", { params: { path: { workspaceId } } });
|
|
2034
2144
|
}
|
|
2035
2145
|
};
|
|
2036
2146
|
|
|
2037
2147
|
//#endregion
|
|
2038
|
-
export { Auth as _,
|
|
2039
|
-
//# sourceMappingURL=services-
|
|
2148
|
+
export { Auth as _, Status as a, Activities as b, Policies as c, Members as d, Invites as f, Capabilities as g, Connections as h, Syncs as i, Pipelines as l, Detections as m, Webhooks as n, Redactions as o, Documents as p, Threads as r, Providers as s, Workspaces as t, Notifications as u, ApiTokens as v, Account as x, Analytics as y };
|
|
2149
|
+
//# sourceMappingURL=services-CFFmQDgA.js.map
|