@scryme/chat 2.91.43 → 2.91.76
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/custom-instance.d.ts +22 -2
- package/dist/custom-instance.js +109 -1
- package/dist/generated/v3-client.d.ts +2438 -1441
- package/dist/generated/v3-client.js +1795 -999
- package/dist/generated/v3-server.d.ts +315 -149
- package/dist/generated/v3-server.js +451 -202
- package/dist/sdk.d.ts +49 -49
- package/dist/sdk.js +207 -81
- package/package.json +1 -1
- package/src/__tests__/sdk-error.test.ts +229 -0
- package/src/__tests__/sdk.test.ts +41 -17
- package/src/custom-instance.ts +109 -2
- package/src/generated/v3-client.ts +4467 -2471
- package/src/generated/v3-server.ts +1156 -574
- package/src/sdk.ts +149 -70
package/dist/sdk.js
CHANGED
|
@@ -55,7 +55,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
55
55
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
56
56
|
};
|
|
57
57
|
import axios from 'axios';
|
|
58
|
-
import { setGlobalToken } from './custom-instance';
|
|
58
|
+
import { setGlobalToken, parseSDKError } from './custom-instance';
|
|
59
59
|
import { getSkyrmeChatAPI } from './generated/v3-server';
|
|
60
60
|
/**
|
|
61
61
|
* The primary client SDK class for accessing the Scryme Chat platform APIs.
|
|
@@ -173,7 +173,7 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
173
173
|
case 3:
|
|
174
174
|
error_1 = _e.sent();
|
|
175
175
|
console.error('ScrymeSDK failed to authenticate via client_credentials:', error_1);
|
|
176
|
-
throw error_1;
|
|
176
|
+
throw parseSDKError(error_1);
|
|
177
177
|
case 4: return [2 /*return*/, this.token];
|
|
178
178
|
}
|
|
179
179
|
});
|
|
@@ -217,7 +217,7 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
217
217
|
args[_i] = arguments[_i];
|
|
218
218
|
}
|
|
219
219
|
return __awaiter(_this, void 0, void 0, function () {
|
|
220
|
-
var config, arity, cleanArgs, lastArg, isLastArgOptions, userOptions;
|
|
220
|
+
var config, arity, cleanArgs, lastArg, isLastArgOptions, userOptions, error_2;
|
|
221
221
|
return __generator(this, function (_a) {
|
|
222
222
|
switch (_a.label) {
|
|
223
223
|
case 0: return [4 /*yield*/, this.getRequestConfig()];
|
|
@@ -242,7 +242,15 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
242
242
|
}
|
|
243
243
|
cleanArgs.push(config);
|
|
244
244
|
}
|
|
245
|
-
|
|
245
|
+
_a.label = 2;
|
|
246
|
+
case 2:
|
|
247
|
+
_a.trys.push([2, 4, , 5]);
|
|
248
|
+
return [4 /*yield*/, originalMethod.apply(void 0, cleanArgs)];
|
|
249
|
+
case 3: return [2 /*return*/, _a.sent()];
|
|
250
|
+
case 4:
|
|
251
|
+
error_2 = _a.sent();
|
|
252
|
+
throw parseSDKError(error_2);
|
|
253
|
+
case 5: return [2 /*return*/];
|
|
246
254
|
}
|
|
247
255
|
});
|
|
248
256
|
});
|
|
@@ -586,80 +594,133 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
586
594
|
*/
|
|
587
595
|
message: {
|
|
588
596
|
/**
|
|
589
|
-
* Lists messages in a channel with cursor pagination support.
|
|
597
|
+
* Lists messages in a channel with cursor pagination support via V3 API.
|
|
598
|
+
* @param slug The unique workspace slug.
|
|
590
599
|
* @param channelId Unique identifier of the channel.
|
|
591
600
|
* @param params Query parameters for limiting, sorting, or pagination cursors.
|
|
592
601
|
* @param options Optional request config override.
|
|
593
|
-
* @returns Object containing the messages array and next pagination cursor exactly from the endpoint.
|
|
594
602
|
*/
|
|
595
|
-
list: function (channelId, params, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
596
|
-
|
|
597
|
-
|
|
603
|
+
list: function (slug, channelId, params, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
604
|
+
var queryParams, res;
|
|
605
|
+
var _a;
|
|
606
|
+
return __generator(this, function (_b) {
|
|
607
|
+
switch (_b.label) {
|
|
608
|
+
case 0:
|
|
609
|
+
queryParams = {};
|
|
610
|
+
if (params === null || params === void 0 ? void 0 : params.cursor)
|
|
611
|
+
queryParams.cursor = params.cursor;
|
|
612
|
+
if (params === null || params === void 0 ? void 0 : params.limit)
|
|
613
|
+
queryParams.limit = params.limit;
|
|
614
|
+
return [4 /*yield*/, this.raw.v3WorkspacesControllerGetChannelMessages(slug, channelId, queryParams, options)];
|
|
615
|
+
case 1:
|
|
616
|
+
res = (_b.sent());
|
|
617
|
+
return [2 /*return*/, (_a = res === null || res === void 0 ? void 0 : res.data) !== null && _a !== void 0 ? _a : res];
|
|
618
|
+
}
|
|
598
619
|
});
|
|
599
620
|
}); },
|
|
600
621
|
/**
|
|
601
|
-
* Sends a new message to a channel.
|
|
622
|
+
* Sends a new message to a channel via V3 API.
|
|
623
|
+
* @param slug The unique workspace slug.
|
|
602
624
|
* @param channelId Unique identifier of the target channel.
|
|
603
|
-
* @param data The message content string or structured
|
|
625
|
+
* @param data The message content string or structured payload object.
|
|
604
626
|
* @param options Optional request config override.
|
|
605
|
-
* @returns The created message exactly from the endpoint.
|
|
606
627
|
*/
|
|
607
|
-
create: function (channelId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
608
|
-
var payload;
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
628
|
+
create: function (slug, channelId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
629
|
+
var payload, mergedConfig, res;
|
|
630
|
+
var _a, _b;
|
|
631
|
+
return __generator(this, function (_c) {
|
|
632
|
+
switch (_c.label) {
|
|
633
|
+
case 0:
|
|
634
|
+
payload = typeof data === 'string' ? { content: data } : data;
|
|
635
|
+
mergedConfig = __assign(__assign({}, options), { data: payload });
|
|
636
|
+
return [4 /*yield*/, this.raw.v3WorkspacesControllerCreateChannelMessage(slug, channelId, mergedConfig)];
|
|
637
|
+
case 1:
|
|
638
|
+
res = (_c.sent());
|
|
639
|
+
return [2 /*return*/, (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : res];
|
|
640
|
+
}
|
|
612
641
|
});
|
|
613
642
|
}); },
|
|
614
643
|
/**
|
|
615
|
-
* Updates the content of a previously sent message in a channel.
|
|
644
|
+
* Updates the content of a previously sent message in a channel via V3 API.
|
|
645
|
+
* @param slug The unique workspace slug.
|
|
616
646
|
* @param channelId Unique identifier of the channel containing the message.
|
|
617
647
|
* @param messageId Unique identifier of the message to update.
|
|
618
648
|
* @param data The new content payload.
|
|
619
649
|
* @param options Optional request config override.
|
|
620
|
-
* @returns The updated message details exactly from the endpoint.
|
|
621
650
|
*/
|
|
622
|
-
update: function (channelId, messageId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
623
|
-
|
|
624
|
-
|
|
651
|
+
update: function (slug, channelId, messageId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
652
|
+
var mergedConfig, res;
|
|
653
|
+
var _a, _b;
|
|
654
|
+
return __generator(this, function (_c) {
|
|
655
|
+
switch (_c.label) {
|
|
656
|
+
case 0:
|
|
657
|
+
mergedConfig = __assign(__assign({}, options), { data: data });
|
|
658
|
+
return [4 /*yield*/, this.raw.v3WorkspacesControllerUpdateChannelMessage(slug, channelId, messageId, mergedConfig)];
|
|
659
|
+
case 1:
|
|
660
|
+
res = (_c.sent());
|
|
661
|
+
return [2 /*return*/, (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : res];
|
|
662
|
+
}
|
|
625
663
|
});
|
|
626
664
|
}); },
|
|
627
665
|
/**
|
|
628
|
-
* Permanently deletes a message in a channel.
|
|
666
|
+
* Permanently deletes a message in a channel via V3 API.
|
|
667
|
+
* @param slug The unique workspace slug.
|
|
629
668
|
* @param channelId Unique identifier of the channel containing the message.
|
|
630
669
|
* @param messageId Unique identifier of the message to delete.
|
|
631
670
|
* @param options Optional request config override.
|
|
632
|
-
* @returns Success status indicating that the message was deleted exactly from the endpoint.
|
|
633
671
|
*/
|
|
634
|
-
delete: function (channelId, messageId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
635
|
-
|
|
636
|
-
|
|
672
|
+
delete: function (slug, channelId, messageId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
673
|
+
var res;
|
|
674
|
+
var _a;
|
|
675
|
+
return __generator(this, function (_b) {
|
|
676
|
+
switch (_b.label) {
|
|
677
|
+
case 0: return [4 /*yield*/, this.raw.v3WorkspacesControllerDeleteChannelMessage(slug, channelId, messageId, options)];
|
|
678
|
+
case 1:
|
|
679
|
+
res = (_b.sent());
|
|
680
|
+
return [2 /*return*/, (_a = res === null || res === void 0 ? void 0 : res.data) !== null && _a !== void 0 ? _a : res];
|
|
681
|
+
}
|
|
637
682
|
});
|
|
638
683
|
}); },
|
|
639
684
|
/**
|
|
640
|
-
* Adds a reaction (emoji) to a message in a channel.
|
|
685
|
+
* Adds a reaction (emoji) to a message in a channel via V3 API.
|
|
686
|
+
* @param slug The unique workspace slug.
|
|
641
687
|
* @param channelId Unique identifier of the channel containing the message.
|
|
642
688
|
* @param messageId Unique identifier of the message.
|
|
643
689
|
* @param data Object containing the target emoji character.
|
|
644
690
|
* @param options Optional request config override.
|
|
645
|
-
* @returns The reaction response returned exactly from the endpoint.
|
|
646
691
|
*/
|
|
647
|
-
addReaction: function (channelId, messageId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
648
|
-
|
|
649
|
-
|
|
692
|
+
addReaction: function (slug, channelId, messageId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
693
|
+
var mergedConfig, res;
|
|
694
|
+
var _a, _b;
|
|
695
|
+
return __generator(this, function (_c) {
|
|
696
|
+
switch (_c.label) {
|
|
697
|
+
case 0:
|
|
698
|
+
mergedConfig = __assign(__assign({}, options), { data: data });
|
|
699
|
+
return [4 /*yield*/, this.raw.v3WorkspacesControllerAddChannelMessageReaction(slug, channelId, messageId, mergedConfig)];
|
|
700
|
+
case 1:
|
|
701
|
+
res = (_c.sent());
|
|
702
|
+
return [2 /*return*/, (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.reaction) !== null && _b !== void 0 ? _b : res];
|
|
703
|
+
}
|
|
650
704
|
});
|
|
651
705
|
}); },
|
|
652
706
|
/**
|
|
653
|
-
* Removes a reaction (emoji) from a message in a channel.
|
|
707
|
+
* Removes a reaction (emoji) from a message in a channel via V3 API.
|
|
708
|
+
* @param slug The unique workspace slug.
|
|
654
709
|
* @param channelId Unique identifier of the channel containing the message.
|
|
655
710
|
* @param messageId Unique identifier of the message.
|
|
656
711
|
* @param emoji The emoji character to remove.
|
|
657
712
|
* @param options Optional request config override.
|
|
658
|
-
* @returns The reaction removal response returned exactly from the endpoint.
|
|
659
713
|
*/
|
|
660
|
-
removeReaction: function (channelId, messageId, emoji, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
661
|
-
|
|
662
|
-
|
|
714
|
+
removeReaction: function (slug, channelId, messageId, emoji, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
715
|
+
var res;
|
|
716
|
+
var _a;
|
|
717
|
+
return __generator(this, function (_b) {
|
|
718
|
+
switch (_b.label) {
|
|
719
|
+
case 0: return [4 /*yield*/, this.raw.v3WorkspacesControllerRemoveChannelMessageReaction(slug, channelId, messageId, emoji, options)];
|
|
720
|
+
case 1:
|
|
721
|
+
res = (_b.sent());
|
|
722
|
+
return [2 /*return*/, (_a = res === null || res === void 0 ? void 0 : res.data) !== null && _a !== void 0 ? _a : res];
|
|
723
|
+
}
|
|
663
724
|
});
|
|
664
725
|
}); },
|
|
665
726
|
},
|
|
@@ -746,133 +807,198 @@ var ScrymeSDK = /** @class */ (function () {
|
|
|
746
807
|
});
|
|
747
808
|
Object.defineProperty(ScrymeSDK.prototype, "dm", {
|
|
748
809
|
/**
|
|
749
|
-
* Operations for managing direct messages (DMs) and direct message conversations.
|
|
810
|
+
* Operations for managing direct messages (DMs) and direct message conversations via V3 API.
|
|
750
811
|
*/
|
|
751
812
|
get: function () {
|
|
752
813
|
var _this = this;
|
|
753
814
|
return {
|
|
754
815
|
/**
|
|
755
|
-
* Lists all active direct message conversations for the authenticated user.
|
|
816
|
+
* Lists all active direct message conversations for the authenticated user/bot via V3 API.
|
|
756
817
|
* @param options Optional request config override.
|
|
757
|
-
* @returns List of active DM conversations returned exactly from the endpoint.
|
|
758
818
|
*/
|
|
759
819
|
list: function (options) { return __awaiter(_this, void 0, void 0, function () {
|
|
760
|
-
|
|
761
|
-
|
|
820
|
+
var res;
|
|
821
|
+
var _a, _b;
|
|
822
|
+
return __generator(this, function (_c) {
|
|
823
|
+
switch (_c.label) {
|
|
824
|
+
case 0: return [4 /*yield*/, this.raw.v3DmsControllerGetDms(options)];
|
|
825
|
+
case 1:
|
|
826
|
+
res = (_c.sent());
|
|
827
|
+
return [2 /*return*/, (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.conversations) !== null && _b !== void 0 ? _b : res];
|
|
828
|
+
}
|
|
762
829
|
});
|
|
763
830
|
}); },
|
|
764
831
|
/**
|
|
765
|
-
* Creates/initiates a direct message conversation
|
|
832
|
+
* Creates/initiates a direct message conversation via V3 API.
|
|
766
833
|
* @param data Create direct message details containing target participant IDs.
|
|
767
834
|
* @param options Optional request config override.
|
|
768
|
-
* @returns Details of the created DM conversation exactly from the endpoint.
|
|
769
835
|
*/
|
|
770
836
|
create: function (data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
771
|
-
|
|
772
|
-
|
|
837
|
+
var res;
|
|
838
|
+
var _a, _b;
|
|
839
|
+
return __generator(this, function (_c) {
|
|
840
|
+
switch (_c.label) {
|
|
841
|
+
case 0: return [4 /*yield*/, this.raw.v3DmsControllerCreateDm(data, options)];
|
|
842
|
+
case 1:
|
|
843
|
+
res = (_c.sent());
|
|
844
|
+
return [2 /*return*/, (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.conversation) !== null && _b !== void 0 ? _b : res];
|
|
845
|
+
}
|
|
773
846
|
});
|
|
774
847
|
}); },
|
|
775
848
|
/**
|
|
776
|
-
* Retrieves details of a specific direct message conversation.
|
|
849
|
+
* Retrieves details of a specific direct message conversation via V3 API.
|
|
777
850
|
* @param dmId Unique identifier of the direct message conversation.
|
|
778
851
|
* @param options Optional request config override.
|
|
779
|
-
* @returns Detailed direct message conversation object exactly from the endpoint.
|
|
780
852
|
*/
|
|
781
853
|
get: function (dmId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
782
|
-
|
|
783
|
-
|
|
854
|
+
var res;
|
|
855
|
+
var _a, _b;
|
|
856
|
+
return __generator(this, function (_c) {
|
|
857
|
+
switch (_c.label) {
|
|
858
|
+
case 0: return [4 /*yield*/, this.raw.v3DmsControllerGetDm(dmId, options)];
|
|
859
|
+
case 1:
|
|
860
|
+
res = (_c.sent());
|
|
861
|
+
return [2 /*return*/, (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.conversation) !== null && _b !== void 0 ? _b : res];
|
|
862
|
+
}
|
|
784
863
|
});
|
|
785
864
|
}); },
|
|
786
865
|
/**
|
|
787
|
-
* Deletes/closes an active direct message conversation.
|
|
866
|
+
* Deletes/closes an active direct message conversation via V3 API.
|
|
788
867
|
* @param dmId Unique identifier of the direct message conversation to close.
|
|
789
868
|
* @param options Optional request config override.
|
|
790
|
-
* @returns Success status indicating that the DM conversation was deleted exactly from the endpoint.
|
|
791
869
|
*/
|
|
792
870
|
delete: function (dmId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
793
|
-
|
|
794
|
-
|
|
871
|
+
var res;
|
|
872
|
+
var _a;
|
|
873
|
+
return __generator(this, function (_b) {
|
|
874
|
+
switch (_b.label) {
|
|
875
|
+
case 0: return [4 /*yield*/, this.raw.v3DmsControllerDeleteDm(dmId, options)];
|
|
876
|
+
case 1:
|
|
877
|
+
res = (_b.sent());
|
|
878
|
+
return [2 /*return*/, (_a = res === null || res === void 0 ? void 0 : res.data) !== null && _a !== void 0 ? _a : res];
|
|
879
|
+
}
|
|
795
880
|
});
|
|
796
881
|
}); },
|
|
797
882
|
/**
|
|
798
|
-
* Sub-namespace for managing direct messages in a specific DM conversation.
|
|
883
|
+
* Sub-namespace for managing direct messages in a specific DM conversation via V3 API.
|
|
799
884
|
*/
|
|
800
885
|
message: {
|
|
801
886
|
/**
|
|
802
|
-
* Lists messages in a direct message conversation with cursor pagination.
|
|
887
|
+
* Lists messages in a direct message conversation with cursor pagination via V3 API.
|
|
803
888
|
* @param dmId Unique identifier of the direct message conversation.
|
|
804
889
|
* @param params Query parameters for pagination limits, cursors or search filters.
|
|
805
890
|
* @param options Optional request config override.
|
|
806
|
-
* @returns List of direct messages and next pagination cursor exactly from the endpoint.
|
|
807
891
|
*/
|
|
808
892
|
list: function (dmId, params, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
809
|
-
|
|
810
|
-
|
|
893
|
+
var res;
|
|
894
|
+
var _a;
|
|
895
|
+
return __generator(this, function (_b) {
|
|
896
|
+
switch (_b.label) {
|
|
897
|
+
case 0: return [4 /*yield*/, this.raw.v3DmsControllerGetMessages(dmId, params, options)];
|
|
898
|
+
case 1:
|
|
899
|
+
res = (_b.sent());
|
|
900
|
+
return [2 /*return*/, (_a = res === null || res === void 0 ? void 0 : res.data) !== null && _a !== void 0 ? _a : res];
|
|
901
|
+
}
|
|
811
902
|
});
|
|
812
903
|
}); },
|
|
813
904
|
/**
|
|
814
|
-
* Sends a new message in a direct message conversation.
|
|
905
|
+
* Sends a new message in a direct message conversation via V3 API.
|
|
815
906
|
* @param dmId Unique identifier of the direct message conversation.
|
|
816
907
|
* @param data The message content string or structured CreateMessageDto object.
|
|
817
908
|
* @param options Optional request config override.
|
|
818
|
-
* @returns The sent message exactly from the endpoint.
|
|
819
909
|
*/
|
|
820
910
|
create: function (dmId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
821
|
-
var payload;
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
911
|
+
var payload, mergedConfig, res;
|
|
912
|
+
var _a, _b;
|
|
913
|
+
return __generator(this, function (_c) {
|
|
914
|
+
switch (_c.label) {
|
|
915
|
+
case 0:
|
|
916
|
+
payload = typeof data === 'string' ? { content: data } : data;
|
|
917
|
+
mergedConfig = __assign(__assign({}, options), { data: payload });
|
|
918
|
+
return [4 /*yield*/, this.raw.v3DmsControllerCreateMessage(dmId, mergedConfig)];
|
|
919
|
+
case 1:
|
|
920
|
+
res = (_c.sent());
|
|
921
|
+
return [2 /*return*/, (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : res];
|
|
922
|
+
}
|
|
825
923
|
});
|
|
826
924
|
}); },
|
|
827
925
|
/**
|
|
828
|
-
* Updates the content of a previously sent direct message.
|
|
926
|
+
* Updates the content of a previously sent direct message via V3 API.
|
|
829
927
|
* @param dmId Unique identifier of the direct message conversation.
|
|
830
928
|
* @param messageId Unique identifier of the message to update.
|
|
831
929
|
* @param data The new content payload.
|
|
832
930
|
* @param options Optional request config override.
|
|
833
|
-
* @returns The updated message details exactly from the endpoint.
|
|
834
931
|
*/
|
|
835
932
|
update: function (dmId, messageId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
836
|
-
|
|
837
|
-
|
|
933
|
+
var mergedConfig, res;
|
|
934
|
+
var _a, _b;
|
|
935
|
+
return __generator(this, function (_c) {
|
|
936
|
+
switch (_c.label) {
|
|
937
|
+
case 0:
|
|
938
|
+
mergedConfig = __assign(__assign({}, options), { data: data });
|
|
939
|
+
return [4 /*yield*/, this.raw.v3DmsControllerUpdateMessage(dmId, messageId, mergedConfig)];
|
|
940
|
+
case 1:
|
|
941
|
+
res = (_c.sent());
|
|
942
|
+
return [2 /*return*/, (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : res];
|
|
943
|
+
}
|
|
838
944
|
});
|
|
839
945
|
}); },
|
|
840
946
|
/**
|
|
841
|
-
* Permanently deletes a direct message.
|
|
947
|
+
* Permanently deletes a direct message via V3 API.
|
|
842
948
|
* @param dmId Unique identifier of the direct message conversation.
|
|
843
949
|
* @param messageId Unique identifier of the message to delete.
|
|
844
950
|
* @param options Optional request config override.
|
|
845
|
-
* @returns Success status indicating that the message was deleted exactly from the endpoint.
|
|
846
951
|
*/
|
|
847
952
|
delete: function (dmId, messageId, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
848
|
-
|
|
849
|
-
|
|
953
|
+
var res;
|
|
954
|
+
var _a;
|
|
955
|
+
return __generator(this, function (_b) {
|
|
956
|
+
switch (_b.label) {
|
|
957
|
+
case 0: return [4 /*yield*/, this.raw.v3DmsControllerDeleteMessage(dmId, messageId, options)];
|
|
958
|
+
case 1:
|
|
959
|
+
res = (_b.sent());
|
|
960
|
+
return [2 /*return*/, (_a = res === null || res === void 0 ? void 0 : res.data) !== null && _a !== void 0 ? _a : res];
|
|
961
|
+
}
|
|
850
962
|
});
|
|
851
963
|
}); },
|
|
852
964
|
/**
|
|
853
|
-
* Adds a reaction (emoji) to a direct message.
|
|
965
|
+
* Adds a reaction (emoji) to a direct message via V3 API.
|
|
854
966
|
* @param dmId Unique identifier of the direct message conversation.
|
|
855
967
|
* @param messageId Unique identifier of the message.
|
|
856
968
|
* @param data Object containing the target emoji character.
|
|
857
969
|
* @param options Optional request config override.
|
|
858
|
-
* @returns The reaction response returned exactly from the endpoint.
|
|
859
970
|
*/
|
|
860
971
|
addReaction: function (dmId, messageId, data, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
861
|
-
|
|
862
|
-
|
|
972
|
+
var mergedConfig, res;
|
|
973
|
+
var _a, _b;
|
|
974
|
+
return __generator(this, function (_c) {
|
|
975
|
+
switch (_c.label) {
|
|
976
|
+
case 0:
|
|
977
|
+
mergedConfig = __assign(__assign({}, options), { data: data });
|
|
978
|
+
return [4 /*yield*/, this.raw.v3DmsControllerAddReaction(dmId, messageId, mergedConfig)];
|
|
979
|
+
case 1:
|
|
980
|
+
res = (_c.sent());
|
|
981
|
+
return [2 /*return*/, (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.reaction) !== null && _b !== void 0 ? _b : res];
|
|
982
|
+
}
|
|
863
983
|
});
|
|
864
984
|
}); },
|
|
865
985
|
/**
|
|
866
|
-
* Removes a reaction (emoji) from a direct message.
|
|
986
|
+
* Removes a reaction (emoji) from a direct message via V3 API.
|
|
867
987
|
* @param dmId Unique identifier of the direct message conversation.
|
|
868
988
|
* @param messageId Unique identifier of the message.
|
|
869
989
|
* @param emoji The emoji character to remove.
|
|
870
990
|
* @param options Optional request config override.
|
|
871
|
-
* @returns The reaction removal response returned exactly from the endpoint.
|
|
872
991
|
*/
|
|
873
992
|
removeReaction: function (dmId, messageId, emoji, options) { return __awaiter(_this, void 0, void 0, function () {
|
|
874
|
-
|
|
875
|
-
|
|
993
|
+
var res;
|
|
994
|
+
var _a;
|
|
995
|
+
return __generator(this, function (_b) {
|
|
996
|
+
switch (_b.label) {
|
|
997
|
+
case 0: return [4 /*yield*/, this.raw.v3DmsControllerRemoveReaction(dmId, messageId, emoji, options)];
|
|
998
|
+
case 1:
|
|
999
|
+
res = (_b.sent());
|
|
1000
|
+
return [2 /*return*/, (_a = res === null || res === void 0 ? void 0 : res.data) !== null && _a !== void 0 ? _a : res];
|
|
1001
|
+
}
|
|
876
1002
|
});
|
|
877
1003
|
}); },
|
|
878
1004
|
},
|