@nvisy/sdk 0.1.0 → 0.2.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 +23 -4
- package/LICENSE.txt +1 -1
- package/README.md +20 -61
- package/dist/client-D6GtLRbO.d.ts +823 -0
- package/dist/datatypes/index.d.ts +8 -0
- package/dist/datatypes/index.js +3 -0
- package/dist/datatypes/index.js.map +1 -0
- package/dist/index.d.ts +254 -2
- package/dist/index.js +1244 -361
- package/dist/index.js.map +1 -1
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.js +956 -0
- package/dist/services/index.js.map +1 -0
- package/dist/workspace-3RLqaMcj.d.ts +7055 -0
- package/package.json +33 -33
- package/dist/builder-BEUIGfoZ.d.ts +0 -138
- package/dist/builder.d.ts +0 -2
- package/dist/builder.js +0 -424
- package/dist/builder.js.map +0 -1
- package/dist/client.d.ts +0 -2
- package/dist/client.js +0 -424
- package/dist/client.js.map +0 -1
- package/dist/errors.d.ts +0 -124
- package/dist/errors.js +0 -201
- package/dist/errors.js.map +0 -1
|
@@ -0,0 +1,956 @@
|
|
|
1
|
+
// src/services/account.ts
|
|
2
|
+
var AccountService = class {
|
|
3
|
+
#api;
|
|
4
|
+
constructor(api) {
|
|
5
|
+
this.#api = api;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Get the authenticated user's account details
|
|
9
|
+
* @returns Promise that resolves with the account details
|
|
10
|
+
* @throws {ApiError} if the request fails
|
|
11
|
+
*/
|
|
12
|
+
async get() {
|
|
13
|
+
const { data } = await this.#api.GET("/account");
|
|
14
|
+
return data;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Update the authenticated user's account details
|
|
18
|
+
* @param updates - Account update request
|
|
19
|
+
* @returns Promise that resolves with the updated account
|
|
20
|
+
* @throws {ApiError} if the request fails
|
|
21
|
+
*/
|
|
22
|
+
async update(updates) {
|
|
23
|
+
const { data } = await this.#api.PATCH("/account", {
|
|
24
|
+
body: updates
|
|
25
|
+
});
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Delete the authenticated user's account
|
|
30
|
+
* @returns Promise that resolves when the account is deleted
|
|
31
|
+
* @throws {ApiError} if the request fails
|
|
32
|
+
*/
|
|
33
|
+
async delete() {
|
|
34
|
+
await this.#api.DELETE("/account");
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/services/activities.ts
|
|
39
|
+
var ActivitiesService = class {
|
|
40
|
+
#api;
|
|
41
|
+
constructor(api) {
|
|
42
|
+
this.#api = api;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* List activities for a workspace
|
|
46
|
+
* @param workspaceId - Workspace ID
|
|
47
|
+
* @param query - Optional query parameters (offset, limit)
|
|
48
|
+
* @returns Promise that resolves with the list of activities
|
|
49
|
+
* @throws {ApiError} if the request fails
|
|
50
|
+
*/
|
|
51
|
+
async list(workspaceId, query) {
|
|
52
|
+
const { data } = await this.#api.GET(
|
|
53
|
+
"/workspaces/{workspace_id}/activities/",
|
|
54
|
+
{
|
|
55
|
+
params: { path: { workspaceId }, query }
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
return data;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// src/services/annotations.ts
|
|
63
|
+
var AnnotationsService = class {
|
|
64
|
+
#api;
|
|
65
|
+
constructor(api) {
|
|
66
|
+
this.#api = api;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* List annotations for a file
|
|
70
|
+
* @param fileId - File ID
|
|
71
|
+
* @param query - Optional query parameters (offset, limit)
|
|
72
|
+
* @returns Promise that resolves with the list of annotations
|
|
73
|
+
* @throws {ApiError} if the request fails
|
|
74
|
+
*/
|
|
75
|
+
async list(fileId, query) {
|
|
76
|
+
const { data } = await this.#api.GET("/files/{file_id}/annotations/", {
|
|
77
|
+
params: { path: { fileId }, query }
|
|
78
|
+
});
|
|
79
|
+
return data;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get annotation details by ID
|
|
83
|
+
* @param annotationId - Annotation ID
|
|
84
|
+
* @returns Promise that resolves with the annotation details
|
|
85
|
+
* @throws {ApiError} if the request fails
|
|
86
|
+
*/
|
|
87
|
+
async get(annotationId) {
|
|
88
|
+
const { data } = await this.#api.GET("/annotations/{annotation_id}", {
|
|
89
|
+
params: { path: { annotationId } }
|
|
90
|
+
});
|
|
91
|
+
return data;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Create a new annotation
|
|
95
|
+
* @param fileId - File ID
|
|
96
|
+
* @param annotation - Annotation creation request
|
|
97
|
+
* @returns Promise that resolves with the created annotation
|
|
98
|
+
* @throws {ApiError} if the request fails
|
|
99
|
+
*/
|
|
100
|
+
async create(fileId, annotation) {
|
|
101
|
+
const { data } = await this.#api.POST("/files/{file_id}/annotations/", {
|
|
102
|
+
params: { path: { fileId } },
|
|
103
|
+
body: annotation
|
|
104
|
+
});
|
|
105
|
+
return data;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Update an existing annotation
|
|
109
|
+
* @param annotationId - Annotation ID
|
|
110
|
+
* @param updates - Annotation update request
|
|
111
|
+
* @returns Promise that resolves with the updated annotation
|
|
112
|
+
* @throws {ApiError} if the request fails
|
|
113
|
+
*/
|
|
114
|
+
async update(annotationId, updates) {
|
|
115
|
+
const { data } = await this.#api.PATCH("/annotations/{annotation_id}", {
|
|
116
|
+
params: { path: { annotationId } },
|
|
117
|
+
body: updates
|
|
118
|
+
});
|
|
119
|
+
return data;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Delete an annotation
|
|
123
|
+
* @param annotationId - Annotation ID
|
|
124
|
+
* @returns Promise that resolves when the annotation is deleted
|
|
125
|
+
* @throws {ApiError} if the request fails
|
|
126
|
+
*/
|
|
127
|
+
async delete(annotationId) {
|
|
128
|
+
await this.#api.DELETE("/annotations/{annotation_id}", {
|
|
129
|
+
params: { path: { annotationId } }
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// src/services/api-tokens.ts
|
|
135
|
+
var ApiTokensService = class {
|
|
136
|
+
#api;
|
|
137
|
+
constructor(api) {
|
|
138
|
+
this.#api = api;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
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
|
|
144
|
+
* @throws {ApiError} if the request fails
|
|
145
|
+
*/
|
|
146
|
+
async list(options) {
|
|
147
|
+
const { data } = await this.#api.GET("/api-tokens/", {
|
|
148
|
+
params: { query: options }
|
|
149
|
+
});
|
|
150
|
+
return data;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Get a specific API token by access token
|
|
154
|
+
* @param accessToken - The access token identifier
|
|
155
|
+
* @returns Promise that resolves with the API token details
|
|
156
|
+
* @throws {ApiError} if the request fails
|
|
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
|
+
);
|
|
165
|
+
return data;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Create a new API token
|
|
169
|
+
* @param token - Token creation request
|
|
170
|
+
* @returns Promise that resolves with the created token (includes secret, shown only once)
|
|
171
|
+
* @throws {ApiError} if the request fails
|
|
172
|
+
*/
|
|
173
|
+
async create(token) {
|
|
174
|
+
const { data } = await this.#api.POST("/api-tokens/", {
|
|
175
|
+
body: token
|
|
176
|
+
});
|
|
177
|
+
return data;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Update an existing API token
|
|
181
|
+
* @param accessToken - The access token identifier
|
|
182
|
+
* @param updates - Token update request
|
|
183
|
+
* @returns Promise that resolves with the updated token
|
|
184
|
+
* @throws {ApiError} if the request fails
|
|
185
|
+
*/
|
|
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
|
+
);
|
|
194
|
+
return data;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Revoke an API token
|
|
198
|
+
* @param accessToken - The access token identifier
|
|
199
|
+
* @returns Promise that resolves when the token is revoked
|
|
200
|
+
* @throws {ApiError} if the request fails
|
|
201
|
+
*/
|
|
202
|
+
async revoke(accessToken) {
|
|
203
|
+
await this.#api.DELETE(
|
|
204
|
+
"/api-tokens/{access_token}/",
|
|
205
|
+
{
|
|
206
|
+
params: { path: { access_token: accessToken } }
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// src/services/auth.ts
|
|
213
|
+
var AuthService = class {
|
|
214
|
+
#api;
|
|
215
|
+
constructor(api) {
|
|
216
|
+
this.#api = api;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Login with email and password
|
|
220
|
+
* @param credentials - Login credentials
|
|
221
|
+
* @returns Promise that resolves with the auth response containing access token
|
|
222
|
+
* @throws {ApiError} if the request fails
|
|
223
|
+
*/
|
|
224
|
+
async login(credentials) {
|
|
225
|
+
const { data } = await this.#api.POST("/auth/login", {
|
|
226
|
+
body: credentials
|
|
227
|
+
});
|
|
228
|
+
return data;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Sign up a new account
|
|
232
|
+
* @param details - Signup details
|
|
233
|
+
* @returns Promise that resolves with the auth response containing access token
|
|
234
|
+
* @throws {ApiError} if the request fails
|
|
235
|
+
*/
|
|
236
|
+
async signup(details) {
|
|
237
|
+
const { data } = await this.#api.POST("/auth/signup", {
|
|
238
|
+
body: details
|
|
239
|
+
});
|
|
240
|
+
return data;
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// src/services/comments.ts
|
|
245
|
+
var CommentsService = class {
|
|
246
|
+
#api;
|
|
247
|
+
constructor(api) {
|
|
248
|
+
this.#api = api;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* List all comments on a file
|
|
252
|
+
* @param fileId - File ID
|
|
253
|
+
* @param query - Optional query parameters (offset, limit)
|
|
254
|
+
* @returns Promise that resolves with the list of comments
|
|
255
|
+
* @throws {ApiError} if the request fails
|
|
256
|
+
*/
|
|
257
|
+
async list(fileId, query) {
|
|
258
|
+
const { data } = await this.#api.GET("/files/{file_id}/comments", {
|
|
259
|
+
params: { path: { fileId }, query }
|
|
260
|
+
});
|
|
261
|
+
return data;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Create a new comment on a file
|
|
265
|
+
* @param fileId - File ID
|
|
266
|
+
* @param comment - Comment creation request
|
|
267
|
+
* @returns Promise that resolves with the created comment
|
|
268
|
+
* @throws {ApiError} if the request fails
|
|
269
|
+
*/
|
|
270
|
+
async create(fileId, comment) {
|
|
271
|
+
const { data } = await this.#api.POST("/files/{file_id}/comments", {
|
|
272
|
+
params: { path: { fileId } },
|
|
273
|
+
body: comment
|
|
274
|
+
});
|
|
275
|
+
return data;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Delete a comment
|
|
279
|
+
* @param fileId - File ID
|
|
280
|
+
* @param commentId - Comment ID
|
|
281
|
+
* @returns Promise that resolves when the comment is deleted
|
|
282
|
+
* @throws {ApiError} if the request fails
|
|
283
|
+
*/
|
|
284
|
+
async delete(fileId, commentId) {
|
|
285
|
+
await this.#api.DELETE("/files/{file_id}/comments/{comment_id}", {
|
|
286
|
+
params: { path: { fileId, commentId } }
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
// src/services/documents.ts
|
|
292
|
+
var DocumentsService = class {
|
|
293
|
+
#api;
|
|
294
|
+
constructor(api) {
|
|
295
|
+
this.#api = api;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* List documents in a workspace
|
|
299
|
+
* @param workspaceId - Workspace ID
|
|
300
|
+
* @param query - Optional query parameters (offset, limit)
|
|
301
|
+
* @returns Promise that resolves with the list of documents
|
|
302
|
+
* @throws {ApiError} if the request fails
|
|
303
|
+
*/
|
|
304
|
+
async list(workspaceId, query) {
|
|
305
|
+
const { data } = await this.#api.GET(
|
|
306
|
+
"/workspaces/{workspace_id}/documents",
|
|
307
|
+
{
|
|
308
|
+
params: { path: { workspaceId }, query }
|
|
309
|
+
}
|
|
310
|
+
);
|
|
311
|
+
return data;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Get document details by ID
|
|
315
|
+
* @param documentId - Document ID
|
|
316
|
+
* @returns Promise that resolves with the document details
|
|
317
|
+
* @throws {ApiError} if the request fails
|
|
318
|
+
*/
|
|
319
|
+
async get(documentId) {
|
|
320
|
+
const { data } = await this.#api.GET("/documents/{document_id}", {
|
|
321
|
+
params: { path: { documentId } }
|
|
322
|
+
});
|
|
323
|
+
return data;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Create a new document
|
|
327
|
+
* @param workspaceId - Workspace ID
|
|
328
|
+
* @param document - Document creation request
|
|
329
|
+
* @returns Promise that resolves with the created document
|
|
330
|
+
* @throws {ApiError} if the request fails
|
|
331
|
+
*/
|
|
332
|
+
async create(workspaceId, document) {
|
|
333
|
+
const { data } = await this.#api.POST(
|
|
334
|
+
"/workspaces/{workspace_id}/documents",
|
|
335
|
+
{
|
|
336
|
+
params: { path: { workspaceId } },
|
|
337
|
+
body: document
|
|
338
|
+
}
|
|
339
|
+
);
|
|
340
|
+
return data;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Update an existing document
|
|
344
|
+
* @param documentId - Document ID
|
|
345
|
+
* @param updates - Document update request
|
|
346
|
+
* @returns Promise that resolves with the updated document
|
|
347
|
+
* @throws {ApiError} if the request fails
|
|
348
|
+
*/
|
|
349
|
+
async update(documentId, updates) {
|
|
350
|
+
const { data } = await this.#api.PATCH("/documents/{document_id}", {
|
|
351
|
+
params: { path: { documentId } },
|
|
352
|
+
body: updates
|
|
353
|
+
});
|
|
354
|
+
return data;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Delete a document
|
|
358
|
+
* @param documentId - Document ID
|
|
359
|
+
* @returns Promise that resolves when the document is deleted
|
|
360
|
+
* @throws {ApiError} if the request fails
|
|
361
|
+
*/
|
|
362
|
+
async delete(documentId) {
|
|
363
|
+
await this.#api.DELETE("/documents/{document_id}", {
|
|
364
|
+
params: { path: { documentId } }
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
// src/services/files.ts
|
|
370
|
+
var FilesService = class {
|
|
371
|
+
#api;
|
|
372
|
+
constructor(api) {
|
|
373
|
+
this.#api = api;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* List files in a workspace
|
|
377
|
+
* @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
|
|
380
|
+
* @throws {ApiError} if the request fails
|
|
381
|
+
*/
|
|
382
|
+
async list(workspaceId, query) {
|
|
383
|
+
const { data } = await this.#api.GET("/workspaces/{workspace_id}/files/", {
|
|
384
|
+
params: { path: { workspaceId }, query }
|
|
385
|
+
});
|
|
386
|
+
return data;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Download a file by ID
|
|
390
|
+
* @param fileId - File ID
|
|
391
|
+
* @returns Promise that resolves with the file response
|
|
392
|
+
* @throws {ApiError} if the request fails
|
|
393
|
+
*/
|
|
394
|
+
async download(fileId) {
|
|
395
|
+
const { response } = await this.#api.GET("/files/{file_id}", {
|
|
396
|
+
params: { path: { fileId } },
|
|
397
|
+
parseAs: "stream"
|
|
398
|
+
});
|
|
399
|
+
return response;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Update a file's metadata
|
|
403
|
+
* @param fileId - File ID
|
|
404
|
+
* @param updates - File update request
|
|
405
|
+
* @returns Promise that resolves with the updated file
|
|
406
|
+
* @throws {ApiError} if the request fails
|
|
407
|
+
*/
|
|
408
|
+
async update(fileId, updates) {
|
|
409
|
+
const { data } = await this.#api.PATCH("/files/{file_id}", {
|
|
410
|
+
params: { path: { fileId } },
|
|
411
|
+
body: updates
|
|
412
|
+
});
|
|
413
|
+
return data;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Delete a file
|
|
417
|
+
* @param fileId - File ID
|
|
418
|
+
* @returns Promise that resolves when the file is deleted
|
|
419
|
+
* @throws {ApiError} if the request fails
|
|
420
|
+
*/
|
|
421
|
+
async delete(fileId) {
|
|
422
|
+
await this.#api.DELETE("/files/{file_id}", {
|
|
423
|
+
params: { path: { fileId } }
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Download multiple files
|
|
428
|
+
* @param workspaceId - Workspace ID
|
|
429
|
+
* @param request - Download request with file IDs
|
|
430
|
+
* @returns Promise that resolves with the download response
|
|
431
|
+
* @throws {ApiError} if the request fails
|
|
432
|
+
*/
|
|
433
|
+
async downloadMultiple(workspaceId, request) {
|
|
434
|
+
const { response } = await this.#api.POST(
|
|
435
|
+
"/workspaces/{workspace_id}/files/download",
|
|
436
|
+
{
|
|
437
|
+
params: { path: { workspaceId } },
|
|
438
|
+
body: request,
|
|
439
|
+
parseAs: "stream"
|
|
440
|
+
}
|
|
441
|
+
);
|
|
442
|
+
return response;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Download files as an archive
|
|
446
|
+
* @param workspaceId - Workspace ID
|
|
447
|
+
* @param request - Archive download request
|
|
448
|
+
* @returns Promise that resolves with the archive response
|
|
449
|
+
* @throws {ApiError} if the request fails
|
|
450
|
+
*/
|
|
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;
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
// src/services/integrations.ts
|
|
465
|
+
var IntegrationsService = class {
|
|
466
|
+
#api;
|
|
467
|
+
constructor(api) {
|
|
468
|
+
this.#api = api;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* List integrations for a workspace
|
|
472
|
+
* @param workspaceId - Workspace ID
|
|
473
|
+
* @param query - Optional query parameters (integrationType, offset, limit)
|
|
474
|
+
* @returns Promise that resolves with the list of integrations
|
|
475
|
+
* @throws {ApiError} if the request fails
|
|
476
|
+
*/
|
|
477
|
+
async list(workspaceId, query) {
|
|
478
|
+
const { data } = await this.#api.GET(
|
|
479
|
+
"/workspaces/{workspace_id}/integrations/",
|
|
480
|
+
{
|
|
481
|
+
params: { path: { workspaceId }, query }
|
|
482
|
+
}
|
|
483
|
+
);
|
|
484
|
+
return data;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Get integration details by ID
|
|
488
|
+
* @param integrationId - Integration ID
|
|
489
|
+
* @returns Promise that resolves with the integration details
|
|
490
|
+
* @throws {ApiError} if the request fails
|
|
491
|
+
*/
|
|
492
|
+
async get(integrationId) {
|
|
493
|
+
const { data } = await this.#api.GET("/integrations/{integration_id}/", {
|
|
494
|
+
params: { path: { integrationId } }
|
|
495
|
+
});
|
|
496
|
+
return data;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Create a new integration
|
|
500
|
+
* @param workspaceId - Workspace ID
|
|
501
|
+
* @param integration - Integration creation request
|
|
502
|
+
* @returns Promise that resolves with the created integration
|
|
503
|
+
* @throws {ApiError} if the request fails
|
|
504
|
+
*/
|
|
505
|
+
async create(workspaceId, integration) {
|
|
506
|
+
const { data } = await this.#api.POST(
|
|
507
|
+
"/workspaces/{workspace_id}/integrations/",
|
|
508
|
+
{
|
|
509
|
+
params: { path: { workspaceId } },
|
|
510
|
+
body: integration
|
|
511
|
+
}
|
|
512
|
+
);
|
|
513
|
+
return data;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Update an existing integration
|
|
517
|
+
* @param integrationId - Integration ID
|
|
518
|
+
* @param updates - Integration update request
|
|
519
|
+
* @returns Promise that resolves with the updated integration
|
|
520
|
+
* @throws {ApiError} if the request fails
|
|
521
|
+
*/
|
|
522
|
+
async update(integrationId, updates) {
|
|
523
|
+
const { data } = await this.#api.PUT("/integrations/{integration_id}/", {
|
|
524
|
+
params: { path: { integrationId } },
|
|
525
|
+
body: updates
|
|
526
|
+
});
|
|
527
|
+
return data;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Update integration credentials
|
|
531
|
+
* @param integrationId - Integration ID
|
|
532
|
+
* @param credentials - New credentials
|
|
533
|
+
* @returns Promise that resolves with the updated integration
|
|
534
|
+
* @throws {ApiError} if the request fails
|
|
535
|
+
*/
|
|
536
|
+
async updateCredentials(integrationId, credentials) {
|
|
537
|
+
const { data } = await this.#api.PATCH(
|
|
538
|
+
"/integrations/{integration_id}/credentials/",
|
|
539
|
+
{
|
|
540
|
+
params: { path: { integrationId } },
|
|
541
|
+
body: credentials
|
|
542
|
+
}
|
|
543
|
+
);
|
|
544
|
+
return data;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Delete an integration
|
|
548
|
+
* @param integrationId - Integration ID
|
|
549
|
+
* @returns Promise that resolves when the integration is deleted
|
|
550
|
+
* @throws {ApiError} if the request fails
|
|
551
|
+
*/
|
|
552
|
+
async delete(integrationId) {
|
|
553
|
+
await this.#api.DELETE("/integrations/{integration_id}/", {
|
|
554
|
+
params: { path: { integrationId } }
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
// src/services/invites.ts
|
|
560
|
+
var InvitesService = class {
|
|
561
|
+
#api;
|
|
562
|
+
constructor(api) {
|
|
563
|
+
this.#api = api;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* List all invitations for a workspace
|
|
567
|
+
* @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
|
|
570
|
+
* @throws {ApiError} if the request fails
|
|
571
|
+
*/
|
|
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
|
+
);
|
|
579
|
+
return data;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Send an invitation to join a workspace
|
|
583
|
+
* @param workspaceId - Workspace ID
|
|
584
|
+
* @param invite - Invitation request
|
|
585
|
+
* @returns Promise that resolves with the created invitation
|
|
586
|
+
* @throws {ApiError} if the request fails
|
|
587
|
+
*/
|
|
588
|
+
async send(workspaceId, invite) {
|
|
589
|
+
const { data } = await this.#api.POST(
|
|
590
|
+
"/workspaces/{workspace_id}/invites/",
|
|
591
|
+
{
|
|
592
|
+
params: { path: { workspaceId } },
|
|
593
|
+
body: invite
|
|
594
|
+
}
|
|
595
|
+
);
|
|
596
|
+
return data;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Cancel a pending invitation
|
|
600
|
+
* @param inviteId - Invite ID
|
|
601
|
+
* @returns Promise that resolves when the invitation is canceled
|
|
602
|
+
* @throws {ApiError} if the request fails
|
|
603
|
+
*/
|
|
604
|
+
async cancel(inviteId) {
|
|
605
|
+
await this.#api.DELETE("/invites/{invite_id}/", {
|
|
606
|
+
params: { path: { inviteId } }
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Reply to an invitation (accept or decline)
|
|
611
|
+
* @param inviteId - Invite ID
|
|
612
|
+
* @param reply - Reply request
|
|
613
|
+
* @returns Promise that resolves with the updated invitation
|
|
614
|
+
* @throws {ApiError} if the request fails
|
|
615
|
+
*/
|
|
616
|
+
async reply(inviteId, reply) {
|
|
617
|
+
const { data } = await this.#api.PATCH("/invites/{invite_id}/reply/", {
|
|
618
|
+
params: { path: { inviteId } },
|
|
619
|
+
body: reply
|
|
620
|
+
});
|
|
621
|
+
return data;
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Generate a shareable invite code for a workspace
|
|
625
|
+
* @param workspaceId - Workspace ID
|
|
626
|
+
* @param options - Invite code generation options
|
|
627
|
+
* @returns Promise that resolves with the generated invite code
|
|
628
|
+
* @throws {ApiError} if the request fails
|
|
629
|
+
*/
|
|
630
|
+
async generateCode(workspaceId, options) {
|
|
631
|
+
const { data } = await this.#api.POST(
|
|
632
|
+
"/workspaces/{workspace_id}/invites/code/",
|
|
633
|
+
{
|
|
634
|
+
params: { path: { workspaceId } },
|
|
635
|
+
body: options
|
|
636
|
+
}
|
|
637
|
+
);
|
|
638
|
+
return data;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Join a workspace using an invite code
|
|
642
|
+
* @param inviteCode - The invite code
|
|
643
|
+
* @returns Promise that resolves with the member details
|
|
644
|
+
* @throws {ApiError} if the request fails
|
|
645
|
+
*/
|
|
646
|
+
async joinWithCode(inviteCode) {
|
|
647
|
+
const { data } = await this.#api.POST("/invites/{invite_code}/join/", {
|
|
648
|
+
params: { path: { inviteCode } }
|
|
649
|
+
});
|
|
650
|
+
return data;
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
// src/services/members.ts
|
|
655
|
+
var MembersService = class {
|
|
656
|
+
#api;
|
|
657
|
+
constructor(api) {
|
|
658
|
+
this.#api = api;
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* List members of a workspace
|
|
662
|
+
* @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
|
|
665
|
+
* @throws {ApiError} if the request fails
|
|
666
|
+
*/
|
|
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
|
+
);
|
|
674
|
+
return data;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Get member details by account ID
|
|
678
|
+
* @param workspaceId - Workspace ID
|
|
679
|
+
* @param accountId - Account ID
|
|
680
|
+
* @returns Promise that resolves with the member details
|
|
681
|
+
* @throws {ApiError} if the request fails
|
|
682
|
+
*/
|
|
683
|
+
async get(workspaceId, accountId) {
|
|
684
|
+
const { data } = await this.#api.GET(
|
|
685
|
+
"/workspaces/{workspace_id}/members/{account_id}/",
|
|
686
|
+
{
|
|
687
|
+
params: { path: { workspaceId, accountId } }
|
|
688
|
+
}
|
|
689
|
+
);
|
|
690
|
+
return data;
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Update a member's role
|
|
694
|
+
* @param workspaceId - Workspace ID
|
|
695
|
+
* @param accountId - Account ID
|
|
696
|
+
* @param role - New role for the member
|
|
697
|
+
* @returns Promise that resolves with the updated member
|
|
698
|
+
* @throws {ApiError} if the request fails
|
|
699
|
+
*/
|
|
700
|
+
async updateRole(workspaceId, accountId, role) {
|
|
701
|
+
const { data } = await this.#api.PATCH(
|
|
702
|
+
"/workspaces/{workspace_id}/members/{account_id}/role",
|
|
703
|
+
{
|
|
704
|
+
params: { path: { workspaceId, accountId } },
|
|
705
|
+
body: role
|
|
706
|
+
}
|
|
707
|
+
);
|
|
708
|
+
return data;
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Remove a member from a workspace
|
|
712
|
+
* @param workspaceId - Workspace ID
|
|
713
|
+
* @param accountId - Account ID
|
|
714
|
+
* @returns Promise that resolves when the member is removed
|
|
715
|
+
* @throws {ApiError} if the request fails
|
|
716
|
+
*/
|
|
717
|
+
async remove(workspaceId, accountId) {
|
|
718
|
+
await this.#api.DELETE("/workspaces/{workspace_id}/members/{account_id}/", {
|
|
719
|
+
params: { path: { workspaceId, accountId } }
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Leave a workspace
|
|
724
|
+
* @param workspaceId - Workspace ID
|
|
725
|
+
* @returns Promise that resolves when the member has left
|
|
726
|
+
* @throws {ApiError} if the request fails
|
|
727
|
+
*/
|
|
728
|
+
async leave(workspaceId) {
|
|
729
|
+
await this.#api.POST("/workspaces/{workspace_id}/members/leave", {
|
|
730
|
+
params: { path: { workspaceId } }
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
|
|
735
|
+
// src/services/notifications.ts
|
|
736
|
+
var NotificationsService = class {
|
|
737
|
+
#api;
|
|
738
|
+
constructor(api) {
|
|
739
|
+
this.#api = api;
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* List notifications for the authenticated account
|
|
743
|
+
* @param query - Optional query parameters (offset, limit)
|
|
744
|
+
* @returns Promise that resolves with the list of notifications
|
|
745
|
+
* @throws {ApiError} if the request fails
|
|
746
|
+
*/
|
|
747
|
+
async list(query) {
|
|
748
|
+
const { data } = await this.#api.GET("/notifications/", {
|
|
749
|
+
params: { query }
|
|
750
|
+
});
|
|
751
|
+
return data;
|
|
752
|
+
}
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
// src/services/runs.ts
|
|
756
|
+
var RunsService = class {
|
|
757
|
+
#api;
|
|
758
|
+
constructor(api) {
|
|
759
|
+
this.#api = api;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* List integration runs for a workspace
|
|
763
|
+
* @param workspaceId - Workspace ID
|
|
764
|
+
* @param query - Optional query parameters (offset, limit)
|
|
765
|
+
* @returns Promise that resolves with the list of integration runs
|
|
766
|
+
* @throws {ApiError} if the request fails
|
|
767
|
+
*/
|
|
768
|
+
async list(workspaceId, query) {
|
|
769
|
+
const { data } = await this.#api.GET("/workspaces/{workspace_id}/runs/", {
|
|
770
|
+
params: { path: { workspaceId }, query }
|
|
771
|
+
});
|
|
772
|
+
return data;
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Get integration run details by ID
|
|
776
|
+
* @param runId - Run ID
|
|
777
|
+
* @returns Promise that resolves with the integration run details
|
|
778
|
+
* @throws {ApiError} if the request fails
|
|
779
|
+
*/
|
|
780
|
+
async get(runId) {
|
|
781
|
+
const { data } = await this.#api.GET("/runs/{run_id}", {
|
|
782
|
+
params: { path: { runId } }
|
|
783
|
+
});
|
|
784
|
+
return data;
|
|
785
|
+
}
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
// src/services/status.ts
|
|
789
|
+
var StatusService = class {
|
|
790
|
+
#api;
|
|
791
|
+
constructor(api) {
|
|
792
|
+
this.#api = api;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Check the health status of the API
|
|
796
|
+
* @param options - Health check options
|
|
797
|
+
* @returns Promise that resolves with the API health status
|
|
798
|
+
*/
|
|
799
|
+
async health(options) {
|
|
800
|
+
const { data, error } = await this.#api.GET("/health", {
|
|
801
|
+
params: { path: { version: "v1" } },
|
|
802
|
+
body: options ?? {}
|
|
803
|
+
});
|
|
804
|
+
return data ?? error;
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
// src/services/webhooks.ts
|
|
809
|
+
var WebhooksService = class {
|
|
810
|
+
#api;
|
|
811
|
+
constructor(api) {
|
|
812
|
+
this.#api = api;
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* List all webhooks in a workspace
|
|
816
|
+
* @param workspaceId - Workspace ID
|
|
817
|
+
* @returns Promise that resolves with the list of webhooks
|
|
818
|
+
* @throws {ApiError} if the request fails
|
|
819
|
+
*/
|
|
820
|
+
async list(workspaceId) {
|
|
821
|
+
const { data } = await this.#api.GET(
|
|
822
|
+
"/workspaces/{workspace_id}/webhooks/",
|
|
823
|
+
{
|
|
824
|
+
params: { path: { workspaceId } }
|
|
825
|
+
}
|
|
826
|
+
);
|
|
827
|
+
return data;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Get a specific webhook by ID
|
|
831
|
+
* @param webhookId - Webhook ID
|
|
832
|
+
* @returns Promise that resolves with the webhook details
|
|
833
|
+
* @throws {ApiError} if the request fails
|
|
834
|
+
*/
|
|
835
|
+
async get(webhookId) {
|
|
836
|
+
const { data } = await this.#api.GET("/webhooks/{webhook_id}/", {
|
|
837
|
+
params: { path: { webhookId } }
|
|
838
|
+
});
|
|
839
|
+
return data;
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* Create a new webhook
|
|
843
|
+
* @param workspaceId - Workspace ID
|
|
844
|
+
* @param webhook - Webhook creation request
|
|
845
|
+
* @returns Promise that resolves with the created webhook (includes secret, shown only once)
|
|
846
|
+
* @throws {ApiError} if the request fails
|
|
847
|
+
*/
|
|
848
|
+
async create(workspaceId, webhook) {
|
|
849
|
+
const { data } = await this.#api.POST(
|
|
850
|
+
"/workspaces/{workspace_id}/webhooks/",
|
|
851
|
+
{
|
|
852
|
+
params: { path: { workspaceId } },
|
|
853
|
+
body: webhook
|
|
854
|
+
}
|
|
855
|
+
);
|
|
856
|
+
return data;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Update an existing webhook
|
|
860
|
+
* @param webhookId - Webhook ID
|
|
861
|
+
* @param updates - Webhook update request
|
|
862
|
+
* @returns Promise that resolves with the updated webhook
|
|
863
|
+
* @throws {ApiError} if the request fails
|
|
864
|
+
*/
|
|
865
|
+
async update(webhookId, updates) {
|
|
866
|
+
const { data } = await this.#api.PUT("/webhooks/{webhook_id}/", {
|
|
867
|
+
params: { path: { webhookId } },
|
|
868
|
+
body: updates
|
|
869
|
+
});
|
|
870
|
+
return data;
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Delete a webhook
|
|
874
|
+
* @param webhookId - Webhook ID
|
|
875
|
+
* @returns Promise that resolves when the webhook is deleted
|
|
876
|
+
* @throws {ApiError} if the request fails
|
|
877
|
+
*/
|
|
878
|
+
async delete(webhookId) {
|
|
879
|
+
await this.#api.DELETE("/webhooks/{webhook_id}/", {
|
|
880
|
+
params: { path: { webhookId } }
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
// src/services/workspaces.ts
|
|
886
|
+
var WorkspacesService = class {
|
|
887
|
+
#api;
|
|
888
|
+
constructor(api) {
|
|
889
|
+
this.#api = api;
|
|
890
|
+
}
|
|
891
|
+
/**
|
|
892
|
+
* List all workspaces
|
|
893
|
+
* @param query - Optional query parameters (offset, limit)
|
|
894
|
+
* @returns Promise that resolves with the list of workspaces
|
|
895
|
+
* @throws {ApiError} if the request fails
|
|
896
|
+
*/
|
|
897
|
+
async list(query) {
|
|
898
|
+
const { data } = await this.#api.GET("/workspaces/", {
|
|
899
|
+
params: { query }
|
|
900
|
+
});
|
|
901
|
+
return data;
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* Get workspace details by ID
|
|
905
|
+
* @param workspaceId - Workspace ID
|
|
906
|
+
* @returns Promise that resolves with the workspace details
|
|
907
|
+
* @throws {ApiError} if the request fails
|
|
908
|
+
*/
|
|
909
|
+
async get(workspaceId) {
|
|
910
|
+
const { data } = await this.#api.GET("/workspaces/{workspace_id}/", {
|
|
911
|
+
params: { path: { workspaceId } }
|
|
912
|
+
});
|
|
913
|
+
return data;
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Create a new workspace
|
|
917
|
+
* @param workspace - Workspace creation request
|
|
918
|
+
* @returns Promise that resolves with the created workspace
|
|
919
|
+
* @throws {ApiError} if the request fails
|
|
920
|
+
*/
|
|
921
|
+
async create(workspace) {
|
|
922
|
+
const { data } = await this.#api.POST("/workspaces/", {
|
|
923
|
+
body: workspace
|
|
924
|
+
});
|
|
925
|
+
return data;
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Update an existing workspace
|
|
929
|
+
* @param workspaceId - Workspace ID
|
|
930
|
+
* @param updates - Workspace update request
|
|
931
|
+
* @returns Promise that resolves with the updated workspace
|
|
932
|
+
* @throws {ApiError} if the request fails
|
|
933
|
+
*/
|
|
934
|
+
async update(workspaceId, updates) {
|
|
935
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspace_id}/", {
|
|
936
|
+
params: { path: { workspaceId } },
|
|
937
|
+
body: updates
|
|
938
|
+
});
|
|
939
|
+
return data;
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* Delete a workspace
|
|
943
|
+
* @param workspaceId - Workspace ID
|
|
944
|
+
* @returns Promise that resolves when the workspace is deleted
|
|
945
|
+
* @throws {ApiError} if the request fails
|
|
946
|
+
*/
|
|
947
|
+
async delete(workspaceId) {
|
|
948
|
+
await this.#api.DELETE("/workspaces/{workspace_id}/", {
|
|
949
|
+
params: { path: { workspaceId } }
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
export { AccountService, ActivitiesService, AnnotationsService, ApiTokensService, AuthService, CommentsService, DocumentsService, FilesService, IntegrationsService, InvitesService, MembersService, NotificationsService, RunsService, StatusService, WebhooksService, WorkspacesService };
|
|
955
|
+
//# sourceMappingURL=index.js.map
|
|
956
|
+
//# sourceMappingURL=index.js.map
|