stream-chat 4.2.0 → 4.3.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/index.js CHANGED
@@ -1089,7 +1089,8 @@ var Channel = /*#__PURE__*/function () {
1089
1089
  * sendMessage - Send a message to this channel
1090
1090
  *
1091
1091
  * @param {Message<AttachmentType, MessageType, UserType>} message The Message object
1092
- * @param {{ skip_push?: boolean }} [options] Option object, {skip_push: true} to skip sending push notifications
1092
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
1093
+ * @param {boolean} [options.skip_push] Skip sending push notifications
1093
1094
  *
1094
1095
  * @return {Promise<SendMessageAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The Server Response
1095
1096
  */
@@ -1284,8 +1285,8 @@ var Channel = /*#__PURE__*/function () {
1284
1285
  * queryMembers - Query Members
1285
1286
  *
1286
1287
  * @param {UserFilters<UserType>} filterConditions object MongoDB style filters
1287
- * @param {UserSort<UserType>} [sort] Sort options, for instance [{created_at: -1}].
1288
- * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_active: -1}, {created_at: 1}]
1288
+ * @param {MemberSort<UserType>} [sort] Sort options, for instance [{created_at: -1}].
1289
+ * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{name: -1}, {created_at: 1}]
1289
1290
  * @param {{ limit?: number; offset?: number }} [options] Option object, {limit: 10, offset:10}
1290
1291
  *
1291
1292
  * @return {Promise<ChannelMemberAPIResponse<UserType>>} Query Members response
@@ -2537,6 +2538,7 @@ var Channel = /*#__PURE__*/function () {
2537
2538
  if (message.silent) return false;
2538
2539
  if (((_message$user = message.user) === null || _message$user === void 0 ? void 0 : _message$user.id) === this.getClient().userID) return false;
2539
2540
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
2541
+ if (message.type === 'system') return false;
2540
2542
  if (this.muteStatus().muted) return false;
2541
2543
  return true;
2542
2544
  }
@@ -3727,14 +3729,22 @@ var StableWSConnection = /*#__PURE__*/function () {
3727
3729
  });
3728
3730
 
