@scryme/chat 2.13.3 → 2.15.1
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/dist/sdk.d.ts +925 -33
- package/dist/sdk.js +685 -8
- package/package.json +1 -1
- package/src/__tests__/sdk.test.ts +224 -2
- package/src/sdk.ts +1261 -69
package/dist/sdk.js
CHANGED
|
@@ -57,11 +57,21 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
57
57
|
import axios from 'axios';
|
|
58
58
|
import { setGlobalToken } from './custom-instance';
|
|
59
59
|
import { getSkyrmeChatAPI } from './generated/v3-server';
|
|
60
|
+
/**
|
|
61
|
+
* The primary client SDK class for accessing the Scryme Chat platform APIs.
|
|
62
|
+
* Supports automated OAuth2 Token management and provides clean, type-safe namespaces.
|
|
63
|
+
*/
|
|
60
64
|
var ScrymeSDK = /** @class */ (function () {
|
|
65
|
+
/**
|
|
66
|
+
* Constructs a new ScrymeSDK instance.
|
|
67
|
+
* @param options Configuration options for baseURL, tokens, and credentials.
|
|
68
|
+
*/
|
|
61
69
|
function ScrymeSDK(options) {
|
|
62
70
|
if (options === void 0) { options = {}; }
|
|
63
71
|
var _a;
|
|
72
|
+
/** The currently cached access token. */
|
|
64
73
|
this.token = null;
|
|
74
|
+
/** Timestamp in milliseconds indicating when the cached token will expire. */
|
|
65
75
|
this.tokenExpiresAt = null;
|
|
66
76
|
this.clientId = options.clientId;
|
|
67
77
|
this.clientSecret = options.clientSecret;
|
|
@@ -77,7 +87,9 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
77
87
|
var g = globalThis;
|
|
78
88
|
var env = ((_a = g.process) === null || _a === void 0 ? void 0 : _a.env) || g.__env__ || {};
|
|
79
89
|
var isProd = env.NODE_ENV === 'production' ||
|
|
80
|
-
(typeof window !== 'undefined' &&
|
|
90
|
+
(typeof window !== 'undefined' &&
|
|
91
|
+
window.location.hostname !== 'localhost' &&
|
|
92
|
+
window.location.hostname !== '127.0.0.1');
|
|
81
93
|
url =
|
|
82
94
|
env.API_URL ||
|
|
83
95
|
env.NEXT_PUBLIC_API_URL ||
|
|
@@ -86,6 +98,10 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
86
98
|
}
|
|
87
99
|
this.baseURL = url.replace(/\/$/, '');
|
|
88
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Synchronizes the authentication token to local storage and the global configuration.
|
|
103
|
+
* @param token The token to synchronize.
|
|
104
|
+
*/
|
|
89
105
|
ScrymeSDK.prototype.syncToken = function (token) {
|
|
90
106
|
if (!token)
|
|
91
107
|
return;
|
|
@@ -97,7 +113,9 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
97
113
|
}
|
|
98
114
|
};
|
|
99
115
|
/**
|
|
100
|
-
* Automatically retrieves or
|
|
116
|
+
* Automatically retrieves a cached token, or fetches a new one via M2M OAuth2 Client Credentials
|
|
117
|
+
* if a clientId and clientSecret are configured.
|
|
118
|
+
* @returns A promise resolving to the token string, or null if unauthenticated.
|
|
101
119
|
*/
|
|
102
120
|
ScrymeSDK.prototype.getOrFetchToken = function () {
|
|
103
121
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -158,7 +176,8 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
158
176
|
});
|
|
159
177
|
};
|
|
160
178
|
/**
|
|
161
|
-
*
|
|
179
|
+
* Generates the default request configuration containing the authorization headers and baseURL.
|
|
180
|
+
* @returns Request configuration object.
|
|
162
181
|
*/
|
|
163
182
|
ScrymeSDK.prototype.getRequestConfig = function () {
|
|
164
183
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -206,7 +225,7 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
206
225
|
// If the user provided options, we merge them with our default request config.
|
|
207
226
|
if (args.length >= arity && typeof args[args.length - 1] === 'object') {
|
|
208
227
|
userOptions = args[args.length - 1];
|
|
209
|
-
newArgs[args.length - 1] = __assign(__assign({}, userOptions), { baseURL: config.baseURL, headers: __assign(__assign({}, config.headers), userOptions.headers) });
|
|
228
|
+
newArgs[args.length - 1] = __assign(__assign({}, userOptions), { baseURL: config.baseURL, headers: __assign(__assign({}, config.headers), userOptions === null || userOptions === void 0 ? void 0 : userOptions.headers) });
|
|
210
229
|
}
|
|
211
230
|
else {
|
|
212
231
|
// Otherwise, we pad missing parameters with undefined and append our config as the options object.
|
|
@@ -230,67 +249,155 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
230
249
|
});
|
|
231
250
|
Object.defineProperty(ScrymeSDK.prototype, "workspace", {
|
|
232
251
|
// --- High-level nested namespace chains for excellent DX ---
|
|
252
|
+
/**
|
|
253
|
+
* Operations for managing workspaces, including creation, updating, retrieval,
|
|
254
|
+
* members, and channels.
|
|
255
|
+
*/
|
|
233
256
|
get: function () {
|
|
234
257
|
var _this = this;
|
|
235
258
|
return {
|
|
259
|
+
/**
|
|
260
|
+
* Lists all workspaces in the authenticated organization context.
|
|
261
|
+
* @param options Optional request config override.
|
|
262
|
+
* @returns List of workspaces returned exactly from the endpoint.
|
|
263
|
+
*/
|
|
236
264
|
list: function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
237
265
|
return __generator(this, function (_a) {
|
|
238
266
|
return [2 /*return*/, this.raw.v3WorkspacesControllerGetWorkspaces(options)];
|
|
239
267
|
});
|
|
240
268
|
}); },
|
|
269
|
+
/**
|
|
270
|
+
* Retrieves detailed information of a specific workspace by its slug.
|
|
271
|
+
* @param slug The unique workspace slug identifier.
|
|
272
|
+
* @param options Optional request config override.
|
|
273
|
+
* @returns Workspace details returned exactly from the endpoint.
|
|
274
|
+
*/
|
|
241
275
|
get: function (slug, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
242
276
|
return __generator(this, function (_a) {
|
|
243
277
|
return [2 /*return*/, this.raw.v3WorkspacesControllerGetWorkspaceBySlug(slug, options)];
|
|
244
278
|
});
|
|
245
279
|
}); },
|
|
280
|
+
/**
|
|
281
|
+
* Provisions a new workspace inside the organization.
|
|
282
|
+
* @param data Workspace creation and configuration data.
|
|
283
|
+
* @param options Optional request config override.
|
|
284
|
+
* @returns Provisioned workspace and bot configuration exactly from the endpoint.
|
|
285
|
+
*/
|
|
246
286
|
create: function (data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
247
287
|
return __generator(this, function (_a) {
|
|
248
288
|
return [2 /*return*/, this.raw.v3WorkspacesControllerProvisionWorkspace(data, options)];
|
|
249
289
|
});
|
|
250
290
|
}); },
|
|
291
|
+
/**
|
|
292
|
+
* Updates the configurations and metadata of an existing workspace.
|
|
293
|
+
* @param slug The unique workspace slug identifier.
|
|
294
|
+
* @param data Fields to update.
|
|
295
|
+
* @param options Optional request config override.
|
|
296
|
+
* @returns The updated workspace details exactly from the endpoint.
|
|
297
|
+
*/
|
|
251
298
|
update: function (slug, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
252
299
|
return __generator(this, function (_a) {
|
|
253
300
|
return [2 /*return*/, this.raw.v3WorkspacesControllerUpdateWorkspace(slug, data, options)];
|
|
254
301
|
});
|
|
255
302
|
}); },
|
|
303
|
+
/**
|
|
304
|
+
* Permanently deletes a specific workspace by its slug.
|
|
305
|
+
* @param slug The unique workspace slug identifier.
|
|
306
|
+
* @param options Optional request config override.
|
|
307
|
+
* @returns Deletion status response exactly from the endpoint.
|
|
308
|
+
*/
|
|
256
309
|
delete: function (slug, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
257
310
|
return __generator(this, function (_a) {
|
|
258
311
|
return [2 /*return*/, this.raw.v3WorkspacesControllerDeleteWorkspace(slug, options)];
|
|
259
312
|
});
|
|
260
313
|
}); },
|
|
314
|
+
/**
|
|
315
|
+
* Operations for managing workspace members, including listing, adding, role updates, and removal.
|
|
316
|
+
*/
|
|
261
317
|
members: {
|
|
318
|
+
/**
|
|
319
|
+
* Lists all members currently in a workspace.
|
|
320
|
+
* @param slug The unique workspace slug identifier.
|
|
321
|
+
* @param options Optional request config override.
|
|
322
|
+
* @returns List of workspace members exactly from the endpoint.
|
|
323
|
+
*/
|
|
262
324
|
list: function (slug, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
263
325
|
return __generator(this, function (_a) {
|
|
264
326
|
return [2 /*return*/, this.raw.v3WorkspacesControllerGetWorkspaceMembers(slug, options)];
|
|
265
327
|
});
|
|
266
328
|
}); },
|
|
329
|
+
/**
|
|
330
|
+
* Adds a new member to the workspace.
|
|
331
|
+
* @param slug The unique workspace slug identifier.
|
|
332
|
+
* @param data Input DTO containing the user's email and role.
|
|
333
|
+
* @param options Optional request config override.
|
|
334
|
+
* @returns Newly added member details exactly from the endpoint.
|
|
335
|
+
*/
|
|
267
336
|
add: function (slug, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
268
337
|
return __generator(this, function (_a) {
|
|
269
338
|
return [2 /*return*/, this.raw.v3WorkspacesControllerAddWorkspaceMember(slug, data, options)];
|
|
270
339
|
});
|
|
271
340
|
}); },
|
|
341
|
+
/**
|
|
342
|
+
* Retrieves membership details of a specific member in a workspace.
|
|
343
|
+
* @param slug The unique workspace slug identifier.
|
|
344
|
+
* @param memberId Unique ID of the workspace member (user ID).
|
|
345
|
+
* @param options Optional request config override.
|
|
346
|
+
* @returns Workspace member details exactly from the endpoint.
|
|
347
|
+
*/
|
|
272
348
|
get: function (slug, memberId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
273
349
|
return __generator(this, function (_a) {
|
|
274
350
|
return [2 /*return*/, this.raw.v3WorkspacesControllerGetWorkspaceMember(slug, memberId, options)];
|
|
275
351
|
});
|
|
276
352
|
}); },
|
|
353
|
+
/**
|
|
354
|
+
* Updates the role or configuration of a workspace member.
|
|
355
|
+
* @param slug The unique workspace slug identifier.
|
|
356
|
+
* @param memberId Unique ID of the workspace member (user ID).
|
|
357
|
+
* @param data Update details containing the target role.
|
|
358
|
+
* @param options Optional request config override.
|
|
359
|
+
* @returns The updated workspace member details exactly from the endpoint.
|
|
360
|
+
*/
|
|
277
361
|
update: function (slug, memberId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
278
362
|
return __generator(this, function (_a) {
|
|
279
363
|
return [2 /*return*/, this.raw.v3WorkspacesControllerUpdateWorkspaceMember(slug, memberId, data, options)];
|
|
280
364
|
});
|
|
281
365
|
}); },
|
|
366
|
+
/**
|
|
367
|
+
* Removes a member from the workspace.
|
|
368
|
+
* @param slug The unique workspace slug identifier.
|
|
369
|
+
* @param memberId Unique ID of the workspace member (user ID).
|
|
370
|
+
* @param options Optional request config override.
|
|
371
|
+
* @returns Workspace member deletion confirmation exactly from the endpoint.
|
|
372
|
+
*/
|
|
282
373
|
delete: function (slug, memberId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
283
374
|
return __generator(this, function (_a) {
|
|
284
375
|
return [2 /*return*/, this.raw.v3WorkspacesControllerDeleteWorkspaceMember(slug, memberId, options)];
|
|
285
376
|
});
|
|
286
377
|
}); },
|
|
287
378
|
},
|
|
379
|
+
/**
|
|
380
|
+
* Operations for listing and creating channels inside a workspace.
|
|
381
|
+
*/
|
|
288
382
|
channels: {
|
|
383
|
+
/**
|
|
384
|
+
* Lists all public channels (and private channels the user has access to) in a workspace.
|
|
385
|
+
* @param slug The unique workspace slug identifier.
|
|
386
|
+
* @param options Optional request config override.
|
|
387
|
+
* @returns List of channels returned exactly from the endpoint.
|
|
388
|
+
*/
|
|
289
389
|
list: function (slug, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
290
390
|
return __generator(this, function (_a) {
|
|
291
391
|
return [2 /*return*/, this.raw.channelsControllerGetWorkspaceChannels(slug, options)];
|
|
292
392
|
});
|
|
293
393
|
}); },
|
|
394
|
+
/**
|
|
395
|
+
* Creates a new channel within a workspace.
|
|
396
|
+
* @param slug The unique workspace slug identifier.
|
|
397
|
+
* @param data Configuration DTO for the new channel.
|
|
398
|
+
* @param options Optional request config override.
|
|
399
|
+
* @returns Details of the created channel exactly from the endpoint.
|
|
400
|
+
*/
|
|
294
401
|
create: function (slug, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
295
402
|
return __generator(this, function (_a) {
|
|
296
403
|
return [2 /*return*/, this.raw.channelsControllerCreateChannel(slug, data, options)];
|
|
@@ -303,33 +410,128 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
303
410
|
configurable: true
|
|
304
411
|
});
|
|
305
412
|
Object.defineProperty(ScrymeSDK.prototype, "channel", {
|
|
413
|
+
/**
|
|
414
|
+
* Operations for managing specific channels and channel message actions.
|
|
415
|
+
*/
|
|
306
416
|
get: function () {
|
|
307
417
|
var _this = this;
|
|
308
418
|
return {
|
|
419
|
+
/**
|
|
420
|
+
* Retrieves detailed information of a specific channel.
|
|
421
|
+
* @param slug The unique workspace slug identifier.
|
|
422
|
+
* @param channelId Unique identifier of the channel.
|
|
423
|
+
* @param options Optional request config override.
|
|
424
|
+
* @returns Channel details returned exactly from the endpoint.
|
|
425
|
+
*/
|
|
309
426
|
get: function (slug, channelId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
310
427
|
return __generator(this, function (_a) {
|
|
311
428
|
return [2 /*return*/, this.raw.channelsControllerGetChannel(slug, channelId, options)];
|
|
312
429
|
});
|
|
313
430
|
}); },
|
|
431
|
+
/**
|
|
432
|
+
* Updates configuration, description, icon or status of an existing channel.
|
|
433
|
+
* @param slug The unique workspace slug identifier.
|
|
434
|
+
* @param channelId Unique identifier of the channel.
|
|
435
|
+
* @param data Configuration options to update.
|
|
436
|
+
* @param options Optional request config override.
|
|
437
|
+
* @returns The updated channel details exactly from the endpoint.
|
|
438
|
+
*/
|
|
314
439
|
update: function (slug, channelId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
315
440
|
return __generator(this, function (_a) {
|
|
316
441
|
return [2 /*return*/, this.raw.channelsControllerUpdateChannel(slug, channelId, data, options)];
|
|
317
442
|
});
|
|
318
443
|
}); },
|
|
444
|
+
/**
|
|
445
|
+
* Permanently deletes a channel from a workspace.
|
|
446
|
+
* @param slug The unique workspace slug identifier.
|
|
447
|
+
* @param channelId Unique identifier of the channel to delete.
|
|
448
|
+
* @param options Optional request config override.
|
|
449
|
+
* @returns Success status indicating that the channel was deleted exactly from the endpoint.
|
|
450
|
+
*/
|
|
319
451
|
delete: function (slug, channelId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
320
452
|
return __generator(this, function (_a) {
|
|
321
453
|
return [2 /*return*/, this.raw.channelsControllerDeleteChannel(slug, channelId, options)];
|
|
322
454
|
});
|
|
323
455
|
}); },
|
|
456
|
+
/**
|
|
457
|
+
* Sub-namespace for managing messages inside a channel.
|
|
458
|
+
*/
|
|
324
459
|
message: {
|
|
460
|
+
/**
|
|
461
|
+
* Lists messages in a channel with cursor pagination support.
|
|
462
|
+
* @param channelId Unique identifier of the channel.
|
|
463
|
+
* @param params Query parameters for limiting, sorting, or pagination cursors.
|
|
464
|
+
* @param options Optional request config override.
|
|
465
|
+
* @returns Object containing the messages array and next pagination cursor exactly from the endpoint.
|
|
466
|
+
*/
|
|
325
467
|
list: function (channelId, params, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
326
468
|
return __generator(this, function (_a) {
|
|
327
469
|
return [2 /*return*/, this.raw.channelsControllerGetMessages(channelId, params, options)];
|
|
328
470
|
});
|
|
329
471
|
}); },
|
|
330
|
-
|
|
472
|
+
/**
|
|
473
|
+
* Sends a new message to a channel.
|
|
474
|
+
* @param channelId Unique identifier of the target channel.
|
|
475
|
+
* @param data The message content string or structured CreateMessageDto object.
|
|
476
|
+
* @param options Optional request config override.
|
|
477
|
+
* @returns The created message exactly from the endpoint.
|
|
478
|
+
*/
|
|
479
|
+
create: function (channelId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
480
|
+
var payload;
|
|
331
481
|
return __generator(this, function (_a) {
|
|
332
|
-
|
|
482
|
+
payload = typeof data === 'string' ? { content: data } : data;
|
|
483
|
+
return [2 /*return*/, this.raw.channelsControllerCreateMessage(channelId, __assign(__assign({}, options), { data: payload }))];
|
|
484
|
+
});
|
|
485
|
+
}); },
|
|
486
|
+
/**
|
|
487
|
+
* Updates the content of a previously sent message in a channel.
|
|
488
|
+
* @param channelId Unique identifier of the channel containing the message.
|
|
489
|
+
* @param messageId Unique identifier of the message to update.
|
|
490
|
+
* @param data The new content payload.
|
|
491
|
+
* @param options Optional request config override.
|
|
492
|
+
* @returns The updated message details exactly from the endpoint.
|
|
493
|
+
*/
|
|
494
|
+
update: function (channelId, messageId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
495
|
+
return __generator(this, function (_a) {
|
|
496
|
+
return [2 /*return*/, this.raw.channelsControllerUpdateMessage(channelId, messageId, data, options)];
|
|
497
|
+
});
|
|
498
|
+
}); },
|
|
499
|
+
/**
|
|
500
|
+
* Permanently deletes a message in a channel.
|
|
501
|
+
* @param channelId Unique identifier of the channel containing the message.
|
|
502
|
+
* @param messageId Unique identifier of the message to delete.
|
|
503
|
+
* @param options Optional request config override.
|
|
504
|
+
* @returns Success status indicating that the message was deleted exactly from the endpoint.
|
|
505
|
+
*/
|
|
506
|
+
delete: function (channelId, messageId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
507
|
+
return __generator(this, function (_a) {
|
|
508
|
+
return [2 /*return*/, this.raw.channelsControllerDeleteMessage(channelId, messageId, options)];
|
|
509
|
+
});
|
|
510
|
+
}); },
|
|
511
|
+
/**
|
|
512
|
+
* Adds a reaction (emoji) to a message in a channel.
|
|
513
|
+
* @param channelId Unique identifier of the channel containing the message.
|
|
514
|
+
* @param messageId Unique identifier of the message.
|
|
515
|
+
* @param data Object containing the target emoji character.
|
|
516
|
+
* @param options Optional request config override.
|
|
517
|
+
* @returns The reaction response returned exactly from the endpoint.
|
|
518
|
+
*/
|
|
519
|
+
addReaction: function (channelId, messageId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
520
|
+
return __generator(this, function (_a) {
|
|
521
|
+
return [2 /*return*/, this.raw.channelsControllerAddReaction(channelId, messageId, data, options)];
|
|
522
|
+
});
|
|
523
|
+
}); },
|
|
524
|
+
/**
|
|
525
|
+
* Removes a reaction (emoji) from a message in a channel.
|
|
526
|
+
* @param channelId Unique identifier of the channel containing the message.
|
|
527
|
+
* @param messageId Unique identifier of the message.
|
|
528
|
+
* @param emoji The emoji character to remove.
|
|
529
|
+
* @param options Optional request config override.
|
|
530
|
+
* @returns The reaction removal response returned exactly from the endpoint.
|
|
531
|
+
*/
|
|
532
|
+
removeReaction: function (channelId, messageId, emoji, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
533
|
+
return __generator(this, function (_a) {
|
|
534
|
+
return [2 /*return*/, this.raw.channelsControllerRemoveReaction(channelId, messageId, emoji, options)];
|
|
333
535
|
});
|
|
334
536
|
}); },
|
|
335
537
|
},
|
|
@@ -339,26 +541,73 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
339
541
|
configurable: true
|
|
340
542
|
});
|
|
341
543
|
Object.defineProperty(ScrymeSDK.prototype, "message", {
|
|
544
|
+
/**
|
|
545
|
+
* Operations for modifying, reacting to, or deleting existing messages (both channel & direct messages).
|
|
546
|
+
* Automatically intercepts direct messages starting with 'dm-' and routes them correctly.
|
|
547
|
+
*/
|
|
342
548
|
get: function () {
|
|
343
549
|
var _this = this;
|
|
344
550
|
return {
|
|
551
|
+
/**
|
|
552
|
+
* Updates the content of a previously sent message.
|
|
553
|
+
* @param channelId Unique identifier of the channel or DM conversation containing the message.
|
|
554
|
+
* @param messageId Unique identifier of the message to update.
|
|
555
|
+
* @param data The new content payload.
|
|
556
|
+
* @param options Optional request config override.
|
|
557
|
+
* @returns The updated message details exactly from the endpoint.
|
|
558
|
+
*/
|
|
345
559
|
update: function (channelId, messageId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
346
560
|
return __generator(this, function (_a) {
|
|
561
|
+
if (channelId.startsWith('dm-')) {
|
|
562
|
+
return [2 /*return*/, this.raw.dmsControllerUpdateMessage(channelId, messageId, data, options)];
|
|
563
|
+
}
|
|
347
564
|
return [2 /*return*/, this.raw.channelsControllerUpdateMessage(channelId, messageId, data, options)];
|
|
348
565
|
});
|
|
349
566
|
}); },
|
|
567
|
+
/**
|
|
568
|
+
* Permanently deletes a message.
|
|
569
|
+
* @param channelId Unique identifier of the channel or DM conversation containing the message.
|
|
570
|
+
* @param messageId Unique identifier of the message to delete.
|
|
571
|
+
* @param options Optional request config override.
|
|
572
|
+
* @returns Success status indicating that the message was deleted exactly from the endpoint.
|
|
573
|
+
*/
|
|
350
574
|
delete: function (channelId, messageId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
351
575
|
return __generator(this, function (_a) {
|
|
576
|
+
if (channelId.startsWith('dm-')) {
|
|
577
|
+
return [2 /*return*/, this.raw.dmsControllerDeleteMessage(channelId, messageId, options)];
|
|
578
|
+
}
|
|
352
579
|
return [2 /*return*/, this.raw.channelsControllerDeleteMessage(channelId, messageId, options)];
|
|
353
580
|
});
|
|
354
581
|
}); },
|
|
582
|
+
/**
|
|
583
|
+
* Adds a reaction (emoji) to a message.
|
|
584
|
+
* @param channelId Unique identifier of the channel or DM conversation containing the message.
|
|
585
|
+
* @param messageId Unique identifier of the message.
|
|
586
|
+
* @param data Object containing the target emoji character.
|
|
587
|
+
* @param options Optional request config override.
|
|
588
|
+
* @returns The reaction response returned exactly from the endpoint.
|
|
589
|
+
*/
|
|
355
590
|
addReaction: function (channelId, messageId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
356
591
|
return __generator(this, function (_a) {
|
|
592
|
+
if (channelId.startsWith('dm-')) {
|
|
593
|
+
return [2 /*return*/, this.raw.dmsControllerAddReaction(channelId, messageId, data, options)];
|
|
594
|
+
}
|
|
357
595
|
return [2 /*return*/, this.raw.channelsControllerAddReaction(channelId, messageId, data, options)];
|
|
358
596
|
});
|
|
359
597
|
}); },
|
|
598
|
+
/**
|
|
599
|
+
* Removes a reaction (emoji) from a message.
|
|
600
|
+
* @param channelId Unique identifier of the channel or DM conversation containing the message.
|
|
601
|
+
* @param messageId Unique identifier of the message.
|
|
602
|
+
* @param emoji The emoji character to remove.
|
|
603
|
+
* @param options Optional request config override.
|
|
604
|
+
* @returns The reaction removal response returned exactly from the endpoint.
|
|
605
|
+
*/
|
|
360
606
|
removeReaction: function (channelId, messageId, emoji, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
361
607
|
return __generator(this, function (_a) {
|
|
608
|
+
if (channelId.startsWith('dm-')) {
|
|
609
|
+
return [2 /*return*/, this.raw.dmsControllerRemoveReaction(channelId, messageId, emoji, options)];
|
|
610
|
+
}
|
|
362
611
|
return [2 /*return*/, this.raw.channelsControllerRemoveReaction(channelId, messageId, emoji, options)];
|
|
363
612
|
});
|
|
364
613
|
}); },
|
|
@@ -368,38 +617,134 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
368
617
|
configurable: true
|
|
369
618
|
});
|
|
370
619
|
Object.defineProperty(ScrymeSDK.prototype, "dm", {
|
|
620
|
+
/**
|
|
621
|
+
* Operations for managing direct messages (DMs) and direct message conversations.
|
|
622
|
+
*/
|
|
371
623
|
get: function () {
|
|
372
624
|
var _this = this;
|
|
373
625
|
return {
|
|
626
|
+
/**
|
|
627
|
+
* Lists all active direct message conversations for the authenticated user.
|
|
628
|
+
* @param options Optional request config override.
|
|
629
|
+
* @returns List of active DM conversations returned exactly from the endpoint.
|
|
630
|
+
*/
|
|
374
631
|
list: function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
375
632
|
return __generator(this, function (_a) {
|
|
376
633
|
return [2 /*return*/, this.raw.dmsControllerGetDms(options)];
|
|
377
634
|
});
|
|
378
635
|
}); },
|
|
636
|
+
/**
|
|
637
|
+
* Creates/initiates a direct message conversation with specified users.
|
|
638
|
+
* @param data Create direct message details containing target participant IDs.
|
|
639
|
+
* @param options Optional request config override.
|
|
640
|
+
* @returns Details of the created DM conversation exactly from the endpoint.
|
|
641
|
+
*/
|
|
379
642
|
create: function (data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
380
643
|
return __generator(this, function (_a) {
|
|
381
644
|
return [2 /*return*/, this.raw.dmsControllerCreateDm(data, options)];
|
|
382
645
|
});
|
|
383
646
|
}); },
|
|
647
|
+
/**
|
|
648
|
+
* Retrieves details of a specific direct message conversation.
|
|
649
|
+
* @param dmId Unique identifier of the direct message conversation.
|
|
650
|
+
* @param options Optional request config override.
|
|
651
|
+
* @returns Detailed direct message conversation object exactly from the endpoint.
|
|
652
|
+
*/
|
|
384
653
|
get: function (dmId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
385
654
|
return __generator(this, function (_a) {
|
|
386
655
|
return [2 /*return*/, this.raw.dmsControllerGetDm(dmId, options)];
|
|
387
656
|
});
|
|
388
657
|
}); },
|
|
658
|
+
/**
|
|
659
|
+
* Deletes/closes an active direct message conversation.
|
|
660
|
+
* @param dmId Unique identifier of the direct message conversation to close.
|
|
661
|
+
* @param options Optional request config override.
|
|
662
|
+
* @returns Success status indicating that the DM conversation was deleted exactly from the endpoint.
|
|
663
|
+
*/
|
|
389
664
|
delete: function (dmId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
390
665
|
return __generator(this, function (_a) {
|
|
391
666
|
return [2 /*return*/, this.raw.dmsControllerDeleteDm(dmId, options)];
|
|
392
667
|
});
|
|
393
668
|
}); },
|
|
669
|
+
/**
|
|
670
|
+
* Sub-namespace for managing direct messages in a specific DM conversation.
|
|
671
|
+
*/
|
|
394
672
|
message: {
|
|
673
|
+
/**
|
|
674
|
+
* Lists messages in a direct message conversation with cursor pagination.
|
|
675
|
+
* @param dmId Unique identifier of the direct message conversation.
|
|
676
|
+
* @param params Query parameters for pagination limits, cursors or search filters.
|
|
677
|
+
* @param options Optional request config override.
|
|
678
|
+
* @returns List of direct messages and next pagination cursor exactly from the endpoint.
|
|
679
|
+
*/
|
|
395
680
|
list: function (dmId, params, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
396
681
|
return __generator(this, function (_a) {
|
|
397
682
|
return [2 /*return*/, this.raw.dmsControllerGetMessages(dmId, params, options)];
|
|
398
683
|
});
|
|
399
684
|
}); },
|
|
400
|
-
|
|
685
|
+
/**
|
|
686
|
+
* Sends a new message in a direct message conversation.
|
|
687
|
+
* @param dmId Unique identifier of the direct message conversation.
|
|
688
|
+
* @param data The message content string or structured CreateMessageDto object.
|
|
689
|
+
* @param options Optional request config override.
|
|
690
|
+
* @returns The sent message exactly from the endpoint.
|
|
691
|
+
*/
|
|
692
|
+
create: function (dmId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
693
|
+
var payload;
|
|
694
|
+
return __generator(this, function (_a) {
|
|
695
|
+
payload = typeof data === 'string' ? { content: data } : data;
|
|
696
|
+
return [2 /*return*/, this.raw.dmsControllerCreateMessage(dmId, __assign(__assign({}, options), { data: payload }))];
|
|
697
|
+
});
|
|
698
|
+
}); },
|
|
699
|
+
/**
|
|
700
|
+
* Updates the content of a previously sent direct message.
|
|
701
|
+
* @param dmId Unique identifier of the direct message conversation.
|
|
702
|
+
* @param messageId Unique identifier of the message to update.
|
|
703
|
+
* @param data The new content payload.
|
|
704
|
+
* @param options Optional request config override.
|
|
705
|
+
* @returns The updated message details exactly from the endpoint.
|
|
706
|
+
*/
|
|
707
|
+
update: function (dmId, messageId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
708
|
+
return __generator(this, function (_a) {
|
|
709
|
+
return [2 /*return*/, this.raw.dmsControllerUpdateMessage(dmId, messageId, data, options)];
|
|
710
|
+
});
|
|
711
|
+
}); },
|
|
712
|
+
/**
|
|
713
|
+
* Permanently deletes a direct message.
|
|
714
|
+
* @param dmId Unique identifier of the direct message conversation.
|
|
715
|
+
* @param messageId Unique identifier of the message to delete.
|
|
716
|
+
* @param options Optional request config override.
|
|
717
|
+
* @returns Success status indicating that the message was deleted exactly from the endpoint.
|
|
718
|
+
*/
|
|
719
|
+
delete: function (dmId, messageId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
720
|
+
return __generator(this, function (_a) {
|
|
721
|
+
return [2 /*return*/, this.raw.dmsControllerDeleteMessage(dmId, messageId, options)];
|
|
722
|
+
});
|
|
723
|
+
}); },
|
|
724
|
+
/**
|
|
725
|
+
* Adds a reaction (emoji) to a direct message.
|
|
726
|
+
* @param dmId Unique identifier of the direct message conversation.
|
|
727
|
+
* @param messageId Unique identifier of the message.
|
|
728
|
+
* @param data Object containing the target emoji character.
|
|
729
|
+
* @param options Optional request config override.
|
|
730
|
+
* @returns The reaction response returned exactly from the endpoint.
|
|
731
|
+
*/
|
|
732
|
+
addReaction: function (dmId, messageId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
401
733
|
return __generator(this, function (_a) {
|
|
402
|
-
return [2 /*return*/, this.raw.
|
|
734
|
+
return [2 /*return*/, this.raw.dmsControllerAddReaction(dmId, messageId, data, options)];
|
|
735
|
+
});
|
|
736
|
+
}); },
|
|
737
|
+
/**
|
|
738
|
+
* Removes a reaction (emoji) from a direct message.
|
|
739
|
+
* @param dmId Unique identifier of the direct message conversation.
|
|
740
|
+
* @param messageId Unique identifier of the message.
|
|
741
|
+
* @param emoji The emoji character to remove.
|
|
742
|
+
* @param options Optional request config override.
|
|
743
|
+
* @returns The reaction removal response returned exactly from the endpoint.
|
|
744
|
+
*/
|
|
745
|
+
removeReaction: function (dmId, messageId, emoji, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
746
|
+
return __generator(this, function (_a) {
|
|
747
|
+
return [2 /*return*/, this.raw.dmsControllerRemoveReaction(dmId, messageId, emoji, options)];
|
|
403
748
|
});
|
|
404
749
|
}); },
|
|
405
750
|
},
|
|
@@ -409,19 +754,40 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
409
754
|
configurable: true
|
|
410
755
|
});
|
|
411
756
|
Object.defineProperty(ScrymeSDK.prototype, "user", {
|
|
757
|
+
/**
|
|
758
|
+
* Operations for retrieving information about the current user or other user profiles,
|
|
759
|
+
* as well as performing user searches.
|
|
760
|
+
*/
|
|
412
761
|
get: function () {
|
|
413
762
|
var _this = this;
|
|
414
763
|
return {
|
|
764
|
+
/**
|
|
765
|
+
* Retrieves the profile details of the currently authenticated user.
|
|
766
|
+
* @param options Optional request config override.
|
|
767
|
+
* @returns The active user's profile returned exactly from the endpoint.
|
|
768
|
+
*/
|
|
415
769
|
me: function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
416
770
|
return __generator(this, function (_a) {
|
|
417
771
|
return [2 /*return*/, this.raw.usersControllerGetMe(options)];
|
|
418
772
|
});
|
|
419
773
|
}); },
|
|
774
|
+
/**
|
|
775
|
+
* Retrieves the public profile of a user by their user ID.
|
|
776
|
+
* @param userId Unique identifier of the target user.
|
|
777
|
+
* @param options Optional request config override.
|
|
778
|
+
* @returns Public user profile returned exactly from the endpoint.
|
|
779
|
+
*/
|
|
420
780
|
get: function (userId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
421
781
|
return __generator(this, function (_a) {
|
|
422
782
|
return [2 /*return*/, this.raw.usersControllerGetUser(userId, options)];
|
|
423
783
|
});
|
|
424
784
|
}); },
|
|
785
|
+
/**
|
|
786
|
+
* Searches the organization or workspace directory for user profiles matching specific queries.
|
|
787
|
+
* @param params Object containing search filters and query string parameters.
|
|
788
|
+
* @param options Optional request config override.
|
|
789
|
+
* @returns List of matching user profiles returned exactly from the endpoint.
|
|
790
|
+
*/
|
|
425
791
|
search: function (params, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
426
792
|
return __generator(this, function (_a) {
|
|
427
793
|
return [2 /*return*/, this.raw.usersControllerSearchUsers(params, options)];
|
|
@@ -432,6 +798,317 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
432
798
|
enumerable: false,
|
|
433
799
|
configurable: true
|
|
434
800
|
});
|
|
801
|
+
Object.defineProperty(ScrymeSDK.prototype, "webhooks", {
|
|
802
|
+
/**
|
|
803
|
+
* Operations for managing webhooks (both standard workspace webhooks and channel incoming webhooks).
|
|
804
|
+
*/
|
|
805
|
+
get: function () {
|
|
806
|
+
var _this = this;
|
|
807
|
+
return {
|
|
808
|
+
/**
|
|
809
|
+
* Lists all configured webhooks for a workspace. Requires webhooks:read scope.
|
|
810
|
+
* @param slug The unique workspace slug.
|
|
811
|
+
* @param options Optional request config override.
|
|
812
|
+
*/
|
|
813
|
+
list: function (slug, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
814
|
+
return __generator(this, function (_a) {
|
|
815
|
+
return [2 /*return*/, this.raw.v3WebhooksControllerGetWebhooks(slug, options)];
|
|
816
|
+
});
|
|
817
|
+
}); },
|
|
818
|
+
/**
|
|
819
|
+
* Creates a new standard webhook for a workspace. Requires webhooks:write scope.
|
|
820
|
+
* @param slug The unique workspace slug.
|
|
821
|
+
* @param data Configuration options for the standard webhook.
|
|
822
|
+
* @param options Optional request config override.
|
|
823
|
+
*/
|
|
824
|
+
create: function (slug, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
825
|
+
return __generator(this, function (_a) {
|
|
826
|
+
return [2 /*return*/, this.raw.v3WebhooksControllerCreateWebhook(slug, data, options)];
|
|
827
|
+
});
|
|
828
|
+
}); },
|
|
829
|
+
/**
|
|
830
|
+
* Retrieves details of a specific webhook. Requires webhooks:read scope.
|
|
831
|
+
* @param slug The unique workspace slug.
|
|
832
|
+
* @param webhookId The unique webhook identifier.
|
|
833
|
+
* @param options Optional request config override.
|
|
834
|
+
*/
|
|
835
|
+
get: function (slug, webhookId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
836
|
+
return __generator(this, function (_a) {
|
|
837
|
+
return [2 /*return*/, this.raw.v3WebhooksControllerGetWebhook(slug, webhookId, options)];
|
|
838
|
+
});
|
|
839
|
+
}); },
|
|
840
|
+
/**
|
|
841
|
+
* Updates a standard webhook for a workspace. Requires webhooks:write scope.
|
|
842
|
+
* @param slug The unique workspace slug.
|
|
843
|
+
* @param webhookId The unique webhook identifier.
|
|
844
|
+
* @param data Fields to update on the webhook.
|
|
845
|
+
* @param options Optional request config override.
|
|
846
|
+
*/
|
|
847
|
+
update: function (slug, webhookId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
848
|
+
return __generator(this, function (_a) {
|
|
849
|
+
return [2 /*return*/, this.raw.v3WebhooksControllerUpdateWebhook(slug, webhookId, data, options)];
|
|
850
|
+
});
|
|
851
|
+
}); },
|
|
852
|
+
/**
|
|
853
|
+
* Permanently deletes a standard webhook. Requires webhooks:write scope.
|
|
854
|
+
* @param slug The unique workspace slug.
|
|
855
|
+
* @param webhookId The unique webhook identifier.
|
|
856
|
+
* @param options Optional request config override.
|
|
857
|
+
*/
|
|
858
|
+
delete: function (slug, webhookId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
859
|
+
return __generator(this, function (_a) {
|
|
860
|
+
return [2 /*return*/, this.raw.v3WebhooksControllerDeleteWebhook(slug, webhookId, options)];
|
|
861
|
+
});
|
|
862
|
+
}); },
|
|
863
|
+
/**
|
|
864
|
+
* Sub-namespace for managing channel incoming webhooks.
|
|
865
|
+
*/
|
|
866
|
+
incoming: {
|
|
867
|
+
/**
|
|
868
|
+
* Lists incoming webhooks configured for a specific channel. Requires webhooks:read scope.
|
|
869
|
+
* @param slug The unique workspace slug.
|
|
870
|
+
* @param channelId The unique channel identifier.
|
|
871
|
+
* @param options Optional request config override.
|
|
872
|
+
*/
|
|
873
|
+
list: function (slug, channelId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
874
|
+
return __generator(this, function (_a) {
|
|
875
|
+
return [2 /*return*/, this.raw.v3ChannelIncomingWebhooksControllerGetChannelWebhooks(slug, channelId, options)];
|
|
876
|
+
});
|
|
877
|
+
}); },
|
|
878
|
+
/**
|
|
879
|
+
* Creates an incoming webhook for a specific channel. Requires webhooks:write scope.
|
|
880
|
+
* @param slug The unique workspace slug.
|
|
881
|
+
* @param channelId The unique channel identifier.
|
|
882
|
+
* @param data Configuration options for the incoming webhook.
|
|
883
|
+
* @param options Optional request config override.
|
|
884
|
+
*/
|
|
885
|
+
create: function (slug, channelId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
886
|
+
return __generator(this, function (_a) {
|
|
887
|
+
return [2 /*return*/, this.raw.v3ChannelIncomingWebhooksControllerCreateChannelWebhook(slug, channelId, data, options)];
|
|
888
|
+
});
|
|
889
|
+
}); },
|
|
890
|
+
/**
|
|
891
|
+
* Retrieves details of a specific channel incoming webhook. Requires webhooks:read scope.
|
|
892
|
+
* @param slug The unique workspace slug.
|
|
893
|
+
* @param channelId The unique channel identifier.
|
|
894
|
+
* @param webhookId The unique webhook identifier.
|
|
895
|
+
* @param options Optional request config override.
|
|
896
|
+
*/
|
|
897
|
+
get: function (slug, channelId, webhookId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
898
|
+
return __generator(this, function (_a) {
|
|
899
|
+
return [2 /*return*/, this.raw.v3ChannelIncomingWebhooksControllerGetChannelWebhook(slug, channelId, webhookId, options)];
|
|
900
|
+
});
|
|
901
|
+
}); },
|
|
902
|
+
/**
|
|
903
|
+
* Updates a channel incoming webhook. Requires webhooks:write scope.
|
|
904
|
+
* @param slug The unique workspace slug.
|
|
905
|
+
* @param channelId The unique channel identifier.
|
|
906
|
+
* @param webhookId The unique webhook identifier.
|
|
907
|
+
* @param data Fields to update on the incoming webhook.
|
|
908
|
+
* @param options Optional request config override.
|
|
909
|
+
*/
|
|
910
|
+
update: function (slug, channelId, webhookId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
911
|
+
return __generator(this, function (_a) {
|
|
912
|
+
return [2 /*return*/, this.raw.v3ChannelIncomingWebhooksControllerUpdateChannelWebhook(slug, channelId, webhookId, data, options)];
|
|
913
|
+
});
|
|
914
|
+
}); },
|
|
915
|
+
/**
|
|
916
|
+
* Deletes a channel incoming webhook. Requires webhooks:write scope.
|
|
917
|
+
* @param slug The unique workspace slug.
|
|
918
|
+
* @param channelId The unique channel identifier.
|
|
919
|
+
* @param webhookId The unique webhook identifier.
|
|
920
|
+
* @param options Optional request config override.
|
|
921
|
+
*/
|
|
922
|
+
delete: function (slug, channelId, webhookId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
923
|
+
return __generator(this, function (_a) {
|
|
924
|
+
return [2 /*return*/, this.raw.v3ChannelIncomingWebhooksControllerDeleteChannelWebhook(slug, channelId, webhookId, options)];
|
|
925
|
+
});
|
|
926
|
+
}); },
|
|
927
|
+
/**
|
|
928
|
+
* Executes an incoming webhook using its unique url token directly. No auth headers required.
|
|
929
|
+
* @param token The unique webhook token from the webhook URL.
|
|
930
|
+
* @param data The payload payload consisting of content/attachments/metadata.
|
|
931
|
+
* @param options Optional request config override.
|
|
932
|
+
*/
|
|
933
|
+
executeByUrlToken: function (token, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
934
|
+
return __generator(this, function (_a) {
|
|
935
|
+
return [2 /*return*/, this.raw.v3ChannelIncomingWebhooksControllerExecuteWebhookByUrlToken(token, data, options)];
|
|
936
|
+
});
|
|
937
|
+
}); },
|
|
938
|
+
/**
|
|
939
|
+
* Executes an incoming webhook by channel ID.
|
|
940
|
+
* @param channelId The target channel identifier.
|
|
941
|
+
* @param data The payload payload consisting of content/attachments/metadata.
|
|
942
|
+
* @param params Optional query parameters like token or signature.
|
|
943
|
+
* @param options Optional request config override.
|
|
944
|
+
*/
|
|
945
|
+
executeByChannelId: function (channelId, data, params, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
946
|
+
return __generator(this, function (_a) {
|
|
947
|
+
return [2 /*return*/, this.raw.v3ChannelIncomingWebhooksControllerExecuteWebhookByChannelId(channelId, data, params, options)];
|
|
948
|
+
});
|
|
949
|
+
}); },
|
|
950
|
+
},
|
|
951
|
+
};
|
|
952
|
+
},
|
|
953
|
+
enumerable: false,
|
|
954
|
+
configurable: true
|
|
955
|
+
});
|
|
956
|
+
Object.defineProperty(ScrymeSDK.prototype, "m2m", {
|
|
957
|
+
/**
|
|
958
|
+
* First-class namespace for Machine-to-Machine (M2M) operations,
|
|
959
|
+
* grouping V3 Enterprise M2M APIs into logical, highly cohesive spaces.
|
|
960
|
+
*/
|
|
961
|
+
get: function () {
|
|
962
|
+
var _this = this;
|
|
963
|
+
return {
|
|
964
|
+
/**
|
|
965
|
+
* M2M Workspace Operations (Provisioning, Retrieval, and Lifecycle management).
|
|
966
|
+
*/
|
|
967
|
+
workspace: {
|
|
968
|
+
/**
|
|
969
|
+
* Provisions a brand new tenant workspace in the organization.
|
|
970
|
+
* @param data Configuration payload for workspace name, slug, owner, and initial setups.
|
|
971
|
+
* @param options Optional request config override.
|
|
972
|
+
*/
|
|
973
|
+
provision: function (data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
974
|
+
return __generator(this, function (_a) {
|
|
975
|
+
return [2 /*return*/, this.raw.v3WorkspacesControllerProvisionWorkspace(data, options)];
|
|
976
|
+
});
|
|
977
|
+
}); },
|
|
978
|
+
/**
|
|
979
|
+
* Retrieves detailed information of a specific workspace by its slug.
|
|
980
|
+
* @param slug The unique workspace slug.
|
|
981
|
+
* @param options Optional request config override.
|
|
982
|
+
*/
|
|
983
|
+
get: function (slug, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
984
|
+
return __generator(this, function (_a) {
|
|
985
|
+
return [2 /*return*/, this.raw.v3WorkspacesControllerGetWorkspaceBySlug(slug, options)];
|
|
986
|
+
});
|
|
987
|
+
}); },
|
|
988
|
+
/**
|
|
989
|
+
* Lists all workspaces under the organization context.
|
|
990
|
+
* @param options Optional request config override.
|
|
991
|
+
*/
|
|
992
|
+
list: function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
993
|
+
return __generator(this, function (_a) {
|
|
994
|
+
return [2 /*return*/, this.raw.v3WorkspacesControllerGetWorkspaces(options)];
|
|
995
|
+
});
|
|
996
|
+
}); },
|
|
997
|
+
/**
|
|
998
|
+
* Updates configuration and branding metadata of a specific workspace.
|
|
999
|
+
* @param slug The unique workspace slug.
|
|
1000
|
+
* @param data Workspace update DTO.
|
|
1001
|
+
* @param options Optional request config override.
|
|
1002
|
+
*/
|
|
1003
|
+
update: function (slug, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
1004
|
+
return __generator(this, function (_a) {
|
|
1005
|
+
return [2 /*return*/, this.raw.v3WorkspacesControllerUpdateWorkspace(slug, data, options)];
|
|
1006
|
+
});
|
|
1007
|
+
}); },
|
|
1008
|
+
/**
|
|
1009
|
+
* Permanently deletes a specific workspace by its slug.
|
|
1010
|
+
* @param slug The unique workspace slug.
|
|
1011
|
+
* @param options Optional request config override.
|
|
1012
|
+
*/
|
|
1013
|
+
delete: function (slug, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
1014
|
+
return __generator(this, function (_a) {
|
|
1015
|
+
return [2 /*return*/, this.raw.v3WorkspacesControllerDeleteWorkspace(slug, options)];
|
|
1016
|
+
});
|
|
1017
|
+
}); },
|
|
1018
|
+
},
|
|
1019
|
+
/**
|
|
1020
|
+
* M2M Workspace Membership Operations (Adding, modifying roles, and removing workspace members).
|
|
1021
|
+
*/
|
|
1022
|
+
member: {
|
|
1023
|
+
/**
|
|
1024
|
+
* Lists all members currently in a workspace.
|
|
1025
|
+
* @param slug The unique workspace slug.
|
|
1026
|
+
* @param options Optional request config override.
|
|
1027
|
+
*/
|
|
1028
|
+
list: function (slug, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
1029
|
+
return __generator(this, function (_a) {
|
|
1030
|
+
return [2 /*return*/, this.raw.v3WorkspacesControllerGetWorkspaceMembers(slug, options)];
|
|
1031
|
+
});
|
|
1032
|
+
}); },
|
|
1033
|
+
/**
|
|
1034
|
+
* Adds a new member to a workspace.
|
|
1035
|
+
* @param slug The unique workspace slug.
|
|
1036
|
+
* @param data Configuration containing user email and target role.
|
|
1037
|
+
* @param options Optional request config override.
|
|
1038
|
+
*/
|
|
1039
|
+
add: function (slug, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
1040
|
+
return __generator(this, function (_a) {
|
|
1041
|
+
return [2 /*return*/, this.raw.v3WorkspacesControllerAddWorkspaceMember(slug, data, options)];
|
|
1042
|
+
});
|
|
1043
|
+
}); },
|
|
1044
|
+
/**
|
|
1045
|
+
* Retrieves membership details of a specific workspace member.
|
|
1046
|
+
* @param slug The unique workspace slug.
|
|
1047
|
+
* @param memberId Unique ID of the workspace member (user ID).
|
|
1048
|
+
* @param options Optional request config override.
|
|
1049
|
+
*/
|
|
1050
|
+
get: function (slug, memberId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
1051
|
+
return __generator(this, function (_a) {
|
|
1052
|
+
return [2 /*return*/, this.raw.v3WorkspacesControllerGetWorkspaceMember(slug, memberId, options)];
|
|
1053
|
+
});
|
|
1054
|
+
}); },
|
|
1055
|
+
/**
|
|
1056
|
+
* Updates the role or settings of an existing member in a workspace.
|
|
1057
|
+
* @param slug The unique workspace slug.
|
|
1058
|
+
* @param memberId Unique ID of the workspace member (user ID).
|
|
1059
|
+
* @param data Updated role.
|
|
1060
|
+
* @param options Optional request config override.
|
|
1061
|
+
*/
|
|
1062
|
+
update: function (slug, memberId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
1063
|
+
return __generator(this, function (_a) {
|
|
1064
|
+
return [2 /*return*/, this.raw.v3WorkspacesControllerUpdateWorkspaceMember(slug, memberId, data, options)];
|
|
1065
|
+
});
|
|
1066
|
+
}); },
|
|
1067
|
+
/**
|
|
1068
|
+
* Removes a member from a workspace.
|
|
1069
|
+
* @param slug The unique workspace slug.
|
|
1070
|
+
* @param memberId Unique ID of the workspace member (user ID).
|
|
1071
|
+
* @param options Optional request config override.
|
|
1072
|
+
*/
|
|
1073
|
+
delete: function (slug, memberId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
1074
|
+
return __generator(this, function (_a) {
|
|
1075
|
+
return [2 /*return*/, this.raw.v3WorkspacesControllerDeleteWorkspaceMember(slug, memberId, options)];
|
|
1076
|
+
});
|
|
1077
|
+
}); },
|
|
1078
|
+
},
|
|
1079
|
+
/**
|
|
1080
|
+
* M2M Authentication and Token Management Utilities.
|
|
1081
|
+
*/
|
|
1082
|
+
auth: {
|
|
1083
|
+
/**
|
|
1084
|
+
* Explicitly exchanges Client Credentials for a V3 access token.
|
|
1085
|
+
* @param clientId The unique M2M Client ID.
|
|
1086
|
+
* @param clientSecret The secure M2M Client Secret.
|
|
1087
|
+
* @param options Optional request config override.
|
|
1088
|
+
*/
|
|
1089
|
+
token: function (clientId, clientSecret, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
1090
|
+
return __generator(this, function (_a) {
|
|
1091
|
+
return [2 /*return*/, this.raw.v3OAuthControllerGetToken({
|
|
1092
|
+
client_id: clientId,
|
|
1093
|
+
client_secret: clientSecret,
|
|
1094
|
+
grant_type: 'client_credentials',
|
|
1095
|
+
}, options)];
|
|
1096
|
+
});
|
|
1097
|
+
}); },
|
|
1098
|
+
/**
|
|
1099
|
+
* Dynamically retrieves the current cached M2M token, or proactively fetches a new one.
|
|
1100
|
+
*/
|
|
1101
|
+
getOrFetchToken: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1102
|
+
return __generator(this, function (_a) {
|
|
1103
|
+
return [2 /*return*/, this.getOrFetchToken()];
|
|
1104
|
+
});
|
|
1105
|
+
}); },
|
|
1106
|
+
},
|
|
1107
|
+
};
|
|
1108
|
+
},
|
|
1109
|
+
enumerable: false,
|
|
1110
|
+
configurable: true
|
|
1111
|
+
});
|
|
435
1112
|
return ScrymeSDK;
|
|
436
1113
|
}());
|
|
437
1114
|
export { ScrymeSDK };
|