@scryme/chat 2.91.16 → 2.91.26
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/generated/v3-server.d.ts +13 -1
- package/dist/sdk.d.ts +39 -30
- package/dist/sdk.js +115 -44
- package/package.json +1 -1
- package/src/__tests__/sdk.test.ts +43 -28
- package/src/generated/v3-server.ts +13 -1
- package/src/sdk.ts +104 -42
|
@@ -854,8 +854,16 @@ export interface V3AddChannelMemberDto {
|
|
|
854
854
|
role?: string;
|
|
855
855
|
/** User ID to add to channel */
|
|
856
856
|
userId?: string;
|
|
857
|
+
/** Member ID to add to channel */
|
|
858
|
+
memberId?: string;
|
|
859
|
+
/** Email address to add to channel */
|
|
860
|
+
email?: string;
|
|
857
861
|
/** Array of user IDs to add */
|
|
858
862
|
userIds?: string[];
|
|
863
|
+
/** Array of workspace member IDs to add */
|
|
864
|
+
memberIds?: string[];
|
|
865
|
+
/** Array of user emails to add */
|
|
866
|
+
emails?: string[];
|
|
859
867
|
}
|
|
860
868
|
export type V3UpdateChannelDtoType = typeof V3UpdateChannelDtoType[keyof typeof V3UpdateChannelDtoType];
|
|
861
869
|
export declare const V3UpdateChannelDtoType: {
|
|
@@ -922,7 +930,11 @@ export interface V3UpdateMemberRoleDto {
|
|
|
922
930
|
}
|
|
923
931
|
export interface V3AddMemberDto {
|
|
924
932
|
/** The email of the user to add */
|
|
925
|
-
email
|
|
933
|
+
email?: string;
|
|
934
|
+
/** The user ID of the user to add */
|
|
935
|
+
userId?: string;
|
|
936
|
+
/** The workspace member ID of the user to add */
|
|
937
|
+
memberId?: string;
|
|
926
938
|
/** The role of the member */
|
|
927
939
|
role?: string;
|
|
928
940
|
}
|
package/dist/sdk.d.ts
CHANGED
|
@@ -595,24 +595,27 @@ export declare class ScrymeSDK {
|
|
|
595
595
|
list: (slug: string, options?: AxiosRequestConfig) => Promise<V3WorkspaceMembersResponse>;
|
|
596
596
|
/**
|
|
597
597
|
* Adds a new member to the workspace.
|
|
598
|
+
* Accepts member options by email address, userId, or memberId.
|
|
598
599
|
* @param slug The unique workspace slug identifier.
|
|
599
|
-
* @param data Input DTO containing
|
|
600
|
+
* @param data Input DTO containing member email, userId, or memberId and target role.
|
|
600
601
|
* @param options Optional request config override.
|
|
601
602
|
* @returns Newly added member details exactly from the endpoint.
|
|
602
603
|
*/
|
|
603
604
|
add: (slug: string, data: V3AddMemberDto, options?: AxiosRequestConfig) => Promise<V3AddWorkspaceMemberResponse>;
|
|
604
605
|
/**
|
|
605
606
|
* Retrieves membership details of a specific member in a workspace.
|
|
607
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
606
608
|
* @param slug The unique workspace slug identifier.
|
|
607
|
-
* @param memberId
|
|
609
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
608
610
|
* @param options Optional request config override.
|
|
609
611
|
* @returns Workspace member details exactly from the endpoint.
|
|
610
612
|
*/
|
|
611
613
|
get: (slug: string, memberId: string, options?: AxiosRequestConfig) => Promise<V3GetWorkspaceMemberResponse>;
|
|
612
614
|
/**
|
|
613
615
|
* Updates the role or configuration of a workspace member.
|
|
616
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
614
617
|
* @param slug The unique workspace slug identifier.
|
|
615
|
-
* @param memberId
|
|
618
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
616
619
|
* @param data Update details containing the target role.
|
|
617
620
|
* @param options Optional request config override.
|
|
618
621
|
* @returns The updated workspace member details exactly from the endpoint.
|
|
@@ -620,8 +623,9 @@ export declare class ScrymeSDK {
|
|
|
620
623
|
update: (slug: string, memberId: string, data: V3UpdateMemberRoleDto, options?: AxiosRequestConfig) => Promise<V3UpdateWorkspaceMemberResponse>;
|
|
621
624
|
/**
|
|
622
625
|
* Removes a member from the workspace.
|
|
626
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
623
627
|
* @param slug The unique workspace slug identifier.
|
|
624
|
-
* @param memberId
|
|
628
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
625
629
|
* @param options Optional request config override.
|
|
626
630
|
* @returns Workspace member deletion confirmation exactly from the endpoint.
|
|
627
631
|
*/
|
|
@@ -632,20 +636,20 @@ export declare class ScrymeSDK {
|
|
|
632
636
|
*/
|
|
633
637
|
channels: {
|
|
634
638
|
/**
|
|
635
|
-
* Lists all public channels (and private channels the user has access to) in a workspace.
|
|
639
|
+
* Lists all public channels (and private channels the user has access to) in a workspace via V3 API.
|
|
636
640
|
* @param slug The unique workspace slug identifier.
|
|
637
641
|
* @param options Optional request config override.
|
|
638
|
-
* @returns List of channels returned
|
|
642
|
+
* @returns List of channels returned from the endpoint.
|
|
639
643
|
*/
|
|
640
644
|
list: (slug: string, options?: AxiosRequestConfig) => Promise<WorkspaceChannel[]>;
|
|
641
645
|
/**
|
|
642
|
-
* Creates a new channel within a workspace.
|
|
646
|
+
* Creates a new channel within a workspace via V3 API.
|
|
643
647
|
* @param slug The unique workspace slug identifier.
|
|
644
648
|
* @param data Configuration DTO for the new channel.
|
|
645
649
|
* @param options Optional request config override.
|
|
646
|
-
* @returns Details of the created channel
|
|
650
|
+
* @returns Details of the created channel returned from the endpoint.
|
|
647
651
|
*/
|
|
648
|
-
create: (slug: string, data: CreateWorkspaceChannelDto, options?: AxiosRequestConfig) => Promise<WorkspaceChannel>;
|
|
652
|
+
create: (slug: string, data: V3CreateChannelDto | CreateWorkspaceChannelDto, options?: AxiosRequestConfig) => Promise<WorkspaceChannel>;
|
|
649
653
|
};
|
|
650
654
|
};
|
|
651
655
|
/**
|
|
@@ -653,69 +657,70 @@ export declare class ScrymeSDK {
|
|
|
653
657
|
*/
|
|
654
658
|
get channel(): {
|
|
655
659
|
/**
|
|
656
|
-
* Retrieves detailed information of a specific channel.
|
|
660
|
+
* Retrieves detailed information of a specific channel via V3 API.
|
|
657
661
|
* @param slug The unique workspace slug identifier.
|
|
658
662
|
* @param channelId Unique identifier of the channel.
|
|
659
663
|
* @param options Optional request config override.
|
|
660
|
-
* @returns Channel details returned
|
|
664
|
+
* @returns Channel details returned from the V3 endpoint.
|
|
661
665
|
*/
|
|
662
666
|
get: (slug: string, channelId: string, options?: AxiosRequestConfig) => Promise<WorkspaceChannel>;
|
|
663
667
|
/**
|
|
664
|
-
* Updates configuration, description, icon or status of an existing channel.
|
|
668
|
+
* Updates configuration, description, icon or status of an existing channel via V3 API.
|
|
665
669
|
* @param slug The unique workspace slug identifier.
|
|
666
670
|
* @param channelId Unique identifier of the channel.
|
|
667
671
|
* @param data Configuration options to update.
|
|
668
672
|
* @param options Optional request config override.
|
|
669
|
-
* @returns The updated channel details
|
|
673
|
+
* @returns The updated channel details returned from the V3 endpoint.
|
|
670
674
|
*/
|
|
671
|
-
update: (slug: string, channelId: string, data: UpdateWorkspaceChannelDto, options?: AxiosRequestConfig) => Promise<WorkspaceChannel>;
|
|
675
|
+
update: (slug: string, channelId: string, data: V3UpdateChannelDto | UpdateWorkspaceChannelDto, options?: AxiosRequestConfig) => Promise<WorkspaceChannel>;
|
|
672
676
|
/**
|
|
673
|
-
* Permanently deletes a channel from a workspace.
|
|
677
|
+
* Permanently deletes a channel from a workspace via V3 API.
|
|
674
678
|
* @param slug The unique workspace slug identifier.
|
|
675
679
|
* @param channelId Unique identifier of the channel to delete.
|
|
676
680
|
* @param options Optional request config override.
|
|
677
|
-
* @returns Success status indicating that the channel was deleted
|
|
681
|
+
* @returns Success status indicating that the channel was deleted from the V3 endpoint.
|
|
678
682
|
*/
|
|
679
683
|
delete: (slug: string, channelId: string, options?: AxiosRequestConfig) => Promise<{
|
|
680
684
|
success: boolean;
|
|
681
685
|
}>;
|
|
682
686
|
/**
|
|
683
|
-
* Sub-namespace for managing channel member access and permissions.
|
|
687
|
+
* Sub-namespace for managing channel member access and permissions via V3 API.
|
|
684
688
|
*/
|
|
685
689
|
members: {
|
|
686
690
|
/**
|
|
687
|
-
* Lists members belonging to a specific channel.
|
|
691
|
+
* Lists members belonging to a specific channel via V3 API.
|
|
688
692
|
* @param slug The unique workspace slug.
|
|
689
693
|
* @param channelId Unique identifier of the channel.
|
|
690
694
|
* @param options Optional request config override.
|
|
691
695
|
*/
|
|
692
696
|
list: (slug: string, channelId: string, options?: AxiosRequestConfig) => Promise<any[]>;
|
|
693
697
|
/**
|
|
694
|
-
* Adds member(s) to a channel with optional role and bitwise permissions.
|
|
698
|
+
* Adds member(s) to a channel with optional role and bitwise permissions via V3 API.
|
|
695
699
|
* @param slug The unique workspace slug.
|
|
696
700
|
* @param channelId Unique identifier of the channel.
|
|
697
|
-
* @param data Object containing userIds or userId, role, and optional permissions.
|
|
701
|
+
* @param data Object containing userIds/memberIds/emails or userId/memberId/email, role, and optional permissions.
|
|
698
702
|
* @param options Optional request config override.
|
|
699
703
|
*/
|
|
700
|
-
add: (slug: string, channelId: string, data: {
|
|
704
|
+
add: (slug: string, channelId: string, data: V3AddChannelMemberDto | {
|
|
701
705
|
userIds?: string[];
|
|
702
706
|
userId?: string;
|
|
703
707
|
role?: string;
|
|
708
|
+
permissions?: string | number;
|
|
704
709
|
}, options?: AxiosRequestConfig) => Promise<any[]>;
|
|
705
710
|
/**
|
|
706
|
-
* Updates a channel member's role or bitwise permissions.
|
|
711
|
+
* Updates a channel member's role or bitwise permissions via V3 API.
|
|
707
712
|
* @param slug The unique workspace slug.
|
|
708
713
|
* @param channelId Unique identifier of the channel.
|
|
709
|
-
* @param targetUserId Target user ID of the channel member.
|
|
714
|
+
* @param targetUserId Target user ID, member ID, or email of the channel member.
|
|
710
715
|
* @param data Object containing role and/or bitwise permissions.
|
|
711
716
|
* @param options Optional request config override.
|
|
712
717
|
*/
|
|
713
|
-
update: (slug: string, channelId: string, targetUserId: string, data: UpdateChannelMemberDto, options?: AxiosRequestConfig) => Promise<any>;
|
|
718
|
+
update: (slug: string, channelId: string, targetUserId: string, data: V3UpdateChannelMemberDto | UpdateChannelMemberDto, options?: AxiosRequestConfig) => Promise<any>;
|
|
714
719
|
/**
|
|
715
|
-
* Removes a member from a channel.
|
|
720
|
+
* Removes a member from a channel via V3 API.
|
|
716
721
|
* @param slug The unique workspace slug.
|
|
717
722
|
* @param channelId Unique identifier of the channel.
|
|
718
|
-
* @param targetUserId Target user ID to remove.
|
|
723
|
+
* @param targetUserId Target user ID, member ID, or email to remove.
|
|
719
724
|
* @param options Optional request config override.
|
|
720
725
|
*/
|
|
721
726
|
remove: (slug: string, channelId: string, targetUserId: string, options?: AxiosRequestConfig) => Promise<{
|
|
@@ -1320,30 +1325,34 @@ export declare class ScrymeSDK {
|
|
|
1320
1325
|
list: (slug: string, options?: AxiosRequestConfig) => Promise<V3WorkspaceMembersResponse>;
|
|
1321
1326
|
/**
|
|
1322
1327
|
* Adds a new member to a workspace.
|
|
1328
|
+
* Accepts member options by email address, userId, or memberId.
|
|
1323
1329
|
* @param slug The unique workspace slug.
|
|
1324
|
-
* @param data Configuration containing user email and target role.
|
|
1330
|
+
* @param data Configuration containing user email, userId, or memberId and target role.
|
|
1325
1331
|
* @param options Optional request config override.
|
|
1326
1332
|
*/
|
|
1327
1333
|
add: (slug: string, data: V3AddMemberDto, options?: AxiosRequestConfig) => Promise<V3AddWorkspaceMemberResponse>;
|
|
1328
1334
|
/**
|
|
1329
1335
|
* Retrieves membership details of a specific workspace member.
|
|
1336
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
1330
1337
|
* @param slug The unique workspace slug.
|
|
1331
|
-
* @param memberId
|
|
1338
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
1332
1339
|
* @param options Optional request config override.
|
|
1333
1340
|
*/
|
|
1334
1341
|
get: (slug: string, memberId: string, options?: AxiosRequestConfig) => Promise<V3GetWorkspaceMemberResponse>;
|
|
1335
1342
|
/**
|
|
1336
1343
|
* Updates the role or settings of an existing member in a workspace.
|
|
1344
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
1337
1345
|
* @param slug The unique workspace slug.
|
|
1338
|
-
* @param memberId
|
|
1346
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
1339
1347
|
* @param data Updated role.
|
|
1340
1348
|
* @param options Optional request config override.
|
|
1341
1349
|
*/
|
|
1342
1350
|
update: (slug: string, memberId: string, data: V3UpdateMemberRoleDto, options?: AxiosRequestConfig) => Promise<V3UpdateWorkspaceMemberResponse>;
|
|
1343
1351
|
/**
|
|
1344
1352
|
* Removes a member from a workspace.
|
|
1353
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
1345
1354
|
* @param slug The unique workspace slug.
|
|
1346
|
-
* @param memberId
|
|
1355
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
1347
1356
|
* @param options Optional request config override.
|
|
1348
1357
|
*/
|
|
1349
1358
|
delete: (slug: string, memberId: string, options?: AxiosRequestConfig) => Promise<V3DeleteWorkspaceMemberResponse>;
|
package/dist/sdk.js
CHANGED
|
@@ -336,8 +336,9 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
336
336
|
}); },
|
|
337
337
|
/**
|
|
338
338
|
* Adds a new member to the workspace.
|
|
339
|
+
* Accepts member options by email address, userId, or memberId.
|
|
339
340
|
* @param slug The unique workspace slug identifier.
|
|
340
|
-
* @param data Input DTO containing
|
|
341
|
+
* @param data Input DTO containing member email, userId, or memberId and target role.
|
|
341
342
|
* @param options Optional request config override.
|
|
342
343
|
* @returns Newly added member details exactly from the endpoint.
|
|
343
344
|
*/
|
|
@@ -348,8 +349,9 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
348
349
|
}); },
|
|
349
350
|
/**
|
|
350
351
|
* Retrieves membership details of a specific member in a workspace.
|
|
352
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
351
353
|
* @param slug The unique workspace slug identifier.
|
|
352
|
-
* @param memberId
|
|
354
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
353
355
|
* @param options Optional request config override.
|
|
354
356
|
* @returns Workspace member details exactly from the endpoint.
|
|
355
357
|
*/
|
|
@@ -360,8 +362,9 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
360
362
|
}); },
|
|
361
363
|
/**
|
|
362
364
|
* Updates the role or configuration of a workspace member.
|
|
365
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
363
366
|
* @param slug The unique workspace slug identifier.
|
|
364
|
-
* @param memberId
|
|
367
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
365
368
|
* @param data Update details containing the target role.
|
|
366
369
|
* @param options Optional request config override.
|
|
367
370
|
* @returns The updated workspace member details exactly from the endpoint.
|
|
@@ -373,8 +376,9 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
373
376
|
}); },
|
|
374
377
|
/**
|
|
375
378
|
* Removes a member from the workspace.
|
|
379
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
376
380
|
* @param slug The unique workspace slug identifier.
|
|
377
|
-
* @param memberId
|
|
381
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
378
382
|
* @param options Optional request config override.
|
|
379
383
|
* @returns Workspace member deletion confirmation exactly from the endpoint.
|
|
380
384
|
*/
|
|
@@ -389,26 +393,40 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
389
393
|
*/
|
|
390
394
|
channels: {
|
|
391
395
|
/**
|
|
392
|
-
* Lists all public channels (and private channels the user has access to) in a workspace.
|
|
396
|
+
* Lists all public channels (and private channels the user has access to) in a workspace via V3 API.
|
|
393
397
|
* @param slug The unique workspace slug identifier.
|
|
394
398
|
* @param options Optional request config override.
|
|
395
|
-
* @returns List of channels returned
|
|
399
|
+
* @returns List of channels returned from the endpoint.
|
|
396
400
|
*/
|
|
397
401
|
list: function (slug, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
398
|
-
|
|
399
|
-
|
|
402
|
+
var res;
|
|
403
|
+
var _a, _b;
|
|
404
|
+
return __generator(this, function (_c) {
|
|
405
|
+
switch (_c.label) {
|
|
406
|
+
case 0: return [4 /*yield*/, this.raw.v3WorkspacesControllerGetChannels(slug, options)];
|
|
407
|
+
case 1:
|
|
408
|
+
res = (_c.sent());
|
|
409
|
+
return [2 /*return*/, (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.channels) !== null && _b !== void 0 ? _b : res];
|
|
410
|
+
}
|
|
400
411
|
});
|
|
401
412
|
}); },
|
|
402
413
|
/**
|
|
403
|
-
* Creates a new channel within a workspace.
|
|
414
|
+
* Creates a new channel within a workspace via V3 API.
|
|
404
415
|
* @param slug The unique workspace slug identifier.
|
|
405
416
|
* @param data Configuration DTO for the new channel.
|
|
406
417
|
* @param options Optional request config override.
|
|
407
|
-
* @returns Details of the created channel
|
|
418
|
+
* @returns Details of the created channel returned from the endpoint.
|
|
408
419
|
*/
|
|
409
420
|
create: function (slug, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
410
|
-
|
|
411
|
-
|
|
421
|
+
var res;
|
|
422
|
+
var _a, _b;
|
|
423
|
+
return __generator(this, function (_c) {
|
|
424
|
+
switch (_c.label) {
|
|
425
|
+
case 0: return [4 /*yield*/, this.raw.v3WorkspacesControllerCreateChannel(slug, data, options)];
|
|
426
|
+
case 1:
|
|
427
|
+
res = (_c.sent());
|
|
428
|
+
return [2 /*return*/, (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.channel) !== null && _b !== void 0 ? _b : res];
|
|
429
|
+
}
|
|
412
430
|
});
|
|
413
431
|
}); },
|
|
414
432
|
},
|
|
@@ -425,92 +443,141 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
425
443
|
var _this = this;
|
|
426
444
|
return {
|
|
427
445
|
/**
|
|
428
|
-
* Retrieves detailed information of a specific channel.
|
|
446
|
+
* Retrieves detailed information of a specific channel via V3 API.
|
|
429
447
|
* @param slug The unique workspace slug identifier.
|
|
430
448
|
* @param channelId Unique identifier of the channel.
|
|
431
449
|
* @param options Optional request config override.
|
|
432
|
-
* @returns Channel details returned
|
|
450
|
+
* @returns Channel details returned from the V3 endpoint.
|
|
433
451
|
*/
|
|
434
452
|
get: function (slug, channelId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
435
|
-
|
|
436
|
-
|
|
453
|
+
var res;
|
|
454
|
+
var _a, _b;
|
|
455
|
+
return __generator(this, function (_c) {
|
|
456
|
+
switch (_c.label) {
|
|
457
|
+
case 0: return [4 /*yield*/, this.raw.v3WorkspacesControllerGetChannel(slug, channelId, options)];
|
|
458
|
+
case 1:
|
|
459
|
+
res = (_c.sent());
|
|
460
|
+
return [2 /*return*/, (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.channel) !== null && _b !== void 0 ? _b : res];
|
|
461
|
+
}
|
|
437
462
|
});
|
|
438
463
|
}); },
|
|
439
464
|
/**
|
|
440
|
-
* Updates configuration, description, icon or status of an existing channel.
|
|
465
|
+
* Updates configuration, description, icon or status of an existing channel via V3 API.
|
|
441
466
|
* @param slug The unique workspace slug identifier.
|
|
442
467
|
* @param channelId Unique identifier of the channel.
|
|
443
468
|
* @param data Configuration options to update.
|
|
444
469
|
* @param options Optional request config override.
|
|
445
|
-
* @returns The updated channel details
|
|
470
|
+
* @returns The updated channel details returned from the V3 endpoint.
|
|
446
471
|
*/
|
|
447
472
|
update: function (slug, channelId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
448
|
-
|
|
449
|
-
|
|
473
|
+
var res;
|
|
474
|
+
var _a, _b;
|
|
475
|
+
return __generator(this, function (_c) {
|
|
476
|
+
switch (_c.label) {
|
|
477
|
+
case 0: return [4 /*yield*/, this.raw.v3WorkspacesControllerUpdateChannel(slug, channelId, data, options)];
|
|
478
|
+
case 1:
|
|
479
|
+
res = (_c.sent());
|
|
480
|
+
return [2 /*return*/, (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.channel) !== null && _b !== void 0 ? _b : res];
|
|
481
|
+
}
|
|
450
482
|
});
|
|
451
483
|
}); },
|
|
452
484
|
/**
|
|
453
|
-
* Permanently deletes a channel from a workspace.
|
|
485
|
+
* Permanently deletes a channel from a workspace via V3 API.
|
|
454
486
|
* @param slug The unique workspace slug identifier.
|
|
455
487
|
* @param channelId Unique identifier of the channel to delete.
|
|
456
488
|
* @param options Optional request config override.
|
|
457
|
-
* @returns Success status indicating that the channel was deleted
|
|
489
|
+
* @returns Success status indicating that the channel was deleted from the V3 endpoint.
|
|
458
490
|
*/
|
|
459
491
|
delete: function (slug, channelId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
460
|
-
|
|
461
|
-
|
|
492
|
+
var res;
|
|
493
|
+
var _a;
|
|
494
|
+
return __generator(this, function (_b) {
|
|
495
|
+
switch (_b.label) {
|
|
496
|
+
case 0: return [4 /*yield*/, this.raw.v3WorkspacesControllerDeleteChannel(slug, channelId, options)];
|
|
497
|
+
case 1:
|
|
498
|
+
res = (_b.sent());
|
|
499
|
+
return [2 /*return*/, (_a = res === null || res === void 0 ? void 0 : res.data) !== null && _a !== void 0 ? _a : res];
|
|
500
|
+
}
|
|
462
501
|
});
|
|
463
502
|
}); },
|
|
464
503
|
/**
|
|
465
|
-
* Sub-namespace for managing channel member access and permissions.
|
|
504
|
+
* Sub-namespace for managing channel member access and permissions via V3 API.
|
|
466
505
|
*/
|
|
467
506
|
members: {
|
|
468
507
|
/**
|
|
469
|
-
* Lists members belonging to a specific channel.
|
|
508
|
+
* Lists members belonging to a specific channel via V3 API.
|
|
470
509
|
* @param slug The unique workspace slug.
|
|
471
510
|
* @param channelId Unique identifier of the channel.
|
|
472
511
|
* @param options Optional request config override.
|
|
473
512
|
*/
|
|
474
513
|
list: function (slug, channelId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
475
|
-
|
|
476
|
-
|
|
514
|
+
var res;
|
|
515
|
+
var _a, _b;
|
|
516
|
+
return __generator(this, function (_c) {
|
|
517
|
+
switch (_c.label) {
|
|
518
|
+
case 0: return [4 /*yield*/, this.raw.v3WorkspacesControllerGetChannelMembers(slug, channelId, options)];
|
|
519
|
+
case 1:
|
|
520
|
+
res = (_c.sent());
|
|
521
|
+
return [2 /*return*/, (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.members) !== null && _b !== void 0 ? _b : res];
|
|
522
|
+
}
|
|
477
523
|
});
|
|
478
524
|
}); },
|
|
479
525
|
/**
|
|
480
|
-
* Adds member(s) to a channel with optional role and bitwise permissions.
|
|
526
|
+
* Adds member(s) to a channel with optional role and bitwise permissions via V3 API.
|
|
481
527
|
* @param slug The unique workspace slug.
|
|
482
528
|
* @param channelId Unique identifier of the channel.
|
|
483
|
-
* @param data Object containing userIds or userId, role, and optional permissions.
|
|
529
|
+
* @param data Object containing userIds/memberIds/emails or userId/memberId/email, role, and optional permissions.
|
|
484
530
|
* @param options Optional request config override.
|
|
485
531
|
*/
|
|
486
532
|
add: function (slug, channelId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
487
|
-
|
|
488
|
-
|
|
533
|
+
var res;
|
|
534
|
+
var _a, _b;
|
|
535
|
+
return __generator(this, function (_c) {
|
|
536
|
+
switch (_c.label) {
|
|
537
|
+
case 0: return [4 /*yield*/, this.raw.v3WorkspacesControllerAddChannelMembers(slug, channelId, data, options)];
|
|
538
|
+
case 1:
|
|
539
|
+
res = (_c.sent());
|
|
540
|
+
return [2 /*return*/, (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.members) !== null && _b !== void 0 ? _b : res];
|
|
541
|
+
}
|
|
489
542
|
});
|
|
490
543
|
}); },
|
|
491
544
|
/**
|
|
492
|
-
* Updates a channel member's role or bitwise permissions.
|
|
545
|
+
* Updates a channel member's role or bitwise permissions via V3 API.
|
|
493
546
|
* @param slug The unique workspace slug.
|
|
494
547
|
* @param channelId Unique identifier of the channel.
|
|
495
|
-
* @param targetUserId Target user ID of the channel member.
|
|
548
|
+
* @param targetUserId Target user ID, member ID, or email of the channel member.
|
|
496
549
|
* @param data Object containing role and/or bitwise permissions.
|
|
497
550
|
* @param options Optional request config override.
|
|
498
551
|
*/
|
|
499
552
|
update: function (slug, channelId, targetUserId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
500
|
-
|
|
501
|
-
|
|
553
|
+
var res;
|
|
554
|
+
var _a, _b;
|
|
555
|
+
return __generator(this, function (_c) {
|
|
556
|
+
switch (_c.label) {
|
|
557
|
+
case 0: return [4 /*yield*/, this.raw.v3WorkspacesControllerUpdateChannelMember(slug, channelId, targetUserId, data, options)];
|
|
558
|
+
case 1:
|
|
559
|
+
res = (_c.sent());
|
|
560
|
+
return [2 /*return*/, (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.member) !== null && _b !== void 0 ? _b : res];
|
|
561
|
+
}
|
|
502
562
|
});
|
|
503
563
|
}); },
|
|
504
564
|
/**
|
|
505
|
-
* Removes a member from a channel.
|
|
565
|
+
* Removes a member from a channel via V3 API.
|
|
506
566
|
* @param slug The unique workspace slug.
|
|
507
567
|
* @param channelId Unique identifier of the channel.
|
|
508
|
-
* @param targetUserId Target user ID to remove.
|
|
568
|
+
* @param targetUserId Target user ID, member ID, or email to remove.
|
|
509
569
|
* @param options Optional request config override.
|
|
510
570
|
*/
|
|
511
571
|
remove: function (slug, channelId, targetUserId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
512
|
-
|
|
513
|
-
|
|
572
|
+
var res;
|
|
573
|
+
var _a;
|
|
574
|
+
return __generator(this, function (_b) {
|
|
575
|
+
switch (_b.label) {
|
|
576
|
+
case 0: return [4 /*yield*/, this.raw.v3WorkspacesControllerDeleteChannelMember(slug, channelId, targetUserId, options)];
|
|
577
|
+
case 1:
|
|
578
|
+
res = (_b.sent());
|
|
579
|
+
return [2 /*return*/, (_a = res === null || res === void 0 ? void 0 : res.data) !== null && _a !== void 0 ? _a : res];
|
|
580
|
+
}
|
|
514
581
|
});
|
|
515
582
|
}); },
|
|
516
583
|
},
|
|
@@ -1357,8 +1424,9 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
1357
1424
|
}); },
|
|
1358
1425
|
/**
|
|
1359
1426
|
* Adds a new member to a workspace.
|
|
1427
|
+
* Accepts member options by email address, userId, or memberId.
|
|
1360
1428
|
* @param slug The unique workspace slug.
|
|
1361
|
-
* @param data Configuration containing user email and target role.
|
|
1429
|
+
* @param data Configuration containing user email, userId, or memberId and target role.
|
|
1362
1430
|
* @param options Optional request config override.
|
|
1363
1431
|
*/
|
|
1364
1432
|
add: function (slug, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -1368,8 +1436,9 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
1368
1436
|
}); },
|
|
1369
1437
|
/**
|
|
1370
1438
|
* Retrieves membership details of a specific workspace member.
|
|
1439
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
1371
1440
|
* @param slug The unique workspace slug.
|
|
1372
|
-
* @param memberId
|
|
1441
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
1373
1442
|
* @param options Optional request config override.
|
|
1374
1443
|
*/
|
|
1375
1444
|
get: function (slug, memberId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -1379,8 +1448,9 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
1379
1448
|
}); },
|
|
1380
1449
|
/**
|
|
1381
1450
|
* Updates the role or settings of an existing member in a workspace.
|
|
1451
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
1382
1452
|
* @param slug The unique workspace slug.
|
|
1383
|
-
* @param memberId
|
|
1453
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
1384
1454
|
* @param data Updated role.
|
|
1385
1455
|
* @param options Optional request config override.
|
|
1386
1456
|
*/
|
|
@@ -1391,8 +1461,9 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
1391
1461
|
}); },
|
|
1392
1462
|
/**
|
|
1393
1463
|
* Removes a member from a workspace.
|
|
1464
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
1394
1465
|
* @param slug The unique workspace slug.
|
|
1395
|
-
* @param memberId
|
|
1466
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
1396
1467
|
* @param options Optional request config override.
|
|
1397
1468
|
*/
|
|
1398
1469
|
delete: function (slug, memberId, options) { return __awaiter(_this, void 0, void 0, function () {
|
package/package.json
CHANGED
|
@@ -29,12 +29,6 @@ vi.mock('../generated/v3-server', () => {
|
|
|
29
29
|
v3WorkspacesControllerGetWorkspaceBySlug: vi.fn(async (slug, options) => {
|
|
30
30
|
return { success: true, data: { workspace: { slug } }, options };
|
|
31
31
|
}),
|
|
32
|
-
channelsControllerGetWorkspaceChannels: vi.fn(async (slug, options) => {
|
|
33
|
-
return { success: true, data: { channels: [] }, slug, options };
|
|
34
|
-
}),
|
|
35
|
-
channelsControllerCreateChannel: vi.fn(async (slug, data, options) => {
|
|
36
|
-
return { success: true, data: { slug, data }, options };
|
|
37
|
-
}),
|
|
38
32
|
channelsControllerGetMessages: vi.fn(async (channelId, params, options) => {
|
|
39
33
|
return { success: true, channelId, params, options };
|
|
40
34
|
}),
|
|
@@ -53,18 +47,6 @@ vi.mock('../generated/v3-server', () => {
|
|
|
53
47
|
channelsControllerRemoveReaction: vi.fn(async (channelId, messageId, emoji, options) => {
|
|
54
48
|
return { success: true, type: 'channel', action: 'removeReaction', channelId, messageId, emoji, options };
|
|
55
49
|
}),
|
|
56
|
-
channelsControllerGetChannelMembers: vi.fn(async (slug, channelId, options) => {
|
|
57
|
-
return { success: true, slug, channelId, members: [], options };
|
|
58
|
-
}),
|
|
59
|
-
channelsControllerAddChannelMembers: vi.fn(async (slug, channelId, data, options) => {
|
|
60
|
-
return { success: true, slug, channelId, data, options };
|
|
61
|
-
}),
|
|
62
|
-
channelsControllerUpdateChannelMember: vi.fn(async (slug, channelId, targetUserId, data, options) => {
|
|
63
|
-
return { success: true, slug, channelId, targetUserId, data, options };
|
|
64
|
-
}),
|
|
65
|
-
channelsControllerRemoveChannelMember: vi.fn(async (slug, channelId, targetUserId, options) => {
|
|
66
|
-
return { success: true, slug, channelId, targetUserId, options };
|
|
67
|
-
}),
|
|
68
50
|
|
|
69
51
|
// DMs Mock
|
|
70
52
|
dmsControllerGetDms: vi.fn(async (options) => {
|
|
@@ -172,8 +154,10 @@ vi.mock('../generated/v3-server', () => {
|
|
|
172
154
|
v3WorkspacesControllerGetChannel: vi.fn(async (slug, channelId, options) => {
|
|
173
155
|
return { success: true, data: { channel: { id: channelId } }, slug, options };
|
|
174
156
|
}),
|
|
175
|
-
v3WorkspacesControllerUpdateChannel: vi.fn(async (
|
|
176
|
-
|
|
157
|
+
v3WorkspacesControllerUpdateChannel: vi.fn(async (...args: any[]) => {
|
|
158
|
+
const slug = args[0];
|
|
159
|
+
const channelId = args[1];
|
|
160
|
+
return { success: true, data: { channel: { id: channelId } }, slug };
|
|
177
161
|
}),
|
|
178
162
|
v3WorkspacesControllerDeleteChannel: vi.fn(async (slug, channelId, options) => {
|
|
179
163
|
return { success: true, data: { success: true }, slug, channelId, options };
|
|
@@ -181,11 +165,13 @@ vi.mock('../generated/v3-server', () => {
|
|
|
181
165
|
v3WorkspacesControllerGetChannelMembers: vi.fn(async (slug, channelId, options) => {
|
|
182
166
|
return { success: true, data: { members: [] }, slug, channelId, options };
|
|
183
167
|
}),
|
|
184
|
-
v3WorkspacesControllerAddChannelMembers: vi.fn(async (
|
|
185
|
-
|
|
168
|
+
v3WorkspacesControllerAddChannelMembers: vi.fn(async (...args: any[]) => {
|
|
169
|
+
const slug = args[0];
|
|
170
|
+
const channelId = args[1];
|
|
171
|
+
return { success: true, data: { members: [] }, slug, channelId };
|
|
186
172
|
}),
|
|
187
173
|
v3WorkspacesControllerUpdateChannelMember: vi.fn(async (slug, channelId, userId, data, options) => {
|
|
188
|
-
return { success: true, data: { member: { userId, role: data
|
|
174
|
+
return { success: true, data: { member: { userId, role: data?.role } }, slug, channelId, options };
|
|
189
175
|
}),
|
|
190
176
|
v3WorkspacesControllerDeleteChannelMember: vi.fn(async (slug, channelId, userId, options) => {
|
|
191
177
|
return { success: true, data: { success: true }, slug, channelId, userId, options };
|
|
@@ -388,21 +374,50 @@ describe('ScrymeSDK', () => {
|
|
|
388
374
|
expect(createRes.options.headers.Authorization).toBe('Bearer active-token');
|
|
389
375
|
});
|
|
390
376
|
|
|
391
|
-
it('should support workspace channels namespace', async () => {
|
|
377
|
+
it('should support workspace channels namespace and call V3 endpoints', async () => {
|
|
392
378
|
const sdk = new ScrymeSDK({
|
|
393
379
|
baseURL: 'https://api.test.com',
|
|
394
380
|
token: 'active-token',
|
|
395
381
|
});
|
|
396
382
|
|
|
397
383
|
const channelsRes = await sdk.workspace.channels.list('acme-corp') as any;
|
|
398
|
-
expect(channelsRes
|
|
384
|
+
expect(channelsRes).toEqual([]);
|
|
399
385
|
|
|
400
386
|
const createRes = await sdk.workspace.channels.create('acme-corp', { name: 'general' }) as any;
|
|
401
|
-
expect(createRes
|
|
402
|
-
|
|
387
|
+
expect(createRes).toEqual({ name: 'general' });
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
it('should support channel CRUD and channel members operations using V3 endpoints', async () => {
|
|
391
|
+
const sdk = new ScrymeSDK({
|
|
392
|
+
baseURL: 'https://api.test.com',
|
|
393
|
+
token: 'active-token',
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
// Channel CRUD
|
|
397
|
+
const getChan = await sdk.channel.get('acme-corp', 'chan_123') as any;
|
|
398
|
+
expect(getChan.id).toBe('chan_123');
|
|
399
|
+
|
|
400
|
+
const updateChan = await sdk.channel.update('acme-corp', 'chan_123', { name: 'general-updated' }) as any;
|
|
401
|
+
expect(updateChan.id).toBe('chan_123');
|
|
402
|
+
|
|
403
|
+
const deleteChan = await sdk.channel.delete('acme-corp', 'chan_123') as any;
|
|
404
|
+
expect(deleteChan.success).toBe(true);
|
|
405
|
+
|
|
406
|
+
// Channel Members
|
|
407
|
+
const listMembers = await sdk.channel.members.list('acme-corp', 'chan_123') as any;
|
|
408
|
+
expect(listMembers).toEqual([]);
|
|
409
|
+
|
|
410
|
+
const addMembers = await sdk.channel.members.add('acme-corp', 'chan_123', { userIds: ['usr_1'] }) as any;
|
|
411
|
+
expect(addMembers).toEqual([]);
|
|
412
|
+
|
|
413
|
+
const updateMember = await sdk.channel.members.update('acme-corp', 'chan_123', 'usr_1', { role: 'admin' }) as any;
|
|
414
|
+
expect(updateMember).toEqual({ userId: 'usr_1', role: 'admin' });
|
|
415
|
+
|
|
416
|
+
const removeMember = await sdk.channel.members.remove('acme-corp', 'chan_123', 'usr_1') as any;
|
|
417
|
+
expect(removeMember).toEqual({ success: true });
|
|
403
418
|
});
|
|
404
419
|
|
|
405
|
-
it('should support channel
|
|
420
|
+
it('should support channel message namespaces', async () => {
|
|
406
421
|
const sdk = new ScrymeSDK({
|
|
407
422
|
baseURL: 'https://api.test.com',
|
|
408
423
|
token: 'active-token',
|
|
@@ -1008,8 +1008,16 @@ export interface V3AddChannelMemberDto {
|
|
|
1008
1008
|
role?: string;
|
|
1009
1009
|
/** User ID to add to channel */
|
|
1010
1010
|
userId?: string;
|
|
1011
|
+
/** Member ID to add to channel */
|
|
1012
|
+
memberId?: string;
|
|
1013
|
+
/** Email address to add to channel */
|
|
1014
|
+
email?: string;
|
|
1011
1015
|
/** Array of user IDs to add */
|
|
1012
1016
|
userIds?: string[];
|
|
1017
|
+
/** Array of workspace member IDs to add */
|
|
1018
|
+
memberIds?: string[];
|
|
1019
|
+
/** Array of user emails to add */
|
|
1020
|
+
emails?: string[];
|
|
1013
1021
|
}
|
|
1014
1022
|
|
|
1015
1023
|
export type V3UpdateChannelDtoType = typeof V3UpdateChannelDtoType[keyof typeof V3UpdateChannelDtoType];
|
|
@@ -1095,7 +1103,11 @@ export interface V3UpdateMemberRoleDto {
|
|
|
1095
1103
|
|
|
1096
1104
|
export interface V3AddMemberDto {
|
|
1097
1105
|
/** The email of the user to add */
|
|
1098
|
-
email
|
|
1106
|
+
email?: string;
|
|
1107
|
+
/** The user ID of the user to add */
|
|
1108
|
+
userId?: string;
|
|
1109
|
+
/** The workspace member ID of the user to add */
|
|
1110
|
+
memberId?: string;
|
|
1099
1111
|
/** The role of the member */
|
|
1100
1112
|
role?: string;
|
|
1101
1113
|
}
|
package/src/sdk.ts
CHANGED
|
@@ -871,8 +871,9 @@ export class ScrymeSDK {
|
|
|
871
871
|
},
|
|
872
872
|
/**
|
|
873
873
|
* Adds a new member to the workspace.
|
|
874
|
+
* Accepts member options by email address, userId, or memberId.
|
|
874
875
|
* @param slug The unique workspace slug identifier.
|
|
875
|
-
* @param data Input DTO containing
|
|
876
|
+
* @param data Input DTO containing member email, userId, or memberId and target role.
|
|
876
877
|
* @param options Optional request config override.
|
|
877
878
|
* @returns Newly added member details exactly from the endpoint.
|
|
878
879
|
*/
|
|
@@ -885,8 +886,9 @@ export class ScrymeSDK {
|
|
|
885
886
|
},
|
|
886
887
|
/**
|
|
887
888
|
* Retrieves membership details of a specific member in a workspace.
|
|
889
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
888
890
|
* @param slug The unique workspace slug identifier.
|
|
889
|
-
* @param memberId
|
|
891
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
890
892
|
* @param options Optional request config override.
|
|
891
893
|
* @returns Workspace member details exactly from the endpoint.
|
|
892
894
|
*/
|
|
@@ -899,8 +901,9 @@ export class ScrymeSDK {
|
|
|
899
901
|
},
|
|
900
902
|
/**
|
|
901
903
|
* Updates the role or configuration of a workspace member.
|
|
904
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
902
905
|
* @param slug The unique workspace slug identifier.
|
|
903
|
-
* @param memberId
|
|
906
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
904
907
|
* @param data Update details containing the target role.
|
|
905
908
|
* @param options Optional request config override.
|
|
906
909
|
* @returns The updated workspace member details exactly from the endpoint.
|
|
@@ -915,8 +918,9 @@ export class ScrymeSDK {
|
|
|
915
918
|
},
|
|
916
919
|
/**
|
|
917
920
|
* Removes a member from the workspace.
|
|
921
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
918
922
|
* @param slug The unique workspace slug identifier.
|
|
919
|
-
* @param memberId
|
|
923
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
920
924
|
* @param options Optional request config override.
|
|
921
925
|
* @returns Workspace member deletion confirmation exactly from the endpoint.
|
|
922
926
|
*/
|
|
@@ -933,27 +937,39 @@ export class ScrymeSDK {
|
|
|
933
937
|
*/
|
|
934
938
|
channels: {
|
|
935
939
|
/**
|
|
936
|
-
* Lists all public channels (and private channels the user has access to) in a workspace.
|
|
940
|
+
* Lists all public channels (and private channels the user has access to) in a workspace via V3 API.
|
|
937
941
|
* @param slug The unique workspace slug identifier.
|
|
938
942
|
* @param options Optional request config override.
|
|
939
|
-
* @returns List of channels returned
|
|
943
|
+
* @returns List of channels returned from the endpoint.
|
|
940
944
|
*/
|
|
941
945
|
list: async (slug: string, options?: AxiosRequestConfig): Promise<WorkspaceChannel[]> => {
|
|
942
|
-
|
|
946
|
+
const res = (await this.raw.v3WorkspacesControllerGetChannels(slug, options)) as unknown as {
|
|
947
|
+
success: boolean;
|
|
948
|
+
data: { channels: WorkspaceChannel[] };
|
|
949
|
+
};
|
|
950
|
+
return res?.data?.channels ?? (res as unknown as WorkspaceChannel[]);
|
|
943
951
|
},
|
|
944
952
|
/**
|
|
945
|
-
* Creates a new channel within a workspace.
|
|
953
|
+
* Creates a new channel within a workspace via V3 API.
|
|
946
954
|
* @param slug The unique workspace slug identifier.
|
|
947
955
|
* @param data Configuration DTO for the new channel.
|
|
948
956
|
* @param options Optional request config override.
|
|
949
|
-
* @returns Details of the created channel
|
|
957
|
+
* @returns Details of the created channel returned from the endpoint.
|
|
950
958
|
*/
|
|
951
959
|
create: async (
|
|
952
960
|
slug: string,
|
|
953
|
-
data: CreateWorkspaceChannelDto,
|
|
961
|
+
data: V3CreateChannelDto | CreateWorkspaceChannelDto,
|
|
954
962
|
options?: AxiosRequestConfig
|
|
955
963
|
): Promise<WorkspaceChannel> => {
|
|
956
|
-
|
|
964
|
+
const res = (await this.raw.v3WorkspacesControllerCreateChannel(
|
|
965
|
+
slug,
|
|
966
|
+
data as V3CreateChannelDto,
|
|
967
|
+
options
|
|
968
|
+
)) as unknown as {
|
|
969
|
+
success: boolean;
|
|
970
|
+
data: { channel: WorkspaceChannel };
|
|
971
|
+
};
|
|
972
|
+
return res?.data?.channel ?? (res as unknown as WorkspaceChannel);
|
|
957
973
|
},
|
|
958
974
|
},
|
|
959
975
|
};
|
|
@@ -965,74 +981,108 @@ export class ScrymeSDK {
|
|
|
965
981
|
public get channel() {
|
|
966
982
|
return {
|
|
967
983
|
/**
|
|
968
|
-
* Retrieves detailed information of a specific channel.
|
|
984
|
+
* Retrieves detailed information of a specific channel via V3 API.
|
|
969
985
|
* @param slug The unique workspace slug identifier.
|
|
970
986
|
* @param channelId Unique identifier of the channel.
|
|
971
987
|
* @param options Optional request config override.
|
|
972
|
-
* @returns Channel details returned
|
|
988
|
+
* @returns Channel details returned from the V3 endpoint.
|
|
973
989
|
*/
|
|
974
990
|
get: async (slug: string, channelId: string, options?: AxiosRequestConfig): Promise<WorkspaceChannel> => {
|
|
975
|
-
|
|
991
|
+
const res = (await this.raw.v3WorkspacesControllerGetChannel(slug, channelId, options)) as unknown as {
|
|
992
|
+
success: boolean;
|
|
993
|
+
data: { channel: WorkspaceChannel };
|
|
994
|
+
};
|
|
995
|
+
return res?.data?.channel ?? (res as unknown as WorkspaceChannel);
|
|
976
996
|
},
|
|
977
997
|
/**
|
|
978
|
-
* Updates configuration, description, icon or status of an existing channel.
|
|
998
|
+
* Updates configuration, description, icon or status of an existing channel via V3 API.
|
|
979
999
|
* @param slug The unique workspace slug identifier.
|
|
980
1000
|
* @param channelId Unique identifier of the channel.
|
|
981
1001
|
* @param data Configuration options to update.
|
|
982
1002
|
* @param options Optional request config override.
|
|
983
|
-
* @returns The updated channel details
|
|
1003
|
+
* @returns The updated channel details returned from the V3 endpoint.
|
|
984
1004
|
*/
|
|
985
1005
|
update: async (
|
|
986
1006
|
slug: string,
|
|
987
1007
|
channelId: string,
|
|
988
|
-
data: UpdateWorkspaceChannelDto,
|
|
1008
|
+
data: V3UpdateChannelDto | UpdateWorkspaceChannelDto,
|
|
989
1009
|
options?: AxiosRequestConfig
|
|
990
1010
|
): Promise<WorkspaceChannel> => {
|
|
991
|
-
|
|
1011
|
+
const res = (await this.raw.v3WorkspacesControllerUpdateChannel(
|
|
1012
|
+
slug,
|
|
1013
|
+
channelId,
|
|
1014
|
+
data as V3UpdateChannelDto,
|
|
1015
|
+
options
|
|
1016
|
+
)) as unknown as {
|
|
1017
|
+
success: boolean;
|
|
1018
|
+
data: { channel: WorkspaceChannel };
|
|
1019
|
+
};
|
|
1020
|
+
return res?.data?.channel ?? (res as unknown as WorkspaceChannel);
|
|
992
1021
|
},
|
|
993
1022
|
/**
|
|
994
|
-
* Permanently deletes a channel from a workspace.
|
|
1023
|
+
* Permanently deletes a channel from a workspace via V3 API.
|
|
995
1024
|
* @param slug The unique workspace slug identifier.
|
|
996
1025
|
* @param channelId Unique identifier of the channel to delete.
|
|
997
1026
|
* @param options Optional request config override.
|
|
998
|
-
* @returns Success status indicating that the channel was deleted
|
|
1027
|
+
* @returns Success status indicating that the channel was deleted from the V3 endpoint.
|
|
999
1028
|
*/
|
|
1000
1029
|
delete: async (slug: string, channelId: string, options?: AxiosRequestConfig): Promise<{ success: boolean }> => {
|
|
1001
|
-
|
|
1030
|
+
const res = (await this.raw.v3WorkspacesControllerDeleteChannel(slug, channelId, options)) as unknown as {
|
|
1031
|
+
success: boolean;
|
|
1032
|
+
data?: { success: boolean };
|
|
1033
|
+
};
|
|
1034
|
+
return res?.data ?? res;
|
|
1002
1035
|
},
|
|
1003
1036
|
/**
|
|
1004
|
-
* Sub-namespace for managing channel member access and permissions.
|
|
1037
|
+
* Sub-namespace for managing channel member access and permissions via V3 API.
|
|
1005
1038
|
*/
|
|
1006
1039
|
members: {
|
|
1007
1040
|
/**
|
|
1008
|
-
* Lists members belonging to a specific channel.
|
|
1041
|
+
* Lists members belonging to a specific channel via V3 API.
|
|
1009
1042
|
* @param slug The unique workspace slug.
|
|
1010
1043
|
* @param channelId Unique identifier of the channel.
|
|
1011
1044
|
* @param options Optional request config override.
|
|
1012
1045
|
*/
|
|
1013
1046
|
list: async (slug: string, channelId: string, options?: AxiosRequestConfig): Promise<any[]> => {
|
|
1014
|
-
|
|
1047
|
+
const res = (await this.raw.v3WorkspacesControllerGetChannelMembers(
|
|
1048
|
+
slug,
|
|
1049
|
+
channelId,
|
|
1050
|
+
options
|
|
1051
|
+
)) as unknown as {
|
|
1052
|
+
success: boolean;
|
|
1053
|
+
data: { members: any[] };
|
|
1054
|
+
};
|
|
1055
|
+
return res?.data?.members ?? (res as unknown as any[]);
|
|
1015
1056
|
},
|
|
1016
1057
|
/**
|
|
1017
|
-
* Adds member(s) to a channel with optional role and bitwise permissions.
|
|
1058
|
+
* Adds member(s) to a channel with optional role and bitwise permissions via V3 API.
|
|
1018
1059
|
* @param slug The unique workspace slug.
|
|
1019
1060
|
* @param channelId Unique identifier of the channel.
|
|
1020
|
-
* @param data Object containing userIds or userId, role, and optional permissions.
|
|
1061
|
+
* @param data Object containing userIds/memberIds/emails or userId/memberId/email, role, and optional permissions.
|
|
1021
1062
|
* @param options Optional request config override.
|
|
1022
1063
|
*/
|
|
1023
1064
|
add: async (
|
|
1024
1065
|
slug: string,
|
|
1025
1066
|
channelId: string,
|
|
1026
|
-
data: { userIds?: string[]; userId?: string; role?: string },
|
|
1067
|
+
data: V3AddChannelMemberDto | { userIds?: string[]; userId?: string; role?: string; permissions?: string | number },
|
|
1027
1068
|
options?: AxiosRequestConfig
|
|
1028
1069
|
): Promise<any[]> => {
|
|
1029
|
-
|
|
1070
|
+
const res = (await this.raw.v3WorkspacesControllerAddChannelMembers(
|
|
1071
|
+
slug,
|
|
1072
|
+
channelId,
|
|
1073
|
+
data as V3AddChannelMemberDto,
|
|
1074
|
+
options
|
|
1075
|
+
)) as unknown as {
|
|
1076
|
+
success: boolean;
|
|
1077
|
+
data: { members: any[] };
|
|
1078
|
+
};
|
|
1079
|
+
return res?.data?.members ?? (res as unknown as any[]);
|
|
1030
1080
|
},
|
|
1031
1081
|
/**
|
|
1032
|
-
* Updates a channel member's role or bitwise permissions.
|
|
1082
|
+
* Updates a channel member's role or bitwise permissions via V3 API.
|
|
1033
1083
|
* @param slug The unique workspace slug.
|
|
1034
1084
|
* @param channelId Unique identifier of the channel.
|
|
1035
|
-
* @param targetUserId Target user ID of the channel member.
|
|
1085
|
+
* @param targetUserId Target user ID, member ID, or email of the channel member.
|
|
1036
1086
|
* @param data Object containing role and/or bitwise permissions.
|
|
1037
1087
|
* @param options Optional request config override.
|
|
1038
1088
|
*/
|
|
@@ -1040,22 +1090,26 @@ export class ScrymeSDK {
|
|
|
1040
1090
|
slug: string,
|
|
1041
1091
|
channelId: string,
|
|
1042
1092
|
targetUserId: string,
|
|
1043
|
-
data: UpdateChannelMemberDto,
|
|
1093
|
+
data: V3UpdateChannelMemberDto | UpdateChannelMemberDto,
|
|
1044
1094
|
options?: AxiosRequestConfig
|
|
1045
1095
|
): Promise<any> => {
|
|
1046
|
-
|
|
1096
|
+
const res = (await this.raw.v3WorkspacesControllerUpdateChannelMember(
|
|
1047
1097
|
slug,
|
|
1048
1098
|
channelId,
|
|
1049
1099
|
targetUserId,
|
|
1050
|
-
data,
|
|
1100
|
+
data as V3UpdateChannelMemberDto,
|
|
1051
1101
|
options
|
|
1052
|
-
) as unknown as
|
|
1102
|
+
)) as unknown as {
|
|
1103
|
+
success: boolean;
|
|
1104
|
+
data: { member: any };
|
|
1105
|
+
};
|
|
1106
|
+
return res?.data?.member ?? res;
|
|
1053
1107
|
},
|
|
1054
1108
|
/**
|
|
1055
|
-
* Removes a member from a channel.
|
|
1109
|
+
* Removes a member from a channel via V3 API.
|
|
1056
1110
|
* @param slug The unique workspace slug.
|
|
1057
1111
|
* @param channelId Unique identifier of the channel.
|
|
1058
|
-
* @param targetUserId Target user ID to remove.
|
|
1112
|
+
* @param targetUserId Target user ID, member ID, or email to remove.
|
|
1059
1113
|
* @param options Optional request config override.
|
|
1060
1114
|
*/
|
|
1061
1115
|
remove: async (
|
|
@@ -1064,12 +1118,16 @@ export class ScrymeSDK {
|
|
|
1064
1118
|
targetUserId: string,
|
|
1065
1119
|
options?: AxiosRequestConfig
|
|
1066
1120
|
): Promise<{ success: boolean }> => {
|
|
1067
|
-
|
|
1121
|
+
const res = (await this.raw.v3WorkspacesControllerDeleteChannelMember(
|
|
1068
1122
|
slug,
|
|
1069
1123
|
channelId,
|
|
1070
1124
|
targetUserId,
|
|
1071
1125
|
options
|
|
1072
|
-
) as unknown as {
|
|
1126
|
+
)) as unknown as {
|
|
1127
|
+
success: boolean;
|
|
1128
|
+
data?: { success: boolean };
|
|
1129
|
+
};
|
|
1130
|
+
return res?.data ?? res;
|
|
1073
1131
|
},
|
|
1074
1132
|
},
|
|
1075
1133
|
/**
|
|
@@ -2044,8 +2102,9 @@ export class ScrymeSDK {
|
|
|
2044
2102
|
},
|
|
2045
2103
|
/**
|
|
2046
2104
|
* Adds a new member to a workspace.
|
|
2105
|
+
* Accepts member options by email address, userId, or memberId.
|
|
2047
2106
|
* @param slug The unique workspace slug.
|
|
2048
|
-
* @param data Configuration containing user email and target role.
|
|
2107
|
+
* @param data Configuration containing user email, userId, or memberId and target role.
|
|
2049
2108
|
* @param options Optional request config override.
|
|
2050
2109
|
*/
|
|
2051
2110
|
add: async (
|
|
@@ -2057,8 +2116,9 @@ export class ScrymeSDK {
|
|
|
2057
2116
|
},
|
|
2058
2117
|
/**
|
|
2059
2118
|
* Retrieves membership details of a specific workspace member.
|
|
2119
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
2060
2120
|
* @param slug The unique workspace slug.
|
|
2061
|
-
* @param memberId
|
|
2121
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
2062
2122
|
* @param options Optional request config override.
|
|
2063
2123
|
*/
|
|
2064
2124
|
get: async (
|
|
@@ -2070,8 +2130,9 @@ export class ScrymeSDK {
|
|
|
2070
2130
|
},
|
|
2071
2131
|
/**
|
|
2072
2132
|
* Updates the role or settings of an existing member in a workspace.
|
|
2133
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
2073
2134
|
* @param slug The unique workspace slug.
|
|
2074
|
-
* @param memberId
|
|
2135
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
2075
2136
|
* @param data Updated role.
|
|
2076
2137
|
* @param options Optional request config override.
|
|
2077
2138
|
*/
|
|
@@ -2085,8 +2146,9 @@ export class ScrymeSDK {
|
|
|
2085
2146
|
},
|
|
2086
2147
|
/**
|
|
2087
2148
|
* Removes a member from a workspace.
|
|
2149
|
+
* Supports member identifier options allowing workspace member ID, user ID, or user email address.
|
|
2088
2150
|
* @param slug The unique workspace slug.
|
|
2089
|
-
* @param memberId
|
|
2151
|
+
* @param memberId Workspace member ID, user ID, or user email address.
|
|
2090
2152
|
* @param options Optional request config override.
|
|
2091
2153
|
*/
|
|
2092
2154
|
delete: async (
|