3729
3731
  _defineProperty__default['default'](this, "_listenForConnectionChanges", function () {
3730
- if (typeof window !== 'undefined' && window != null && window.addEventListener != null) {
3732
+ var _window;
3733
+
3734
+ // (typeof window !== 'undefined') check is for environments where window is not defined, such as nextjs environment,
3735
+ // and thus (window === undefined) will result in ReferenceError.
3736
+ if (typeof window !== 'undefined' && (_window = window) !== null && _window !== void 0 && _window.addEventListener) {
3731
3737
  window.addEventListener('offline', _this.onlineStatusChanged);
3732
3738
  window.addEventListener('online', _this.onlineStatusChanged);
3733
3739
  }
3734
3740
  });
3735
3741
 
3736
3742
  _defineProperty__default['default'](this, "_removeConnectionListeners", function () {
3737
- if (typeof window !== 'undefined' && window != null && window.addEventListener != null) {
3743
+ var _window2;
3744
+
3745
+ // (typeof window !== 'undefined') check is for environments where window is not defined, such as nextjs environment,
3746
+ // and thus (window === undefined) will result in ReferenceError.
3747
+ if (typeof window !== 'undefined' && (_window2 = window) !== null && _window2 !== void 0 && _window2.removeEventListener) {
3738
3748
  window.removeEventListener('offline', _this.onlineStatusChanged);
3739
3749
  window.removeEventListener('online', _this.onlineStatusChanged);
3740
3750
  }
@@ -5398,6 +5408,8 @@ var StreamChat = /*#__PURE__*/function () {
5398
5408
 
5399
5409
  _defineProperty__default['default'](this, "updateUser", this.upsertUser);
5400
5410
 
5411
+ _defineProperty__default['default'](this, "markAllRead", this.markChannelsRead);
5412
+
5401
5413
  _defineProperty__default['default'](this, "_isUsingServerAuth", function () {
5402
5414
  return !!_this.secret;
5403
5415
  });
@@ -5803,6 +5815,7 @@ var StreamChat = /*#__PURE__*/function () {
5803
5815
  apnTemplate: '{}', //if app doesn't have apn configured it will error
5804
5816
  firebaseTemplate: '{}', //if app doesn't have firebase configured it will error
5805
5817
  firebaseDataTemplate: '{}', //if app doesn't have firebase configured it will error
5818
+ huaweiDataTemplate: '{}' //if app doesn't have huawei configured it will error
5806
5819
  skipDevices: true, // skip config/device checks and sending to real devices
5807
5820
  }
5808
5821
  */
@@ -5819,7 +5832,7 @@ var StreamChat = /*#__PURE__*/function () {
5819
5832
  case 0:
5820
5833
  data = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
5821
5834
  _context11.next = 3;
5822
- return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
5835
+ return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
5823
5836
  user_id: userID
5824
5837
  }, data.messageID ? {
5825
5838
  message_id: data.messageID
@@ -5829,6 +5842,8 @@ var StreamChat = /*#__PURE__*/function () {
5829
5842
  firebase_template: data.firebaseTemplate
5830
5843
  } : {}), data.firebaseDataTemplate ? {
5831
5844
  firebase_data_template: data.firebaseDataTemplate
5845
+ } : {}), data.huaweiDataTemplate ? {
5846
+ huawei_data_template: data.huaweiDataTemplate
5832
5847
  } : {}), data.skipDevices ? {
5833
5848
  skip_devices: true
5834
5849
  } : {}));
@@ -5853,13 +5868,11 @@ var StreamChat = /*#__PURE__*/function () {
5853
5868
  /**
5854
5869
  * testSQSSettings - Tests that the given or configured SQS configuration is valid
5855
5870
  *
5856
- * @param {string} userID User ID. If user has no devices, it will error
5857
- * @param {TestPushDataInput} [data] Overrides for push templates/message used
5871
+ * @param {TestSQSDataInput} [data] Overrides SQS settings for testing if needed
5858
5872
  * IE: {
5859
- messageID: 'id-of-message',//will error if message does not exist
5860
- apnTemplate: '{}', //if app doesn't have apn configured it will error
5861
- firebaseTemplate: '{}', //if app doesn't have firebase configured it will error
5862
- firebaseDataTemplate: '{}', //if app doesn't have firebase configured it will error
5873
+ sqs_key: 'auth_key',
5874
+ sqs_secret: 'auth_secret',
5875
+ sqs_url: 'url_to_queue',
5863
5876
  }
5864
5877
  */
5865
5878
 
@@ -6732,7 +6745,7 @@ var StreamChat = /*#__PURE__*/function () {
6732
6745
  *
6733
6746
  * @param {BaseDeviceFields} device the device object
6734
6747
  * @param {string} device.id device id
6735
- * @param {string} device.push_provider the push provider (apn or firebase)
6748
+ * @param {string} device.push_provider the push provider
6736
6749
  *
6737
6750
  */
6738
6751
 
@@ -6749,7 +6762,7 @@ var StreamChat = /*#__PURE__*/function () {
6749
6762
  * addDevice - Adds a push device for a user.
6750
6763
  *
6751
6764
  * @param {string} id the device id
6752
- * @param {'apn' | 'firebase'} push_provider the push provider (apn or firebase)
6765
+ * @param {PushProvider} push_provider the push provider
6753
6766
  * @param {string} [userID] the user id (defaults to current user)
6754
6767
  *
6755
6768
  */
@@ -7740,6 +7753,8 @@ var StreamChat = /*#__PURE__*/function () {
7740
7753
  return unflagUser;
7741
7754
  }()
7742
7755
  /**
7756
+ * @deprecated use markChannelsRead instead
7757
+ *
7743
7758
  * markAllRead - marks all channels for this user as read
7744
7759
  * @param {MarkAllReadOptions<UserType>} [data]
7745
7760
  *
@@ -7747,9 +7762,18 @@ var StreamChat = /*#__PURE__*/function () {
7747
7762
  */
7748
7763
 
7749
7764
  }, {
7750
- key: "markAllRead",
7751
- value: function () {
7752
- var _markAllRead = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee41() {
7765
+ key: "markChannelsRead",
7766
+ value:
7767
+ /**
7768
+ * markChannelsRead - marks channels read -
7769
+ * it accepts a map of cid:messageid pairs, if messageid is empty, the whole channel will be marked as read
7770
+ *
7771
+ * @param {MarkChannelsReadOptions <UserType>} [data]
7772
+ *
7773
+ * @return {Promise<APIResponse>}
7774
+ */
7775
+ function () {
7776
+ var _markChannelsRead = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee41() {
7753
7777
  var data,
7754
7778
  _args41 = arguments;
7755
7779
  return _regeneratorRuntime__default['default'].wrap(function _callee41$(_context41) {
@@ -7768,11 +7792,11 @@ var StreamChat = /*#__PURE__*/function () {
7768
7792
  }, _callee41, this);
7769
7793
  }));
7770
7794
 
7771
- function markAllRead() {
7772
- return _markAllRead.apply(this, arguments);
7795
+ function markChannelsRead() {
7796
+ return _markChannelsRead.apply(this, arguments);
7773
7797
  }
7774
7798
 
7775
- return markAllRead;
7799
+ return markChannelsRead;
7776
7800
  }()
7777
7801
  }, {
7778
7802
  key: "createCommand",
@@ -7953,6 +7977,7 @@ var StreamChat = /*#__PURE__*/function () {
7953
7977
  *
7954
7978
  * @param {Omit<MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>, 'mentioned_users'> & { mentioned_users?: string[] }} message object, id needs to be specified
7955
7979
  * @param {string | { id: string }} [userId]
7980
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
7956
7981
  *
7957
7982
  * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the message
7958
7983
  */
@@ -7960,7 +7985,7 @@ var StreamChat = /*#__PURE__*/function () {
7960
7985
  }, {
7961
7986
  key: "updateMessage",
7962
7987
  value: function () {
7963
- var _updateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee43(message, userId) {
7988
+ var _updateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee43(message, userId, options) {
7964
7989
  var clonedMessage, reservedMessageFields;
7965
7990
  return _regeneratorRuntime__default['default'].wrap(function _callee43$(_context43) {
7966
7991
  while (1) {
@@ -8005,9 +8030,9 @@ var StreamChat = /*#__PURE__*/function () {
8005
8030
  }
8006
8031
 
8007
8032
  _context43.next = 10;
8008
- return this.post(this.baseURL + "/messages/".concat(message.id), {
8033
+ return this.post(this.baseURL + "/messages/".concat(message.id), _objectSpread({
8009
8034
  message: clonedMessage
8010
- });
8035
+ }, options));
8011
8036
 
8012
8037
  case 10:
8013
8038
  return _context43.abrupt("return", _context43.sent);
@@ -8020,7 +8045,7 @@ var StreamChat = /*#__PURE__*/function () {
8020
8045
  }, _callee43, this);
8021
8046
  }));
8022
8047
 
8023
- function updateMessage(_x55, _x56) {
8048
+ function updateMessage(_x55, _x56, _x57) {
8024
8049
  return _updateMessage.apply(this, arguments);
8025
8050
  }
8026
8051
 
@@ -8035,13 +8060,15 @@ var StreamChat = /*#__PURE__*/function () {
8035
8060
  * example: {id: "user1", set:{text: "hi"}, unset:["color"]}
8036
8061
  * @param {string | { id: string }} [userId]
8037
8062
  *
8063
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
8064
+ *
8038
8065
  * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the updated message
8039
8066
  */
8040
8067
 
8041
8068
  }, {
8042
8069
  key: "partialUpdateMessage",
8043
8070
  value: function () {
8044
- var _partialUpdateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee44(id, partialMessageObject, userId) {
8071
+ var _partialUpdateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee44(id, partialMessageObject, userId, options) {
8045
8072
  var user;
8046
8073
  return _regeneratorRuntime__default['default'].wrap(function _callee44$(_context44) {
8047
8074
  while (1) {
@@ -8064,7 +8091,7 @@ var StreamChat = /*#__PURE__*/function () {
8064
8091
  }
8065
8092
 
8066
8093
  _context44.next = 6;
8067
- return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread({}, partialMessageObject), {}, {
8094
+ return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
8068
8095
  user: user
8069
8096
  }));
8070
8097
 
@@ -8079,7 +8106,7 @@ var StreamChat = /*#__PURE__*/function () {
8079
8106
  }, _callee44, this);
8080
8107
  }));
8081
8108
 
8082
- function partialUpdateMessage(_x57, _x58, _x59) {
8109
+ function partialUpdateMessage(_x58, _x59, _x60, _x61) {
8083
8110
  return _partialUpdateMessage.apply(this, arguments);
8084
8111
  }
8085
8112
 
@@ -8116,7 +8143,7 @@ var StreamChat = /*#__PURE__*/function () {
8116
8143
  }, _callee45, this);
8117
8144
  }));
8118
8145
 
8119
- function deleteMessage(_x60, _x61) {
8146
+ function deleteMessage(_x62, _x63) {
8120
8147
  return _deleteMessage.apply(this, arguments);
8121
8148
  }
8122
8149
 
@@ -8144,7 +8171,7 @@ var StreamChat = /*#__PURE__*/function () {
8144
8171
  }, _callee46, this);
8145
8172
  }));
8146
8173
 
8147
- function getMessage(_x62) {
8174
+ function getMessage(_x64) {
8148
8175
  return _getMessage.apply(this, arguments);
8149
8176
  }
8150
8177
 
@@ -8153,7 +8180,7 @@ var StreamChat = /*#__PURE__*/function () {
8153
8180
  }, {
8154
8181
  key: "getUserAgent",
8155
8182
  value: function getUserAgent() {
8156
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "4.2.0");
8183
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "4.3.0");
8157
8184
  }
8158
8185
  }, {
8159
8186
  key: "setUserAgent",
@@ -8355,7 +8382,7 @@ var StreamChat = /*#__PURE__*/function () {
8355
8382
  }, _callee47, this);
8356
8383
  }));
8357
8384
 
8358
- function sendUserCustomEvent(_x63, _x64) {
8385
+ function sendUserCustomEvent(_x65, _x66) {
8359
8386
  return _sendUserCustomEvent.apply(this, arguments);
8360
8387
  }
8361
8388
 
@@ -8443,7 +8470,7 @@ var StreamChat = /*#__PURE__*/function () {
8443
8470
  }, _callee48, this);
8444
8471
  }));
