stream-chat 8.25.0 → 8.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.es.js +800 -30
- package/dist/browser.es.js.map +1 -1
- package/dist/browser.full-bundle.min.js +1 -1
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/browser.js +799 -29
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +800 -30
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +799 -29
- package/dist/index.js.map +1 -1
- package/dist/types/channel.d.ts +11 -1
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/channel_state.d.ts +5 -1
- package/dist/types/channel_state.d.ts.map +1 -1
- package/dist/types/client.d.ts +108 -1
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/events.d.ts +5 -0
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/thread.d.ts +1 -0
- package/dist/types/thread.d.ts.map +1 -1
- package/dist/types/types.d.ts +210 -1
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/channel.ts +41 -0
- package/src/channel_state.ts +92 -0
- package/src/client.ts +206 -13
- package/src/events.ts +5 -0
- package/src/thread.ts +22 -8
- package/src/types.ts +292 -3
package/dist/index.js
CHANGED
|
@@ -532,6 +532,111 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
532
532
|
};
|
|
533
533
|
});
|
|
534
534
|
|
|
535
|
+
_defineProperty__default['default'](this, "updatePollVote", function (pollVote, poll, messageId) {
|
|
536
|
+
var message = _this.findMessage(messageId);
|
|
537
|
+
|
|
538
|
+
if (!message) return;
|
|
539
|
+
if (message.poll_id !== pollVote.poll_id) return;
|
|
540
|
+
|
|
541
|
+
var updatedPoll = _objectSpread$7({}, poll);
|
|
542
|
+
|
|
543
|
+
var ownVotes = _toConsumableArray__default['default'](message.poll.own_votes || []);
|
|
544
|
+
|
|
545
|
+
if (pollVote.user_id === _this._channel.getClient().userID) {
|
|
546
|
+
if (pollVote.option_id && poll.enforce_unique_vote) {
|
|
547
|
+
// remove all previous votes where option_id is not empty
|
|
548
|
+
ownVotes = ownVotes.filter(function (vote) {
|
|
549
|
+
return !vote.option_id;
|
|
550
|
+
});
|
|
551
|
+
} else if (pollVote.answer_text) {
|
|
552
|
+
// remove all previous votes where option_id is empty
|
|
553
|
+
ownVotes = ownVotes.filter(function (vote) {
|
|
554
|
+
return vote.answer_text;
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
ownVotes.push(pollVote);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
updatedPoll.own_votes = ownVotes;
|
|
562
|
+
|
|
563
|
+
var newMessage = _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
564
|
+
poll: updatedPoll
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
_this.addMessageSorted(newMessage, false, false);
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
_defineProperty__default['default'](this, "addPollVote", function (pollVote, poll, messageId) {
|
|
571
|
+
var message = _this.findMessage(messageId);
|
|
572
|
+
|
|
573
|
+
if (!message) return;
|
|
574
|
+
if (message.poll_id !== pollVote.poll_id) return;
|
|
575
|
+
|
|
576
|
+
var updatedPoll = _objectSpread$7({}, poll);
|
|
577
|
+
|
|
578
|
+
var ownVotes = _toConsumableArray__default['default'](message.poll.own_votes || []);
|
|
579
|
+
|
|
580
|
+
if (pollVote.user_id === _this._channel.getClient().userID) {
|
|
581
|
+
ownVotes.push(pollVote);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
updatedPoll.own_votes = ownVotes;
|
|
585
|
+
|
|
586
|
+
var newMessage = _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
587
|
+
poll: updatedPoll
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
_this.addMessageSorted(newMessage, false, false);
|
|
591
|
+
});
|
|
592
|
+
|
|
593
|
+
_defineProperty__default['default'](this, "removePollVote", function (pollVote, poll, messageId) {
|
|
594
|
+
var message = _this.findMessage(messageId);
|
|
595
|
+
|
|
596
|
+
if (!message) return;
|
|
597
|
+
if (message.poll_id !== pollVote.poll_id) return;
|
|
598
|
+
|
|
599
|
+
var updatedPoll = _objectSpread$7({}, poll);
|
|
600
|
+
|
|
601
|
+
var ownVotes = _toConsumableArray__default['default'](message.poll.own_votes || []);
|
|
602
|
+
|
|
603
|
+
if (pollVote.user_id === _this._channel.getClient().userID) {
|
|
604
|
+
var index = ownVotes.findIndex(function (vote) {
|
|
605
|
+
return vote.option_id === pollVote.option_id;
|
|
606
|
+
});
|
|
607
|
+
|
|
608
|
+
if (index > -1) {
|
|
609
|
+
ownVotes.splice(index, 1);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
updatedPoll.own_votes = ownVotes;
|
|
614
|
+
|
|
615
|
+
var newMessage = _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
616
|
+
poll: updatedPoll
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
_this.addMessageSorted(newMessage, false, false);
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
_defineProperty__default['default'](this, "updatePoll", function (poll, messageId) {
|
|
623
|
+
var _message$poll;
|
|
624
|
+
|
|
625
|
+
var message = _this.findMessage(messageId);
|
|
626
|
+
|
|
627
|
+
if (!message) return;
|
|
628
|
+
|
|
629
|
+
var updatedPoll = _objectSpread$7(_objectSpread$7({}, poll), {}, {
|
|
630
|
+
own_votes: _toConsumableArray__default['default'](((_message$poll = message.poll) === null || _message$poll === void 0 ? void 0 : _message$poll.own_votes) || [])
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
var newMessage = _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
634
|
+
poll: updatedPoll
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
_this.addMessageSorted(newMessage, false, false);
|
|
638
|
+
});
|
|
639
|
+
|
|
535
640
|
_defineProperty__default['default'](this, "updateUserMessages", function (user) {
|
|
536
641
|
var _updateUserMessages = function _updateUserMessages(messages, user) {
|
|
537
642
|
for (var i = 0; i < messages.length; i++) {
|
|
@@ -3174,7 +3279,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3174
3279
|
if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
|
|
3175
3280
|
if (message.type === 'system') return false; // Return false if channel doesn't allow read events.
|
|
3176
3281
|
|
|
3177
|
-
if (Array.isArray((_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.own_capabilities) && !((_this$data5 = this.data) !== null && _this$data5 !== void 0 && _this$data5.own_capabilities.includes('read-events'))) return false;
|
|
3282
|
+
if (Array.isArray((_this$data4 = this.data) === null || _this$data4 === void 0 ? void 0 : _this$data4.own_capabilities) && !((_this$data5 = this.data) !== null && _this$data5 !== void 0 && _this$data5.own_capabilities.includes('read-events'))) return false; // FIXME: see #1265, adjust and count new messages even when the channel is muted
|
|
3283
|
+
|
|
3178
3284
|
if (this.muteStatus().muted) return false;
|
|
3179
3285
|
return true;
|
|
3180
3286
|
}
|
|
@@ -3635,6 +3741,69 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3635
3741
|
|
|
3636
3742
|
return createCall;
|
|
3637
3743
|
}()
|
|
3744
|
+
/**
|
|
3745
|
+
* Cast or cancel one or more votes on a poll
|
|
3746
|
+
* @param pollId string The poll id
|
|
3747
|
+
* @param votes PollVoteData[] The votes that will be casted (or canceled in case of an empty array)
|
|
3748
|
+
* @returns {APIResponse & PollVoteResponse} The poll votes
|
|
3749
|
+
*/
|
|
3750
|
+
|
|
3751
|
+
}, {
|
|
3752
|
+
key: "vote",
|
|
3753
|
+
value: function () {
|
|
3754
|
+
var _vote2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee40(messageId, pollId, _vote) {
|
|
3755
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee40$(_context40) {
|
|
3756
|
+
while (1) {
|
|
3757
|
+
switch (_context40.prev = _context40.next) {
|
|
3758
|
+
case 0:
|
|
3759
|
+
_context40.next = 2;
|
|
3760
|
+
return this.getClient().castPollVote(messageId, pollId, _vote);
|
|
3761
|
+
|
|
3762
|
+
case 2:
|
|
3763
|
+
return _context40.abrupt("return", _context40.sent);
|
|
3764
|
+
|
|
3765
|
+
case 3:
|
|
3766
|
+
case "end":
|
|
3767
|
+
return _context40.stop();
|
|
3768
|
+
}
|
|
3769
|
+
}
|
|
3770
|
+
}, _callee40, this);
|
|
3771
|
+
}));
|
|
3772
|
+
|
|
3773
|
+
function vote(_x42, _x43, _x44) {
|
|
3774
|
+
return _vote2.apply(this, arguments);
|
|
3775
|
+
}
|
|
3776
|
+
|
|
3777
|
+
return vote;
|
|
3778
|
+
}()
|
|
3779
|
+
}, {
|
|
3780
|
+
key: "removeVote",
|
|
3781
|
+
value: function () {
|
|
3782
|
+
var _removeVote = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee41(messageId, pollId, voteId) {
|
|
3783
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee41$(_context41) {
|
|
3784
|
+
while (1) {
|
|
3785
|
+
switch (_context41.prev = _context41.next) {
|
|
3786
|
+
case 0:
|
|
3787
|
+
_context41.next = 2;
|
|
3788
|
+
return this.getClient().removePollVote(messageId, pollId, voteId);
|
|
3789
|
+
|
|
3790
|
+
case 2:
|
|
3791
|
+
return _context41.abrupt("return", _context41.sent);
|
|
3792
|
+
|
|
3793
|
+
case 3:
|
|
3794
|
+
case "end":
|
|
3795
|
+
return _context41.stop();
|
|
3796
|
+
}
|
|
3797
|
+
}
|
|
3798
|
+
}, _callee41, this);
|
|
3799
|
+
}));
|
|
3800
|
+
|
|
3801
|
+
function removeVote(_x45, _x46, _x47) {
|
|
3802
|
+
return _removeVote.apply(this, arguments);
|
|
3803
|
+
}
|
|
3804
|
+
|
|
3805
|
+
return removeVote;
|
|
3806
|
+
}()
|
|
3638
3807
|
/**
|
|
3639
3808
|
* on - Listen to events on this channel.
|
|
3640
3809
|
*
|
|
@@ -3933,6 +4102,49 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3933
4102
|
|
|
3934
4103
|
break;
|
|
3935
4104
|
|
|
4105
|
+
case 'poll.updated':
|
|
4106
|
+
if (event.poll) {
|
|
4107
|
+
var _event$message;
|
|
4108
|
+
|
|
4109
|
+
channelState.updatePoll(event.poll, ((_event$message = event.message) === null || _event$message === void 0 ? void 0 : _event$message.id) || '');
|
|
4110
|
+
}
|
|
4111
|
+
|
|
4112
|
+
break;
|
|
4113
|
+
|
|
4114
|
+
case 'poll.vote_casted':
|
|
4115
|
+
if (event.poll_vote && event.poll) {
|
|
4116
|
+
var _event$message2;
|
|
4117
|
+
|
|
4118
|
+
channelState.addPollVote(event.poll_vote, event.poll, ((_event$message2 = event.message) === null || _event$message2 === void 0 ? void 0 : _event$message2.id) || '');
|
|
4119
|
+
}
|
|
4120
|
+
|
|
4121
|
+
break;
|
|
4122
|
+
|
|
4123
|
+
case 'poll.vote_changed':
|
|
4124
|
+
if (event.poll_vote && event.poll) {
|
|
4125
|
+
var _event$message3;
|
|
4126
|
+
|
|
4127
|
+
channelState.updatePollVote(event.poll_vote, event.poll, ((_event$message3 = event.message) === null || _event$message3 === void 0 ? void 0 : _event$message3.id) || '');
|
|
4128
|
+
}
|
|
4129
|
+
|
|
4130
|
+
break;
|
|
4131
|
+
|
|
4132
|
+
case 'poll.vote_removed':
|
|
4133
|
+
if (event.poll_vote && event.poll) {
|
|
4134
|
+
var _event$message4;
|
|
4135
|
+
|
|
4136
|
+
channelState.removePollVote(event.poll_vote, event.poll, ((_event$message4 = event.message) === null || _event$message4 === void 0 ? void 0 : _event$message4.id) || '');
|
|
4137
|
+
}
|
|
4138
|
+
|
|
4139
|
+
break;
|
|
4140
|
+
|
|
4141
|
+
case 'poll.closed':
|
|
4142
|
+
if (event.message) {
|
|
4143
|
+
channelState.addMessageSorted(event.message, false, false);
|
|
4144
|
+
}
|
|
4145
|
+
|
|
4146
|
+
break;
|
|
4147
|
+
|
|
3936
4148
|
case 'reaction.new':
|
|
3937
4149
|
if (event.message && event.reaction) {
|
|
3938
4150
|
event.message = channelState.addReaction(event.reaction, event.message);
|
|
@@ -6616,8 +6828,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
6616
6828
|
DeleteUserOptions specifies a collection of one or more `user_ids` to be deleted.
|
|
6617
6829
|
|
|
6618
6830
|
`user`:
|
|
6619
|
-
- soft: marks user as deleted and retains all user data
|
|
6620
|
-
- pruning: marks user as deleted and nullifies user information
|
|
6831
|
+
- soft: marks user as deleted and retains all user data
|
|
6832
|
+
- pruning: marks user as deleted and nullifies user information
|
|
6621
6833
|
- hard: deletes user completely - this requires hard option for messages and conversation as well
|
|
6622
6834
|
`conversations`:
|
|
6623
6835
|
- soft: marks all conversation channels as deleted (same effect as Delete Channels with 'hard' option disabled)
|
|
@@ -6656,6 +6868,14 @@ var ErrorFromResponse = /*#__PURE__*/function (_Error) {
|
|
|
6656
6868
|
|
|
6657
6869
|
return ErrorFromResponse;
|
|
6658
6870
|
}( /*#__PURE__*/_wrapNativeSuper__default['default'](Error));
|
|
6871
|
+
exports.VotingVisibility = void 0;
|
|
6872
|
+
|
|
6873
|
+
(function (VotingVisibility) {
|
|
6874
|
+
VotingVisibility["anonymous"] = "anonymous";
|
|
6875
|
+
VotingVisibility["public"] = "public";
|
|
6876
|
+
})(exports.VotingVisibility || (exports.VotingVisibility = {}));
|
|
6877
|
+
|
|
6878
|
+
var _excluded$1 = ["parent_message_id", "parent_message", "latest_replies", "thread_participants", "reply_count", "channel", "read"];
|
|
6659
6879
|
|
|
6660
6880
|
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6661
6881
|
|
|
@@ -6667,6 +6887,7 @@ function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o
|
|
|
6667
6887
|
|
|
6668
6888
|
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
6669
6889
|
var Thread = /*#__PURE__*/function () {
|
|
6890
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6670
6891
|
function Thread(client, t) {
|
|
6671
6892
|
_classCallCheck__default['default'](this, Thread);
|
|
6672
6893
|
|
|
@@ -6688,17 +6909,28 @@ var Thread = /*#__PURE__*/function () {
|
|
|
6688
6909
|
|
|
6689
6910
|
_defineProperty__default['default'](this, "read", {});
|
|
6690
6911
|
|
|
6691
|
-
this
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6912
|
+
_defineProperty__default['default'](this, "data", {});
|
|
6913
|
+
|
|
6914
|
+
var parent_message_id = t.parent_message_id,
|
|
6915
|
+
parent_message = t.parent_message,
|
|
6916
|
+
latest_replies = t.latest_replies,
|
|
6917
|
+
thread_participants = t.thread_participants,
|
|
6918
|
+
reply_count = t.reply_count,
|
|
6919
|
+
channel = t.channel,
|
|
6920
|
+
read = t.read,
|
|
6921
|
+
data = _objectWithoutProperties__default['default'](t, _excluded$1);
|
|
6922
|
+
|
|
6923
|
+
this.id = parent_message_id;
|
|
6924
|
+
this.message = formatMessage(parent_message);
|
|
6925
|
+
this.latestReplies = latest_replies.map(formatMessage);
|
|
6926
|
+
this.participants = thread_participants;
|
|
6927
|
+
this.replyCount = reply_count;
|
|
6928
|
+
this.channel = channel;
|
|
6697
6929
|
this._channel = client.channel(t.channel.type, t.channel.id);
|
|
6698
6930
|
this._client = client;
|
|
6699
6931
|
|
|
6700
|
-
if (
|
|
6701
|
-
var _iterator = _createForOfIteratorHelper$1(
|
|
6932
|
+
if (read) {
|
|
6933
|
+
var _iterator = _createForOfIteratorHelper$1(read),
|
|
6702
6934
|
_step;
|
|
6703
6935
|
|
|
6704
6936
|
try {
|
|
@@ -6714,6 +6946,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
6714
6946
|
_iterator.f();
|
|
6715
6947
|
}
|
|
6716
6948
|
}
|
|
6949
|
+
|
|
6950
|
+
this.data = data;
|
|
6717
6951
|
}
|
|
6718
6952
|
|
|
6719
6953
|
_createClass__default['default'](Thread, [{
|
|
@@ -8418,8 +8652,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8418
8652
|
key: "_handleClientEvent",
|
|
8419
8653
|
value: function _handleClientEvent(event) {
|
|
8420
8654
|
var _event$me,
|
|
8421
|
-
|
|
8422
|
-
|
|
8655
|
+
_event$me2,
|
|
8656
|
+
_this3 = this;
|
|
8423
8657
|
|
|
8424
8658
|
var client = this;
|
|
8425
8659
|
var postListenerCallbacks = [];
|
|
@@ -8444,21 +8678,6 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8444
8678
|
}
|
|
8445
8679
|
|
|
8446
8680
|
if (event.type === 'notification.channel_mutes_updated' && (_event$me = event.me) !== null && _event$me !== void 0 && _event$me.channel_mutes) {
|
|
8447
|
-
var currentMutedChannelIds = [];
|
|
8448
|
-
var nextMutedChannelIds = [];
|
|
8449
|
-
this.mutedChannels.forEach(function (mute) {
|
|
8450
|
-
return mute.channel && currentMutedChannelIds.push(mute.channel.cid);
|
|
8451
|
-
});
|
|
8452
|
-
event.me.channel_mutes.forEach(function (mute) {
|
|
8453
|
-
return mute.channel && nextMutedChannelIds.push(mute.channel.cid);
|
|
8454
|
-
});
|
|
8455
|
-
/** Set the unread count of un-muted channels to 0, which is the behaviour of backend */
|
|
8456
|
-
|
|
8457
|
-
currentMutedChannelIds.forEach(function (cid) {
|
|
8458
|
-
if (!nextMutedChannelIds.includes(cid) && _this3.activeChannels[cid]) {
|
|
8459
|
-
_this3.activeChannels[cid].state.unreadCount = 0;
|
|
8460
|
-
}
|
|
8461
|
-
});
|
|
8462
8681
|
this.mutedChannels = event.me.channel_mutes;
|
|
8463
8682
|
}
|
|
8464
8683
|
|
|
@@ -11145,7 +11364,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11145
11364
|
}, {
|
|
11146
11365
|
key: "getUserAgent",
|
|
11147
11366
|
value: function getUserAgent() {
|
|
11148
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
11367
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.26.0");
|
|
11149
11368
|
}
|
|
11150
11369
|
}, {
|
|
11151
11370
|
key: "setUserAgent",
|
|
@@ -12587,6 +12806,552 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12587
12806
|
|
|
12588
12807
|
return commitMessage;
|
|
12589
12808
|
}()
|
|
12809
|
+
/**
|
|
12810
|
+
* Creates a poll
|
|
12811
|
+
* @param params PollData The poll that will be created
|
|
12812
|
+
* @returns {APIResponse & CreatePollAPIResponse} The poll
|
|
12813
|
+
*/
|
|
12814
|
+
|
|
12815
|
+
}, {
|
|
12816
|
+
key: "createPoll",
|
|
12817
|
+
value: function () {
|
|
12818
|
+
var _createPoll = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee94(poll) {
|
|
12819
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee94$(_context94) {
|
|
12820
|
+
while (1) {
|
|
12821
|
+
switch (_context94.prev = _context94.next) {
|
|
12822
|
+
case 0:
|
|
12823
|
+
_context94.next = 2;
|
|
12824
|
+
return this.post(this.baseURL + "/polls", poll);
|
|
12825
|
+
|
|
12826
|
+
case 2:
|
|
12827
|
+
return _context94.abrupt("return", _context94.sent);
|
|
12828
|
+
|
|
12829
|
+
case 3:
|
|
12830
|
+
case "end":
|
|
12831
|
+
return _context94.stop();
|
|
12832
|
+
}
|
|
12833
|
+
}
|
|
12834
|
+
}, _callee94, this);
|
|
12835
|
+
}));
|
|
12836
|
+
|
|
12837
|
+
function createPoll(_x129) {
|
|
12838
|
+
return _createPoll.apply(this, arguments);
|
|
12839
|
+
}
|
|
12840
|
+
|
|
12841
|
+
return createPoll;
|
|
12842
|
+
}()
|
|
12843
|
+
/**
|
|
12844
|
+
* Retrieves a poll
|
|
12845
|
+
* @param id string The poll id
|
|
12846
|
+
* @returns {APIResponse & GetPollAPIResponse} The poll
|
|
12847
|
+
*/
|
|
12848
|
+
|
|
12849
|
+
}, {
|
|
12850
|
+
key: "getPoll",
|
|
12851
|
+
value: function () {
|
|
12852
|
+
var _getPoll = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee95(id, userId) {
|
|
12853
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee95$(_context95) {
|
|
12854
|
+
while (1) {
|
|
12855
|
+
switch (_context95.prev = _context95.next) {
|
|
12856
|
+
case 0:
|
|
12857
|
+
_context95.next = 2;
|
|
12858
|
+
return this.get(this.baseURL + "/polls/".concat(id), _objectSpread({}, userId ? {
|
|
12859
|
+
user_id: userId
|
|
12860
|
+
} : {}));
|
|
12861
|
+
|
|
12862
|
+
case 2:
|
|
12863
|
+
return _context95.abrupt("return", _context95.sent);
|
|
12864
|
+
|
|
12865
|
+
case 3:
|
|
12866
|
+
case "end":
|
|
12867
|
+
return _context95.stop();
|
|
12868
|
+
}
|
|
12869
|
+
}
|
|
12870
|
+
}, _callee95, this);
|
|
12871
|
+
}));
|
|
12872
|
+
|
|
12873
|
+
function getPoll(_x130, _x131) {
|
|
12874
|
+
return _getPoll.apply(this, arguments);
|
|
12875
|
+
}
|
|
12876
|
+
|
|
12877
|
+
return getPoll;
|
|
12878
|
+
}()
|
|
12879
|
+
/**
|
|
12880
|
+
* Updates a poll
|
|
12881
|
+
* @param poll PollData The poll that will be updated
|
|
12882
|
+
* @returns {APIResponse & PollResponse} The poll
|
|
12883
|
+
*/
|
|
12884
|
+
|
|
12885
|
+
}, {
|
|
12886
|
+
key: "updatePoll",
|
|
12887
|
+
value: function () {
|
|
12888
|
+
var _updatePoll = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee96(poll) {
|
|
12889
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee96$(_context96) {
|
|
12890
|
+
while (1) {
|
|
12891
|
+
switch (_context96.prev = _context96.next) {
|
|
12892
|
+
case 0:
|
|
12893
|
+
_context96.next = 2;
|
|
12894
|
+
return this.put(this.baseURL + "/polls", poll);
|
|
12895
|
+
|
|
12896
|
+
case 2:
|
|
12897
|
+
return _context96.abrupt("return", _context96.sent);
|
|
12898
|
+
|
|
12899
|
+
case 3:
|
|
12900
|
+
case "end":
|
|
12901
|
+
return _context96.stop();
|
|
12902
|
+
}
|
|
12903
|
+
}
|
|
12904
|
+
}, _callee96, this);
|
|
12905
|
+
}));
|
|
12906
|
+
|
|
12907
|
+
function updatePoll(_x132) {
|
|
12908
|
+
return _updatePoll.apply(this, arguments);
|
|
12909
|
+
}
|
|
12910
|
+
|
|
12911
|
+
return updatePoll;
|
|
12912
|
+
}()
|
|
12913
|
+
/**
|
|
12914
|
+
* Partially updates a poll
|
|
12915
|
+
* @param id string The poll id
|
|
12916
|
+
* @param {PartialPollUpdate<StreamChatGenerics>} partialPollObject which should contain id and any of "set" or "unset" params;
|
|
12917
|
+
* example: {id: "44f26af5-f2be-4fa7-9dac-71cf893781de", set:{field: value}, unset:["field2"]}
|
|
12918
|
+
* @returns {APIResponse & UpdatePollAPIResponse} The poll
|
|
12919
|
+
*/
|
|
12920
|
+
|
|
12921
|
+
}, {
|
|
12922
|
+
key: "partialUpdatePoll",
|
|
12923
|
+
value: function () {
|
|
12924
|
+
var _partialUpdatePoll = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee97(id, partialPollObject) {
|
|
12925
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee97$(_context97) {
|
|
12926
|
+
while (1) {
|
|
12927
|
+
switch (_context97.prev = _context97.next) {
|
|
12928
|
+
case 0:
|
|
12929
|
+
_context97.next = 2;
|
|
12930
|
+
return this.patch(this.baseURL + "/polls/".concat(id), partialPollObject);
|
|
12931
|
+
|
|
12932
|
+
case 2:
|
|
12933
|
+
return _context97.abrupt("return", _context97.sent);
|
|
12934
|
+
|
|
12935
|
+
case 3:
|
|
12936
|
+
case "end":
|
|
12937
|
+
return _context97.stop();
|
|
12938
|
+
}
|
|
12939
|
+
}
|
|
12940
|
+
}, _callee97, this);
|
|
12941
|
+
}));
|
|
12942
|
+
|
|
12943
|
+
function partialUpdatePoll(_x133, _x134) {
|
|
12944
|
+
return _partialUpdatePoll.apply(this, arguments);
|
|
12945
|
+
}
|
|
12946
|
+
|
|
12947
|
+
return partialUpdatePoll;
|
|
12948
|
+
}()
|
|
12949
|
+
/**
|
|
12950
|
+
* Delete a poll
|
|
12951
|
+
* @param id string The poll id
|
|
12952
|
+
* @param userId string The user id (only serverside)
|
|
12953
|
+
* @returns
|
|
12954
|
+
*/
|
|
12955
|
+
|
|
12956
|
+
}, {
|
|
12957
|
+
key: "deletePoll",
|
|
12958
|
+
value: function () {
|
|
12959
|
+
var _deletePoll = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee98(id, userId) {
|
|
12960
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee98$(_context98) {
|
|
12961
|
+
while (1) {
|
|
12962
|
+
switch (_context98.prev = _context98.next) {
|
|
12963
|
+
case 0:
|
|
12964
|
+
_context98.next = 2;
|
|
12965
|
+
return this.delete(this.baseURL + "/polls/".concat(id), _objectSpread({}, userId ? {
|
|
12966
|
+
user_id: userId
|
|
12967
|
+
} : {}));
|
|
12968
|
+
|
|
12969
|
+
case 2:
|
|
12970
|
+
return _context98.abrupt("return", _context98.sent);
|
|
12971
|
+
|
|
12972
|
+
case 3:
|
|
12973
|
+
case "end":
|
|
12974
|
+
return _context98.stop();
|
|
12975
|
+
}
|
|
12976
|
+
}
|
|
12977
|
+
}, _callee98, this);
|
|
12978
|
+
}));
|
|
12979
|
+
|
|
12980
|
+
function deletePoll(_x135, _x136) {
|
|
12981
|
+
return _deletePoll.apply(this, arguments);
|
|
12982
|
+
}
|
|
12983
|
+
|
|
12984
|
+
return deletePoll;
|
|
12985
|
+
}()
|
|
12986
|
+
/**
|
|
12987
|
+
* Close a poll
|
|
12988
|
+
* @param id string The poll id
|
|
12989
|
+
* @returns {APIResponse & UpdatePollAPIResponse} The poll
|
|
12990
|
+
*/
|
|
12991
|
+
|
|
12992
|
+
}, {
|
|
12993
|
+
key: "closePoll",
|
|
12994
|
+
value: function () {
|
|
12995
|
+
var _closePoll = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee99(id) {
|
|
12996
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee99$(_context99) {
|
|
12997
|
+
while (1) {
|
|
12998
|
+
switch (_context99.prev = _context99.next) {
|
|
12999
|
+
case 0:
|
|
13000
|
+
return _context99.abrupt("return", this.partialUpdatePoll(id, {
|
|
13001
|
+
set: {
|
|
13002
|
+
is_closed: true
|
|
13003
|
+
}
|
|
13004
|
+
}));
|
|
13005
|
+
|
|
13006
|
+
case 1:
|
|
13007
|
+
case "end":
|
|
13008
|
+
return _context99.stop();
|
|
13009
|
+
}
|
|
13010
|
+
}
|
|
13011
|
+
}, _callee99, this);
|
|
13012
|
+
}));
|
|
13013
|
+
|
|
13014
|
+
function closePoll(_x137) {
|
|
13015
|
+
return _closePoll.apply(this, arguments);
|
|
13016
|
+
}
|
|
13017
|
+
|
|
13018
|
+
return closePoll;
|
|
13019
|
+
}()
|
|
13020
|
+
/**
|
|
13021
|
+
* Creates a poll option
|
|
13022
|
+
* @param pollId string The poll id
|
|
13023
|
+
* @param option PollOptionData The poll option that will be created
|
|
13024
|
+
* @returns {APIResponse & PollOptionResponse} The poll option
|
|
13025
|
+
*/
|
|
13026
|
+
|
|
13027
|
+
}, {
|
|
13028
|
+
key: "createPollOption",
|
|
13029
|
+
value: function () {
|
|
13030
|
+
var _createPollOption = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee100(pollId, option) {
|
|
13031
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee100$(_context100) {
|
|
13032
|
+
while (1) {
|
|
13033
|
+
switch (_context100.prev = _context100.next) {
|
|
13034
|
+
case 0:
|
|
13035
|
+
_context100.next = 2;
|
|
13036
|
+
return this.post(this.baseURL + "/polls/".concat(pollId, "/options"), option);
|
|
13037
|
+
|
|
13038
|
+
case 2:
|
|
13039
|
+
return _context100.abrupt("return", _context100.sent);
|
|
13040
|
+
|
|
13041
|
+
case 3:
|
|
13042
|
+
case "end":
|
|
13043
|
+
return _context100.stop();
|
|
13044
|
+
}
|
|
13045
|
+
}
|
|
13046
|
+
}, _callee100, this);
|
|
13047
|
+
}));
|
|
13048
|
+
|
|
13049
|
+
function createPollOption(_x138, _x139) {
|
|
13050
|
+
return _createPollOption.apply(this, arguments);
|
|
13051
|
+
}
|
|
13052
|
+
|
|
13053
|
+
return createPollOption;
|
|
13054
|
+
}()
|
|
13055
|
+
/**
|
|
13056
|
+
* Retrieves a poll option
|
|
13057
|
+
* @param pollId string The poll id
|
|
13058
|
+
* @param optionId string The poll option id
|
|
13059
|
+
* @returns {APIResponse & PollOptionResponse} The poll option
|
|
13060
|
+
*/
|
|
13061
|
+
|
|
13062
|
+
}, {
|
|
13063
|
+
key: "getPollOption",
|
|
13064
|
+
value: function () {
|
|
13065
|
+
var _getPollOption = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee101(pollId, optionId) {
|
|
13066
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee101$(_context101) {
|
|
13067
|
+
while (1) {
|
|
13068
|
+
switch (_context101.prev = _context101.next) {
|
|
13069
|
+
case 0:
|
|
13070
|
+
_context101.next = 2;
|
|
13071
|
+
return this.get(this.baseURL + "/polls/".concat(pollId, "/options/").concat(optionId));
|
|
13072
|
+
|
|
13073
|
+
case 2:
|
|
13074
|
+
return _context101.abrupt("return", _context101.sent);
|
|
13075
|
+
|
|
13076
|
+
case 3:
|
|
13077
|
+
case "end":
|
|
13078
|
+
return _context101.stop();
|
|
13079
|
+
}
|
|
13080
|
+
}
|
|
13081
|
+
}, _callee101, this);
|
|
13082
|
+
}));
|
|
13083
|
+
|
|
13084
|
+
function getPollOption(_x140, _x141) {
|
|
13085
|
+
return _getPollOption.apply(this, arguments);
|
|
13086
|
+
}
|
|
13087
|
+
|
|
13088
|
+
return getPollOption;
|
|
13089
|
+
}()
|
|
13090
|
+
/**
|
|
13091
|
+
* Updates a poll option
|
|
13092
|
+
* @param pollId string The poll id
|
|
13093
|
+
* @param option PollOptionData The poll option that will be updated
|
|
13094
|
+
* @returns
|
|
13095
|
+
*/
|
|
13096
|
+
|
|
13097
|
+
}, {
|
|
13098
|
+
key: "updatePollOption",
|
|
13099
|
+
value: function () {
|
|
13100
|
+
var _updatePollOption = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee102(pollId, option) {
|
|
13101
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee102$(_context102) {
|
|
13102
|
+
while (1) {
|
|
13103
|
+
switch (_context102.prev = _context102.next) {
|
|
13104
|
+
case 0:
|
|
13105
|
+
_context102.next = 2;
|
|
13106
|
+
return this.put(this.baseURL + "/polls/".concat(pollId, "/options"), option);
|
|
13107
|
+
|
|
13108
|
+
case 2:
|
|
13109
|
+
return _context102.abrupt("return", _context102.sent);
|
|
13110
|
+
|
|
13111
|
+
case 3:
|
|
13112
|
+
case "end":
|
|
13113
|
+
return _context102.stop();
|
|
13114
|
+
}
|
|
13115
|
+
}
|
|
13116
|
+
}, _callee102, this);
|
|
13117
|
+
}));
|
|
13118
|
+
|
|
13119
|
+
function updatePollOption(_x142, _x143) {
|
|
13120
|
+
return _updatePollOption.apply(this, arguments);
|
|
13121
|
+
}
|
|
13122
|
+
|
|
13123
|
+
return updatePollOption;
|
|
13124
|
+
}()
|
|
13125
|
+
/**
|
|
13126
|
+
* Delete a poll option
|
|
13127
|
+
* @param pollId string The poll id
|
|
13128
|
+
* @param optionId string The poll option id
|
|
13129
|
+
* @returns {APIResponse} The poll option
|
|
13130
|
+
*/
|
|
13131
|
+
|
|
13132
|
+
}, {
|
|
13133
|
+
key: "deletePollOption",
|
|
13134
|
+
value: function () {
|
|
13135
|
+
var _deletePollOption = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee103(pollId, optionId) {
|
|
13136
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee103$(_context103) {
|
|
13137
|
+
while (1) {
|
|
13138
|
+
switch (_context103.prev = _context103.next) {
|
|
13139
|
+
case 0:
|
|
13140
|
+
_context103.next = 2;
|
|
13141
|
+
return this.delete(this.baseURL + "/polls/".concat(pollId, "/options/").concat(optionId));
|
|
13142
|
+
|
|
13143
|
+
case 2:
|
|
13144
|
+
return _context103.abrupt("return", _context103.sent);
|
|
13145
|
+
|
|
13146
|
+
case 3:
|
|
13147
|
+
case "end":
|
|
13148
|
+
return _context103.stop();
|
|
13149
|
+
}
|
|
13150
|
+
}
|
|
13151
|
+
}, _callee103, this);
|
|
13152
|
+
}));
|
|
13153
|
+
|
|
13154
|
+
function deletePollOption(_x144, _x145) {
|
|
13155
|
+
return _deletePollOption.apply(this, arguments);
|
|
13156
|
+
}
|
|
13157
|
+
|
|
13158
|
+
return deletePollOption;
|
|
13159
|
+
}()
|
|
13160
|
+
/**
|
|
13161
|
+
* Cast vote on a poll
|
|
13162
|
+
* @param messageId string The message id
|
|
13163
|
+
* @param pollId string The poll id
|
|
13164
|
+
* @param vote PollVoteData The vote that will be casted
|
|
13165
|
+
* @returns {APIResponse & CastVoteAPIResponse} The poll vote
|
|
13166
|
+
*/
|
|
13167
|
+
|
|
13168
|
+
}, {
|
|
13169
|
+
key: "castPollVote",
|
|
13170
|
+
value: function () {
|
|
13171
|
+
var _castPollVote = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee104(messageId, pollId, vote) {
|
|
13172
|
+
var options,
|
|
13173
|
+
_args104 = arguments;
|
|
13174
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee104$(_context104) {
|
|
13175
|
+
while (1) {
|
|
13176
|
+
switch (_context104.prev = _context104.next) {
|
|
13177
|
+
case 0:
|
|
13178
|
+
options = _args104.length > 3 && _args104[3] !== undefined ? _args104[3] : {};
|
|
13179
|
+
_context104.next = 3;
|
|
13180
|
+
return this.post(this.baseURL + "/messages/".concat(messageId, "/polls/").concat(pollId, "/vote"), _objectSpread({
|
|
13181
|
+
vote: vote
|
|
13182
|
+
}, options));
|
|
13183
|
+
|
|
13184
|
+
case 3:
|
|
13185
|
+
return _context104.abrupt("return", _context104.sent);
|
|
13186
|
+
|
|
13187
|
+
case 4:
|
|
13188
|
+
case "end":
|
|
13189
|
+
return _context104.stop();
|
|
13190
|
+
}
|
|
13191
|
+
}
|
|
13192
|
+
}, _callee104, this);
|
|
13193
|
+
}));
|
|
13194
|
+
|
|
13195
|
+
function castPollVote(_x146, _x147, _x148) {
|
|
13196
|
+
return _castPollVote.apply(this, arguments);
|
|
13197
|
+
}
|
|
13198
|
+
|
|
13199
|
+
return castPollVote;
|
|
13200
|
+
}()
|
|
13201
|
+
/**
|
|
13202
|
+
* Add a poll answer
|
|
13203
|
+
* @param messageId string The message id
|
|
13204
|
+
* @param pollId string The poll id
|
|
13205
|
+
* @param answerText string The answer text
|
|
13206
|
+
*/
|
|
13207
|
+
|
|
13208
|
+
}, {
|
|
13209
|
+
key: "addPollAnswer",
|
|
13210
|
+
value: function () {
|
|
13211
|
+
var _addPollAnswer = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee105(messageId, pollId, answerText) {
|
|
13212
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee105$(_context105) {
|
|
13213
|
+
while (1) {
|
|
13214
|
+
switch (_context105.prev = _context105.next) {
|
|
13215
|
+
case 0:
|
|
13216
|
+
return _context105.abrupt("return", this.castPollVote(messageId, pollId, {
|
|
13217
|
+
answer_text: answerText
|
|
13218
|
+
}));
|
|
13219
|
+
|
|
13220
|
+
case 1:
|
|
13221
|
+
case "end":
|
|
13222
|
+
return _context105.stop();
|
|
13223
|
+
}
|
|
13224
|
+
}
|
|
13225
|
+
}, _callee105, this);
|
|
13226
|
+
}));
|
|
13227
|
+
|
|
13228
|
+
function addPollAnswer(_x149, _x150, _x151) {
|
|
13229
|
+
return _addPollAnswer.apply(this, arguments);
|
|
13230
|
+
}
|
|
13231
|
+
|
|
13232
|
+
return addPollAnswer;
|
|
13233
|
+
}()
|
|
13234
|
+
}, {
|
|
13235
|
+
key: "removePollVote",
|
|
13236
|
+
value: function () {
|
|
13237
|
+
var _removePollVote = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee106(messageId, pollId, voteId) {
|
|
13238
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee106$(_context106) {
|
|
13239
|
+
while (1) {
|
|
13240
|
+
switch (_context106.prev = _context106.next) {
|
|
13241
|
+
case 0:
|
|
13242
|
+
_context106.next = 2;
|
|
13243
|
+
return this.delete(this.baseURL + "/messages/".concat(messageId, "/polls/").concat(pollId, "/vote/").concat(voteId));
|
|
13244
|
+
|
|
13245
|
+
case 2:
|
|
13246
|
+
return _context106.abrupt("return", _context106.sent);
|
|
13247
|
+
|
|
13248
|
+
case 3:
|
|
13249
|
+
case "end":
|
|
13250
|
+
return _context106.stop();
|
|
13251
|
+
}
|
|
13252
|
+
}
|
|
13253
|
+
}, _callee106, this);
|
|
13254
|
+
}));
|
|
13255
|
+
|
|
13256
|
+
function removePollVote(_x152, _x153, _x154) {
|
|
13257
|
+
return _removePollVote.apply(this, arguments);
|
|
13258
|
+
}
|
|
13259
|
+
|
|
13260
|
+
return removePollVote;
|
|
13261
|
+
}()
|
|
13262
|
+
/**
|
|
13263
|
+
* Queries polls
|
|
13264
|
+
* @param filter
|
|
13265
|
+
* @param sort
|
|
13266
|
+
* @param options Option object, {limit: 10, offset:0}
|
|
13267
|
+
* @returns {APIResponse & QueryPollsResponse} The polls
|
|
13268
|
+
*/
|
|
13269
|
+
|
|
13270
|
+
}, {
|
|
13271
|
+
key: "queryPolls",
|
|
13272
|
+
value: function () {
|
|
13273
|
+
var _queryPolls = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee107() {
|
|
13274
|
+
var filter,
|
|
13275
|
+
sort,
|
|
13276
|
+
options,
|
|
13277
|
+
_args107 = arguments;
|
|
13278
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee107$(_context107) {
|
|
13279
|
+
while (1) {
|
|
13280
|
+
switch (_context107.prev = _context107.next) {
|
|
13281
|
+
case 0:
|
|
13282
|
+
filter = _args107.length > 0 && _args107[0] !== undefined ? _args107[0] : {};
|
|
13283
|
+
sort = _args107.length > 1 && _args107[1] !== undefined ? _args107[1] : [];
|
|
13284
|
+
options = _args107.length > 2 && _args107[2] !== undefined ? _args107[2] : {};
|
|
13285
|
+
_context107.next = 5;
|
|
13286
|
+
return this.post(this.baseURL + '/polls/query', _objectSpread({
|
|
13287
|
+
filter: filter,
|
|
13288
|
+
sort: normalizeQuerySort(sort)
|
|
13289
|
+
}, options));
|
|
13290
|
+
|
|
13291
|
+
case 5:
|
|
13292
|
+
return _context107.abrupt("return", _context107.sent);
|
|
13293
|
+
|
|
13294
|
+
case 6:
|
|
13295
|
+
case "end":
|
|
13296
|
+
return _context107.stop();
|
|
13297
|
+
}
|
|
13298
|
+
}
|
|
13299
|
+
}, _callee107, this);
|
|
13300
|
+
}));
|
|
13301
|
+
|
|
13302
|
+
function queryPolls() {
|
|
13303
|
+
return _queryPolls.apply(this, arguments);
|
|
13304
|
+
}
|
|
13305
|
+
|
|
13306
|
+
return queryPolls;
|
|
13307
|
+
}()
|
|
13308
|
+
/**
|
|
13309
|
+
* Queries poll votes
|
|
13310
|
+
* @param pollId
|
|
13311
|
+
* @param filter
|
|
13312
|
+
* @param sort
|
|
13313
|
+
* @param options Option object, {limit: 10, offset:0}
|
|
13314
|
+
* @returns {APIResponse & PollVotesAPIResponse} The poll votes
|
|
13315
|
+
*/
|
|
13316
|
+
|
|
13317
|
+
}, {
|
|
13318
|
+
key: "queryPollVotes",
|
|
13319
|
+
value: function () {
|
|
13320
|
+
var _queryPollVotes = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee108(pollId) {
|
|
13321
|
+
var filter,
|
|
13322
|
+
sort,
|
|
13323
|
+
options,
|
|
13324
|
+
_args108 = arguments;
|
|
13325
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee108$(_context108) {
|
|
13326
|
+
while (1) {
|
|
13327
|
+
switch (_context108.prev = _context108.next) {
|
|
13328
|
+
case 0:
|
|
13329
|
+
filter = _args108.length > 1 && _args108[1] !== undefined ? _args108[1] : {};
|
|
13330
|
+
sort = _args108.length > 2 && _args108[2] !== undefined ? _args108[2] : [];
|
|
13331
|
+
options = _args108.length > 3 && _args108[3] !== undefined ? _args108[3] : {};
|
|
13332
|
+
_context108.next = 5;
|
|
13333
|
+
return this.post(this.baseURL + "/polls/".concat(pollId, "/votes"), _objectSpread({
|
|
13334
|
+
filter: filter,
|
|
13335
|
+
sort: normalizeQuerySort(sort)
|
|
13336
|
+
}, options));
|
|
13337
|
+
|
|
13338
|
+
case 5:
|
|
13339
|
+
return _context108.abrupt("return", _context108.sent);
|
|
13340
|
+
|
|
13341
|
+
case 6:
|
|
13342
|
+
case "end":
|
|
13343
|
+
return _context108.stop();
|
|
13344
|
+
}
|
|
13345
|
+
}
|
|
13346
|
+
}, _callee108, this);
|
|
13347
|
+
}));
|
|
13348
|
+
|
|
13349
|
+
function queryPollVotes(_x155) {
|
|
13350
|
+
return _queryPollVotes.apply(this, arguments);
|
|
13351
|
+
}
|
|
13352
|
+
|
|
13353
|
+
return queryPollVotes;
|
|
13354
|
+
}()
|
|
12590
13355
|
}], [{
|
|
12591
13356
|
key: "getInstance",
|
|
12592
13357
|
value: function getInstance(key, secretOrOptions, options) {
|
|
@@ -12639,6 +13404,11 @@ var EVENT_MAP = {
|
|
|
12639
13404
|
'notification.mutes_updated': true,
|
|
12640
13405
|
'notification.removed_from_channel': true,
|
|
12641
13406
|
'notification.thread_message_new': true,
|
|
13407
|
+
'poll.closed': true,
|
|
13408
|
+
'poll.updated': true,
|
|
13409
|
+
'poll.vote_casted': true,
|
|
13410
|
+
'poll.vote_changed': true,
|
|
13411
|
+
'poll.vote_removed': true,
|
|
12642
13412
|
'reaction.deleted': true,
|
|
12643
13413
|
'reaction.new': true,
|
|
12644
13414
|
'reaction.updated': true,
|