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