8445
8472
 
8446
- function createSegment(_x65) {
8473
+ function createSegment(_x67) {
8447
8474
  return _createSegment.apply(this, arguments);
8448
8475
  }
8449
8476
 
@@ -8483,7 +8510,7 @@ var StreamChat = /*#__PURE__*/function () {
8483
8510
  }, _callee49, this);
8484
8511
  }));
8485
8512
 
8486
- function getSegment(_x66) {
8513
+ function getSegment(_x68) {
8487
8514
  return _getSegment.apply(this, arguments);
8488
8515
  }
8489
8516
 
@@ -8522,7 +8549,7 @@ var StreamChat = /*#__PURE__*/function () {
8522
8549
  }, _callee50, this);
8523
8550
  }));
8524
8551
 
8525
- function listSegments(_x67) {
8552
+ function listSegments(_x69) {
8526
8553
  return _listSegments.apply(this, arguments);
8527
8554
  }
8528
8555
 
@@ -8565,7 +8592,7 @@ var StreamChat = /*#__PURE__*/function () {
8565
8592
  }, _callee51, this);
8566
8593
  }));
8567
8594
 
8568
- function updateSegment(_x68, _x69) {
8595
+ function updateSegment(_x70, _x71) {
8569
8596
  return _updateSegment.apply(this, arguments);
8570
8597
  }
8571
8598
 
@@ -8597,7 +8624,7 @@ var StreamChat = /*#__PURE__*/function () {
8597
8624
  }, _callee52, this);
