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.es.js
CHANGED
|
@@ -504,6 +504,111 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
504
504
|
};
|
|
505
505
|
});
|
|
506
506
|
|
|
507
|
+
_defineProperty(this, "updatePollVote", function (pollVote, poll, messageId) {
|
|
508
|
+
var message = _this.findMessage(messageId);
|
|
509
|
+
|
|
510
|
+
if (!message) return;
|
|
511
|
+
if (message.poll_id !== pollVote.poll_id) return;
|
|
512
|
+
|
|
513
|
+
var updatedPoll = _objectSpread$7({}, poll);
|
|
514
|
+
|
|
515
|
+
var ownVotes = _toConsumableArray(message.poll.own_votes || []);
|
|
516
|
+
|
|
517
|
+
if (pollVote.user_id === _this._channel.getClient().userID) {
|
|
518
|
+
if (pollVote.option_id && poll.enforce_unique_vote) {
|
|
519
|
+
// remove all previous votes where option_id is not empty
|
|
520
|
+
ownVotes = ownVotes.filter(function (vote) {
|
|
521
|
+
return !vote.option_id;
|
|
522
|
+
});
|
|
523
|
+
} else if (pollVote.answer_text) {
|
|
524
|
+
// remove all previous votes where option_id is empty
|
|
525
|
+
ownVotes = ownVotes.filter(function (vote) {
|
|
526
|
+
return vote.answer_text;
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
ownVotes.push(pollVote);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
updatedPoll.own_votes = ownVotes;
|
|
534
|
+
|
|
535
|
+
var newMessage = _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
536
|
+
poll: updatedPoll
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
_this.addMessageSorted(newMessage, false, false);
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
_defineProperty(this, "addPollVote", function (pollVote, poll, messageId) {
|
|
543
|
+
var message = _this.findMessage(messageId);
|
|
544
|
+
|
|
545
|
+
if (!message) return;
|
|
546
|
+
if (message.poll_id !== pollVote.poll_id) return;
|
|
547
|
+
|
|
548
|
+
var updatedPoll = _objectSpread$7({}, poll);
|
|
549
|
+
|
|
550
|
+
var ownVotes = _toConsumableArray(message.poll.own_votes || []);
|
|
551
|
+
|
|
552
|
+
if (pollVote.user_id === _this._channel.getClient().userID) {
|
|
553
|
+
ownVotes.push(pollVote);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
updatedPoll.own_votes = ownVotes;
|
|
557
|
+
|
|
558
|
+
var newMessage = _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
559
|
+
poll: updatedPoll
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
_this.addMessageSorted(newMessage, false, false);
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
_defineProperty(this, "removePollVote", function (pollVote, poll, messageId) {
|
|
566
|
+
var message = _this.findMessage(messageId);
|
|
567
|
+
|
|
568
|
+
if (!message) return;
|
|
569
|
+
if (message.poll_id !== pollVote.poll_id) return;
|
|
570
|
+
|
|
571
|
+
var updatedPoll = _objectSpread$7({}, poll);
|
|
572
|
+
|
|
573
|
+
var ownVotes = _toConsumableArray(message.poll.own_votes || []);
|
|
574
|
+
|
|
575
|
+
if (pollVote.user_id === _this._channel.getClient().userID) {
|
|
576
|
+
var index = ownVotes.findIndex(function (vote) {
|
|
577
|
+
return vote.option_id === pollVote.option_id;
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
if (index > -1) {
|
|
581
|
+
ownVotes.splice(index, 1);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
updatedPoll.own_votes = ownVotes;
|
|
586
|
+
|
|
587
|
+
var newMessage = _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
588
|
+
poll: updatedPoll
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
_this.addMessageSorted(newMessage, false, false);
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
_defineProperty(this, "updatePoll", function (poll, messageId) {
|
|
595
|
+
var _message$poll;
|
|
596
|
+
|
|
597
|
+
var message = _this.findMessage(messageId);
|
|
598
|
+
|
|
599
|
+
if (!message) return;
|
|
600
|
+
|
|
601
|
+
var updatedPoll = _objectSpread$7(_objectSpread$7({}, poll), {}, {
|
|
602
|
+
own_votes: _toConsumableArray(((_message$poll = message.poll) === null || _message$poll === void 0 ? void 0 : _message$poll.own_votes) || [])
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
var newMessage = _objectSpread$7(_objectSpread$7({}, message), {}, {
|
|
606
|
+
poll: updatedPoll
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
_this.addMessageSorted(newMessage, false, false);
|
|
610
|
+
});
|
|
611
|
+
|
|
507
612
|
_defineProperty(this, "updateUserMessages", function (user) {
|
|
508
613
|
var _updateUserMessages = function _updateUserMessages(messages, user) {
|
|
509
614
|
for (var i = 0; i < messages.length; i++) {
|
|
@@ -3146,7 +3251,8 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3146
3251
|
if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
|
|
3147
3252
|
if (message.type === 'system') return false; // Return false if channel doesn't allow read events.
|
|
3148
3253
|
|
|
3149
|
-
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;
|
|
3254
|
+
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
|
|
3255
|
+
|
|
3150
3256
|
if (this.muteStatus().muted) return false;
|
|
3151
3257
|
return true;
|
|
3152
3258
|
}
|
|
@@ -3607,6 +3713,69 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3607
3713
|
|
|
3608
3714
|
return createCall;
|
|
3609
3715
|
}()
|
|
3716
|
+
/**
|
|
3717
|
+
* Cast or cancel one or more votes on a poll
|
|
3718
|
+
* @param pollId string The poll id
|
|
3719
|
+
* @param votes PollVoteData[] The votes that will be casted (or canceled in case of an empty array)
|
|
3720
|
+
* @returns {APIResponse & PollVoteResponse} The poll votes
|
|
3721
|
+
*/
|
|
3722
|
+
|
|
3723
|
+
}, {
|
|
3724
|
+
key: "vote",
|
|
3725
|
+
value: function () {
|
|
3726
|
+
var _vote2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40(messageId, pollId, _vote) {
|
|
3727
|
+
return _regeneratorRuntime.wrap(function _callee40$(_context40) {
|
|
3728
|
+
while (1) {
|
|
3729
|
+
switch (_context40.prev = _context40.next) {
|
|
3730
|
+
case 0:
|
|
3731
|
+
_context40.next = 2;
|
|
3732
|
+
return this.getClient().castPollVote(messageId, pollId, _vote);
|
|
3733
|
+
|
|
3734
|
+
case 2:
|
|
3735
|
+
return _context40.abrupt("return", _context40.sent);
|
|
3736
|
+
|
|
3737
|
+
case 3:
|
|
3738
|
+
case "end":
|
|
3739
|
+
return _context40.stop();
|
|
3740
|
+
}
|
|
3741
|
+
}
|
|
3742
|
+
}, _callee40, this);
|
|
3743
|
+
}));
|
|
3744
|
+
|
|
3745
|
+
function vote(_x42, _x43, _x44) {
|
|
3746
|
+
return _vote2.apply(this, arguments);
|
|
3747
|
+
}
|
|
3748
|
+
|
|
3749
|
+
return vote;
|
|
3750
|
+
}()
|
|
3751
|
+
}, {
|
|
3752
|
+
key: "removeVote",
|
|
3753
|
+
value: function () {
|
|
3754
|
+
var _removeVote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41(messageId, pollId, voteId) {
|
|
3755
|
+
return _regeneratorRuntime.wrap(function _callee41$(_context41) {
|
|
3756
|
+
while (1) {
|
|
3757
|
+
switch (_context41.prev = _context41.next) {
|
|
3758
|
+
case 0:
|
|
3759
|
+
_context41.next = 2;
|
|
3760
|
+
return this.getClient().removePollVote(messageId, pollId, voteId);
|
|
3761
|
+
|
|
3762
|
+
case 2:
|
|
3763
|
+
return _context41.abrupt("return", _context41.sent);
|
|
3764
|
+
|
|
3765
|
+
case 3:
|
|
3766
|
+
case "end":
|
|
3767
|
+
return _context41.stop();
|
|
3768
|
+
}
|
|
3769
|
+
}
|
|
3770
|
+
}, _callee41, this);
|
|
3771
|
+
}));
|
|
3772
|
+
|
|
3773
|
+
function removeVote(_x45, _x46, _x47) {
|
|
3774
|
+
return _removeVote.apply(this, arguments);
|
|
3775
|
+
}
|
|
3776
|
+
|
|
3777
|
+
return removeVote;
|
|
3778
|
+
}()
|
|
3610
3779
|
/**
|
|
3611
3780
|
* on - Listen to events on this channel.
|
|
3612
3781
|
*
|
|
@@ -3905,6 +4074,49 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3905
4074
|
|
|
3906
4075
|
break;
|
|
3907
4076
|
|
|
4077
|
+
case 'poll.updated':
|
|
4078
|
+
if (event.poll) {
|
|
4079
|
+
var _event$message;
|
|
4080
|
+
|
|
4081
|
+
channelState.updatePoll(event.poll, ((_event$message = event.message) === null || _event$message === void 0 ? void 0 : _event$message.id) || '');
|
|
4082
|
+
}
|
|
4083
|
+
|
|
4084
|
+
break;
|
|
4085
|
+
|
|
4086
|
+
case 'poll.vote_casted':
|
|
4087
|
+
if (event.poll_vote && event.poll) {
|
|
4088
|
+
var _event$message2;
|
|
4089
|
+
|
|
4090
|
+
channelState.addPollVote(event.poll_vote, event.poll, ((_event$message2 = event.message) === null || _event$message2 === void 0 ? void 0 : _event$message2.id) || '');
|
|
4091
|
+
}
|
|
4092
|
+
|
|
4093
|
+
break;
|
|
4094
|
+
|
|
4095
|
+
case 'poll.vote_changed':
|
|
4096
|
+
if (event.poll_vote && event.poll) {
|
|
4097
|
+
var _event$message3;
|
|
4098
|
+
|
|
4099
|
+
channelState.updatePollVote(event.poll_vote, event.poll, ((_event$message3 = event.message) === null || _event$message3 === void 0 ? void 0 : _event$message3.id) || '');
|
|
4100
|
+
}
|
|
4101
|
+
|
|
4102
|
+
break;
|
|
4103
|
+
|
|
4104
|
+
case 'poll.vote_removed':
|
|
4105
|
+
if (event.poll_vote && event.poll) {
|
|
4106
|
+
var _event$message4;
|
|
4107
|
+
|
|
4108
|
+
channelState.removePollVote(event.poll_vote, event.poll, ((_event$message4 = event.message) === null || _event$message4 === void 0 ? void 0 : _event$message4.id) || '');
|
|
4109
|
+
}
|
|
4110
|
+
|
|
4111
|
+
break;
|
|
4112
|
+
|
|
4113
|
+
case 'poll.closed':
|
|
4114
|
+
if (event.message) {
|
|
4115
|
+
channelState.addMessageSorted(event.message, false, false);
|
|
4116
|
+
}
|
|
4117
|
+
|
|
4118
|
+
break;
|
|
4119
|
+
|
|
3908
4120
|
case 'reaction.new':
|
|
3909
4121
|
if (event.message && event.reaction) {
|
|
3910
4122
|
event.message = channelState.addReaction(event.reaction, event.message);
|
|
@@ -6588,8 +6800,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
6588
6800
|
DeleteUserOptions specifies a collection of one or more `user_ids` to be deleted.
|
|
6589
6801
|
|
|
6590
6802
|
`user`:
|
|
6591
|
-
- soft: marks user as deleted and retains all user data
|
|
6592
|
-
- pruning: marks user as deleted and nullifies user information
|
|
6803
|
+
- soft: marks user as deleted and retains all user data
|
|
6804
|
+
- pruning: marks user as deleted and nullifies user information
|
|
6593
6805
|
- hard: deletes user completely - this requires hard option for messages and conversation as well
|
|
6594
6806
|
`conversations`:
|
|
6595
6807
|
- soft: marks all conversation channels as deleted (same effect as Delete Channels with 'hard' option disabled)
|
|
@@ -6628,6 +6840,14 @@ var ErrorFromResponse = /*#__PURE__*/function (_Error) {
|
|
|
6628
6840
|
|
|
6629
6841
|
return ErrorFromResponse;
|
|
6630
6842
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
6843
|
+
var VotingVisibility;
|
|
6844
|
+
|
|
6845
|
+
(function (VotingVisibility) {
|
|
6846
|
+
VotingVisibility["anonymous"] = "anonymous";
|
|
6847
|
+
VotingVisibility["public"] = "public";
|
|
6848
|
+
})(VotingVisibility || (VotingVisibility = {}));
|
|
6849
|
+
|
|
6850
|
+
var _excluded$1 = ["parent_message_id", "parent_message", "latest_replies", "thread_participants", "reply_count", "channel", "read"];
|
|
6631
6851
|
|
|
6632
6852
|
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; }
|
|
6633
6853
|
|
|
@@ -6639,6 +6859,7 @@ function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o
|
|
|
6639
6859
|
|
|
6640
6860
|
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; }
|
|
6641
6861
|
var Thread = /*#__PURE__*/function () {
|
|
6862
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6642
6863
|
function Thread(client, t) {
|
|
6643
6864
|
_classCallCheck(this, Thread);
|
|
6644
6865
|
|
|
@@ -6660,17 +6881,28 @@ var Thread = /*#__PURE__*/function () {
|
|
|
6660
6881
|
|
|
6661
6882
|
_defineProperty(this, "read", {});
|
|
6662
6883
|
|
|
6663
|
-
this
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6884
|
+
_defineProperty(this, "data", {});
|
|
6885
|
+
|
|
6886
|
+
var parent_message_id = t.parent_message_id,
|
|
6887
|
+
parent_message = t.parent_message,
|
|
6888
|
+
latest_replies = t.latest_replies,
|
|
6889
|
+
thread_participants = t.thread_participants,
|
|
6890
|
+
reply_count = t.reply_count,
|
|
6891
|
+
channel = t.channel,
|
|
6892
|
+
read = t.read,
|
|
6893
|
+
data = _objectWithoutProperties(t, _excluded$1);
|
|
6894
|
+
|
|
6895
|
+
this.id = parent_message_id;
|
|
6896
|
+
this.message = formatMessage(parent_message);
|
|
6897
|
+
this.latestReplies = latest_replies.map(formatMessage);
|
|
6898
|
+
this.participants = thread_participants;
|
|
6899
|
+
this.replyCount = reply_count;
|
|
6900
|
+
this.channel = channel;
|
|
6669
6901
|
this._channel = client.channel(t.channel.type, t.channel.id);
|
|
6670
6902
|
this._client = client;
|
|
6671
6903
|
|
|
6672
|
-
if (
|
|
6673
|
-
var _iterator = _createForOfIteratorHelper$1(
|
|
6904
|
+
if (read) {
|
|
6905
|
+
var _iterator = _createForOfIteratorHelper$1(read),
|
|
6674
6906
|
_step;
|
|
6675
6907
|
|
|
6676
6908
|
try {
|
|
@@ -6686,6 +6918,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
6686
6918
|
_iterator.f();
|
|
6687
6919
|
}
|
|
6688
6920
|
}
|
|
6921
|
+
|
|
6922
|
+
this.data = data;
|
|
6689
6923
|
}
|
|
6690
6924
|
|
|
6691
6925
|
_createClass(Thread, [{
|
|
@@ -8390,8 +8624,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8390
8624
|
key: "_handleClientEvent",
|
|
8391
8625
|
value: function _handleClientEvent(event) {
|
|
8392
8626
|
var _event$me,
|
|
8393
|
-
|
|
8394
|
-
|
|
8627
|
+
_event$me2,
|
|
8628
|
+
_this3 = this;
|
|
8395
8629
|
|
|
8396
8630
|
var client = this;
|
|
8397
8631
|
var postListenerCallbacks = [];
|
|
@@ -8416,21 +8650,6 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
8416
8650
|
}
|
|
8417
8651
|
|
|
8418
8652
|
if (event.type === 'notification.channel_mutes_updated' && (_event$me = event.me) !== null && _event$me !== void 0 && _event$me.channel_mutes) {
|
|
8419
|
-
var currentMutedChannelIds = [];
|
|
8420
|
-
var nextMutedChannelIds = [];
|
|
8421
|
-
this.mutedChannels.forEach(function (mute) {
|
|
8422
|
-
return mute.channel && currentMutedChannelIds.push(mute.channel.cid);
|
|
8423
|
-
});
|
|
8424
|
-
event.me.channel_mutes.forEach(function (mute) {
|
|
8425
|
-
return mute.channel && nextMutedChannelIds.push(mute.channel.cid);
|
|
8426
|
-
});
|
|
8427
|
-
/** Set the unread count of un-muted channels to 0, which is the behaviour of backend */
|
|
8428
|
-
|
|
8429
|
-
currentMutedChannelIds.forEach(function (cid) {
|
|
8430
|
-
if (!nextMutedChannelIds.includes(cid) && _this3.activeChannels[cid]) {
|
|
8431
|
-
_this3.activeChannels[cid].state.unreadCount = 0;
|
|
8432
|
-
}
|
|
8433
|
-
});
|
|
8434
8653
|
this.mutedChannels = event.me.channel_mutes;
|
|
8435
8654
|
}
|
|
8436
8655
|
|
|
@@ -11117,7 +11336,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11117
11336
|
}, {
|
|
11118
11337
|
key: "getUserAgent",
|
|
11119
11338
|
value: function getUserAgent() {
|
|
11120
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
11339
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.26.0");
|
|
11121
11340
|
}
|
|
11122
11341
|
}, {
|
|
11123
11342
|
key: "setUserAgent",
|
|
@@ -12559,6 +12778,552 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12559
12778
|
|
|
12560
12779
|
return commitMessage;
|
|
12561
12780
|
}()
|
|
12781
|
+
/**
|
|
12782
|
+
* Creates a poll
|
|
12783
|
+
* @param params PollData The poll that will be created
|
|
12784
|
+
* @returns {APIResponse & CreatePollAPIResponse} The poll
|
|
12785
|
+
*/
|
|
12786
|
+
|
|
12787
|
+
}, {
|
|
12788
|
+
key: "createPoll",
|
|
12789
|
+
value: function () {
|
|
12790
|
+
var _createPoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee94(poll) {
|
|
12791
|
+
return _regeneratorRuntime.wrap(function _callee94$(_context94) {
|
|
12792
|
+
while (1) {
|
|
12793
|
+
switch (_context94.prev = _context94.next) {
|
|
12794
|
+
case 0:
|
|
12795
|
+
_context94.next = 2;
|
|
12796
|
+
return this.post(this.baseURL + "/polls", poll);
|
|
12797
|
+
|
|
12798
|
+
case 2:
|
|
12799
|
+
return _context94.abrupt("return", _context94.sent);
|
|
12800
|
+
|
|
12801
|
+
case 3:
|
|
12802
|
+
case "end":
|
|
12803
|
+
return _context94.stop();
|
|
12804
|
+
}
|
|
12805
|
+
}
|
|
12806
|
+
}, _callee94, this);
|
|
12807
|
+
}));
|
|
12808
|
+
|
|
12809
|
+
function createPoll(_x129) {
|
|
12810
|
+
return _createPoll.apply(this, arguments);
|
|
12811
|
+
}
|
|
12812
|
+
|
|
12813
|
+
return createPoll;
|
|
12814
|
+
}()
|
|
12815
|
+
/**
|
|
12816
|
+
* Retrieves a poll
|
|
12817
|
+
* @param id string The poll id
|
|
12818
|
+
* @returns {APIResponse & GetPollAPIResponse} The poll
|
|
12819
|
+
*/
|
|
12820
|
+
|
|
12821
|
+
}, {
|
|
12822
|
+
key: "getPoll",
|
|
12823
|
+
value: function () {
|
|
12824
|
+
var _getPoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee95(id, userId) {
|
|
12825
|
+
return _regeneratorRuntime.wrap(function _callee95$(_context95) {
|
|
12826
|
+
while (1) {
|
|
12827
|
+
switch (_context95.prev = _context95.next) {
|
|
12828
|
+
case 0:
|
|
12829
|
+
_context95.next = 2;
|
|
12830
|
+
return this.get(this.baseURL + "/polls/".concat(id), _objectSpread({}, userId ? {
|
|
12831
|
+
user_id: userId
|
|
12832
|
+
} : {}));
|
|
12833
|
+
|
|
12834
|
+
case 2:
|
|
12835
|
+
return _context95.abrupt("return", _context95.sent);
|
|
12836
|
+
|
|
12837
|
+
case 3:
|
|
12838
|
+
case "end":
|
|
12839
|
+
return _context95.stop();
|
|
12840
|
+
}
|
|
12841
|
+
}
|
|
12842
|
+
}, _callee95, this);
|
|
12843
|
+
}));
|
|
12844
|
+
|
|
12845
|
+
function getPoll(_x130, _x131) {
|
|
12846
|
+
return _getPoll.apply(this, arguments);
|
|
12847
|
+
}
|
|
12848
|
+
|
|
12849
|
+
return getPoll;
|
|
12850
|
+
}()
|
|
12851
|
+
/**
|
|
12852
|
+
* Updates a poll
|
|
12853
|
+
* @param poll PollData The poll that will be updated
|
|
12854
|
+
* @returns {APIResponse & PollResponse} The poll
|
|
12855
|
+
*/
|
|
12856
|
+
|
|
12857
|
+
}, {
|
|
12858
|
+
key: "updatePoll",
|
|
12859
|
+
value: function () {
|
|
12860
|
+
var _updatePoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee96(poll) {
|
|
12861
|
+
return _regeneratorRuntime.wrap(function _callee96$(_context96) {
|
|
12862
|
+
while (1) {
|
|
12863
|
+
switch (_context96.prev = _context96.next) {
|
|
12864
|
+
case 0:
|
|
12865
|
+
_context96.next = 2;
|
|
12866
|
+
return this.put(this.baseURL + "/polls", poll);
|
|
12867
|
+
|
|
12868
|
+
case 2:
|
|
12869
|
+
return _context96.abrupt("return", _context96.sent);
|
|
12870
|
+
|
|
12871
|
+
case 3:
|
|
12872
|
+
case "end":
|
|
12873
|
+
return _context96.stop();
|
|
12874
|
+
}
|
|
12875
|
+
}
|
|
12876
|
+
}, _callee96, this);
|
|
12877
|
+
}));
|
|
12878
|
+
|
|
12879
|
+
function updatePoll(_x132) {
|
|
12880
|
+
return _updatePoll.apply(this, arguments);
|
|
12881
|
+
}
|
|
12882
|
+
|
|
12883
|
+
return updatePoll;
|
|
12884
|
+
}()
|
|
12885
|
+
/**
|
|
12886
|
+
* Partially updates a poll
|
|
12887
|
+
* @param id string The poll id
|
|
12888
|
+
* @param {PartialPollUpdate<StreamChatGenerics>} partialPollObject which should contain id and any of "set" or "unset" params;
|
|
12889
|
+
* example: {id: "44f26af5-f2be-4fa7-9dac-71cf893781de", set:{field: value}, unset:["field2"]}
|
|
12890
|
+
* @returns {APIResponse & UpdatePollAPIResponse} The poll
|
|
12891
|
+
*/
|
|
12892
|
+
|
|
12893
|
+
}, {
|
|
12894
|
+
key: "partialUpdatePoll",
|
|
12895
|
+
value: function () {
|
|
12896
|
+
var _partialUpdatePoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee97(id, partialPollObject) {
|
|
12897
|
+
return _regeneratorRuntime.wrap(function _callee97$(_context97) {
|
|
12898
|
+
while (1) {
|
|
12899
|
+
switch (_context97.prev = _context97.next) {
|
|
12900
|
+
case 0:
|
|
12901
|
+
_context97.next = 2;
|
|
12902
|
+
return this.patch(this.baseURL + "/polls/".concat(id), partialPollObject);
|
|
12903
|
+
|
|
12904
|
+
case 2:
|
|
12905
|
+
return _context97.abrupt("return", _context97.sent);
|
|
12906
|
+
|
|
12907
|
+
case 3:
|
|
12908
|
+
case "end":
|
|
12909
|
+
return _context97.stop();
|
|
12910
|
+
}
|
|
12911
|
+
}
|
|
12912
|
+
}, _callee97, this);
|
|
12913
|
+
}));
|
|
12914
|
+
|
|
12915
|
+
function partialUpdatePoll(_x133, _x134) {
|
|
12916
|
+
return _partialUpdatePoll.apply(this, arguments);
|
|
12917
|
+
}
|
|
12918
|
+
|
|
12919
|
+
return partialUpdatePoll;
|
|
12920
|
+
}()
|
|
12921
|
+
/**
|
|
12922
|
+
* Delete a poll
|
|
12923
|
+
* @param id string The poll id
|
|
12924
|
+
* @param userId string The user id (only serverside)
|
|
12925
|
+
* @returns
|
|
12926
|
+
*/
|
|
12927
|
+
|
|
12928
|
+
}, {
|
|
12929
|
+
key: "deletePoll",
|
|
12930
|
+
value: function () {
|
|
12931
|
+
var _deletePoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee98(id, userId) {
|
|
12932
|
+
return _regeneratorRuntime.wrap(function _callee98$(_context98) {
|
|
12933
|
+
while (1) {
|
|
12934
|
+
switch (_context98.prev = _context98.next) {
|
|
12935
|
+
case 0:
|
|
12936
|
+
_context98.next = 2;
|
|
12937
|
+
return this.delete(this.baseURL + "/polls/".concat(id), _objectSpread({}, userId ? {
|
|
12938
|
+
user_id: userId
|
|
12939
|
+
} : {}));
|
|
12940
|
+
|
|
12941
|
+
case 2:
|
|
12942
|
+
return _context98.abrupt("return", _context98.sent);
|
|
12943
|
+
|
|
12944
|
+
case 3:
|
|
12945
|
+
case "end":
|
|
12946
|
+
return _context98.stop();
|
|
12947
|
+
}
|
|
12948
|
+
}
|
|
12949
|
+
}, _callee98, this);
|
|
12950
|
+
}));
|
|
12951
|
+
|
|
12952
|
+
function deletePoll(_x135, _x136) {
|
|
12953
|
+
return _deletePoll.apply(this, arguments);
|
|
12954
|
+
}
|
|
12955
|
+
|
|
12956
|
+
return deletePoll;
|
|
12957
|
+
}()
|
|
12958
|
+
/**
|
|
12959
|
+
* Close a poll
|
|
12960
|
+
* @param id string The poll id
|
|
12961
|
+
* @returns {APIResponse & UpdatePollAPIResponse} The poll
|
|
12962
|
+
*/
|
|
12963
|
+
|
|
12964
|
+
}, {
|
|
12965
|
+
key: "closePoll",
|
|
12966
|
+
value: function () {
|
|
12967
|
+
var _closePoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee99(id) {
|
|
12968
|
+
return _regeneratorRuntime.wrap(function _callee99$(_context99) {
|
|
12969
|
+
while (1) {
|
|
12970
|
+
switch (_context99.prev = _context99.next) {
|
|
12971
|
+
case 0:
|
|
12972
|
+
return _context99.abrupt("return", this.partialUpdatePoll(id, {
|
|
12973
|
+
set: {
|
|
12974
|
+
is_closed: true
|
|
12975
|
+
}
|
|
12976
|
+
}));
|
|
12977
|
+
|
|
12978
|
+
case 1:
|
|
12979
|
+
case "end":
|
|
12980
|
+
return _context99.stop();
|
|
12981
|
+
}
|
|
12982
|
+
}
|
|
12983
|
+
}, _callee99, this);
|
|
12984
|
+
}));
|
|
12985
|
+
|
|
12986
|
+
function closePoll(_x137) {
|
|
12987
|
+
return _closePoll.apply(this, arguments);
|
|
12988
|
+
}
|
|
12989
|
+
|
|
12990
|
+
return closePoll;
|
|
12991
|
+
}()
|
|
12992
|
+
/**
|
|
12993
|
+
* Creates a poll option
|
|
12994
|
+
* @param pollId string The poll id
|
|
12995
|
+
* @param option PollOptionData The poll option that will be created
|
|
12996
|
+
* @returns {APIResponse & PollOptionResponse} The poll option
|
|
12997
|
+
*/
|
|
12998
|
+
|
|
12999
|
+
}, {
|
|
13000
|
+
key: "createPollOption",
|
|
13001
|
+
value: function () {
|
|
13002
|
+
var _createPollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee100(pollId, option) {
|
|
13003
|
+
return _regeneratorRuntime.wrap(function _callee100$(_context100) {
|
|
13004
|
+
while (1) {
|
|
13005
|
+
switch (_context100.prev = _context100.next) {
|
|
13006
|
+
case 0:
|
|
13007
|
+
_context100.next = 2;
|
|
13008
|
+
return this.post(this.baseURL + "/polls/".concat(pollId, "/options"), option);
|
|
13009
|
+
|
|
13010
|
+
case 2:
|
|
13011
|
+
return _context100.abrupt("return", _context100.sent);
|
|
13012
|
+
|
|
13013
|
+
case 3:
|
|
13014
|
+
case "end":
|
|
13015
|
+
return _context100.stop();
|
|
13016
|
+
}
|
|
13017
|
+
}
|
|
13018
|
+
}, _callee100, this);
|
|
13019
|
+
}));
|
|
13020
|
+
|
|
13021
|
+
function createPollOption(_x138, _x139) {
|
|
13022
|
+
return _createPollOption.apply(this, arguments);
|
|
13023
|
+
}
|
|
13024
|
+
|
|
13025
|
+
return createPollOption;
|
|
13026
|
+
}()
|
|
13027
|
+
/**
|
|
13028
|
+
* Retrieves a poll option
|
|
13029
|
+
* @param pollId string The poll id
|
|
13030
|
+
* @param optionId string The poll option id
|
|
13031
|
+
* @returns {APIResponse & PollOptionResponse} The poll option
|
|
13032
|
+
*/
|
|
13033
|
+
|
|
13034
|
+
}, {
|
|
13035
|
+
key: "getPollOption",
|
|
13036
|
+
value: function () {
|
|
13037
|
+
var _getPollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee101(pollId, optionId) {
|
|
13038
|
+
return _regeneratorRuntime.wrap(function _callee101$(_context101) {
|
|
13039
|
+
while (1) {
|
|
13040
|
+
switch (_context101.prev = _context101.next) {
|
|
13041
|
+
case 0:
|
|
13042
|
+
_context101.next = 2;
|
|
13043
|
+
return this.get(this.baseURL + "/polls/".concat(pollId, "/options/").concat(optionId));
|
|
13044
|
+
|
|
13045
|
+
case 2:
|
|
13046
|
+
return _context101.abrupt("return", _context101.sent);
|
|
13047
|
+
|
|
13048
|
+
case 3:
|
|
13049
|
+
case "end":
|
|
13050
|
+
return _context101.stop();
|
|
13051
|
+
}
|
|
13052
|
+
}
|
|
13053
|
+
}, _callee101, this);
|
|
13054
|
+
}));
|
|
13055
|
+
|
|
13056
|
+
function getPollOption(_x140, _x141) {
|
|
13057
|
+
return _getPollOption.apply(this, arguments);
|
|
13058
|
+
}
|
|
13059
|
+
|
|
13060
|
+
return getPollOption;
|
|
13061
|
+
}()
|
|
13062
|
+
/**
|
|
13063
|
+
* Updates a poll option
|
|
13064
|
+
* @param pollId string The poll id
|
|
13065
|
+
* @param option PollOptionData The poll option that will be updated
|
|
13066
|
+
* @returns
|
|
13067
|
+
*/
|
|
13068
|
+
|
|
13069
|
+
}, {
|
|
13070
|
+
key: "updatePollOption",
|
|
13071
|
+
value: function () {
|
|
13072
|
+
var _updatePollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee102(pollId, option) {
|
|
13073
|
+
return _regeneratorRuntime.wrap(function _callee102$(_context102) {
|
|
13074
|
+
while (1) {
|
|
13075
|
+
switch (_context102.prev = _context102.next) {
|
|
13076
|
+
case 0:
|
|
13077
|
+
_context102.next = 2;
|
|
13078
|
+
return this.put(this.baseURL + "/polls/".concat(pollId, "/options"), option);
|
|
13079
|
+
|
|
13080
|
+
case 2:
|
|
13081
|
+
return _context102.abrupt("return", _context102.sent);
|
|
13082
|
+
|
|
13083
|
+
case 3:
|
|
13084
|
+
case "end":
|
|
13085
|
+
return _context102.stop();
|
|
13086
|
+
}
|
|
13087
|
+
}
|
|
13088
|
+
}, _callee102, this);
|
|
13089
|
+
}));
|
|
13090
|
+
|
|
13091
|
+
function updatePollOption(_x142, _x143) {
|
|
13092
|
+
return _updatePollOption.apply(this, arguments);
|
|
13093
|
+
}
|
|
13094
|
+
|
|
13095
|
+
return updatePollOption;
|
|
13096
|
+
}()
|
|
13097
|
+
/**
|
|
13098
|
+
* Delete a poll option
|
|
13099
|
+
* @param pollId string The poll id
|
|
13100
|
+
* @param optionId string The poll option id
|
|
13101
|
+
* @returns {APIResponse} The poll option
|
|
13102
|
+
*/
|
|
13103
|
+
|
|
13104
|
+
}, {
|
|
13105
|
+
key: "deletePollOption",
|
|
13106
|
+
value: function () {
|
|
13107
|
+
var _deletePollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee103(pollId, optionId) {
|
|
13108
|
+
return _regeneratorRuntime.wrap(function _callee103$(_context103) {
|
|
13109
|
+
while (1) {
|
|
13110
|
+
switch (_context103.prev = _context103.next) {
|
|
13111
|
+
case 0:
|
|
13112
|
+
_context103.next = 2;
|
|
13113
|
+
return this.delete(this.baseURL + "/polls/".concat(pollId, "/options/").concat(optionId));
|
|
13114
|
+
|
|
13115
|
+
case 2:
|
|
13116
|
+
return _context103.abrupt("return", _context103.sent);
|
|
13117
|
+
|
|
13118
|
+
case 3:
|
|
13119
|
+
case "end":
|
|
13120
|
+
return _context103.stop();
|
|
13121
|
+
}
|
|
13122
|
+
}
|
|
13123
|
+
}, _callee103, this);
|
|
13124
|
+
}));
|
|
13125
|
+
|
|
13126
|
+
function deletePollOption(_x144, _x145) {
|
|
13127
|
+
return _deletePollOption.apply(this, arguments);
|
|
13128
|
+
}
|
|
13129
|
+
|
|
13130
|
+
return deletePollOption;
|
|
13131
|
+
}()
|
|
13132
|
+
/**
|
|
13133
|
+
* Cast vote on a poll
|
|
13134
|
+
* @param messageId string The message id
|
|
13135
|
+
* @param pollId string The poll id
|
|
13136
|
+
* @param vote PollVoteData The vote that will be casted
|
|
13137
|
+
* @returns {APIResponse & CastVoteAPIResponse} The poll vote
|
|
13138
|
+
*/
|
|
13139
|
+
|
|
13140
|
+
}, {
|
|
13141
|
+
key: "castPollVote",
|
|
13142
|
+
value: function () {
|
|
13143
|
+
var _castPollVote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee104(messageId, pollId, vote) {
|
|
13144
|
+
var options,
|
|
13145
|
+
_args104 = arguments;
|
|
13146
|
+
return _regeneratorRuntime.wrap(function _callee104$(_context104) {
|
|
13147
|
+
while (1) {
|
|
13148
|
+
switch (_context104.prev = _context104.next) {
|
|
13149
|
+
case 0:
|
|
13150
|
+
options = _args104.length > 3 && _args104[3] !== undefined ? _args104[3] : {};
|
|
13151
|
+
_context104.next = 3;
|
|
13152
|
+
return this.post(this.baseURL + "/messages/".concat(messageId, "/polls/").concat(pollId, "/vote"), _objectSpread({
|
|
13153
|
+
vote: vote
|
|
13154
|
+
}, options));
|
|
13155
|
+
|
|
13156
|
+
case 3:
|
|
13157
|
+
return _context104.abrupt("return", _context104.sent);
|
|
13158
|
+
|
|
13159
|
+
case 4:
|
|
13160
|
+
case "end":
|
|
13161
|
+
return _context104.stop();
|
|
13162
|
+
}
|
|
13163
|
+
}
|
|
13164
|
+
}, _callee104, this);
|
|
13165
|
+
}));
|
|
13166
|
+
|
|
13167
|
+
function castPollVote(_x146, _x147, _x148) {
|
|
13168
|
+
return _castPollVote.apply(this, arguments);
|
|
13169
|
+
}
|
|
13170
|
+
|
|
13171
|
+
return castPollVote;
|
|
13172
|
+
}()
|
|
13173
|
+
/**
|
|
13174
|
+
* Add a poll answer
|
|
13175
|
+
* @param messageId string The message id
|
|
13176
|
+
* @param pollId string The poll id
|
|
13177
|
+
* @param answerText string The answer text
|
|
13178
|
+
*/
|
|
13179
|
+
|
|
13180
|
+
}, {
|
|
13181
|
+
key: "addPollAnswer",
|
|
13182
|
+
value: function () {
|
|
13183
|
+
var _addPollAnswer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee105(messageId, pollId, answerText) {
|
|
13184
|
+
return _regeneratorRuntime.wrap(function _callee105$(_context105) {
|
|
13185
|
+
while (1) {
|
|
13186
|
+
switch (_context105.prev = _context105.next) {
|
|
13187
|
+
case 0:
|
|
13188
|
+
return _context105.abrupt("return", this.castPollVote(messageId, pollId, {
|
|
13189
|
+
answer_text: answerText
|
|
13190
|
+
}));
|
|
13191
|
+
|
|
13192
|
+
case 1:
|
|
13193
|
+
case "end":
|
|
13194
|
+
return _context105.stop();
|
|
13195
|
+
}
|
|
13196
|
+
}
|
|
13197
|
+
}, _callee105, this);
|
|
13198
|
+
}));
|
|
13199
|
+
|
|
13200
|
+
function addPollAnswer(_x149, _x150, _x151) {
|
|
13201
|
+
return _addPollAnswer.apply(this, arguments);
|
|
13202
|
+
}
|
|
13203
|
+
|
|
13204
|
+
return addPollAnswer;
|
|
13205
|
+
}()
|
|
13206
|
+
}, {
|
|
13207
|
+
key: "removePollVote",
|
|
13208
|
+
value: function () {
|
|
13209
|
+
var _removePollVote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee106(messageId, pollId, voteId) {
|
|
13210
|
+
return _regeneratorRuntime.wrap(function _callee106$(_context106) {
|
|
13211
|
+
while (1) {
|
|
13212
|
+
switch (_context106.prev = _context106.next) {
|
|
13213
|
+
case 0:
|
|
13214
|
+
_context106.next = 2;
|
|
13215
|
+
return this.delete(this.baseURL + "/messages/".concat(messageId, "/polls/").concat(pollId, "/vote/").concat(voteId));
|
|
13216
|
+
|
|
13217
|
+
case 2:
|
|
13218
|
+
return _context106.abrupt("return", _context106.sent);
|
|
13219
|
+
|
|
13220
|
+
case 3:
|
|
13221
|
+
case "end":
|
|
13222
|
+
return _context106.stop();
|
|
13223
|
+
}
|
|
13224
|
+
}
|
|
13225
|
+
}, _callee106, this);
|
|
13226
|
+
}));
|
|
13227
|
+
|
|
13228
|
+
function removePollVote(_x152, _x153, _x154) {
|
|
13229
|
+
return _removePollVote.apply(this, arguments);
|
|
13230
|
+
}
|
|
13231
|
+
|
|
13232
|
+
return removePollVote;
|
|
13233
|
+
}()
|
|
13234
|
+
/**
|
|
13235
|
+
* Queries polls
|
|
13236
|
+
* @param filter
|
|
13237
|
+
* @param sort
|
|
13238
|
+
* @param options Option object, {limit: 10, offset:0}
|
|
13239
|
+
* @returns {APIResponse & QueryPollsResponse} The polls
|
|
13240
|
+
*/
|
|
13241
|
+
|
|
13242
|
+
}, {
|
|
13243
|
+
key: "queryPolls",
|
|
13244
|
+
value: function () {
|
|
13245
|
+
var _queryPolls = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee107() {
|
|
13246
|
+
var filter,
|
|
13247
|
+
sort,
|
|
13248
|
+
options,
|
|
13249
|
+
_args107 = arguments;
|
|
13250
|
+
return _regeneratorRuntime.wrap(function _callee107$(_context107) {
|
|
13251
|
+
while (1) {
|
|
13252
|
+
switch (_context107.prev = _context107.next) {
|
|
13253
|
+
case 0:
|
|
13254
|
+
filter = _args107.length > 0 && _args107[0] !== undefined ? _args107[0] : {};
|
|
13255
|
+
sort = _args107.length > 1 && _args107[1] !== undefined ? _args107[1] : [];
|
|
13256
|
+
options = _args107.length > 2 && _args107[2] !== undefined ? _args107[2] : {};
|
|
13257
|
+
_context107.next = 5;
|
|
13258
|
+
return this.post(this.baseURL + '/polls/query', _objectSpread({
|
|
13259
|
+
filter: filter,
|
|
13260
|
+
sort: normalizeQuerySort(sort)
|
|
13261
|
+
}, options));
|
|
13262
|
+
|
|
13263
|
+
case 5:
|
|
13264
|
+
return _context107.abrupt("return", _context107.sent);
|
|
13265
|
+
|
|
13266
|
+
case 6:
|
|
13267
|
+
case "end":
|
|
13268
|
+
return _context107.stop();
|
|
13269
|
+
}
|
|
13270
|
+
}
|
|
13271
|
+
}, _callee107, this);
|
|
13272
|
+
}));
|
|
13273
|
+
|
|
13274
|
+
function queryPolls() {
|
|
13275
|
+
return _queryPolls.apply(this, arguments);
|
|
13276
|
+
}
|
|
13277
|
+
|
|
13278
|
+
return queryPolls;
|
|
13279
|
+
}()
|
|
13280
|
+
/**
|
|
13281
|
+
* Queries poll votes
|
|
13282
|
+
* @param pollId
|
|
13283
|
+
* @param filter
|
|
13284
|
+
* @param sort
|
|
13285
|
+
* @param options Option object, {limit: 10, offset:0}
|
|
13286
|
+
* @returns {APIResponse & PollVotesAPIResponse} The poll votes
|
|
13287
|
+
*/
|
|
13288
|
+
|
|
13289
|
+
}, {
|
|
13290
|
+
key: "queryPollVotes",
|
|
13291
|
+
value: function () {
|
|
13292
|
+
var _queryPollVotes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee108(pollId) {
|
|
13293
|
+
var filter,
|
|
13294
|
+
sort,
|
|
13295
|
+
options,
|
|
13296
|
+
_args108 = arguments;
|
|
13297
|
+
return _regeneratorRuntime.wrap(function _callee108$(_context108) {
|
|
13298
|
+
while (1) {
|
|
13299
|
+
switch (_context108.prev = _context108.next) {
|
|
13300
|
+
case 0:
|
|
13301
|
+
filter = _args108.length > 1 && _args108[1] !== undefined ? _args108[1] : {};
|
|
13302
|
+
sort = _args108.length > 2 && _args108[2] !== undefined ? _args108[2] : [];
|
|
13303
|
+
options = _args108.length > 3 && _args108[3] !== undefined ? _args108[3] : {};
|
|
13304
|
+
_context108.next = 5;
|
|
13305
|
+
return this.post(this.baseURL + "/polls/".concat(pollId, "/votes"), _objectSpread({
|
|
13306
|
+
filter: filter,
|
|
13307
|
+
sort: normalizeQuerySort(sort)
|
|
13308
|
+
}, options));
|
|
13309
|
+
|
|
13310
|
+
case 5:
|
|
13311
|
+
return _context108.abrupt("return", _context108.sent);
|
|
13312
|
+
|
|
13313
|
+
case 6:
|
|
13314
|
+
case "end":
|
|
13315
|
+
return _context108.stop();
|
|
13316
|
+
}
|
|
13317
|
+
}
|
|
13318
|
+
}, _callee108, this);
|
|
13319
|
+
}));
|
|
13320
|
+
|
|
13321
|
+
function queryPollVotes(_x155) {
|
|
13322
|
+
return _queryPollVotes.apply(this, arguments);
|
|
13323
|
+
}
|
|
13324
|
+
|
|
13325
|
+
return queryPollVotes;
|
|
13326
|
+
}()
|
|
12562
13327
|
}], [{
|
|
12563
13328
|
key: "getInstance",
|
|
12564
13329
|
value: function getInstance(key, secretOrOptions, options) {
|
|
@@ -12611,6 +13376,11 @@ var EVENT_MAP = {
|
|
|
12611
13376
|
'notification.mutes_updated': true,
|
|
12612
13377
|
'notification.removed_from_channel': true,
|
|
12613
13378
|
'notification.thread_message_new': true,
|
|
13379
|
+
'poll.closed': true,
|
|
13380
|
+
'poll.updated': true,
|
|
13381
|
+
'poll.vote_casted': true,
|
|
13382
|
+
'poll.vote_changed': true,
|
|
13383
|
+
'poll.vote_removed': true,
|
|
12614
13384
|
'reaction.deleted': true,
|
|
12615
13385
|
'reaction.new': true,
|
|
12616
13386
|
'reaction.updated': true,
|
|
@@ -12706,5 +13476,5 @@ var BuiltinPermissions = {
|
|
|
12706
13476
|
UseFrozenChannel: 'Send messages and reactions to frozen channels'
|
|
12707
13477
|
};
|
|
12708
13478
|
|
|
12709
|
-
export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Campaign, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, Segment, StableWSConnection, StreamChat, Thread, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, formatMessage, isOwnUser, logChatPromiseExecution, postInsights };
|
|
13479
|
+
export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Campaign, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, Segment, StableWSConnection, StreamChat, Thread, TokenManager, UserFromToken, VotingVisibility, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, formatMessage, isOwnUser, logChatPromiseExecution, postInsights };
|
|
12710
13480
|
//# sourceMappingURL=index.es.js.map
|