@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.
- package/CHANGELOG.md +48 -3
- package/README.md +11 -22
- 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/{workspace-3RLqaMcj.d.ts → auth-CncOz2vx.d.ts} +1309 -944
- package/dist/{client-D6GtLRbO.d.ts → client-DQRisDAK.d.ts} +237 -252
- package/dist/config-L7FKq_q5.d.ts +81 -0
- package/dist/datatypes/index.d.ts +3 -2
- package/dist/index.d.ts +41 -155
- package/dist/index.js +446 -404
- package/dist/index.js.map +1 -1
- package/dist/services/index.d.ts +4 -2
- package/dist/services/index.js +323 -212
- package/dist/services/index.js.map +1 -1
- package/dist/workspace-BjdbMWsa.d.ts +118 -0
- package/package.json +7 -1
package/dist/services/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/services/account.ts
|
|
2
|
-
var
|
|
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
|
|
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
|
|
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
|
|
33
|
+
async deleteAccount() {
|
|
34
34
|
await this.#api.DELETE("/account");
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
// src/services/activities.ts
|
|
39
|
-
var
|
|
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
|
|
48
|
-
* @returns Promise that resolves with
|
|
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
|
|
51
|
+
async listActivities(workspaceId, query) {
|
|
52
52
|
const { data } = await this.#api.GET(
|
|
53
|
-
"/workspaces/{
|
|
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
|
|
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
|
|
72
|
-
* @returns Promise that resolves with
|
|
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
|
|
76
|
-
const { data } = await this.#api.GET("/files/{
|
|
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
|
|
88
|
-
const { data } = await this.#api.GET("/annotations/{
|
|
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
|
|
101
|
-
const { data } = await this.#api.POST("/files/{
|
|
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
|
|
115
|
-
const { data } = await this.#api.PATCH("/annotations/{
|
|
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
|
|
128
|
-
await this.#api.DELETE("/annotations/{
|
|
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
|
|
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
|
|
143
|
-
* @returns Promise that resolves with
|
|
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
|
|
146
|
+
async listApiTokens(query) {
|
|
147
147
|
const { data } = await this.#api.GET("/api-tokens/", {
|
|
148
|
-
params: { query
|
|
148
|
+
params: { query }
|
|
149
149
|
});
|
|
150
150
|
return data;
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
|
-
* Get a specific API token by
|
|
154
|
-
* @param
|
|
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
|
|
159
|
-
const { data } = await this.#api.GET(
|
|
160
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
187
|
-
const { data } = await this.#api.PATCH(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
|
|
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
|
|
203
|
-
await this.#api.DELETE(
|
|
204
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
227
|
+
async signupAccount(credentials) {
|
|
237
228
|
const { data } = await this.#api.POST("/auth/signup", {
|
|
238
|
-
body:
|
|
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
|
|
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
|
|
254
|
-
* @returns Promise that resolves with
|
|
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
|
|
258
|
-
const { data } = await this.#api.GET("/files/{
|
|
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
|
|
271
|
-
const { data } = await this.#api.POST("/files/{
|
|
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
|
|
285
|
-
await this.#api.DELETE("/
|
|
286
|
-
params: { path: {
|
|
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
|
|
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
|
|
301
|
-
* @returns Promise that resolves with
|
|
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
|
|
316
|
+
async listDocuments(workspaceId, query) {
|
|
305
317
|
const { data } = await this.#api.GET(
|
|
306
|
-
"/workspaces/{
|
|
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
|
|
320
|
-
const { data } = await this.#api.GET("/documents/{
|
|
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
|
|
344
|
+
async createDocument(workspaceId, document) {
|
|
333
345
|
const { data } = await this.#api.POST(
|
|
334
|
-
"/workspaces/{
|
|
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
|
|
350
|
-
const { data } = await this.#api.PATCH("/documents/{
|
|
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
|
|
363
|
-
await this.#api.DELETE("/documents/{
|
|
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
|
|
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,
|
|
379
|
-
* @returns Promise that resolves with
|
|
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
|
|
383
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
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
|
|
395
|
-
const { response } = await this.#api.GET("/files/{
|
|
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
|
|
409
|
-
const { data } = await this.#api.PATCH("/files/{
|
|
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
|
|
422
|
-
await this.#api.DELETE("/files/{
|
|
469
|
+
async deleteFile(fileId) {
|
|
470
|
+
await this.#api.DELETE("/files/{fileId}", {
|
|
423
471
|
params: { path: { fileId } }
|
|
424
472
|
});
|
|
425
473
|
}
|
|
426
474
|
/**
|
|
427
|
-
* Download
|
|
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
|
|
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
|
|
434
|
-
const { response } = await this.#api.
|
|
435
|
-
"/workspaces/{
|
|
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
|
-
*
|
|
493
|
+
* Delete multiple files
|
|
446
494
|
* @param workspaceId - Workspace ID
|
|
447
|
-
* @param request -
|
|
448
|
-
* @returns Promise that resolves
|
|
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
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
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
|
|
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
|
|
474
|
-
* @returns Promise that resolves with
|
|
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
|
|
520
|
+
async listIntegrations(workspaceId, query) {
|
|
478
521
|
const { data } = await this.#api.GET(
|
|
479
|
-
"/workspaces/{
|
|
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
|
|
493
|
-
const { data } = await this.#api.GET("/integrations/{
|
|
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
|
|
548
|
+
async createIntegration(workspaceId, integration) {
|
|
506
549
|
const { data } = await this.#api.POST(
|
|
507
|
-
"/workspaces/{
|
|
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
|
|
523
|
-
const { data } = await this.#api.PUT("/integrations/{
|
|
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
|
|
579
|
+
async updateIntegrationCredentials(integrationId, credentials) {
|
|
537
580
|
const { data } = await this.#api.PATCH(
|
|
538
|
-
"/integrations/{
|
|
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
|
|
553
|
-
await this.#api.DELETE("/integrations/{
|
|
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
|
|
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,
|
|
569
|
-
* @returns Promise that resolves with
|
|
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
|
|
573
|
-
const { data } = await this.#api.GET(
|
|
574
|
-
|
|
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
|
|
628
|
+
async sendInvite(workspaceId, invite) {
|
|
589
629
|
const { data } = await this.#api.POST(
|
|
590
|
-
"/workspaces/{
|
|
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
|
|
605
|
-
await this.#api.DELETE("/invites/{
|
|
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
|
|
617
|
-
const { data } = await this.#api.
|
|
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
|
|
670
|
+
async generateInviteCode(workspaceId, options) {
|
|
631
671
|
const { data } = await this.#api.POST(
|
|
632
|
-
"/workspaces/{
|
|
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
|
-
*
|
|
681
|
+
* Reply to an invite code (accept or decline)
|
|
642
682
|
* @param inviteCode - The invite code
|
|
643
|
-
* @
|
|
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
|
|
647
|
-
const { data } = await this.#api.POST("/invites/{
|
|
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
|
|
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,
|
|
664
|
-
* @returns Promise that resolves with
|
|
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
|
|
668
|
-
const { data } = await this.#api.GET(
|
|
669
|
-
|
|
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
|
|
734
|
+
async getMember(workspaceId, accountId) {
|
|
684
735
|
const { data } = await this.#api.GET(
|
|
685
|
-
"/workspaces/{
|
|
736
|
+
"/workspaces/{workspaceId}/members/{accountId}/",
|
|
686
737
|
{
|
|
687
|
-
params: {
|
|
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
|
|
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
|
|
753
|
+
async updateMember(workspaceId, accountId, updates) {
|
|
701
754
|
const { data } = await this.#api.PATCH(
|
|
702
|
-
"/workspaces/{
|
|
755
|
+
"/workspaces/{workspaceId}/members/{accountId}/role",
|
|
703
756
|
{
|
|
704
|
-
params: {
|
|
705
|
-
|
|
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
|
|
718
|
-
await this.#api.DELETE("/workspaces/{
|
|
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
|
|
729
|
-
await this.#api.POST("/workspaces/{
|
|
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
|
|
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
|
|
744
|
-
* @returns Promise that resolves with
|
|
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
|
|
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
|
|
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
|
|
765
|
-
* @returns Promise that resolves with
|
|
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
|
|
769
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
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
|
|
781
|
-
const { data } = await this.#api.GET("/runs/{
|
|
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
|
|
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
|
|
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
|
|
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
|
-
* @
|
|
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
|
|
885
|
+
async listWebhooks(workspaceId, query) {
|
|
821
886
|
const { data } = await this.#api.GET(
|
|
822
|
-
"/workspaces/{
|
|
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
|
|
836
|
-
const { data } = await this.#api.GET("/webhooks/{
|
|
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
|
|
910
|
+
* @returns Promise that resolves with the created webhook
|
|
846
911
|
* @throws {ApiError} if the request fails
|
|
847
912
|
*/
|
|
848
|
-
async
|
|
913
|
+
async createWebhook(workspaceId, webhook) {
|
|
849
914
|
const { data } = await this.#api.POST(
|
|
850
|
-
"/workspaces/{
|
|
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
|
|
866
|
-
const { data } = await this.#api.PUT("/webhooks/{
|
|
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
|
|
879
|
-
await this.#api.DELETE("/webhooks/{
|
|
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
|
|
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
|
|
894
|
-
* @returns Promise that resolves with
|
|
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
|
|
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
|
|
910
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
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
|
|
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
|
|
935
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
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
|
|
948
|
-
await this.#api.DELETE("/workspaces/{
|
|
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 {
|
|
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
|