8598
8625
  }));
8599
8626
 
8600
- function deleteSegment(_x70) {
8627
+ function deleteSegment(_x72) {
8601
8628
  return _deleteSegment.apply(this, arguments);
8602
8629
  }
8603
8630
 
@@ -8639,7 +8666,7 @@ var StreamChat = /*#__PURE__*/function () {
8639
8666
  }, _callee53, this);
8640
8667
  }));
8641
8668
 
8642
- function createCampaign(_x71) {
8669
+ function createCampaign(_x73) {
8643
8670
  return _createCampaign.apply(this, arguments);
8644
8671
  }
8645
8672
 
@@ -8679,7 +8706,7 @@ var StreamChat = /*#__PURE__*/function () {
8679
8706
  }, _callee54, this);
8680
8707
  }));
8681
8708
 
8682
- function getCampaign(_x72) {
8709
+ function getCampaign(_x74) {
8683
8710
  return _getCampaign.apply(this, arguments);
8684
8711
  }
8685
8712
 
@@ -8718,7 +8745,7 @@ var StreamChat = /*#__PURE__*/function () {
8718
8745
  }, _callee55, this);
8719
8746
  }));
8720
8747
 
8721
- function listCampaigns(_x73) {
8748
+ function listCampaigns(_x75) {
8722
8749
  return _listCampaigns.apply(this, arguments);
8723
8750
  }
8724
8751
 
@@ -8761,7 +8788,7 @@ var StreamChat = /*#__PURE__*/function () {
8761
8788
  }, _callee56, this);
