@nvisy/sdk 0.2.0 → 0.3.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.
@@ -1,5 +1,5 @@
1
1
  // src/services/account.ts
2
- var AccountService = class {
2
+ var Account = class {
3
3
  #api;
4
4
  constructor(api) {
5
5
  this.#api = api;
@@ -9,7 +9,7 @@ var AccountService = class {
9
9
  * @returns Promise that resolves with the account details
10
10
  * @throws {ApiError} if the request fails
11
11
  */
12
- async get() {
12
+ async getAccount() {
13
13
  const { data } = await this.#api.GET("/account");
14
14
  return data;
15
15
  }
@@ -19,7 +19,7 @@ var AccountService = class {
19
19
  * @returns Promise that resolves with the updated account
20
20
  * @throws {ApiError} if the request fails
21
21
  */
22
- async update(updates) {
22
+ async updateAccount(updates) {
23
23
  const { data } = await this.#api.PATCH("/account", {
24
24
  body: updates
25
25
  });
@@ -30,13 +30,13 @@ var AccountService = class {
30
30
  * @returns Promise that resolves when the account is deleted
31
31
  * @throws {ApiError} if the request fails
32
32
  */
33
- async delete() {
33
+ async deleteAccount() {
34
34
  await this.#api.DELETE("/account");
35
35
  }
36
36
  };
37
37
 
38
38
  // src/services/activities.ts
39
- var ActivitiesService = class {
39
+ var Activities = class {
40
40
  #api;
41
41
  constructor(api) {
42
42
  this.#api = api;
@@ -44,13 +44,13 @@ var ActivitiesService = class {
44
44
  /**
45
45
  * List activities for a workspace
46
46
  * @param workspaceId - Workspace ID
47
- * @param query - Optional query parameters (offset, limit)
48
- * @returns Promise that resolves with the list of activities
47
+ * @param query - Optional pagination parameters (limit, after)
48
+ * @returns Promise that resolves with a paginated list of activities
49
49
  * @throws {ApiError} if the request fails
50
50
  */
51
- async list(workspaceId, query) {
51
+ async listActivities(workspaceId, query) {
52
52
  const { data } = await this.#api.GET(
53
- "/workspaces/{workspace_id}/activities/",
53
+ "/workspaces/{workspaceId}/activities/",
54
54
  {
55
55
  params: { path: { workspaceId }, query }
56
56
  }
@@ -60,7 +60,7 @@ var ActivitiesService = class {
60
60
  };
61
61
 
62
62
  // src/services/annotations.ts
63
- var AnnotationsService = class {
63
+ var Annotations = class {
64
64
  #api;
65
65
  constructor(api) {
66
66
  this.#api = api;
@@ -68,12 +68,12 @@ var AnnotationsService = class {
68
68
  /**
69
69
  * List annotations for a file
70
70
  * @param fileId - File ID
71
- * @param query - Optional query parameters (offset, limit)
72
- * @returns Promise that resolves with the list of annotations
71
+ * @param query - Optional pagination parameters (limit, after)
72
+ * @returns Promise that resolves with a paginated list of annotations
73
73
  * @throws {ApiError} if the request fails
74
74
  */
75
- async list(fileId, query) {
76
- const { data } = await this.#api.GET("/files/{file_id}/annotations/", {
75
+ async listAnnotations(fileId, query) {
76
+ const { data } = await this.#api.GET("/files/{fileId}/annotations/", {
77
77
  params: { path: { fileId }, query }
78
78
  });
79
79
  return data;
@@ -84,8 +84,8 @@ var AnnotationsService = class {
84
84
  * @returns Promise that resolves with the annotation details
85
85
  * @throws {ApiError} if the request fails
86
86
  */
87
- async get(annotationId) {
88
- const { data } = await this.#api.GET("/annotations/{annotation_id}", {
87
+ async getAnnotation(annotationId) {
88
+ const { data } = await this.#api.GET("/annotations/{annotationId}", {
89
89
  params: { path: { annotationId } }
90
90
  });
91
91
  return data;
@@ -97,8 +97,8 @@ var AnnotationsService = class {
97
97
  * @returns Promise that resolves with the created annotation
98
98
  * @throws {ApiError} if the request fails
99
99
  */
100
- async create(fileId, annotation) {
101
- const { data } = await this.#api.POST("/files/{file_id}/annotations/", {
100
+ async createAnnotation(fileId, annotation) {
101
+ const { data } = await this.#api.POST("/files/{fileId}/annotations/", {
102
102
  params: { path: { fileId } },
103
103
  body: annotation
104
104
  });
@@ -111,8 +111,8 @@ var AnnotationsService = class {
111
111
  * @returns Promise that resolves with the updated annotation
112
112
  * @throws {ApiError} if the request fails
113
113
  */
114
- async update(annotationId, updates) {
115
- const { data } = await this.#api.PATCH("/annotations/{annotation_id}", {
114
+ async updateAnnotation(annotationId, updates) {
115
+ const { data } = await this.#api.PATCH("/annotations/{annotationId}", {
116
116
  params: { path: { annotationId } },
117
117
  body: updates
118
118
  });
@@ -124,53 +124,50 @@ var AnnotationsService = class {
124
124
  * @returns Promise that resolves when the annotation is deleted
125
125
  * @throws {ApiError} if the request fails
126
126
  */
127
- async delete(annotationId) {
128
- await this.#api.DELETE("/annotations/{annotation_id}", {
127
+ async deleteAnnotation(annotationId) {
128
+ await this.#api.DELETE("/annotations/{annotationId}", {
129
129
  params: { path: { annotationId } }
130
130
  });
131
131
  }
132
132
  };
133
133
 
134
134
  // src/services/api-tokens.ts
135
- var ApiTokensService = class {
135
+ var ApiTokens = class {
136
136
  #api;
137
137
  constructor(api) {
138
138
  this.#api = api;
139
139
  }
140
140
  /**
141
141
  * List all API tokens for the authenticated account
142
- * @param options - Pagination options
143
- * @returns Promise that resolves with the list of API tokens
142
+ * @param query - Optional pagination parameters (limit, after)
143
+ * @returns Promise that resolves with a paginated list of API tokens
144
144
  * @throws {ApiError} if the request fails
145
145
  */
146
- async list(options) {
146
+ async listApiTokens(query) {
147
147
  const { data } = await this.#api.GET("/api-tokens/", {
148
- params: { query: options }
148
+ params: { query }
149
149
  });
150
150
  return data;
151
151
  }
152
152
  /**
153
- * Get a specific API token by access token
154
- * @param accessToken - The access token identifier
153
+ * Get a specific API token by token ID
154
+ * @param tokenId - The token identifier
155
155
  * @returns Promise that resolves with the API token details
156
156
  * @throws {ApiError} if the request fails
157
157
  */
158
- async get(accessToken) {
159
- const { data } = await this.#api.GET(
160
- "/api-tokens/{access_token}/",
161
- {
162
- params: { path: { access_token: accessToken } }
163
- }
164
- );
158
+ async getApiToken(tokenId) {
159
+ const { data } = await this.#api.GET("/api-tokens/{tokenId}/", {
160
+ params: { path: { tokenId } }
161
+ });
165
162
  return data;
166
163
  }
167
164
  /**
168
165
  * Create a new API token
169
166
  * @param token - Token creation request
170
- * @returns Promise that resolves with the created token (includes secret, shown only once)
167
+ * @returns Promise that resolves with the created token (includes JWT, shown only once)
171
168
  * @throws {ApiError} if the request fails
172
169
  */
173
- async create(token) {
170
+ async createApiToken(token) {
174
171
  const { data } = await this.#api.POST("/api-tokens/", {
175
172
  body: token
176
173
  });
@@ -178,39 +175,33 @@ var ApiTokensService = class {
178
175
  }
179
176
  /**
180
177
  * Update an existing API token
181
- * @param accessToken - The access token identifier
178
+ * @param tokenId - The token identifier
182
179
  * @param updates - Token update request
183
180
  * @returns Promise that resolves with the updated token
184
181
  * @throws {ApiError} if the request fails
185
182
  */
186
- async update(accessToken, updates) {
187
- const { data } = await this.#api.PATCH(
188
- "/api-tokens/{access_token}/",
189
- {
190
- params: { path: { access_token: accessToken } },
191
- body: updates
192
- }
193
- );
183
+ async updateApiToken(tokenId, updates) {
184
+ const { data } = await this.#api.PATCH("/api-tokens/{tokenId}/", {
185
+ params: { path: { tokenId } },
186
+ body: updates
187
+ });
194
188
  return data;
195
189
  }
196
190
  /**
197
191
  * Revoke an API token
198
- * @param accessToken - The access token identifier
192
+ * @param tokenId - The token identifier
199
193
  * @returns Promise that resolves when the token is revoked
200
194
  * @throws {ApiError} if the request fails
201
195
  */
202
- async revoke(accessToken) {
203
- await this.#api.DELETE(
204
- "/api-tokens/{access_token}/",
205
- {
206
- params: { path: { access_token: accessToken } }
207
- }
208
- );
196
+ async revokeApiToken(tokenId) {
197
+ await this.#api.DELETE("/api-tokens/{tokenId}/", {
198
+ params: { path: { tokenId } }
199
+ });
209
200
  }
210
201
  };
211
202
 
212
203
  // src/services/auth.ts
213
- var AuthService = class {
204
+ var Auth = class {
214
205
  #api;
215
206
  constructor(api) {
216
207
  this.#api = api;
@@ -221,7 +212,7 @@ var AuthService = class {
221
212
  * @returns Promise that resolves with the auth response containing access token
222
213
  * @throws {ApiError} if the request fails
223
214
  */
224
- async login(credentials) {
215
+ async loginAccount(credentials) {
225
216
  const { data } = await this.#api.POST("/auth/login", {
226
217
  body: credentials
227
218
  });
@@ -229,20 +220,28 @@ var AuthService = class {
229
220
  }
230
221
  /**
231
222
  * Sign up a new account
232
- * @param details - Signup details
223
+ * @param credentials - Signup details
233
224
  * @returns Promise that resolves with the auth response containing access token
234
225
  * @throws {ApiError} if the request fails
235
226
  */
236
- async signup(details) {
227
+ async signupAccount(credentials) {
237
228
  const { data } = await this.#api.POST("/auth/signup", {
238
- body: details
229
+ body: credentials
239
230
  });
240
231
  return data;
241
232
  }
233
+ /**
234
+ * Logout and invalidate the current access token
235
+ * @returns Promise that resolves when logout is complete
236
+ * @throws {ApiError} if the request fails
237
+ */
238
+ async logoutAccount() {
239
+ await this.#api.POST("/auth/logout");
240
+ }
242
241
  };
243
242
 
244
243
  // src/services/comments.ts
245
- var CommentsService = class {
244
+ var Comments = class {
246
245
  #api;
247
246
  constructor(api) {
248
247
  this.#api = api;
@@ -250,12 +249,12 @@ var CommentsService = class {
250
249
  /**
251
250
  * List all comments on a file
252
251
  * @param fileId - File ID
253
- * @param query - Optional query parameters (offset, limit)
254
- * @returns Promise that resolves with the list of comments
252
+ * @param query - Optional pagination parameters (limit, after)
253
+ * @returns Promise that resolves with a paginated list of comments
255
254
  * @throws {ApiError} if the request fails
256
255
  */
257
- async list(fileId, query) {
258
- const { data } = await this.#api.GET("/files/{file_id}/comments", {
256
+ async listComments(fileId, query) {
257
+ const { data } = await this.#api.GET("/files/{fileId}/comments", {
259
258
  params: { path: { fileId }, query }
260
259
  });
261
260
  return data;
@@ -267,29 +266,42 @@ var CommentsService = class {
267
266
  * @returns Promise that resolves with the created comment
268
267
  * @throws {ApiError} if the request fails
269
268
  */
270
- async create(fileId, comment) {
271
- const { data } = await this.#api.POST("/files/{file_id}/comments", {
269
+ async createComment(fileId, comment) {
270
+ const { data } = await this.#api.POST("/files/{fileId}/comments", {
272
271
  params: { path: { fileId } },
273
272
  body: comment
274
273
  });
275
274
  return data;
276
275
  }
276
+ /**
277
+ * Update a comment
278
+ * @param commentId - Comment ID
279
+ * @param updates - Comment update request
280
+ * @returns Promise that resolves with the updated comment
281
+ * @throws {ApiError} if the request fails
282
+ */
283
+ async updateComment(commentId, updates) {
284
+ const { data } = await this.#api.PATCH("/comments/{commentId}", {
285
+ params: { path: { commentId } },
286
+ body: updates
287
+ });
288
+ return data;
289
+ }
277
290
  /**
278
291
  * Delete a comment
279
- * @param fileId - File ID
280
292
  * @param commentId - Comment ID
281
293
  * @returns Promise that resolves when the comment is deleted
282
294
  * @throws {ApiError} if the request fails
283
295
  */
284
- async delete(fileId, commentId) {
285
- await this.#api.DELETE("/files/{file_id}/comments/{comment_id}", {
286
- params: { path: { fileId, commentId } }
296
+ async deleteComment(commentId) {
297
+ await this.#api.DELETE("/comments/{commentId}", {
298
+ params: { path: { commentId } }
287
299
  });
288
300
  }
289
301
  };
290
302
 
291
303
  // src/services/documents.ts
292
- var DocumentsService = class {
304
+ var Documents = class {
293
305
  #api;
294
306
  constructor(api) {
295
307
  this.#api = api;
@@ -297,13 +309,13 @@ var DocumentsService = class {
297
309
  /**
298
310
  * List documents in a workspace
299
311
  * @param workspaceId - Workspace ID
300
- * @param query - Optional query parameters (offset, limit)
301
- * @returns Promise that resolves with the list of documents
312
+ * @param query - Optional pagination parameters (limit, after)
313
+ * @returns Promise that resolves with a paginated list of documents
302
314
  * @throws {ApiError} if the request fails
303
315
  */
304
- async list(workspaceId, query) {
316
+ async listDocuments(workspaceId, query) {
305
317
  const { data } = await this.#api.GET(
306
- "/workspaces/{workspace_id}/documents",
318
+ "/workspaces/{workspaceId}/documents",
307
319
  {
308
320
  params: { path: { workspaceId }, query }
309
321
  }
@@ -316,8 +328,8 @@ var DocumentsService = class {
316
328
  * @returns Promise that resolves with the document details
317
329
  * @throws {ApiError} if the request fails
318
330
  */
319
- async get(documentId) {
320
- const { data } = await this.#api.GET("/documents/{document_id}", {
331
+ async getDocument(documentId) {
332
+ const { data } = await this.#api.GET("/documents/{documentId}", {
321
333
  params: { path: { documentId } }
322
334
  });
323
335
  return data;
@@ -329,9 +341,9 @@ var DocumentsService = class {
329
341
  * @returns Promise that resolves with the created document
330
342
  * @throws {ApiError} if the request fails
331
343
  */
332
- async create(workspaceId, document) {
344
+ async createDocument(workspaceId, document) {
333
345
  const { data } = await this.#api.POST(
334
- "/workspaces/{workspace_id}/documents",
346
+ "/workspaces/{workspaceId}/documents",
335
347
  {
336
348
  params: { path: { workspaceId } },
337
349
  body: document
@@ -346,8 +358,8 @@ var DocumentsService = class {
346
358
  * @returns Promise that resolves with the updated document
347
359
  * @throws {ApiError} if the request fails
348
360
  */
349
- async update(documentId, updates) {
350
- const { data } = await this.#api.PATCH("/documents/{document_id}", {
361
+ async updateDocument(documentId, updates) {
362
+ const { data } = await this.#api.PATCH("/documents/{documentId}", {
351
363
  params: { path: { documentId } },
352
364
  body: updates
353
365
  });
@@ -359,40 +371,76 @@ var DocumentsService = class {
359
371
  * @returns Promise that resolves when the document is deleted
360
372
  * @throws {ApiError} if the request fails
361
373
  */
362
- async delete(documentId) {
363
- await this.#api.DELETE("/documents/{document_id}", {
374
+ async deleteDocument(documentId) {
375
+ await this.#api.DELETE("/documents/{documentId}", {
364
376
  params: { path: { documentId } }
365
377
  });
366
378
  }
367
379
  };
368
380
 
369
381
  // src/services/files.ts
370
- var FilesService = class {
382
+ var Files = class {
371
383
  #api;
372
384
  constructor(api) {
373
385
  this.#api = api;
374
386
  }
387
+ /**
388
+ * Upload one or more files to a workspace
389
+ * @param workspaceId - Workspace ID
390
+ * @param files - File or array of files to upload
391
+ * @returns Promise that resolves with the uploaded file metadata
392
+ * @throws {ApiError} if the request fails
393
+ */
394
+ async uploadFiles(workspaceId, files) {
395
+ const formData = new FormData();
396
+ const fileArray = Array.isArray(files) ? files : [files];
397
+ for (const file of fileArray) {
398
+ const name = file instanceof File ? file.name : "file";
399
+ formData.append("files", file, name);
400
+ }
401
+ const { data } = await this.#api.POST("/workspaces/{workspaceId}/files/", {
402
+ params: { path: { workspaceId } },
403
+ // Schema types multipart as unknown[], but openapi-fetch needs FormData.
404
+ body: formData,
405
+ bodySerializer: (formData2) => formData2,
406
+ // Remove Content-Type so browser sets multipart/form-data with boundary.
407
+ headers: { "Content-Type": null }
408
+ });
409
+ return data;
410
+ }
375
411
  /**
376
412
  * List files in a workspace
377
413
  * @param workspaceId - Workspace ID
378
- * @param query - Optional query parameters (formats, sortBy, order, offset, limit)
379
- * @returns Promise that resolves with the list of files
414
+ * @param query - Optional query parameters (formats, limit, after)
415
+ * @returns Promise that resolves with a paginated list of files
380
416
  * @throws {ApiError} if the request fails
381
417
  */
382
- async list(workspaceId, query) {
383
- const { data } = await this.#api.GET("/workspaces/{workspace_id}/files/", {
418
+ async listFiles(workspaceId, query) {
419
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/files/", {
384
420
  params: { path: { workspaceId }, query }
385
421
  });
386
422
  return data;
387
423
  }
424
+ /**
425
+ * Get file metadata by ID
426
+ * @param fileId - File ID
427
+ * @returns Promise that resolves with the file metadata
428
+ * @throws {ApiError} if the request fails
429
+ */
430
+ async getFile(fileId) {
431
+ const { data } = await this.#api.GET("/files/{fileId}", {
432
+ params: { path: { fileId } }
433
+ });
434
+ return data;
435
+ }
388
436
  /**
389
437
  * Download a file by ID
390
438
  * @param fileId - File ID
391
439
  * @returns Promise that resolves with the file response
392
440
  * @throws {ApiError} if the request fails
393
441
  */
394
- async download(fileId) {
395
- const { response } = await this.#api.GET("/files/{file_id}", {
442
+ async downloadFile(fileId) {
443
+ const { response } = await this.#api.GET("/files/{fileId}/content", {
396
444
  params: { path: { fileId } },
397
445
  parseAs: "stream"
398
446
  });
@@ -405,8 +453,8 @@ var FilesService = class {
405
453
  * @returns Promise that resolves with the updated file
406
454
  * @throws {ApiError} if the request fails
407
455
  */
408
- async update(fileId, updates) {
409
- const { data } = await this.#api.PATCH("/files/{file_id}", {
456
+ async updateFile(fileId, updates) {
457
+ const { data } = await this.#api.PATCH("/files/{fileId}", {
410
458
  params: { path: { fileId } },
411
459
  body: updates
412
460
  });
@@ -418,21 +466,21 @@ var FilesService = class {
418
466
  * @returns Promise that resolves when the file is deleted
419
467
  * @throws {ApiError} if the request fails
420
468
  */
421
- async delete(fileId) {
422
- await this.#api.DELETE("/files/{file_id}", {
469
+ async deleteFile(fileId) {
470
+ await this.#api.DELETE("/files/{fileId}", {
423
471
  params: { path: { fileId } }
424
472
  });
425
473
  }
426
474
  /**
427
- * Download multiple files
475
+ * Download files as an archive
428
476
  * @param workspaceId - Workspace ID
429
- * @param request - Download request with file IDs
430
- * @returns Promise that resolves with the download response
477
+ * @param request - Download request with format and optional file IDs
478
+ * @returns Promise that resolves with the archive response
431
479
  * @throws {ApiError} if the request fails
432
480
  */
433
- async downloadMultiple(workspaceId, request) {
434
- const { response } = await this.#api.POST(
435
- "/workspaces/{workspace_id}/files/download",
481
+ async downloadFiles(workspaceId, request) {
482
+ const { response } = await this.#api.GET(
483
+ "/workspaces/{workspaceId}/files/batch",
436
484
  {
437
485
  params: { path: { workspaceId } },
438
486
  body: request,
@@ -442,27 +490,22 @@ var FilesService = class {
442
490
  return response;
443
491
  }
444
492
  /**
445
- * Download files as an archive
493
+ * Delete multiple files
446
494
  * @param workspaceId - Workspace ID
447
- * @param request - Archive download request
448
- * @returns Promise that resolves with the archive response
495
+ * @param request - Delete request with file IDs
496
+ * @returns Promise that resolves when the files are deleted
449
497
  * @throws {ApiError} if the request fails
450
498
  */
451
- async downloadArchive(workspaceId, request) {
452
- const { response } = await this.#api.POST(
453
- "/workspaces/{workspace_id}/files/archive",
454
- {
455
- params: { path: { workspaceId } },
456
- body: request,
457
- parseAs: "stream"
458
- }
459
- );
460
- return response;
499
+ async deleteFiles(workspaceId, request) {
500
+ await this.#api.DELETE("/workspaces/{workspaceId}/files/batch", {
501
+ params: { path: { workspaceId } },
502
+ body: request
503
+ });
461
504
  }
462
505
  };
463
506
 
464
507
  // src/services/integrations.ts
465
- var IntegrationsService = class {
508
+ var Integrations = class {
466
509
  #api;
467
510
  constructor(api) {
468
511
  this.#api = api;
@@ -470,13 +513,13 @@ var IntegrationsService = class {
470
513
  /**
471
514
  * List integrations for a workspace
472
515
  * @param workspaceId - Workspace ID
473
- * @param query - Optional query parameters (integrationType, offset, limit)
474
- * @returns Promise that resolves with the list of integrations
516
+ * @param query - Optional pagination parameters (limit, after)
517
+ * @returns Promise that resolves with a paginated list of integrations
475
518
  * @throws {ApiError} if the request fails
476
519
  */
477
- async list(workspaceId, query) {
520
+ async listIntegrations(workspaceId, query) {
478
521
  const { data } = await this.#api.GET(
479
- "/workspaces/{workspace_id}/integrations/",
522
+ "/workspaces/{workspaceId}/integrations/",
480
523
  {
481
524
  params: { path: { workspaceId }, query }
482
525
  }
@@ -489,8 +532,8 @@ var IntegrationsService = class {
489
532
  * @returns Promise that resolves with the integration details
490
533
  * @throws {ApiError} if the request fails
491
534
  */
492
- async get(integrationId) {
493
- const { data } = await this.#api.GET("/integrations/{integration_id}/", {
535
+ async getIntegration(integrationId) {
536
+ const { data } = await this.#api.GET("/integrations/{integrationId}/", {
494
537
  params: { path: { integrationId } }
495
538
  });
496
539
  return data;
@@ -502,9 +545,9 @@ var IntegrationsService = class {
502
545
  * @returns Promise that resolves with the created integration
503
546
  * @throws {ApiError} if the request fails
504
547
  */
505
- async create(workspaceId, integration) {
548
+ async createIntegration(workspaceId, integration) {
506
549
  const { data } = await this.#api.POST(
507
- "/workspaces/{workspace_id}/integrations/",
550
+ "/workspaces/{workspaceId}/integrations/",
508
551
  {
509
552
  params: { path: { workspaceId } },
510
553
  body: integration
@@ -519,8 +562,8 @@ var IntegrationsService = class {
519
562
  * @returns Promise that resolves with the updated integration
520
563
  * @throws {ApiError} if the request fails
521
564
  */
522
- async update(integrationId, updates) {
523
- const { data } = await this.#api.PUT("/integrations/{integration_id}/", {
565
+ async updateIntegration(integrationId, updates) {
566
+ const { data } = await this.#api.PUT("/integrations/{integrationId}/", {
524
567
  params: { path: { integrationId } },
525
568
  body: updates
526
569
  });
@@ -533,9 +576,9 @@ var IntegrationsService = class {
533
576
  * @returns Promise that resolves with the updated integration
534
577
  * @throws {ApiError} if the request fails
535
578
  */
536
- async updateCredentials(integrationId, credentials) {
579
+ async updateIntegrationCredentials(integrationId, credentials) {
537
580
  const { data } = await this.#api.PATCH(
538
- "/integrations/{integration_id}/credentials/",
581
+ "/integrations/{integrationId}/credentials/",
539
582
  {
540
583
  params: { path: { integrationId } },
541
584
  body: credentials
@@ -549,15 +592,15 @@ var IntegrationsService = class {
549
592
  * @returns Promise that resolves when the integration is deleted
550
593
  * @throws {ApiError} if the request fails
551
594
  */
552
- async delete(integrationId) {
553
- await this.#api.DELETE("/integrations/{integration_id}/", {
595
+ async deleteIntegration(integrationId) {
596
+ await this.#api.DELETE("/integrations/{integrationId}/", {
554
597
  params: { path: { integrationId } }
555
598
  });
556
599
  }
557
600
  };
558
601
 
559
602
  // src/services/invites.ts
560
- var InvitesService = class {
603
+ var Invites = class {
561
604
  #api;
562
605
  constructor(api) {
563
606
  this.#api = api;
@@ -565,17 +608,14 @@ var InvitesService = class {
565
608
  /**
566
609
  * List all invitations for a workspace
567
610
  * @param workspaceId - Workspace ID
568
- * @param query - Optional query parameters (role, sortBy, order, offset, limit)
569
- * @returns Promise that resolves with the list of invitations
611
+ * @param query - Optional query parameters (role, sortBy, order, limit, after)
612
+ * @returns Promise that resolves with a paginated list of invitations
570
613
  * @throws {ApiError} if the request fails
571
614
  */
572
- async list(workspaceId, query) {
573
- const { data } = await this.#api.GET(
574
- "/workspaces/{workspace_id}/invites/",
575
- {
576
- params: { path: { workspaceId }, query }
577
- }
578
- );
615
+ async listInvites(workspaceId, query) {
616
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/invites/", {
617
+ params: { path: { workspaceId }, query }
618
+ });
579
619
  return data;
580
620
  }
581
621
  /**
@@ -585,9 +625,9 @@ var InvitesService = class {
585
625
  * @returns Promise that resolves with the created invitation
586
626
  * @throws {ApiError} if the request fails
587
627
  */
588
- async send(workspaceId, invite) {
628
+ async sendInvite(workspaceId, invite) {
589
629
  const { data } = await this.#api.POST(
590
- "/workspaces/{workspace_id}/invites/",
630
+ "/workspaces/{workspaceId}/invites/",
591
631
  {
592
632
  params: { path: { workspaceId } },
593
633
  body: invite
@@ -601,8 +641,8 @@ var InvitesService = class {
601
641
  * @returns Promise that resolves when the invitation is canceled
602
642
  * @throws {ApiError} if the request fails
603
643
  */
604
- async cancel(inviteId) {
605
- await this.#api.DELETE("/invites/{invite_id}/", {
644
+ async cancelInvite(inviteId) {
645
+ await this.#api.DELETE("/invites/{inviteId}/", {
606
646
  params: { path: { inviteId } }
607
647
  });
608
648
  }
@@ -613,8 +653,8 @@ var InvitesService = class {
613
653
  * @returns Promise that resolves with the updated invitation
614
654
  * @throws {ApiError} if the request fails
615
655
  */
616
- async reply(inviteId, reply) {
617
- const { data } = await this.#api.PATCH("/invites/{invite_id}/reply/", {
656
+ async replyToInvite(inviteId, reply) {
657
+ const { data } = await this.#api.POST("/invites/{inviteId}/", {
618
658
  params: { path: { inviteId } },
619
659
  body: reply
620
660
  });
@@ -627,9 +667,9 @@ var InvitesService = class {
627
667
  * @returns Promise that resolves with the generated invite code
628
668
  * @throws {ApiError} if the request fails
629
669
  */
630
- async generateCode(workspaceId, options) {
670
+ async generateInviteCode(workspaceId, options) {
631
671
  const { data } = await this.#api.POST(
632
- "/workspaces/{workspace_id}/invites/code/",
672
+ "/workspaces/{workspaceId}/invites/code/",
633
673
  {
634
674
  params: { path: { workspaceId } },
635
675
  body: options
@@ -638,13 +678,27 @@ var InvitesService = class {
638
678
  return data;
639
679
  }
640
680
  /**
641
- * Join a workspace using an invite code
681
+ * Reply to an invite code (accept or decline)
642
682
  * @param inviteCode - The invite code
643
- * @returns Promise that resolves with the member details
683
+ * @param reply - Optional reply request (defaults to accept if not provided)
684
+ * @returns Promise that resolves with the member details if accepted, null if declined
644
685
  * @throws {ApiError} if the request fails
645
686
  */
646
- async joinWithCode(inviteCode) {
647
- const { data } = await this.#api.POST("/invites/{invite_code}/join/", {
687
+ async replyToInviteCode(inviteCode, reply) {
688
+ const { data } = await this.#api.POST("/invites/code/{inviteCode}/", {
689
+ params: { path: { inviteCode } },
690
+ body: reply ?? null
691
+ });
692
+ return data;
693
+ }
694
+ /**
695
+ * Preview an invite code without joining
696
+ * @param inviteCode - The invite code
697
+ * @returns Promise that resolves with the invite preview details
698
+ * @throws {ApiError} if the request fails
699
+ */
700
+ async previewInvite(inviteCode) {
701
+ const { data } = await this.#api.GET("/invites/code/{inviteCode}/", {
648
702
  params: { path: { inviteCode } }
649
703
  });
650
704
  return data;
@@ -652,7 +706,7 @@ var InvitesService = class {
652
706
  };
653
707
 
654
708
  // src/services/members.ts
655
- var MembersService = class {
709
+ var Members = class {
656
710
  #api;
657
711
  constructor(api) {
658
712
  this.#api = api;
@@ -660,17 +714,14 @@ var MembersService = class {
660
714
  /**
661
715
  * List members of a workspace
662
716
  * @param workspaceId - Workspace ID
663
- * @param query - Optional query parameters (role, has2fa, sortBy, order, offset, limit)
664
- * @returns Promise that resolves with the list of members
717
+ * @param query - Optional query parameters (role, has2fa, sortBy, order, limit, after)
718
+ * @returns Promise that resolves with a paginated list of members
665
719
  * @throws {ApiError} if the request fails
666
720
  */
667
- async list(workspaceId, query) {
668
- const { data } = await this.#api.GET(
669
- "/workspaces/{workspace_id}/members/",
670
- {
671
- params: { path: { workspaceId }, query }
672
- }
673
- );
721
+ async listMembers(workspaceId, query) {
722
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/members/", {
723
+ params: { path: { workspaceId }, query }
724
+ });
674
725
  return data;
675
726
  }
676
727
  /**
@@ -680,11 +731,13 @@ var MembersService = class {
680
731
  * @returns Promise that resolves with the member details
681
732
  * @throws {ApiError} if the request fails
682
733
  */
683
- async get(workspaceId, accountId) {
734
+ async getMember(workspaceId, accountId) {
684
735
  const { data } = await this.#api.GET(
685
- "/workspaces/{workspace_id}/members/{account_id}/",
736
+ "/workspaces/{workspaceId}/members/{accountId}/",
686
737
  {
687
- params: { path: { workspaceId, accountId } }
738
+ params: {
739
+ path: { workspaceId, accountId }
740
+ }
688
741
  }
689
742
  );
690
743
  return data;
@@ -693,16 +746,18 @@ var MembersService = class {
693
746
  * Update a member's role
694
747
  * @param workspaceId - Workspace ID
695
748
  * @param accountId - Account ID
696
- * @param role - New role for the member
749
+ * @param updates - New role for the member
697
750
  * @returns Promise that resolves with the updated member
698
751
  * @throws {ApiError} if the request fails
699
752
  */
700
- async updateRole(workspaceId, accountId, role) {
753
+ async updateMember(workspaceId, accountId, updates) {
701
754
  const { data } = await this.#api.PATCH(
702
- "/workspaces/{workspace_id}/members/{account_id}/role",
755
+ "/workspaces/{workspaceId}/members/{accountId}/role",
703
756
  {
704
- params: { path: { workspaceId, accountId } },
705
- body: role
757
+ params: {
758
+ path: { workspaceId, accountId }
759
+ },
760
+ body: updates
706
761
  }
707
762
  );
708
763
  return data;
@@ -714,8 +769,8 @@ var MembersService = class {
714
769
  * @returns Promise that resolves when the member is removed
715
770
  * @throws {ApiError} if the request fails
716
771
  */
717
- async remove(workspaceId, accountId) {
718
- await this.#api.DELETE("/workspaces/{workspace_id}/members/{account_id}/", {
772
+ async removeMember(workspaceId, accountId) {
773
+ await this.#api.DELETE("/workspaces/{workspaceId}/members/{accountId}/", {
719
774
  params: { path: { workspaceId, accountId } }
720
775
  });
721
776
  }
@@ -725,35 +780,44 @@ var MembersService = class {
725
780
  * @returns Promise that resolves when the member has left
726
781
  * @throws {ApiError} if the request fails
727
782
  */
728
- async leave(workspaceId) {
729
- await this.#api.POST("/workspaces/{workspace_id}/members/leave", {
783
+ async leaveWorkspace(workspaceId) {
784
+ await this.#api.POST("/workspaces/{workspaceId}/members/leave", {
730
785
  params: { path: { workspaceId } }
731
786
  });
732
787
  }
733
788
  };
734
789
 
735
790
  // src/services/notifications.ts
736
- var NotificationsService = class {
791
+ var Notifications = class {
737
792
  #api;
738
793
  constructor(api) {
739
794
  this.#api = api;
740
795
  }
741
796
  /**
742
797
  * List notifications for the authenticated account
743
- * @param query - Optional query parameters (offset, limit)
744
- * @returns Promise that resolves with the list of notifications
798
+ * @param query - Optional pagination parameters (limit, after)
799
+ * @returns Promise that resolves with a paginated list of notifications
745
800
  * @throws {ApiError} if the request fails
746
801
  */
747
- async list(query) {
802
+ async listNotifications(query) {
748
803
  const { data } = await this.#api.GET("/notifications/", {
749
804
  params: { query }
750
805
  });
751
806
  return data;
752
807
  }
808
+ /**
809
+ * Get the unread notifications count for the authenticated account
810
+ * @returns Promise that resolves with the unread status
811
+ * @throws {ApiError} if the request fails
812
+ */
813
+ async getUnreadNotificationsStatus() {
814
+ const { data } = await this.#api.GET("/notifications/unread");
815
+ return data;
816
+ }
753
817
  };
754
818
 
755
819
  // src/services/runs.ts
756
- var RunsService = class {
820
+ var Runs = class {
757
821
  #api;
758
822
  constructor(api) {
759
823
  this.#api = api;
@@ -761,12 +825,12 @@ var RunsService = class {
761
825
  /**
762
826
  * List integration runs for a workspace
763
827
  * @param workspaceId - Workspace ID
764
- * @param query - Optional query parameters (offset, limit)
765
- * @returns Promise that resolves with the list of integration runs
828
+ * @param query - Optional pagination parameters (limit, after)
829
+ * @returns Promise that resolves with a paginated list of integration runs
766
830
  * @throws {ApiError} if the request fails
767
831
  */
768
- async list(workspaceId, query) {
769
- const { data } = await this.#api.GET("/workspaces/{workspace_id}/runs/", {
832
+ async listRuns(workspaceId, query) {
833
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/runs/", {
770
834
  params: { path: { workspaceId }, query }
771
835
  });
772
836
  return data;
@@ -777,8 +841,8 @@ var RunsService = class {
777
841
  * @returns Promise that resolves with the integration run details
778
842
  * @throws {ApiError} if the request fails
779
843
  */
780
- async get(runId) {
781
- const { data } = await this.#api.GET("/runs/{run_id}", {
844
+ async getRun(runId) {
845
+ const { data } = await this.#api.GET("/runs/{runId}", {
782
846
  params: { path: { runId } }
783
847
  });
784
848
  return data;
@@ -786,7 +850,7 @@ var RunsService = class {
786
850
  };
787
851
 
788
852
  // src/services/status.ts
789
- var StatusService = class {
853
+ var Status = class {
790
854
  #api;
791
855
  constructor(api) {
792
856
  this.#api = api;
@@ -796,7 +860,7 @@ var StatusService = class {
796
860
  * @param options - Health check options
797
861
  * @returns Promise that resolves with the API health status
798
862
  */
799
- async health(options) {
863
+ async checkHealth(options) {
800
864
  const { data, error } = await this.#api.GET("/health", {
801
865
  params: { path: { version: "v1" } },
802
866
  body: options ?? {}
@@ -806,7 +870,7 @@ var StatusService = class {
806
870
  };
807
871
 
808
872
  // src/services/webhooks.ts
809
- var WebhooksService = class {
873
+ var Webhooks = class {
810
874
  #api;
811
875
  constructor(api) {
812
876
  this.#api = api;
@@ -814,14 +878,15 @@ var WebhooksService = class {
814
878
  /**
815
879
  * List all webhooks in a workspace
816
880
  * @param workspaceId - Workspace ID
817
- * @returns Promise that resolves with the list of webhooks
881
+ * @param query - Optional pagination parameters (limit, after)
882
+ * @returns Promise that resolves with a paginated list of webhooks
818
883
  * @throws {ApiError} if the request fails
819
884
  */
820
- async list(workspaceId) {
885
+ async listWebhooks(workspaceId, query) {
821
886
  const { data } = await this.#api.GET(
822
- "/workspaces/{workspace_id}/webhooks/",
887
+ "/workspaces/{workspaceId}/webhooks/",
823
888
  {
824
- params: { path: { workspaceId } }
889
+ params: { path: { workspaceId }, query }
825
890
  }
826
891
  );
827
892
  return data;
@@ -832,8 +897,8 @@ var WebhooksService = class {
832
897
  * @returns Promise that resolves with the webhook details
833
898
  * @throws {ApiError} if the request fails
834
899
  */
835
- async get(webhookId) {
836
- const { data } = await this.#api.GET("/webhooks/{webhook_id}/", {
900
+ async getWebhook(webhookId) {
901
+ const { data } = await this.#api.GET("/webhooks/{webhookId}/", {
837
902
  params: { path: { webhookId } }
838
903
  });
839
904
  return data;
@@ -842,12 +907,12 @@ var WebhooksService = class {
842
907
  * Create a new webhook
843
908
  * @param workspaceId - Workspace ID
844
909
  * @param webhook - Webhook creation request
845
- * @returns Promise that resolves with the created webhook (includes secret, shown only once)
910
+ * @returns Promise that resolves with the created webhook
846
911
  * @throws {ApiError} if the request fails
847
912
  */
848
- async create(workspaceId, webhook) {
913
+ async createWebhook(workspaceId, webhook) {
849
914
  const { data } = await this.#api.POST(
850
- "/workspaces/{workspace_id}/webhooks/",
915
+ "/workspaces/{workspaceId}/webhooks/",
851
916
  {
852
917
  params: { path: { workspaceId } },
853
918
  body: webhook
@@ -862,8 +927,8 @@ var WebhooksService = class {
862
927
  * @returns Promise that resolves with the updated webhook
863
928
  * @throws {ApiError} if the request fails
864
929
  */
865
- async update(webhookId, updates) {
866
- const { data } = await this.#api.PUT("/webhooks/{webhook_id}/", {
930
+ async updateWebhook(webhookId, updates) {
931
+ const { data } = await this.#api.PUT("/webhooks/{webhookId}/", {
867
932
  params: { path: { webhookId } },
868
933
  body: updates
869
934
  });
@@ -875,26 +940,40 @@ var WebhooksService = class {
875
940
  * @returns Promise that resolves when the webhook is deleted
876
941
  * @throws {ApiError} if the request fails
877
942
  */
878
- async delete(webhookId) {
879
- await this.#api.DELETE("/webhooks/{webhook_id}/", {
943
+ async deleteWebhook(webhookId) {
944
+ await this.#api.DELETE("/webhooks/{webhookId}/", {
880
945
  params: { path: { webhookId } }
881
946
  });
882
947
  }
948
+ /**
949
+ * Test a webhook by sending a test payload
950
+ * @param webhookId - Webhook ID
951
+ * @param options - Test webhook options
952
+ * @returns Promise that resolves with the test result
953
+ * @throws {ApiError} if the request fails
954
+ */
955
+ async testWebhook(webhookId, options) {
956
+ const { data } = await this.#api.POST("/webhooks/{webhookId}/test/", {
957
+ params: { path: { webhookId } },
958
+ body: options ?? {}
959
+ });
960
+ return data;
961
+ }
883
962
  };
884
963
 
885
964
  // src/services/workspaces.ts
886
- var WorkspacesService = class {
965
+ var Workspaces = class {
887
966
  #api;
888
967
  constructor(api) {
889
968
  this.#api = api;
890
969
  }
891
970
  /**
892
971
  * List all workspaces
893
- * @param query - Optional query parameters (offset, limit)
894
- * @returns Promise that resolves with the list of workspaces
972
+ * @param query - Optional pagination parameters (limit, after)
973
+ * @returns Promise that resolves with a paginated list of workspaces
895
974
  * @throws {ApiError} if the request fails
896
975
  */
897
- async list(query) {
976
+ async listWorkspaces(query) {
898
977
  const { data } = await this.#api.GET("/workspaces/", {
899
978
  params: { query }
900
979
  });
@@ -906,8 +985,8 @@ var WorkspacesService = class {
906
985
  * @returns Promise that resolves with the workspace details
907
986
  * @throws {ApiError} if the request fails
908
987
  */
909
- async get(workspaceId) {
910
- const { data } = await this.#api.GET("/workspaces/{workspace_id}/", {
988
+ async getWorkspace(workspaceId) {
989
+ const { data } = await this.#api.GET("/workspaces/{workspaceId}/", {
911
990
  params: { path: { workspaceId } }
912
991
  });
913
992
  return data;
@@ -918,7 +997,7 @@ var WorkspacesService = class {
918
997
  * @returns Promise that resolves with the created workspace
919
998
  * @throws {ApiError} if the request fails
920
999
  */
921
- async create(workspace) {
1000
+ async createWorkspace(workspace) {
922
1001
  const { data } = await this.#api.POST("/workspaces/", {
923
1002
  body: workspace
924
1003
  });
@@ -931,8 +1010,8 @@ var WorkspacesService = class {
931
1010
  * @returns Promise that resolves with the updated workspace
932
1011
  * @throws {ApiError} if the request fails
933
1012
  */
934
- async update(workspaceId, updates) {
935
- const { data } = await this.#api.PATCH("/workspaces/{workspace_id}/", {
1013
+ async updateWorkspace(workspaceId, updates) {
1014
+ const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/", {
936
1015
  params: { path: { workspaceId } },
937
1016
  body: updates
938
1017
  });
@@ -944,13 +1023,45 @@ var WorkspacesService = class {
944
1023
  * @returns Promise that resolves when the workspace is deleted
945
1024
  * @throws {ApiError} if the request fails
946
1025
  */
947
- async delete(workspaceId) {
948
- await this.#api.DELETE("/workspaces/{workspace_id}/", {
1026
+ async deleteWorkspace(workspaceId) {
1027
+ await this.#api.DELETE("/workspaces/{workspaceId}/", {
949
1028
  params: { path: { workspaceId } }
950
1029
  });
951
1030
  }
1031
+ /**
1032
+ * Get notification settings for the authenticated user in a workspace
1033
+ * @param workspaceId - Workspace ID
1034
+ * @returns Promise that resolves with the notification settings
1035
+ * @throws {ApiError} if the request fails
1036
+ */
1037
+ async getNotificationSettings(workspaceId) {
1038
+ const { data } = await this.#api.GET(
1039
+ "/workspaces/{workspaceId}/notifications",
1040
+ {
1041
+ params: { path: { workspaceId } }
1042
+ }
1043
+ );
1044
+ return data;
1045
+ }
1046
+ /**
1047
+ * Update notification settings for the authenticated user in a workspace
1048
+ * @param workspaceId - Workspace ID
1049
+ * @param settings - Notification settings update request
1050
+ * @returns Promise that resolves with the updated notification settings
1051
+ * @throws {ApiError} if the request fails
1052
+ */
1053
+ async updateNotificationSettings(workspaceId, settings) {
1054
+ const { data } = await this.#api.PATCH(
1055
+ "/workspaces/{workspaceId}/notifications",
1056
+ {
1057
+ params: { path: { workspaceId } },
1058
+ body: settings
1059
+ }
1060
+ );
1061
+ return data;
1062
+ }
952
1063
  };
953
1064
 
954
- export { AccountService, ActivitiesService, AnnotationsService, ApiTokensService, AuthService, CommentsService, DocumentsService, FilesService, IntegrationsService, InvitesService, MembersService, NotificationsService, RunsService, StatusService, WebhooksService, WorkspacesService };
1065
+ export { Account, Activities, Annotations, ApiTokens, Auth, Comments, Documents, Files, Integrations, Invites, Members, Notifications, Runs, Status, Webhooks, Workspaces };
955
1066
  //# sourceMappingURL=index.js.map
956
1067
  //# sourceMappingURL=index.js.map