@nvisy/sdk 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1040 @@
1
+ //#region src/services/account.ts
2
+ /**
3
+ * Service for handling account operations
4
+ */
5
+ var Account = class {
6
+ #api;
7
+ constructor(api) {
8
+ this.#api = api;
9
+ }
10
+ /**
11
+ * Get the authenticated user's account details
12
+ * @returns Promise that resolves with the account details
13
+ * @throws {ApiError} if the request fails
14
+ */
15
+ async getAccount() {
16
+ const { data } = await this.#api.GET("/account/");
17
+ return data;
18
+ }
19
+ /**
20
+ * Update the authenticated user's account details
21
+ * @param updates - Account update request
22
+ * @returns Promise that resolves with the updated account
23
+ * @throws {ApiError} if the request fails
24
+ */
25
+ async updateAccount(updates) {
26
+ const { data } = await this.#api.PATCH("/account/", { body: updates });
27
+ return data;
28
+ }
29
+ /**
30
+ * Delete the authenticated user's account
31
+ * @returns Promise that resolves when the account is deleted
32
+ * @throws {ApiError} if the request fails
33
+ */
34
+ async deleteAccount() {
35
+ await this.#api.DELETE("/account/");
36
+ }
37
+ };
38
+
39
+ //#endregion
40
+ //#region src/services/activities.ts
41
+ /**
42
+ * Service for handling workspace activity operations
43
+ */
44
+ var Activities = class {
45
+ #api;
46
+ constructor(api) {
47
+ this.#api = api;
48
+ }
49
+ /**
50
+ * List activities for a workspace
51
+ * @param workspaceId - Workspace ID
52
+ * @param query - Optional pagination parameters (limit, after)
53
+ * @returns Promise that resolves with a paginated list of activities
54
+ * @throws {ApiError} if the request fails
55
+ */
56
+ async listActivities(workspaceId, query) {
57
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/activities/", { params: {
58
+ path: { workspaceId },
59
+ query
60
+ } });
61
+ return data;
62
+ }
63
+ };
64
+
65
+ //#endregion
66
+ //#region src/services/api-tokens.ts
67
+ /**
68
+ * Service for handling API token operations
69
+ */
70
+ var ApiTokens = class {
71
+ #api;
72
+ constructor(api) {
73
+ this.#api = api;
74
+ }
75
+ /**
76
+ * List all API tokens for the authenticated account
77
+ * @param query - Optional pagination parameters (limit, after)
78
+ * @returns Promise that resolves with a paginated list of API tokens
79
+ * @throws {ApiError} if the request fails
80
+ */
81
+ async listApiTokens(query) {
82
+ const { data } = await this.#api.GET("/api-tokens/", { params: { query } });
83
+ return data;
84
+ }
85
+ /**
86
+ * Get a specific API token by token ID
87
+ * @param tokenId - The token identifier
88
+ * @returns Promise that resolves with the API token details
89
+ * @throws {ApiError} if the request fails
90
+ */
91
+ async getApiToken(tokenId) {
92
+ const { data } = await this.#api.GET("/api-tokens/{tokenId}/", { params: { path: { tokenId } } });
93
+ return data;
94
+ }
95
+ /**
96
+ * Create a new API token
97
+ * @param token - Token creation request
98
+ * @returns Promise that resolves with the created token (includes JWT, shown only once)
99
+ * @throws {ApiError} if the request fails
100
+ */
101
+ async createApiToken(token) {
102
+ const { data } = await this.#api.POST("/api-tokens/", { body: token });
103
+ return data;
104
+ }
105
+ /**
106
+ * Update an existing API token
107
+ * @param tokenId - The token identifier
108
+ * @param updates - Token update request
109
+ * @returns Promise that resolves with the updated token
110
+ * @throws {ApiError} if the request fails
111
+ */
112
+ async updateApiToken(tokenId, updates) {
113
+ const { data } = await this.#api.PATCH("/api-tokens/{tokenId}/", {
114
+ params: { path: { tokenId } },
115
+ body: updates
116
+ });
117
+ return data;
118
+ }
119
+ /**
120
+ * Revoke an API token
121
+ * @param tokenId - The token identifier
122
+ * @returns Promise that resolves when the token is revoked
123
+ * @throws {ApiError} if the request fails
124
+ */
125
+ async revokeApiToken(tokenId) {
126
+ await this.#api.DELETE("/api-tokens/{tokenId}/", { params: { path: { tokenId } } });
127
+ }
128
+ };
129
+
130
+ //#endregion
131
+ //#region src/services/auth.ts
132
+ /**
133
+ * Service for handling authentication operations
134
+ */
135
+ var Auth = class {
136
+ #api;
137
+ constructor(api) {
138
+ this.#api = api;
139
+ }
140
+ /**
141
+ * Login with email and password
142
+ * @param credentials - Login credentials
143
+ * @returns Promise that resolves with the auth response containing access token
144
+ * @throws {ApiError} if the request fails
145
+ */
146
+ async loginAccount(credentials) {
147
+ const { data } = await this.#api.POST("/auth/login/", { body: credentials });
148
+ return data;
149
+ }
150
+ /**
151
+ * Sign up a new account
152
+ * @param credentials - Signup details
153
+ * @returns Promise that resolves with the auth response containing access token
154
+ * @throws {ApiError} if the request fails
155
+ */
156
+ async signupAccount(credentials) {
157
+ const { data } = await this.#api.POST("/auth/signup/", { body: credentials });
158
+ return data;
159
+ }
160
+ /**
161
+ * Logout and invalidate the current access token
162
+ * @returns Promise that resolves when logout is complete
163
+ * @throws {ApiError} if the request fails
164
+ */
165
+ async logoutAccount() {
166
+ await this.#api.POST("/auth/logout/");
167
+ }
168
+ };
169
+
170
+ //#endregion
171
+ //#region src/services/connections.ts
172
+ /**
173
+ * Service for handling connection operations
174
+ */
175
+ var Connections = class {
176
+ #api;
177
+ constructor(api) {
178
+ this.#api = api;
179
+ }
180
+ /**
181
+ * List connections in a workspace
182
+ * @param workspaceId - Workspace ID
183
+ * @param query - Optional query parameters (provider, limit, after)
184
+ * @returns Promise that resolves with a paginated list of connections
185
+ * @throws {ApiError} if the request fails
186
+ */
187
+ async listConnections(workspaceId, query) {
188
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/connections/", { params: {
189
+ path: { workspaceId },
190
+ query
191
+ } });
192
+ return data;
193
+ }
194
+ /**
195
+ * Create a connection in a workspace
196
+ * @param workspaceId - Workspace ID
197
+ * @param connection - Connection creation request
198
+ * @returns Promise that resolves with the created connection
199
+ * @throws {ApiError} if the request fails
200
+ */
201
+ async createConnection(workspaceId, connection) {
202
+ const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/", {
203
+ params: { path: { workspaceId } },
204
+ body: connection
205
+ });
206
+ return data;
207
+ }
208
+ /**
209
+ * Get connection details by ID
210
+ * @param connectionId - Connection ID
211
+ * @returns Promise that resolves with the connection details
212
+ * @throws {ApiError} if the request fails
213
+ */
214
+ async getConnection(connectionId) {
215
+ const { data } = await this.#api.GET("/connections/{connectionId}/", { params: { path: { connectionId } } });
216
+ return data;
217
+ }
218
+ /**
219
+ * Update a connection
220
+ * @param connectionId - Connection ID
221
+ * @param updates - Connection update request
222
+ * @returns Promise that resolves with the updated connection
223
+ * @throws {ApiError} if the request fails
224
+ */
225
+ async updateConnection(connectionId, updates) {
226
+ const { data } = await this.#api.PUT("/connections/{connectionId}/", {
227
+ params: { path: { connectionId } },
228
+ body: updates
229
+ });
230
+ return data;
231
+ }
232
+ /**
233
+ * Delete a connection
234
+ * @param connectionId - Connection ID
235
+ * @returns Promise that resolves when the connection is deleted
236
+ * @throws {ApiError} if the request fails
237
+ */
238
+ async deleteConnection(connectionId) {
239
+ await this.#api.DELETE("/connections/{connectionId}/", { params: { path: { connectionId } } });
240
+ }
241
+ };
242
+
243
+ //#endregion
244
+ //#region src/services/contexts.ts
245
+ /**
246
+ * Service for handling context operations
247
+ */
248
+ var Contexts = class {
249
+ #api;
250
+ constructor(api) {
251
+ this.#api = api;
252
+ }
253
+ /**
254
+ * List contexts in a workspace
255
+ * @param workspaceId - Workspace ID
256
+ * @param query - Optional pagination parameters (limit, after)
257
+ * @returns Promise that resolves with a paginated list of contexts
258
+ * @throws {ApiError} if the request fails
259
+ */
260
+ async listContexts(workspaceId, query) {
261
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/contexts/", { params: {
262
+ path: { workspaceId },
263
+ query
264
+ } });
265
+ return data;
266
+ }
267
+ /**
268
+ * Create a context in a workspace
269
+ * @param workspaceId - Workspace ID
270
+ * @param context - Context creation request
271
+ * @returns Promise that resolves with the created context
272
+ * @throws {ApiError} if the request fails
273
+ */
274
+ async createContext(workspaceId, context) {
275
+ const { data } = await this.#api.POST("/workspaces/{workspaceId}/contexts/", {
276
+ params: { path: { workspaceId } },
277
+ body: context
278
+ });
279
+ return data;
280
+ }
281
+ /**
282
+ * Get context details by ID
283
+ * @param contextId - Context ID
284
+ * @returns Promise that resolves with the context details
285
+ * @throws {ApiError} if the request fails
286
+ */
287
+ async getContext(contextId) {
288
+ const { data } = await this.#api.GET("/contexts/{contextId}/", { params: { path: { contextId } } });
289
+ return data;
290
+ }
291
+ /**
292
+ * Update a context
293
+ * @param contextId - Context ID
294
+ * @param updates - Context update request
295
+ * @returns Promise that resolves with the updated context
296
+ * @throws {ApiError} if the request fails
297
+ */
298
+ async updateContext(contextId, updates) {
299
+ const { data } = await this.#api.PUT("/contexts/{contextId}/", {
300
+ params: { path: { contextId } },
301
+ body: updates
302
+ });
303
+ return data;
304
+ }
305
+ /**
306
+ * Delete a context
307
+ * @param contextId - Context ID
308
+ * @returns Promise that resolves when the context is deleted
309
+ * @throws {ApiError} if the request fails
310
+ */
311
+ async deleteContext(contextId) {
312
+ await this.#api.DELETE("/contexts/{contextId}/", { params: { path: { contextId } } });
313
+ }
314
+ };
315
+
316
+ //#endregion
317
+ //#region src/services/files.ts
318
+ /**
319
+ * Service for handling file operations
320
+ */
321
+ var Files = class {
322
+ #api;
323
+ constructor(api) {
324
+ this.#api = api;
325
+ }
326
+ /**
327
+ * Upload one or more files to a workspace
328
+ * @param workspaceId - Workspace ID
329
+ * @param files - File or array of files to upload
330
+ * @returns Promise that resolves with the uploaded file metadata
331
+ * @throws {ApiError} if the request fails
332
+ */
333
+ async uploadFiles(workspaceId, files) {
334
+ const formData = new FormData();
335
+ const fileArray = Array.isArray(files) ? files : [files];
336
+ for (const file of fileArray) {
337
+ const name = file instanceof File ? file.name : "file";
338
+ formData.append("files", file, name);
339
+ }
340
+ const { data } = await this.#api.POST("/workspaces/{workspaceId}/files/", {
341
+ params: { path: { workspaceId } },
342
+ body: formData,
343
+ bodySerializer: (formData) => formData,
344
+ headers: { "Content-Type": null }
345
+ });
346
+ return data;
347
+ }
348
+ /**
349
+ * List files in a workspace
350
+ * @param workspaceId - Workspace ID
351
+ * @param query - Optional query parameters (formats, search, limit, after)
352
+ * @returns Promise that resolves with a paginated list of files
353
+ * @throws {ApiError} if the request fails
354
+ */
355
+ async listFiles(workspaceId, query) {
356
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/files/", { params: {
357
+ path: { workspaceId },
358
+ query
359
+ } });
360
+ return data;
361
+ }
362
+ /**
363
+ * Get file metadata by ID
364
+ * @param fileId - File ID
365
+ * @returns Promise that resolves with the file metadata
366
+ * @throws {ApiError} if the request fails
367
+ */
368
+ async getFile(fileId) {
369
+ const { data } = await this.#api.GET("/files/{fileId}/", { params: { path: { fileId } } });
370
+ return data;
371
+ }
372
+ /**
373
+ * Download a file by ID
374
+ * @param fileId - File ID
375
+ * @returns Promise that resolves with the file response
376
+ * @throws {ApiError} if the request fails
377
+ */
378
+ async downloadFile(fileId) {
379
+ const { response } = await this.#api.GET("/files/{fileId}/content/", {
380
+ params: { path: { fileId } },
381
+ parseAs: "stream"
382
+ });
383
+ return response;
384
+ }
385
+ /**
386
+ * Update a file's metadata
387
+ * @param fileId - File ID
388
+ * @param updates - File update request
389
+ * @returns Promise that resolves with the updated file
390
+ * @throws {ApiError} if the request fails
391
+ */
392
+ async updateFile(fileId, updates) {
393
+ const { data } = await this.#api.PATCH("/files/{fileId}/", {
394
+ params: { path: { fileId } },
395
+ body: updates
396
+ });
397
+ return data;
398
+ }
399
+ /**
400
+ * Delete a file
401
+ * @param fileId - File ID
402
+ * @returns Promise that resolves when the file is deleted
403
+ * @throws {ApiError} if the request fails
404
+ */
405
+ async deleteFile(fileId) {
406
+ await this.#api.DELETE("/files/{fileId}/", { params: { path: { fileId } } });
407
+ }
408
+ };
409
+
410
+ //#endregion
411
+ //#region src/services/invites.ts
412
+ /**
413
+ * Service for handling workspace invitation operations
414
+ */
415
+ var Invites = class {
416
+ #api;
417
+ constructor(api) {
418
+ this.#api = api;
419
+ }
420
+ /**
421
+ * List all invitations for a workspace
422
+ * @param workspaceId - Workspace ID
423
+ * @param query - Optional query parameters (role, sortBy, order, limit, after)
424
+ * @returns Promise that resolves with a paginated list of invitations
425
+ * @throws {ApiError} if the request fails
426
+ */
427
+ async listInvites(workspaceId, query) {
428
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/invites/", { params: {
429
+ path: { workspaceId },
430
+ query
431
+ } });
432
+ return data;
433
+ }
434
+ /**
435
+ * Send an invitation to join a workspace
436
+ * @param workspaceId - Workspace ID
437
+ * @param invite - Invitation request
438
+ * @returns Promise that resolves with the created invitation
439
+ * @throws {ApiError} if the request fails
440
+ */
441
+ async sendInvite(workspaceId, invite) {
442
+ const { data } = await this.#api.POST("/workspaces/{workspaceId}/invites/", {
443
+ params: { path: { workspaceId } },
444
+ body: invite
445
+ });
446
+ return data;
447
+ }
448
+ /**
449
+ * Cancel a pending invitation
450
+ * @param inviteId - Invite ID
451
+ * @returns Promise that resolves when the invitation is canceled
452
+ * @throws {ApiError} if the request fails
453
+ */
454
+ async cancelInvite(inviteId) {
455
+ await this.#api.DELETE("/invites/{inviteId}/", { params: { path: { inviteId } } });
456
+ }
457
+ /**
458
+ * Reply to an invitation (accept or decline)
459
+ * @param inviteId - Invite ID
460
+ * @param reply - Reply request
461
+ * @returns Promise that resolves with the updated invitation
462
+ * @throws {ApiError} if the request fails
463
+ */
464
+ async replyToInvite(inviteId, reply) {
465
+ const { data } = await this.#api.POST("/invites/{inviteId}/", {
466
+ params: { path: { inviteId } },
467
+ body: reply
468
+ });
469
+ return data;
470
+ }
471
+ /**
472
+ * Generate a shareable invite code for a workspace
473
+ * @param workspaceId - Workspace ID
474
+ * @param options - Invite code generation options
475
+ * @returns Promise that resolves with the generated invite code
476
+ * @throws {ApiError} if the request fails
477
+ */
478
+ async generateInviteCode(workspaceId, options) {
479
+ const { data } = await this.#api.POST("/workspaces/{workspaceId}/invites/code/", {
480
+ params: { path: { workspaceId } },
481
+ body: options
482
+ });
483
+ return data;
484
+ }
485
+ /**
486
+ * Reply to an invite code (accept or decline)
487
+ * @param inviteCode - The invite code
488
+ * @param reply - Optional reply request (defaults to accept if not provided)
489
+ * @returns Promise that resolves with the member details if accepted, null if declined
490
+ * @throws {ApiError} if the request fails
491
+ */
492
+ async replyToInviteCode(inviteCode, reply) {
493
+ const { data } = await this.#api.POST("/invites/code/{inviteCode}/", {
494
+ params: { path: { inviteCode } },
495
+ body: reply ?? null
496
+ });
497
+ return data;
498
+ }
499
+ /**
500
+ * Preview an invite code without joining
501
+ * @param inviteCode - The invite code
502
+ * @returns Promise that resolves with the invite preview details
503
+ * @throws {ApiError} if the request fails
504
+ */
505
+ async previewInvite(inviteCode) {
506
+ const { data } = await this.#api.GET("/invites/code/{inviteCode}/", { params: { path: { inviteCode } } });
507
+ return data;
508
+ }
509
+ };
510
+
511
+ //#endregion
512
+ //#region src/services/members.ts
513
+ /**
514
+ * Service for handling member operations
515
+ */
516
+ var Members = class {
517
+ #api;
518
+ constructor(api) {
519
+ this.#api = api;
520
+ }
521
+ /**
522
+ * List members of a workspace
523
+ * @param workspaceId - Workspace ID
524
+ * @param query - Optional query parameters (role, has2fa, sortBy, order, limit, after)
525
+ * @returns Promise that resolves with a paginated list of members
526
+ * @throws {ApiError} if the request fails
527
+ */
528
+ async listMembers(workspaceId, query) {
529
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/members/", { params: {
530
+ path: { workspaceId },
531
+ query
532
+ } });
533
+ return data;
534
+ }
535
+ /**
536
+ * Get member details by account ID
537
+ * @param workspaceId - Workspace ID
538
+ * @param accountId - Account ID
539
+ * @returns Promise that resolves with the member details
540
+ * @throws {ApiError} if the request fails
541
+ */
542
+ async getMember(workspaceId, accountId) {
543
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/members/{accountId}/", { params: { path: {
544
+ workspaceId,
545
+ accountId
546
+ } } });
547
+ return data;
548
+ }
549
+ /**
550
+ * Update a member's role
551
+ * @param workspaceId - Workspace ID
552
+ * @param accountId - Account ID
553
+ * @param updates - New role for the member
554
+ * @returns Promise that resolves with the updated member
555
+ * @throws {ApiError} if the request fails
556
+ */
557
+ async updateMember(workspaceId, accountId, updates) {
558
+ const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/members/{accountId}/", {
559
+ params: { path: {
560
+ workspaceId,
561
+ accountId
562
+ } },
563
+ body: updates
564
+ });
565
+ return data;
566
+ }
567
+ /**
568
+ * Remove a member from a workspace
569
+ * @param workspaceId - Workspace ID
570
+ * @param accountId - Account ID
571
+ * @returns Promise that resolves when the member is removed
572
+ * @throws {ApiError} if the request fails
573
+ */
574
+ async removeMember(workspaceId, accountId) {
575
+ await this.#api.DELETE("/workspaces/{workspaceId}/members/{accountId}/", { params: { path: {
576
+ workspaceId,
577
+ accountId
578
+ } } });
579
+ }
580
+ /**
581
+ * Leave a workspace
582
+ * @param workspaceId - Workspace ID
583
+ * @returns Promise that resolves when the member has left
584
+ * @throws {ApiError} if the request fails
585
+ */
586
+ async leaveWorkspace(workspaceId) {
587
+ await this.#api.POST("/workspaces/{workspaceId}/members/leave/", { params: { path: { workspaceId } } });
588
+ }
589
+ };
590
+
591
+ //#endregion
592
+ //#region src/services/notifications.ts
593
+ /**
594
+ * Service for handling account notification operations
595
+ */
596
+ var Notifications = class {
597
+ #api;
598
+ constructor(api) {
599
+ this.#api = api;
600
+ }
601
+ /**
602
+ * List notifications for the authenticated account
603
+ * @param query - Optional pagination parameters (limit, after)
604
+ * @returns Promise that resolves with a paginated list of notifications
605
+ * @throws {ApiError} if the request fails
606
+ */
607
+ async listNotifications(query) {
608
+ const { data } = await this.#api.GET("/notifications/", { params: { query } });
609
+ return data;
610
+ }
611
+ /**
612
+ * Get the unread notifications count for the authenticated account
613
+ * @returns Promise that resolves with the unread status
614
+ * @throws {ApiError} if the request fails
615
+ */
616
+ async getUnreadNotificationsStatus() {
617
+ const { data } = await this.#api.GET("/notifications/unread/");
618
+ return data;
619
+ }
620
+ };
621
+
622
+ //#endregion
623
+ //#region src/services/pipelines.ts
624
+ /**
625
+ * Service for handling pipeline operations
626
+ */
627
+ var Pipelines = class {
628
+ #api;
629
+ constructor(api) {
630
+ this.#api = api;
631
+ }
632
+ /**
633
+ * List pipelines in a workspace
634
+ * @param workspaceId - Workspace ID
635
+ * @param query - Optional query parameters (search, status, limit, after)
636
+ * @returns Promise that resolves with a paginated list of pipeline summaries
637
+ * @throws {ApiError} if the request fails
638
+ */
639
+ async listPipelines(workspaceId, query) {
640
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/pipelines/", { params: {
641
+ path: { workspaceId },
642
+ query
643
+ } });
644
+ return data;
645
+ }
646
+ /**
647
+ * Create a pipeline in a workspace
648
+ * @param workspaceId - Workspace ID
649
+ * @param pipeline - Pipeline creation request
650
+ * @returns Promise that resolves with the created pipeline
651
+ * @throws {ApiError} if the request fails
652
+ */
653
+ async createPipeline(workspaceId, pipeline) {
654
+ const { data } = await this.#api.POST("/workspaces/{workspaceId}/pipelines/", {
655
+ params: { path: { workspaceId } },
656
+ body: pipeline
657
+ });
658
+ return data;
659
+ }
660
+ /**
661
+ * Get pipeline details by ID
662
+ * @param pipelineId - Pipeline ID
663
+ * @returns Promise that resolves with the pipeline details
664
+ * @throws {ApiError} if the request fails
665
+ */
666
+ async getPipeline(pipelineId) {
667
+ const { data } = await this.#api.GET("/pipelines/{pipelineId}/", { params: { path: { pipelineId } } });
668
+ return data;
669
+ }
670
+ /**
671
+ * Update a pipeline
672
+ * @param pipelineId - Pipeline ID
673
+ * @param updates - Pipeline update request
674
+ * @returns Promise that resolves with the updated pipeline
675
+ * @throws {ApiError} if the request fails
676
+ */
677
+ async updatePipeline(pipelineId, updates) {
678
+ const { data } = await this.#api.PATCH("/pipelines/{pipelineId}/", {
679
+ params: { path: { pipelineId } },
680
+ body: updates
681
+ });
682
+ return data;
683
+ }
684
+ /**
685
+ * Delete a pipeline
686
+ * @param pipelineId - Pipeline ID
687
+ * @returns Promise that resolves when the pipeline is deleted
688
+ * @throws {ApiError} if the request fails
689
+ */
690
+ async deletePipeline(pipelineId) {
691
+ await this.#api.DELETE("/pipelines/{pipelineId}/", { params: { path: { pipelineId } } });
692
+ }
693
+ };
694
+
695
+ //#endregion
696
+ //#region src/services/policies.ts
697
+ /**
698
+ * Service for handling policy operations
699
+ */
700
+ var Policies = class {
701
+ #api;
702
+ constructor(api) {
703
+ this.#api = api;
704
+ }
705
+ /**
706
+ * List policies in a workspace
707
+ * @param workspaceId - Workspace ID
708
+ * @param query - Optional pagination parameters (limit, after)
709
+ * @returns Promise that resolves with a paginated list of policies
710
+ * @throws {ApiError} if the request fails
711
+ */
712
+ async listPolicies(workspaceId, query) {
713
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/policies/", { params: {
714
+ path: { workspaceId },
715
+ query
716
+ } });
717
+ return data;
718
+ }
719
+ /**
720
+ * Create a policy in a workspace
721
+ * @param workspaceId - Workspace ID
722
+ * @param policy - Policy creation request
723
+ * @returns Promise that resolves with the created policy
724
+ * @throws {ApiError} if the request fails
725
+ */
726
+ async createPolicy(workspaceId, policy) {
727
+ const { data } = await this.#api.POST("/workspaces/{workspaceId}/policies/", {
728
+ params: { path: { workspaceId } },
729
+ body: policy
730
+ });
731
+ return data;
732
+ }
733
+ /**
734
+ * Get policy details by ID
735
+ * @param policyId - Policy ID
736
+ * @returns Promise that resolves with the policy details
737
+ * @throws {ApiError} if the request fails
738
+ */
739
+ async getPolicy(policyId) {
740
+ const { data } = await this.#api.GET("/policies/{policyId}/", { params: { path: { policyId } } });
741
+ return data;
742
+ }
743
+ /**
744
+ * Update a policy
745
+ * @param policyId - Policy ID
746
+ * @param updates - Policy update request
747
+ * @returns Promise that resolves with the updated policy
748
+ * @throws {ApiError} if the request fails
749
+ */
750
+ async updatePolicy(policyId, updates) {
751
+ const { data } = await this.#api.PUT("/policies/{policyId}/", {
752
+ params: { path: { policyId } },
753
+ body: updates
754
+ });
755
+ return data;
756
+ }
757
+ /**
758
+ * Delete a policy
759
+ * @param policyId - Policy ID
760
+ * @returns Promise that resolves when the policy is deleted
761
+ * @throws {ApiError} if the request fails
762
+ */
763
+ async deletePolicy(policyId) {
764
+ await this.#api.DELETE("/policies/{policyId}/", { params: { path: { policyId } } });
765
+ }
766
+ };
767
+
768
+ //#endregion
769
+ //#region src/services/runs.ts
770
+ /**
771
+ * Service for handling pipeline run operations
772
+ */
773
+ var Runs = class {
774
+ #api;
775
+ constructor(api) {
776
+ this.#api = api;
777
+ }
778
+ /**
779
+ * List runs for a pipeline
780
+ * @param pipelineId - Pipeline ID
781
+ * @param query - Optional pagination parameters (limit, after)
782
+ * @returns Promise that resolves with a paginated list of pipeline runs
783
+ * @throws {ApiError} if the request fails
784
+ */
785
+ async listRuns(pipelineId, query) {
786
+ const { data } = await this.#api.GET("/pipelines/{pipelineId}/runs/", { params: {
787
+ path: { pipelineId },
788
+ query
789
+ } });
790
+ return data;
791
+ }
792
+ /**
793
+ * Trigger a new run for a pipeline
794
+ * @param pipelineId - Pipeline ID
795
+ * @param run - Pipeline run creation request
796
+ * @returns Promise that resolves with the created pipeline run
797
+ * @throws {ApiError} if the request fails
798
+ */
799
+ async createRun(pipelineId, run) {
800
+ const { data } = await this.#api.POST("/pipelines/{pipelineId}/runs/", {
801
+ params: { path: { pipelineId } },
802
+ body: run
803
+ });
804
+ return data;
805
+ }
806
+ /**
807
+ * Get pipeline run details by ID
808
+ * @param runId - Run ID
809
+ * @returns Promise that resolves with the pipeline run details
810
+ * @throws {ApiError} if the request fails
811
+ */
812
+ async getRun(runId) {
813
+ const { data } = await this.#api.GET("/runs/{runId}/", { params: { path: { runId } } });
814
+ return data;
815
+ }
816
+ /**
817
+ * Get the detections (analyzed document) for a pipeline run
818
+ * @param runId - Run ID
819
+ * @returns Promise that resolves with the analyzed document
820
+ * @throws {ApiError} if the request fails
821
+ */
822
+ async getDetections(runId) {
823
+ const { data } = await this.#api.GET("/runs/{runId}/detections/", { params: { path: { runId } } });
824
+ return data;
825
+ }
826
+ /**
827
+ * Apply redactions to a pipeline run
828
+ * @param runId - Run ID
829
+ * @returns Promise that resolves with the updated pipeline run
830
+ * @throws {ApiError} if the request fails
831
+ */
832
+ async redact(runId) {
833
+ const { data } = await this.#api.POST("/runs/{runId}/redactions/", { params: { path: { runId } } });
834
+ return data;
835
+ }
836
+ };
837
+
838
+ //#endregion
839
+ //#region src/services/status.ts
840
+ /**
841
+ * Service for handling status and health check operations
842
+ */
843
+ var Status = class {
844
+ #api;
845
+ constructor(api) {
846
+ this.#api = api;
847
+ }
848
+ /**
849
+ * Check the health status of the API
850
+ * @param options - Health check options
851
+ * @returns Promise that resolves with the API health status
852
+ */
853
+ async checkHealth(options) {
854
+ const { data, error } = await this.#api.GET("/health/", {
855
+ params: { path: { version: "v1" } },
856
+ body: options ?? {}
857
+ });
858
+ return data ?? error;
859
+ }
860
+ };
861
+
862
+ //#endregion
863
+ //#region src/services/webhooks.ts
864
+ /**
865
+ * Service for handling webhook operations
866
+ */
867
+ var Webhooks = class {
868
+ #api;
869
+ constructor(api) {
870
+ this.#api = api;
871
+ }
872
+ /**
873
+ * List all webhooks in a workspace
874
+ * @param workspaceId - Workspace ID
875
+ * @param query - Optional pagination parameters (limit, after)
876
+ * @returns Promise that resolves with a paginated list of webhooks
877
+ * @throws {ApiError} if the request fails
878
+ */
879
+ async listWebhooks(workspaceId, query) {
880
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/webhooks/", { params: {
881
+ path: { workspaceId },
882
+ query
883
+ } });
884
+ return data;
885
+ }
886
+ /**
887
+ * Get a specific webhook by ID
888
+ * @param webhookId - Webhook ID
889
+ * @returns Promise that resolves with the webhook details
890
+ * @throws {ApiError} if the request fails
891
+ */
892
+ async getWebhook(webhookId) {
893
+ const { data } = await this.#api.GET("/webhooks/{webhookId}/", { params: { path: { webhookId } } });
894
+ return data;
895
+ }
896
+ /**
897
+ * Create a new webhook
898
+ * @param workspaceId - Workspace ID
899
+ * @param webhook - Webhook creation request
900
+ * @returns Promise that resolves with the created webhook
901
+ * @throws {ApiError} if the request fails
902
+ */
903
+ async createWebhook(workspaceId, webhook) {
904
+ const { data } = await this.#api.POST("/workspaces/{workspaceId}/webhooks/", {
905
+ params: { path: { workspaceId } },
906
+ body: webhook
907
+ });
908
+ return data;
909
+ }
910
+ /**
911
+ * Update an existing webhook
912
+ * @param webhookId - Webhook ID
913
+ * @param updates - Webhook update request
914
+ * @returns Promise that resolves with the updated webhook
915
+ * @throws {ApiError} if the request fails
916
+ */
917
+ async updateWebhook(webhookId, updates) {
918
+ const { data } = await this.#api.PUT("/webhooks/{webhookId}/", {
919
+ params: { path: { webhookId } },
920
+ body: updates
921
+ });
922
+ return data;
923
+ }
924
+ /**
925
+ * Delete a webhook
926
+ * @param webhookId - Webhook ID
927
+ * @returns Promise that resolves when the webhook is deleted
928
+ * @throws {ApiError} if the request fails
929
+ */
930
+ async deleteWebhook(webhookId) {
931
+ await this.#api.DELETE("/webhooks/{webhookId}/", { params: { path: { webhookId } } });
932
+ }
933
+ /**
934
+ * Test a webhook by sending a test payload
935
+ * @param webhookId - Webhook ID
936
+ * @param options - Test webhook options
937
+ * @returns Promise that resolves with the test result
938
+ * @throws {ApiError} if the request fails
939
+ */
940
+ async testWebhook(webhookId, options) {
941
+ const { data } = await this.#api.POST("/webhooks/{webhookId}/test/", {
942
+ params: { path: { webhookId } },
943
+ body: options ?? {}
944
+ });
945
+ return data;
946
+ }
947
+ };
948
+
949
+ //#endregion
950
+ //#region src/services/workspaces.ts
951
+ /**
952
+ * Service for handling workspace operations
953
+ */
954
+ var Workspaces = class {
955
+ #api;
956
+ constructor(api) {
957
+ this.#api = api;
958
+ }
959
+ /**
960
+ * List all workspaces
961
+ * @param query - Optional pagination parameters (limit, after)
962
+ * @returns Promise that resolves with a paginated list of workspaces
963
+ * @throws {ApiError} if the request fails
964
+ */
965
+ async listWorkspaces(query) {
966
+ const { data } = await this.#api.GET("/workspaces/", { params: { query } });
967
+ return data;
968
+ }
969
+ /**
970
+ * Get workspace details by ID
971
+ * @param workspaceId - Workspace ID
972
+ * @returns Promise that resolves with the workspace details
973
+ * @throws {ApiError} if the request fails
974
+ */
975
+ async getWorkspace(workspaceId) {
976
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/", { params: { path: { workspaceId } } });
977
+ return data;
978
+ }
979
+ /**
980
+ * Create a new workspace
981
+ * @param workspace - Workspace creation request
982
+ * @returns Promise that resolves with the created workspace
983
+ * @throws {ApiError} if the request fails
984
+ */
985
+ async createWorkspace(workspace) {
986
+ const { data } = await this.#api.POST("/workspaces/", { body: workspace });
987
+ return data;
988
+ }
989
+ /**
990
+ * Update an existing workspace
991
+ * @param workspaceId - Workspace ID
992
+ * @param updates - Workspace update request
993
+ * @returns Promise that resolves with the updated workspace
994
+ * @throws {ApiError} if the request fails
995
+ */
996
+ async updateWorkspace(workspaceId, updates) {
997
+ const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/", {
998
+ params: { path: { workspaceId } },
999
+ body: updates
1000
+ });
1001
+ return data;
1002
+ }
1003
+ /**
1004
+ * Delete a workspace
1005
+ * @param workspaceId - Workspace ID
1006
+ * @returns Promise that resolves when the workspace is deleted
1007
+ * @throws {ApiError} if the request fails
1008
+ */
1009
+ async deleteWorkspace(workspaceId) {
1010
+ await this.#api.DELETE("/workspaces/{workspaceId}/", { params: { path: { workspaceId } } });
1011
+ }
1012
+ /**
1013
+ * Get notification settings for the authenticated user in a workspace
1014
+ * @param workspaceId - Workspace ID
1015
+ * @returns Promise that resolves with the notification settings
1016
+ * @throws {ApiError} if the request fails
1017
+ */
1018
+ async getNotificationSettings(workspaceId) {
1019
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/notifications/", { params: { path: { workspaceId } } });
1020
+ return data;
1021
+ }
1022
+ /**
1023
+ * Update notification settings for the authenticated user in a workspace
1024
+ * @param workspaceId - Workspace ID
1025
+ * @param settings - Notification settings update request
1026
+ * @returns Promise that resolves with the updated notification settings
1027
+ * @throws {ApiError} if the request fails
1028
+ */
1029
+ async updateNotificationSettings(workspaceId, settings) {
1030
+ const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/notifications/", {
1031
+ params: { path: { workspaceId } },
1032
+ body: settings
1033
+ });
1034
+ return data;
1035
+ }
1036
+ };
1037
+
1038
+ //#endregion
1039
+ export { Policies as a, Members as c, Contexts as d, Connections as f, Account as g, Activities as h, Runs as i, Invites as l, ApiTokens as m, Webhooks as n, Pipelines as o, Auth as p, Status as r, Notifications as s, Workspaces as t, Files as u };
1040
+ //# sourceMappingURL=services-Dh0FMDzU.js.map