8762
8789
  }));
8763
8790
 
8764
- function updateCampaign(_x74, _x75) {
8791
+ function updateCampaign(_x76, _x77) {
8765
8792
  return _updateCampaign.apply(this, arguments);
8766
8793
  }
8767
8794
 
@@ -8793,7 +8820,7 @@ var StreamChat = /*#__PURE__*/function () {
8793
8820
  }, _callee57, this);
8794
8821
  }));
8795
8822
 
8796
- function deleteCampaign(_x76) {
8823
+ function deleteCampaign(_x78) {
8797
8824
  return _deleteCampaign.apply(this, arguments);
8798
8825
  }
8799
8826
 
@@ -8837,7 +8864,7 @@ var StreamChat = /*#__PURE__*/function () {
8837
8864
  }, _callee58, this);
8838
8865
  }));
8839
8866
 
8840
- function scheduleCampaign(_x77, _x78) {
8867
+ function scheduleCampaign(_x79, _x80) {
8841
8868
  return _scheduleCampaign.apply(this, arguments);
8842
8869
  }
8843
8870
 
@@ -8877,7 +8904,7 @@ var StreamChat = /*#__PURE__*/function () {
8877
8904
  }, _callee59, this);
8878
8905
  }));
8879
8906
 
8880
- function stopCampaign(_x79) {
8907
+ function stopCampaign(_x81) {
8881
8908
  return _stopCampaign.apply(this, arguments);
8882
8909
  }
8883
8910
 
@@ -8917,7 +8944,7 @@ var StreamChat = /*#__PURE__*/function () {
8917
8944
  }, _callee60, this);
8918
8945
  }));
8919
8946
 
8920
- function resumeCampaign(_x80) {
8947
+ function resumeCampaign(_x82) {
8921
8948
  return _resumeCampaign.apply(this, arguments);
8922
8949
  }
8923
8950
 
@@ -8960,12 +8987,182 @@ var StreamChat = /*#__PURE__*/function () {
8960
8987
  }, _callee61, this);
8961
8988
  }));
8962
8989
 
8963
- function testCampaign(_x81, _x82) {
8990
+ function testCampaign(_x83, _x84) {
8964
8991
  return _testCampaign.apply(this, arguments);
8965
8992
  }
8966
8993
 
8967
8994
  return testCampaign;
8968
8995
  }()
