@nvisy/sdk 0.1.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.
- package/CHANGELOG.md +68 -4
- package/LICENSE.txt +1 -1
- package/README.md +16 -68
- package/dist/auth/index.d.ts +105 -0
- package/dist/auth/index.js +184 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth-CncOz2vx.d.ts +7420 -0
- package/dist/client-DQRisDAK.d.ts +808 -0
- package/dist/config-L7FKq_q5.d.ts +81 -0
- package/dist/datatypes/index.d.ts +9 -0
- package/dist/datatypes/index.js +3 -0
- package/dist/datatypes/index.js.map +1 -0
- package/dist/index.d.ts +140 -2
- package/dist/index.js +1303 -378
- package/dist/index.js.map +1 -1
- package/dist/services/index.d.ts +5 -0
- package/dist/services/index.js +1067 -0
- package/dist/services/index.js.map +1 -0
- package/dist/workspace-BjdbMWsa.d.ts +118 -0
- package/package.json +38 -32
- 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,1067 @@
|
|
|
1
|
+
// src/services/account.ts
|
|
2
|
+
var Account = 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 getAccount() {
|
|
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 updateAccount(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 deleteAccount() {
|
|
34
|
+
await this.#api.DELETE("/account");
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/services/activities.ts
|
|
39
|
+
var Activities = 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 pagination parameters (limit, after)
|
|
48
|
+
* @returns Promise that resolves with a paginated list of activities
|
|
49
|
+
* @throws {ApiError} if the request fails
|
|
50
|
+
*/
|
|
51
|
+
async listActivities(workspaceId, query) {
|
|
52
|
+
const { data } = await this.#api.GET(
|
|
53
|
+
"/workspaces/{workspaceId}/activities/",
|
|
54
|
+
{
|
|
55
|
+
params: { path: { workspaceId }, query }
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
return data;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// src/services/annotations.ts
|
|
63
|
+
var Annotations = 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 pagination parameters (limit, after)
|
|
72
|
+
* @returns Promise that resolves with a paginated list of annotations
|
|
73
|
+
* @throws {ApiError} if the request fails
|
|
74
|
+
*/
|
|
75
|
+
async listAnnotations(fileId, query) {
|
|
76
|
+
const { data } = await this.#api.GET("/files/{fileId}/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 getAnnotation(annotationId) {
|
|
88
|
+
const { data } = await this.#api.GET("/annotations/{annotationId}", {
|
|
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 createAnnotation(fileId, annotation) {
|
|
101
|
+
const { data } = await this.#api.POST("/files/{fileId}/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 updateAnnotation(annotationId, updates) {
|
|
115
|
+
const { data } = await this.#api.PATCH("/annotations/{annotationId}", {
|
|
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 deleteAnnotation(annotationId) {
|
|
128
|
+
await this.#api.DELETE("/annotations/{annotationId}", {
|
|
129
|
+
params: { path: { annotationId } }
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// src/services/api-tokens.ts
|
|
135
|
+
var ApiTokens = class {
|
|
136
|
+
#api;
|
|
137
|
+
constructor(api) {
|
|
138
|
+
this.#api = api;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* List all API tokens for the authenticated account
|
|
142
|
+
* @param query - Optional pagination parameters (limit, after)
|
|
143
|
+
* @returns Promise that resolves with a paginated list of API tokens
|
|
144
|
+
* @throws {ApiError} if the request fails
|
|
145
|
+
*/
|
|
146
|
+
async listApiTokens(query) {
|
|
147
|
+
const { data } = await this.#api.GET("/api-tokens/", {
|
|
148
|
+
params: { query }
|
|
149
|
+
});
|
|
150
|
+
return data;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Get a specific API token by token ID
|
|
154
|
+
* @param tokenId - The token identifier
|
|
155
|
+
* @returns Promise that resolves with the API token details
|
|
156
|
+
* @throws {ApiError} if the request fails
|
|
157
|
+
*/
|
|
158
|
+
async getApiToken(tokenId) {
|
|
159
|
+
const { data } = await this.#api.GET("/api-tokens/{tokenId}/", {
|
|
160
|
+
params: { path: { tokenId } }
|
|
161
|
+
});
|
|
162
|
+
return data;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Create a new API token
|
|
166
|
+
* @param token - Token creation request
|
|
167
|
+
* @returns Promise that resolves with the created token (includes JWT, shown only once)
|
|
168
|
+
* @throws {ApiError} if the request fails
|
|
169
|
+
*/
|
|
170
|
+
async createApiToken(token) {
|
|
171
|
+
const { data } = await this.#api.POST("/api-tokens/", {
|
|
172
|
+
body: token
|
|
173
|
+
});
|
|
174
|
+
return data;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Update an existing API token
|
|
178
|
+
* @param tokenId - The token identifier
|
|
179
|
+
* @param updates - Token update request
|
|
180
|
+
* @returns Promise that resolves with the updated token
|
|
181
|
+
* @throws {ApiError} if the request fails
|
|
182
|
+
*/
|
|
183
|
+
async updateApiToken(tokenId, updates) {
|
|
184
|
+
const { data } = await this.#api.PATCH("/api-tokens/{tokenId}/", {
|
|
185
|
+
params: { path: { tokenId } },
|
|
186
|
+
body: updates
|
|
187
|
+
});
|
|
188
|
+
return data;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Revoke an API token
|
|
192
|
+
* @param tokenId - The token identifier
|
|
193
|
+
* @returns Promise that resolves when the token is revoked
|
|
194
|
+
* @throws {ApiError} if the request fails
|
|
195
|
+
*/
|
|
196
|
+
async revokeApiToken(tokenId) {
|
|
197
|
+
await this.#api.DELETE("/api-tokens/{tokenId}/", {
|
|
198
|
+
params: { path: { tokenId } }
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// src/services/auth.ts
|
|
204
|
+
var Auth = class {
|
|
205
|
+
#api;
|
|
206
|
+
constructor(api) {
|
|
207
|
+
this.#api = api;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Login with email and password
|
|
211
|
+
* @param credentials - Login credentials
|
|
212
|
+
* @returns Promise that resolves with the auth response containing access token
|
|
213
|
+
* @throws {ApiError} if the request fails
|
|
214
|
+
*/
|
|
215
|
+
async loginAccount(credentials) {
|
|
216
|
+
const { data } = await this.#api.POST("/auth/login", {
|
|
217
|
+
body: credentials
|
|
218
|
+
});
|
|
219
|
+
return data;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Sign up a new account
|
|
223
|
+
* @param credentials - Signup details
|
|
224
|
+
* @returns Promise that resolves with the auth response containing access token
|
|
225
|
+
* @throws {ApiError} if the request fails
|
|
226
|
+
*/
|
|
227
|
+
async signupAccount(credentials) {
|
|
228
|
+
const { data } = await this.#api.POST("/auth/signup", {
|
|
229
|
+
body: credentials
|
|
230
|
+
});
|
|
231
|
+
return data;
|
|
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
|
+
}
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
// src/services/comments.ts
|
|
244
|
+
var Comments = class {
|
|
245
|
+
#api;
|
|
246
|
+
constructor(api) {
|
|
247
|
+
this.#api = api;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* List all comments on a file
|
|
251
|
+
* @param fileId - File ID
|
|
252
|
+
* @param query - Optional pagination parameters (limit, after)
|
|
253
|
+
* @returns Promise that resolves with a paginated list of comments
|
|
254
|
+
* @throws {ApiError} if the request fails
|
|
255
|
+
*/
|
|
256
|
+
async listComments(fileId, query) {
|
|
257
|
+
const { data } = await this.#api.GET("/files/{fileId}/comments", {
|
|
258
|
+
params: { path: { fileId }, query }
|
|
259
|
+
});
|
|
260
|
+
return data;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Create a new comment on a file
|
|
264
|
+
* @param fileId - File ID
|
|
265
|
+
* @param comment - Comment creation request
|
|
266
|
+
* @returns Promise that resolves with the created comment
|
|
267
|
+
* @throws {ApiError} if the request fails
|
|
268
|
+
*/
|
|
269
|
+
async createComment(fileId, comment) {
|
|
270
|
+
const { data } = await this.#api.POST("/files/{fileId}/comments", {
|
|
271
|
+
params: { path: { fileId } },
|
|
272
|
+
body: comment
|
|
273
|
+
});
|
|
274
|
+
return data;
|
|
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
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Delete a comment
|
|
292
|
+
* @param commentId - Comment ID
|
|
293
|
+
* @returns Promise that resolves when the comment is deleted
|
|
294
|
+
* @throws {ApiError} if the request fails
|
|
295
|
+
*/
|
|
296
|
+
async deleteComment(commentId) {
|
|
297
|
+
await this.#api.DELETE("/comments/{commentId}", {
|
|
298
|
+
params: { path: { commentId } }
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
// src/services/documents.ts
|
|
304
|
+
var Documents = class {
|
|
305
|
+
#api;
|
|
306
|
+
constructor(api) {
|
|
307
|
+
this.#api = api;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* List documents in a workspace
|
|
311
|
+
* @param workspaceId - Workspace ID
|
|
312
|
+
* @param query - Optional pagination parameters (limit, after)
|
|
313
|
+
* @returns Promise that resolves with a paginated list of documents
|
|
314
|
+
* @throws {ApiError} if the request fails
|
|
315
|
+
*/
|
|
316
|
+
async listDocuments(workspaceId, query) {
|
|
317
|
+
const { data } = await this.#api.GET(
|
|
318
|
+
"/workspaces/{workspaceId}/documents",
|
|
319
|
+
{
|
|
320
|
+
params: { path: { workspaceId }, query }
|
|
321
|
+
}
|
|
322
|
+
);
|
|
323
|
+
return data;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Get document details by ID
|
|
327
|
+
* @param documentId - Document ID
|
|
328
|
+
* @returns Promise that resolves with the document details
|
|
329
|
+
* @throws {ApiError} if the request fails
|
|
330
|
+
*/
|
|
331
|
+
async getDocument(documentId) {
|
|
332
|
+
const { data } = await this.#api.GET("/documents/{documentId}", {
|
|
333
|
+
params: { path: { documentId } }
|
|
334
|
+
});
|
|
335
|
+
return data;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Create a new document
|
|
339
|
+
* @param workspaceId - Workspace ID
|
|
340
|
+
* @param document - Document creation request
|
|
341
|
+
* @returns Promise that resolves with the created document
|
|
342
|
+
* @throws {ApiError} if the request fails
|
|
343
|
+
*/
|
|
344
|
+
async createDocument(workspaceId, document) {
|
|
345
|
+
const { data } = await this.#api.POST(
|
|
346
|
+
"/workspaces/{workspaceId}/documents",
|
|
347
|
+
{
|
|
348
|
+
params: { path: { workspaceId } },
|
|
349
|
+
body: document
|
|
350
|
+
}
|
|
351
|
+
);
|
|
352
|
+
return data;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Update an existing document
|
|
356
|
+
* @param documentId - Document ID
|
|
357
|
+
* @param updates - Document update request
|
|
358
|
+
* @returns Promise that resolves with the updated document
|
|
359
|
+
* @throws {ApiError} if the request fails
|
|
360
|
+
*/
|
|
361
|
+
async updateDocument(documentId, updates) {
|
|
362
|
+
const { data } = await this.#api.PATCH("/documents/{documentId}", {
|
|
363
|
+
params: { path: { documentId } },
|
|
364
|
+
body: updates
|
|
365
|
+
});
|
|
366
|
+
return data;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Delete a document
|
|
370
|
+
* @param documentId - Document ID
|
|
371
|
+
* @returns Promise that resolves when the document is deleted
|
|
372
|
+
* @throws {ApiError} if the request fails
|
|
373
|
+
*/
|
|
374
|
+
async deleteDocument(documentId) {
|
|
375
|
+
await this.#api.DELETE("/documents/{documentId}", {
|
|
376
|
+
params: { path: { documentId } }
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
// src/services/files.ts
|
|
382
|
+
var Files = class {
|
|
383
|
+
#api;
|
|
384
|
+
constructor(api) {
|
|
385
|
+
this.#api = api;
|
|
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
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* List files in a workspace
|
|
413
|
+
* @param workspaceId - Workspace ID
|
|
414
|
+
* @param query - Optional query parameters (formats, limit, after)
|
|
415
|
+
* @returns Promise that resolves with a paginated list of files
|
|
416
|
+
* @throws {ApiError} if the request fails
|
|
417
|
+
*/
|
|
418
|
+
async listFiles(workspaceId, query) {
|
|
419
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/files/", {
|
|
420
|
+
params: { path: { workspaceId }, query }
|
|
421
|
+
});
|
|
422
|
+
return data;
|
|
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
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Download a file by ID
|
|
438
|
+
* @param fileId - File ID
|
|
439
|
+
* @returns Promise that resolves with the file response
|
|
440
|
+
* @throws {ApiError} if the request fails
|
|
441
|
+
*/
|
|
442
|
+
async downloadFile(fileId) {
|
|
443
|
+
const { response } = await this.#api.GET("/files/{fileId}/content", {
|
|
444
|
+
params: { path: { fileId } },
|
|
445
|
+
parseAs: "stream"
|
|
446
|
+
});
|
|
447
|
+
return response;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Update a file's metadata
|
|
451
|
+
* @param fileId - File ID
|
|
452
|
+
* @param updates - File update request
|
|
453
|
+
* @returns Promise that resolves with the updated file
|
|
454
|
+
* @throws {ApiError} if the request fails
|
|
455
|
+
*/
|
|
456
|
+
async updateFile(fileId, updates) {
|
|
457
|
+
const { data } = await this.#api.PATCH("/files/{fileId}", {
|
|
458
|
+
params: { path: { fileId } },
|
|
459
|
+
body: updates
|
|
460
|
+
});
|
|
461
|
+
return data;
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Delete a file
|
|
465
|
+
* @param fileId - File ID
|
|
466
|
+
* @returns Promise that resolves when the file is deleted
|
|
467
|
+
* @throws {ApiError} if the request fails
|
|
468
|
+
*/
|
|
469
|
+
async deleteFile(fileId) {
|
|
470
|
+
await this.#api.DELETE("/files/{fileId}", {
|
|
471
|
+
params: { path: { fileId } }
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Download files as an archive
|
|
476
|
+
* @param workspaceId - Workspace ID
|
|
477
|
+
* @param request - Download request with format and optional file IDs
|
|
478
|
+
* @returns Promise that resolves with the archive response
|
|
479
|
+
* @throws {ApiError} if the request fails
|
|
480
|
+
*/
|
|
481
|
+
async downloadFiles(workspaceId, request) {
|
|
482
|
+
const { response } = await this.#api.GET(
|
|
483
|
+
"/workspaces/{workspaceId}/files/batch",
|
|
484
|
+
{
|
|
485
|
+
params: { path: { workspaceId } },
|
|
486
|
+
body: request,
|
|
487
|
+
parseAs: "stream"
|
|
488
|
+
}
|
|
489
|
+
);
|
|
490
|
+
return response;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Delete multiple files
|
|
494
|
+
* @param workspaceId - Workspace ID
|
|
495
|
+
* @param request - Delete request with file IDs
|
|
496
|
+
* @returns Promise that resolves when the files are deleted
|
|
497
|
+
* @throws {ApiError} if the request fails
|
|
498
|
+
*/
|
|
499
|
+
async deleteFiles(workspaceId, request) {
|
|
500
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/files/batch", {
|
|
501
|
+
params: { path: { workspaceId } },
|
|
502
|
+
body: request
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
// src/services/integrations.ts
|
|
508
|
+
var Integrations = class {
|
|
509
|
+
#api;
|
|
510
|
+
constructor(api) {
|
|
511
|
+
this.#api = api;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* List integrations for a workspace
|
|
515
|
+
* @param workspaceId - Workspace ID
|
|
516
|
+
* @param query - Optional pagination parameters (limit, after)
|
|
517
|
+
* @returns Promise that resolves with a paginated list of integrations
|
|
518
|
+
* @throws {ApiError} if the request fails
|
|
519
|
+
*/
|
|
520
|
+
async listIntegrations(workspaceId, query) {
|
|
521
|
+
const { data } = await this.#api.GET(
|
|
522
|
+
"/workspaces/{workspaceId}/integrations/",
|
|
523
|
+
{
|
|
524
|
+
params: { path: { workspaceId }, query }
|
|
525
|
+
}
|
|
526
|
+
);
|
|
527
|
+
return data;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Get integration details by ID
|
|
531
|
+
* @param integrationId - Integration ID
|
|
532
|
+
* @returns Promise that resolves with the integration details
|
|
533
|
+
* @throws {ApiError} if the request fails
|
|
534
|
+
*/
|
|
535
|
+
async getIntegration(integrationId) {
|
|
536
|
+
const { data } = await this.#api.GET("/integrations/{integrationId}/", {
|
|
537
|
+
params: { path: { integrationId } }
|
|
538
|
+
});
|
|
539
|
+
return data;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Create a new integration
|
|
543
|
+
* @param workspaceId - Workspace ID
|
|
544
|
+
* @param integration - Integration creation request
|
|
545
|
+
* @returns Promise that resolves with the created integration
|
|
546
|
+
* @throws {ApiError} if the request fails
|
|
547
|
+
*/
|
|
548
|
+
async createIntegration(workspaceId, integration) {
|
|
549
|
+
const { data } = await this.#api.POST(
|
|
550
|
+
"/workspaces/{workspaceId}/integrations/",
|
|
551
|
+
{
|
|
552
|
+
params: { path: { workspaceId } },
|
|
553
|
+
body: integration
|
|
554
|
+
}
|
|
555
|
+
);
|
|
556
|
+
return data;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Update an existing integration
|
|
560
|
+
* @param integrationId - Integration ID
|
|
561
|
+
* @param updates - Integration update request
|
|
562
|
+
* @returns Promise that resolves with the updated integration
|
|
563
|
+
* @throws {ApiError} if the request fails
|
|
564
|
+
*/
|
|
565
|
+
async updateIntegration(integrationId, updates) {
|
|
566
|
+
const { data } = await this.#api.PUT("/integrations/{integrationId}/", {
|
|
567
|
+
params: { path: { integrationId } },
|
|
568
|
+
body: updates
|
|
569
|
+
});
|
|
570
|
+
return data;
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Update integration credentials
|
|
574
|
+
* @param integrationId - Integration ID
|
|
575
|
+
* @param credentials - New credentials
|
|
576
|
+
* @returns Promise that resolves with the updated integration
|
|
577
|
+
* @throws {ApiError} if the request fails
|
|
578
|
+
*/
|
|
579
|
+
async updateIntegrationCredentials(integrationId, credentials) {
|
|
580
|
+
const { data } = await this.#api.PATCH(
|
|
581
|
+
"/integrations/{integrationId}/credentials/",
|
|
582
|
+
{
|
|
583
|
+
params: { path: { integrationId } },
|
|
584
|
+
body: credentials
|
|
585
|
+
}
|
|
586
|
+
);
|
|
587
|
+
return data;
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Delete an integration
|
|
591
|
+
* @param integrationId - Integration ID
|
|
592
|
+
* @returns Promise that resolves when the integration is deleted
|
|
593
|
+
* @throws {ApiError} if the request fails
|
|
594
|
+
*/
|
|
595
|
+
async deleteIntegration(integrationId) {
|
|
596
|
+
await this.#api.DELETE("/integrations/{integrationId}/", {
|
|
597
|
+
params: { path: { integrationId } }
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
// src/services/invites.ts
|
|
603
|
+
var Invites = class {
|
|
604
|
+
#api;
|
|
605
|
+
constructor(api) {
|
|
606
|
+
this.#api = api;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* List all invitations for a workspace
|
|
610
|
+
* @param workspaceId - Workspace ID
|
|
611
|
+
* @param query - Optional query parameters (role, sortBy, order, limit, after)
|
|
612
|
+
* @returns Promise that resolves with a paginated list of invitations
|
|
613
|
+
* @throws {ApiError} if the request fails
|
|
614
|
+
*/
|
|
615
|
+
async listInvites(workspaceId, query) {
|
|
616
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/invites/", {
|
|
617
|
+
params: { path: { workspaceId }, query }
|
|
618
|
+
});
|
|
619
|
+
return data;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Send an invitation to join a workspace
|
|
623
|
+
* @param workspaceId - Workspace ID
|
|
624
|
+
* @param invite - Invitation request
|
|
625
|
+
* @returns Promise that resolves with the created invitation
|
|
626
|
+
* @throws {ApiError} if the request fails
|
|
627
|
+
*/
|
|
628
|
+
async sendInvite(workspaceId, invite) {
|
|
629
|
+
const { data } = await this.#api.POST(
|
|
630
|
+
"/workspaces/{workspaceId}/invites/",
|
|
631
|
+
{
|
|
632
|
+
params: { path: { workspaceId } },
|
|
633
|
+
body: invite
|
|
634
|
+
}
|
|
635
|
+
);
|
|
636
|
+
return data;
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Cancel a pending invitation
|
|
640
|
+
* @param inviteId - Invite ID
|
|
641
|
+
* @returns Promise that resolves when the invitation is canceled
|
|
642
|
+
* @throws {ApiError} if the request fails
|
|
643
|
+
*/
|
|
644
|
+
async cancelInvite(inviteId) {
|
|
645
|
+
await this.#api.DELETE("/invites/{inviteId}/", {
|
|
646
|
+
params: { path: { inviteId } }
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* Reply to an invitation (accept or decline)
|
|
651
|
+
* @param inviteId - Invite ID
|
|
652
|
+
* @param reply - Reply request
|
|
653
|
+
* @returns Promise that resolves with the updated invitation
|
|
654
|
+
* @throws {ApiError} if the request fails
|
|
655
|
+
*/
|
|
656
|
+
async replyToInvite(inviteId, reply) {
|
|
657
|
+
const { data } = await this.#api.POST("/invites/{inviteId}/", {
|
|
658
|
+
params: { path: { inviteId } },
|
|
659
|
+
body: reply
|
|
660
|
+
});
|
|
661
|
+
return data;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Generate a shareable invite code for a workspace
|
|
665
|
+
* @param workspaceId - Workspace ID
|
|
666
|
+
* @param options - Invite code generation options
|
|
667
|
+
* @returns Promise that resolves with the generated invite code
|
|
668
|
+
* @throws {ApiError} if the request fails
|
|
669
|
+
*/
|
|
670
|
+
async generateInviteCode(workspaceId, options) {
|
|
671
|
+
const { data } = await this.#api.POST(
|
|
672
|
+
"/workspaces/{workspaceId}/invites/code/",
|
|
673
|
+
{
|
|
674
|
+
params: { path: { workspaceId } },
|
|
675
|
+
body: options
|
|
676
|
+
}
|
|
677
|
+
);
|
|
678
|
+
return data;
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* Reply to an invite code (accept or decline)
|
|
682
|
+
* @param inviteCode - The invite code
|
|
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
|
|
685
|
+
* @throws {ApiError} if the request fails
|
|
686
|
+
*/
|
|
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}/", {
|
|
702
|
+
params: { path: { inviteCode } }
|
|
703
|
+
});
|
|
704
|
+
return data;
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
// src/services/members.ts
|
|
709
|
+
var Members = class {
|
|
710
|
+
#api;
|
|
711
|
+
constructor(api) {
|
|
712
|
+
this.#api = api;
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* List members of a workspace
|
|
716
|
+
* @param workspaceId - Workspace ID
|
|
717
|
+
* @param query - Optional query parameters (role, has2fa, sortBy, order, limit, after)
|
|
718
|
+
* @returns Promise that resolves with a paginated list of members
|
|
719
|
+
* @throws {ApiError} if the request fails
|
|
720
|
+
*/
|
|
721
|
+
async listMembers(workspaceId, query) {
|
|
722
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/members/", {
|
|
723
|
+
params: { path: { workspaceId }, query }
|
|
724
|
+
});
|
|
725
|
+
return data;
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Get member details by account ID
|
|
729
|
+
* @param workspaceId - Workspace ID
|
|
730
|
+
* @param accountId - Account ID
|
|
731
|
+
* @returns Promise that resolves with the member details
|
|
732
|
+
* @throws {ApiError} if the request fails
|
|
733
|
+
*/
|
|
734
|
+
async getMember(workspaceId, accountId) {
|
|
735
|
+
const { data } = await this.#api.GET(
|
|
736
|
+
"/workspaces/{workspaceId}/members/{accountId}/",
|
|
737
|
+
{
|
|
738
|
+
params: {
|
|
739
|
+
path: { workspaceId, accountId }
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
);
|
|
743
|
+
return data;
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Update a member's role
|
|
747
|
+
* @param workspaceId - Workspace ID
|
|
748
|
+
* @param accountId - Account ID
|
|
749
|
+
* @param updates - New role for the member
|
|
750
|
+
* @returns Promise that resolves with the updated member
|
|
751
|
+
* @throws {ApiError} if the request fails
|
|
752
|
+
*/
|
|
753
|
+
async updateMember(workspaceId, accountId, updates) {
|
|
754
|
+
const { data } = await this.#api.PATCH(
|
|
755
|
+
"/workspaces/{workspaceId}/members/{accountId}/role",
|
|
756
|
+
{
|
|
757
|
+
params: {
|
|
758
|
+
path: { workspaceId, accountId }
|
|
759
|
+
},
|
|
760
|
+
body: updates
|
|
761
|
+
}
|
|
762
|
+
);
|
|
763
|
+
return data;
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Remove a member from a workspace
|
|
767
|
+
* @param workspaceId - Workspace ID
|
|
768
|
+
* @param accountId - Account ID
|
|
769
|
+
* @returns Promise that resolves when the member is removed
|
|
770
|
+
* @throws {ApiError} if the request fails
|
|
771
|
+
*/
|
|
772
|
+
async removeMember(workspaceId, accountId) {
|
|
773
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/members/{accountId}/", {
|
|
774
|
+
params: { path: { workspaceId, accountId } }
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* Leave a workspace
|
|
779
|
+
* @param workspaceId - Workspace ID
|
|
780
|
+
* @returns Promise that resolves when the member has left
|
|
781
|
+
* @throws {ApiError} if the request fails
|
|
782
|
+
*/
|
|
783
|
+
async leaveWorkspace(workspaceId) {
|
|
784
|
+
await this.#api.POST("/workspaces/{workspaceId}/members/leave", {
|
|
785
|
+
params: { path: { workspaceId } }
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
// src/services/notifications.ts
|
|
791
|
+
var Notifications = class {
|
|
792
|
+
#api;
|
|
793
|
+
constructor(api) {
|
|
794
|
+
this.#api = api;
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* List notifications for the authenticated account
|
|
798
|
+
* @param query - Optional pagination parameters (limit, after)
|
|
799
|
+
* @returns Promise that resolves with a paginated list of notifications
|
|
800
|
+
* @throws {ApiError} if the request fails
|
|
801
|
+
*/
|
|
802
|
+
async listNotifications(query) {
|
|
803
|
+
const { data } = await this.#api.GET("/notifications/", {
|
|
804
|
+
params: { query }
|
|
805
|
+
});
|
|
806
|
+
return data;
|
|
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
|
+
}
|
|
817
|
+
};
|
|
818
|
+
|
|
819
|
+
// src/services/runs.ts
|
|
820
|
+
var Runs = class {
|
|
821
|
+
#api;
|
|
822
|
+
constructor(api) {
|
|
823
|
+
this.#api = api;
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* List integration runs for a workspace
|
|
827
|
+
* @param workspaceId - Workspace ID
|
|
828
|
+
* @param query - Optional pagination parameters (limit, after)
|
|
829
|
+
* @returns Promise that resolves with a paginated list of integration runs
|
|
830
|
+
* @throws {ApiError} if the request fails
|
|
831
|
+
*/
|
|
832
|
+
async listRuns(workspaceId, query) {
|
|
833
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/runs/", {
|
|
834
|
+
params: { path: { workspaceId }, query }
|
|
835
|
+
});
|
|
836
|
+
return data;
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Get integration run details by ID
|
|
840
|
+
* @param runId - Run ID
|
|
841
|
+
* @returns Promise that resolves with the integration run details
|
|
842
|
+
* @throws {ApiError} if the request fails
|
|
843
|
+
*/
|
|
844
|
+
async getRun(runId) {
|
|
845
|
+
const { data } = await this.#api.GET("/runs/{runId}", {
|
|
846
|
+
params: { path: { runId } }
|
|
847
|
+
});
|
|
848
|
+
return data;
|
|
849
|
+
}
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
// src/services/status.ts
|
|
853
|
+
var Status = class {
|
|
854
|
+
#api;
|
|
855
|
+
constructor(api) {
|
|
856
|
+
this.#api = api;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Check the health status of the API
|
|
860
|
+
* @param options - Health check options
|
|
861
|
+
* @returns Promise that resolves with the API health status
|
|
862
|
+
*/
|
|
863
|
+
async checkHealth(options) {
|
|
864
|
+
const { data, error } = await this.#api.GET("/health", {
|
|
865
|
+
params: { path: { version: "v1" } },
|
|
866
|
+
body: options ?? {}
|
|
867
|
+
});
|
|
868
|
+
return data ?? error;
|
|
869
|
+
}
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
// src/services/webhooks.ts
|
|
873
|
+
var Webhooks = class {
|
|
874
|
+
#api;
|
|
875
|
+
constructor(api) {
|
|
876
|
+
this.#api = api;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* List all webhooks in a workspace
|
|
880
|
+
* @param workspaceId - Workspace ID
|
|
881
|
+
* @param query - Optional pagination parameters (limit, after)
|
|
882
|
+
* @returns Promise that resolves with a paginated list of webhooks
|
|
883
|
+
* @throws {ApiError} if the request fails
|
|
884
|
+
*/
|
|
885
|
+
async listWebhooks(workspaceId, query) {
|
|
886
|
+
const { data } = await this.#api.GET(
|
|
887
|
+
"/workspaces/{workspaceId}/webhooks/",
|
|
888
|
+
{
|
|
889
|
+
params: { path: { workspaceId }, query }
|
|
890
|
+
}
|
|
891
|
+
);
|
|
892
|
+
return data;
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Get a specific webhook by ID
|
|
896
|
+
* @param webhookId - Webhook ID
|
|
897
|
+
* @returns Promise that resolves with the webhook details
|
|
898
|
+
* @throws {ApiError} if the request fails
|
|
899
|
+
*/
|
|
900
|
+
async getWebhook(webhookId) {
|
|
901
|
+
const { data } = await this.#api.GET("/webhooks/{webhookId}/", {
|
|
902
|
+
params: { path: { webhookId } }
|
|
903
|
+
});
|
|
904
|
+
return data;
|
|
905
|
+
}
|
|
906
|
+
/**
|
|
907
|
+
* Create a new webhook
|
|
908
|
+
* @param workspaceId - Workspace ID
|
|
909
|
+
* @param webhook - Webhook creation request
|
|
910
|
+
* @returns Promise that resolves with the created webhook
|
|
911
|
+
* @throws {ApiError} if the request fails
|
|
912
|
+
*/
|
|
913
|
+
async createWebhook(workspaceId, webhook) {
|
|
914
|
+
const { data } = await this.#api.POST(
|
|
915
|
+
"/workspaces/{workspaceId}/webhooks/",
|
|
916
|
+
{
|
|
917
|
+
params: { path: { workspaceId } },
|
|
918
|
+
body: webhook
|
|
919
|
+
}
|
|
920
|
+
);
|
|
921
|
+
return data;
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* Update an existing webhook
|
|
925
|
+
* @param webhookId - Webhook ID
|
|
926
|
+
* @param updates - Webhook update request
|
|
927
|
+
* @returns Promise that resolves with the updated webhook
|
|
928
|
+
* @throws {ApiError} if the request fails
|
|
929
|
+
*/
|
|
930
|
+
async updateWebhook(webhookId, updates) {
|
|
931
|
+
const { data } = await this.#api.PUT("/webhooks/{webhookId}/", {
|
|
932
|
+
params: { path: { webhookId } },
|
|
933
|
+
body: updates
|
|
934
|
+
});
|
|
935
|
+
return data;
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Delete a webhook
|
|
939
|
+
* @param webhookId - Webhook ID
|
|
940
|
+
* @returns Promise that resolves when the webhook is deleted
|
|
941
|
+
* @throws {ApiError} if the request fails
|
|
942
|
+
*/
|
|
943
|
+
async deleteWebhook(webhookId) {
|
|
944
|
+
await this.#api.DELETE("/webhooks/{webhookId}/", {
|
|
945
|
+
params: { path: { webhookId } }
|
|
946
|
+
});
|
|
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
|
+
}
|
|
962
|
+
};
|
|
963
|
+
|
|
964
|
+
// src/services/workspaces.ts
|
|
965
|
+
var Workspaces = class {
|
|
966
|
+
#api;
|
|
967
|
+
constructor(api) {
|
|
968
|
+
this.#api = api;
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* List all workspaces
|
|
972
|
+
* @param query - Optional pagination parameters (limit, after)
|
|
973
|
+
* @returns Promise that resolves with a paginated list of workspaces
|
|
974
|
+
* @throws {ApiError} if the request fails
|
|
975
|
+
*/
|
|
976
|
+
async listWorkspaces(query) {
|
|
977
|
+
const { data } = await this.#api.GET("/workspaces/", {
|
|
978
|
+
params: { query }
|
|
979
|
+
});
|
|
980
|
+
return data;
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* Get workspace details by ID
|
|
984
|
+
* @param workspaceId - Workspace ID
|
|
985
|
+
* @returns Promise that resolves with the workspace details
|
|
986
|
+
* @throws {ApiError} if the request fails
|
|
987
|
+
*/
|
|
988
|
+
async getWorkspace(workspaceId) {
|
|
989
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/", {
|
|
990
|
+
params: { path: { workspaceId } }
|
|
991
|
+
});
|
|
992
|
+
return data;
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Create a new workspace
|
|
996
|
+
* @param workspace - Workspace creation request
|
|
997
|
+
* @returns Promise that resolves with the created workspace
|
|
998
|
+
* @throws {ApiError} if the request fails
|
|
999
|
+
*/
|
|
1000
|
+
async createWorkspace(workspace) {
|
|
1001
|
+
const { data } = await this.#api.POST("/workspaces/", {
|
|
1002
|
+
body: workspace
|
|
1003
|
+
});
|
|
1004
|
+
return data;
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Update an existing workspace
|
|
1008
|
+
* @param workspaceId - Workspace ID
|
|
1009
|
+
* @param updates - Workspace update request
|
|
1010
|
+
* @returns Promise that resolves with the updated workspace
|
|
1011
|
+
* @throws {ApiError} if the request fails
|
|
1012
|
+
*/
|
|
1013
|
+
async updateWorkspace(workspaceId, updates) {
|
|
1014
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/", {
|
|
1015
|
+
params: { path: { workspaceId } },
|
|
1016
|
+
body: updates
|
|
1017
|
+
});
|
|
1018
|
+
return data;
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* Delete a workspace
|
|
1022
|
+
* @param workspaceId - Workspace ID
|
|
1023
|
+
* @returns Promise that resolves when the workspace is deleted
|
|
1024
|
+
* @throws {ApiError} if the request fails
|
|
1025
|
+
*/
|
|
1026
|
+
async deleteWorkspace(workspaceId) {
|
|
1027
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/", {
|
|
1028
|
+
params: { path: { workspaceId } }
|
|
1029
|
+
});
|
|
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
|
+
}
|
|
1063
|
+
};
|
|
1064
|
+
|
|
1065
|
+
export { Account, Activities, Annotations, ApiTokens, Auth, Comments, Documents, Files, Integrations, Invites, Members, Notifications, Runs, Status, Webhooks, Workspaces };
|
|
1066
|
+
//# sourceMappingURL=index.js.map
|
|
1067
|
+
//# sourceMappingURL=index.js.map
|