8996
+ /**
8997
+ * enrichURL - Get OpenGraph data of the given link
8998
+ *
8999
+ * @param {string} url link
9000
+ * @return {OGAttachment} OG Attachment
9001
+ */
9002
+
9003
+ }, {
9004
+ key: "enrichURL",
9005
+ value: function () {
9006
+ var _enrichURL = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee62(url) {
9007
+ return _regeneratorRuntime__default['default'].wrap(function _callee62$(_context62) {
9008
+ while (1) {
9009
+ switch (_context62.prev = _context62.next) {
9010
+ case 0:
9011
+ return _context62.abrupt("return", this.get(this.baseURL + "/og", {
9012
+ url: url
9013
+ }));
9014
+
9015
+ case 1:
9016
+ case "end":
9017
+ return _context62.stop();
9018
+ }
9019
+ }
9020
+ }, _callee62, this);
9021
+ }));
9022
+
9023
+ function enrichURL(_x85) {
9024
+ return _enrichURL.apply(this, arguments);
9025
+ }
9026
+
9027
+ return enrichURL;
9028
+ }()
9029
+ /**
9030
+ * getTask - Gets status of a long running task
9031
+ *
9032
+ * @param {string} id Task ID
9033
+ *
9034
+ * @return {TaskStatus} The task status
9035
+ */
9036
+
9037
+ }, {
9038
+ key: "getTask",
9039
+ value: function () {
9040
+ var _getTask = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee63(id) {
9041
+ return _regeneratorRuntime__default['default'].wrap(function _callee63$(_context63) {
9042
+ while (1) {
9043
+ switch (_context63.prev = _context63.next) {
9044
+ case 0:
9045
+ return _context63.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
9046
+
9047
+ case 1:
9048
+ case "end":
9049
+ return _context63.stop();
9050
+ }
9051
+ }
9052
+ }, _callee63, this);
9053
+ }));
9054
+
9055
+ function getTask(_x86) {
9056
+ return _getTask.apply(this, arguments);
9057
+ }
9058
+
9059
+ return getTask;
9060
+ }()
9061
+ /**
9062
+ * deleteChannels - Deletes a list of channel
9063
+ *
9064
+ * @param {string[]} cids Channel CIDs
9065
+ * @param {boolean} [options.hard_delete] Defines if the channel is hard deleted or not
9066
+ *
9067
+ * @return {DeleteChannelsResponse} Result of the soft deletion, if server-side, it holds the task ID as well
9068
+ */
9069
+
9070
+ }, {
9071
+ key: "deleteChannels",
9072
+ value: function () {
9073
+ var _deleteChannels = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee64(cids) {
9074
+ var options,
9075
+ _args64 = arguments;
9076
+ return _regeneratorRuntime__default['default'].wrap(function _callee64$(_context64) {
9077
+ while (1) {
9078
+ switch (_context64.prev = _context64.next) {
9079
+ case 0:
9080
+ options = _args64.length > 1 && _args64[1] !== undefined ? _args64[1] : {};
9081
+ _context64.next = 3;
9082
+ return this.post(this.baseURL + "/channels/delete", _objectSpread({
9083
+ cids: cids
9084
+ }, options));
9085
+
9086
+ case 3:
9087
+ return _context64.abrupt("return", _context64.sent);
9088
+
9089
+ case 4:
9090
+ case "end":
9091
+ return _context64.stop();
9092
+ }
9093
+ }
9094
+ }, _callee64, this);
9095
+ }));
9096
+
9097
+ function deleteChannels(_x87) {
9098
+ return _deleteChannels.apply(this, arguments);
9099
+ }
9100
+
9101
+ return deleteChannels;
9102
+ }()
9103
+ /**
9104
+ * deleteUsers - Batch Delete Users
9105
+ *
9106
+ * @param {string[]} user_ids which users to delete
9107
+ * @param {DeleteUserOptions} options Configuration how to delete users
9108
+ *
9109
+ * @return {APIResponse} A task ID
9110
+ */
9111
+
9112
+ }, {
9113
+ key: "deleteUsers",
9114
+ value: function () {
9115
+ var _deleteUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee65(user_ids, options) {
9116
+ return _regeneratorRuntime__default['default'].wrap(function _callee65$(_context65) {
9117
+ while (1) {
9118
+ switch (_context65.prev = _context65.next) {
9119
+ case 0:
9120
+ if (!((options === null || options === void 0 ? void 0 : options.user) !== 'soft' && (options === null || options === void 0 ? void 0 : options.user) !== 'hard')) {
9121
+ _context65.next = 2;
9122
+ break;
9123
+ }
9124
+
9125
+ throw new Error('Invalid delete user options. user must be one of [soft hard]');
9126
+
9127
+ case 2:
9128
+ if (!(options.messages !== undefined && options.messages !== 'soft' && options.messages !== 'hard')) {
9129
+ _context65.next = 4;
9130
+ break;
9131
+ }
9132
+
9133
+ throw new Error('Invalid delete user options. messages must be one of [soft hard]');
9134
+
9135
+ case 4:
9136
+ if (!(options.conversations !== undefined && options.conversations !== 'soft' && options.conversations !== 'hard')) {
9137
+ _context65.next = 6;
9138
+ break;
9139
+ }
9140
+
9141
+ throw new Error('Invalid delete user options. conversations must be one of [soft hard]');
9142
+
9143
+ case 6:
9144
+ _context65.next = 8;
9145
+ return this.post(this.baseURL + "/users/delete", _objectSpread({
9146
+ user_ids: user_ids
9147
+ }, options));
9148
+
9149
+ case 8:
9150
+ return _context65.abrupt("return", _context65.sent);
9151
+
9152
+ case 9:
9153
+ case "end":
9154
+ return _context65.stop();
9155
+ }
9156
+ }
9157
+ }, _callee65, this);
9158
+ }));
9159
+
9160
+ function deleteUsers(_x88, _x89) {
9161
+ return _deleteUsers.apply(this, arguments);
9162
+ }
9163
+
9164
+ return deleteUsers;
9165
+ }()
8969
9166
  }], [{
8970
9167
  key: "getInstance",
8971
9168
  value: function getInstance(key, secretOrOptions, options) {