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.es.js CHANGED
@@ -1066,7 +1066,8 @@ var Channel = /*#__PURE__*/function () {
1066
1066
  * sendMessage - Send a message to this channel
1067
1067
  *
1068
1068
  * @param {Message<AttachmentType, MessageType, UserType>} message The Message object
1069
- * @param {{ skip_push?: boolean }} [options] Option object, {skip_push: true} to skip sending push notifications
1069
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
1070
+ * @param {boolean} [options.skip_push] Skip sending push notifications
1070
1071
  *
1071
1072
  * @return {Promise<SendMessageAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The Server Response
1072
1073
  */
@@ -1261,8 +1262,8 @@ var Channel = /*#__PURE__*/function () {
1261
1262
  * queryMembers - Query Members
1262
1263
  *
1263
1264
  * @param {UserFilters<UserType>} filterConditions object MongoDB style filters
1264
- * @param {UserSort<UserType>} [sort] Sort options, for instance [{created_at: -1}].
1265
- * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_active: -1}, {created_at: 1}]
1265
+ * @param {MemberSort<UserType>} [sort] Sort options, for instance [{created_at: -1}].
1266
+ * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{name: -1}, {created_at: 1}]
1266
1267
  * @param {{ limit?: number; offset?: number }} [options] Option object, {limit: 10, offset:10}
1267
1268
  *
1268
1269
  * @return {Promise<ChannelMemberAPIResponse<UserType>>} Query Members response
@@ -2514,6 +2515,7 @@ var Channel = /*#__PURE__*/function () {
2514
2515
  if (message.silent) return false;
2515
2516
  if (((_message$user = message.user) === null || _message$user === void 0 ? void 0 : _message$user.id) === this.getClient().userID) return false;
2516
2517
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
2518
+ if (message.type === 'system') return false;
2517
2519
  if (this.muteStatus().muted) return false;
2518
2520
  return true;
2519
2521
  }
@@ -3704,14 +3706,22 @@ var StableWSConnection = /*#__PURE__*/function () {
3704
3706
  });
3705
3707
 
3706
3708
  _defineProperty(this, "_listenForConnectionChanges", function () {
3707
- if (typeof window !== 'undefined' && window != null && window.addEventListener != null) {
3709
+ var _window;
3710
+
3711
+ // (typeof window !== 'undefined') check is for environments where window is not defined, such as nextjs environment,
3712
+ // and thus (window === undefined) will result in ReferenceError.
3713
+ if (typeof window !== 'undefined' && (_window = window) !== null && _window !== void 0 && _window.addEventListener) {
3708
3714
  window.addEventListener('offline', _this.onlineStatusChanged);
3709
3715
  window.addEventListener('online', _this.onlineStatusChanged);
3710
3716
  }
3711
3717
  });
3712
3718
 
3713
3719
  _defineProperty(this, "_removeConnectionListeners", function () {
3714
- if (typeof window !== 'undefined' && window != null && window.addEventListener != null) {
3720
+ var _window2;
3721
+
3722
+ // (typeof window !== 'undefined') check is for environments where window is not defined, such as nextjs environment,
3723
+ // and thus (window === undefined) will result in ReferenceError.
3724
+ if (typeof window !== 'undefined' && (_window2 = window) !== null && _window2 !== void 0 && _window2.removeEventListener) {
3715
3725
  window.removeEventListener('offline', _this.onlineStatusChanged);
3716
3726
  window.removeEventListener('online', _this.onlineStatusChanged);
3717
3727
  }
@@ -5375,6 +5385,8 @@ var StreamChat = /*#__PURE__*/function () {
5375
5385
 
5376
5386
  _defineProperty(this, "updateUser", this.upsertUser);
5377
5387
 
5388
+ _defineProperty(this, "markAllRead", this.markChannelsRead);
5389
+
5378
5390
  _defineProperty(this, "_isUsingServerAuth", function () {
5379
5391
  return !!_this.secret;
5380
5392
  });
@@ -5780,6 +5792,7 @@ var StreamChat = /*#__PURE__*/function () {
5780
5792
  apnTemplate: '{}', //if app doesn't have apn configured it will error
5781
5793
  firebaseTemplate: '{}', //if app doesn't have firebase configured it will error
5782
5794
  firebaseDataTemplate: '{}', //if app doesn't have firebase configured it will error
5795
+ huaweiDataTemplate: '{}' //if app doesn't have huawei configured it will error
5783
5796
  skipDevices: true, // skip config/device checks and sending to real devices
5784
5797
  }
5785
5798
  */
@@ -5796,7 +5809,7 @@ var StreamChat = /*#__PURE__*/function () {
5796
5809
  case 0:
5797
5810
  data = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
5798
5811
  _context11.next = 3;
5799
- return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
5812
+ return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
5800
5813
  user_id: userID
5801
5814
  }, data.messageID ? {
5802
5815
  message_id: data.messageID
@@ -5806,6 +5819,8 @@ var StreamChat = /*#__PURE__*/function () {
5806
5819
  firebase_template: data.firebaseTemplate
5807
5820
  } : {}), data.firebaseDataTemplate ? {
5808
5821
  firebase_data_template: data.firebaseDataTemplate
5822
+ } : {}), data.huaweiDataTemplate ? {
5823
+ huawei_data_template: data.huaweiDataTemplate
5809
5824
  } : {}), data.skipDevices ? {
5810
5825
  skip_devices: true
5811
5826
  } : {}));
@@ -5830,13 +5845,11 @@ var StreamChat = /*#__PURE__*/function () {
5830
5845
  /**
5831
5846
  * testSQSSettings - Tests that the given or configured SQS configuration is valid
5832
5847
  *
5833
- * @param {string} userID User ID. If user has no devices, it will error
5834
- * @param {TestPushDataInput} [data] Overrides for push templates/message used
5848
+ * @param {TestSQSDataInput} [data] Overrides SQS settings for testing if needed
5835
5849
  * IE: {
5836
- messageID: 'id-of-message',//will error if message does not exist
5837
- apnTemplate: '{}', //if app doesn't have apn configured it will error
5838
- firebaseTemplate: '{}', //if app doesn't have firebase configured it will error
5839
- firebaseDataTemplate: '{}', //if app doesn't have firebase configured it will error
5850
+ sqs_key: 'auth_key',
5851
+ sqs_secret: 'auth_secret',
5852
+ sqs_url: 'url_to_queue',
5840
5853
  }
5841
5854
  */
5842
5855
 
@@ -6709,7 +6722,7 @@ var StreamChat = /*#__PURE__*/function () {
6709
6722
  *
6710
6723
  * @param {BaseDeviceFields} device the device object
6711
6724
  * @param {string} device.id device id
6712
- * @param {string} device.push_provider the push provider (apn or firebase)
6725
+ * @param {string} device.push_provider the push provider
6713
6726
  *
6714
6727
  */
6715
6728
 
@@ -6726,7 +6739,7 @@ var StreamChat = /*#__PURE__*/function () {
6726
6739
  * addDevice - Adds a push device for a user.
6727
6740
  *
6728
6741
  * @param {string} id the device id
6729
- * @param {'apn' | 'firebase'} push_provider the push provider (apn or firebase)
6742
+ * @param {PushProvider} push_provider the push provider
6730
6743
  * @param {string} [userID] the user id (defaults to current user)
6731
6744
  *
6732
6745
  */
@@ -7717,6 +7730,8 @@ var StreamChat = /*#__PURE__*/function () {
7717
7730
  return unflagUser;
7718
7731
  }()
7719
7732
  /**
7733
+ * @deprecated use markChannelsRead instead
7734
+ *
7720
7735
  * markAllRead - marks all channels for this user as read
7721
7736
  * @param {MarkAllReadOptions<UserType>} [data]
7722
7737
  *
@@ -7724,9 +7739,18 @@ var StreamChat = /*#__PURE__*/function () {
7724
7739
  */
7725
7740
 
7726
7741
  }, {
7727
- key: "markAllRead",
7728
- value: function () {
7729
- var _markAllRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41() {
7742
+ key: "markChannelsRead",
7743
+ value:
7744
+ /**
7745
+ * markChannelsRead - marks channels read -
7746
+ * it accepts a map of cid:messageid pairs, if messageid is empty, the whole channel will be marked as read
7747
+ *
7748
+ * @param {MarkChannelsReadOptions <UserType>} [data]
7749
+ *
7750
+ * @return {Promise<APIResponse>}
7751
+ */
7752
+ function () {
7753
+ var _markChannelsRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41() {
7730
7754
  var data,
7731
7755
  _args41 = arguments;
7732
7756
  return _regeneratorRuntime.wrap(function _callee41$(_context41) {
@@ -7745,11 +7769,11 @@ var StreamChat = /*#__PURE__*/function () {
7745
7769
  }, _callee41, this);
7746
7770
  }));
7747
7771
 
7748
- function markAllRead() {
7749
- return _markAllRead.apply(this, arguments);
7772
+ function markChannelsRead() {
7773
+ return _markChannelsRead.apply(this, arguments);
7750
7774
  }
7751
7775
 
7752
- return markAllRead;
7776
+ return markChannelsRead;
7753
7777
  }()
7754
7778
  }, {
7755
7779
  key: "createCommand",
@@ -7930,6 +7954,7 @@ var StreamChat = /*#__PURE__*/function () {
7930
7954
  *
7931
7955
  * @param {Omit<MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>, 'mentioned_users'> & { mentioned_users?: string[] }} message object, id needs to be specified
7932
7956
  * @param {string | { id: string }} [userId]
7957
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
7933
7958
  *
7934
7959
  * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the message
7935
7960
  */
@@ -7937,7 +7962,7 @@ var StreamChat = /*#__PURE__*/function () {
7937
7962
  }, {
7938
7963
  key: "updateMessage",
7939
7964
  value: function () {
7940
- var _updateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(message, userId) {
7965
+ var _updateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(message, userId, options) {
7941
7966
  var clonedMessage, reservedMessageFields;
7942
7967
  return _regeneratorRuntime.wrap(function _callee43$(_context43) {
7943
7968
  while (1) {
@@ -7982,9 +8007,9 @@ var StreamChat = /*#__PURE__*/function () {
7982
8007
  }
7983
8008
 
7984
8009
  _context43.next = 10;
7985
- return this.post(this.baseURL + "/messages/".concat(message.id), {
8010
+ return this.post(this.baseURL + "/messages/".concat(message.id), _objectSpread({
7986
8011
  message: clonedMessage
7987
- });
8012
+ }, options));
7988
8013
 
7989
8014
  case 10:
7990
8015
  return _context43.abrupt("return", _context43.sent);
@@ -7997,7 +8022,7 @@ var StreamChat = /*#__PURE__*/function () {
7997
8022
  }, _callee43, this);
7998
8023
  }));
7999
8024
 
8000
- function updateMessage(_x55, _x56) {
8025
+ function updateMessage(_x55, _x56, _x57) {
8001
8026
  return _updateMessage.apply(this, arguments);
8002
8027
  }
8003
8028
 
@@ -8012,13 +8037,15 @@ var StreamChat = /*#__PURE__*/function () {
8012
8037
  * example: {id: "user1", set:{text: "hi"}, unset:["color"]}
8013
8038
  * @param {string | { id: string }} [userId]
8014
8039
  *
8040
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
8041
+ *
8015
8042
  * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the updated message
8016
8043
  */
8017
8044
 
8018
8045
  }, {
8019
8046
  key: "partialUpdateMessage",
8020
8047
  value: function () {
8021
- var _partialUpdateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(id, partialMessageObject, userId) {
8048
+ var _partialUpdateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(id, partialMessageObject, userId, options) {
8022
8049
  var user;
8023
8050
  return _regeneratorRuntime.wrap(function _callee44$(_context44) {
8024
8051
  while (1) {
@@ -8041,7 +8068,7 @@ var StreamChat = /*#__PURE__*/function () {
8041
8068
  }
8042
8069
 
8043
8070
  _context44.next = 6;
8044
- return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread({}, partialMessageObject), {}, {
8071
+ return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
8045
8072
  user: user
8046
8073
  }));
8047
8074
 
@@ -8056,7 +8083,7 @@ var StreamChat = /*#__PURE__*/function () {
8056
8083
  }, _callee44, this);
8057
8084
  }));
8058
8085
 
8059
- function partialUpdateMessage(_x57, _x58, _x59) {
8086
+ function partialUpdateMessage(_x58, _x59, _x60, _x61) {
8060
8087
  return _partialUpdateMessage.apply(this, arguments);
8061
8088
  }
8062
8089
 
@@ -8093,7 +8120,7 @@ var StreamChat = /*#__PURE__*/function () {
8093
8120
  }, _callee45, this);
8094
8121
  }));
8095
8122
 
8096
- function deleteMessage(_x60, _x61) {
8123
+ function deleteMessage(_x62, _x63) {
8097
8124
  return _deleteMessage.apply(this, arguments);
8098
8125
  }
8099
8126
 
@@ -8121,7 +8148,7 @@ var StreamChat = /*#__PURE__*/function () {
8121
8148
  }, _callee46, this);
8122
8149
  }));
8123
8150
 
8124
- function getMessage(_x62) {
8151
+ function getMessage(_x64) {
8125
8152
  return _getMessage.apply(this, arguments);
8126
8153
  }
8127
8154
 
@@ -8130,7 +8157,7 @@ var StreamChat = /*#__PURE__*/function () {
8130
8157
  }, {
8131
8158
  key: "getUserAgent",
8132
8159
  value: function getUserAgent() {
8133
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "4.2.0");
8160
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "4.3.0");
8134
8161
  }
8135
8162
  }, {
8136
8163
  key: "setUserAgent",
@@ -8332,7 +8359,7 @@ var StreamChat = /*#__PURE__*/function () {
8332
8359
  }, _callee47, this);
8333
8360
  }));
8334
8361
 
8335
- function sendUserCustomEvent(_x63, _x64) {
8362
+ function sendUserCustomEvent(_x65, _x66) {
8336
8363
  return _sendUserCustomEvent.apply(this, arguments);
8337
8364
  }
8338
8365
 
@@ -8420,7 +8447,7 @@ var StreamChat = /*#__PURE__*/function () {
8420
8447
  }, _callee48, this);
8421
8448
  }));
8422
8449
 
8423
- function createSegment(_x65) {
8450
+ function createSegment(_x67) {
8424
8451
  return _createSegment.apply(this, arguments);
8425
8452
  }
8426
8453
 
@@ -8460,7 +8487,7 @@ var StreamChat = /*#__PURE__*/function () {
8460
8487
  }, _callee49, this);
8461
8488
  }));
8462
8489
 
8463
- function getSegment(_x66) {
8490
+ function getSegment(_x68) {
8464
8491
  return _getSegment.apply(this, arguments);
8465
8492
  }
8466
8493
 
@@ -8499,7 +8526,7 @@ var StreamChat = /*#__PURE__*/function () {
8499
8526
  }, _callee50, this);
8500
8527
  }));
8501
8528
 
8502
- function listSegments(_x67) {
8529
+ function listSegments(_x69) {
8503
8530
  return _listSegments.apply(this, arguments);
8504
8531
  }
8505
8532
 
@@ -8542,7 +8569,7 @@ var StreamChat = /*#__PURE__*/function () {
8542
8569
  }, _callee51, this);
8543
8570
  }));
8544
8571
 
8545
- function updateSegment(_x68, _x69) {
8572
+ function updateSegment(_x70, _x71) {
8546
8573
  return _updateSegment.apply(this, arguments);
8547
8574
  }
8548
8575
 
@@ -8574,7 +8601,7 @@ var StreamChat = /*#__PURE__*/function () {
8574
8601
  }, _callee52, this);
8575
8602
  }));
8576
8603
 
8577
- function deleteSegment(_x70) {
8604
+ function deleteSegment(_x72) {
8578
8605
  return _deleteSegment.apply(this, arguments);
8579
8606
  }
8580
8607
 
@@ -8616,7 +8643,7 @@ var StreamChat = /*#__PURE__*/function () {
8616
8643
  }, _callee53, this);
8617
8644
  }));
8618
8645
 
8619
- function createCampaign(_x71) {
8646
+ function createCampaign(_x73) {
8620
8647
  return _createCampaign.apply(this, arguments);
8621
8648
  }
8622
8649
 
@@ -8656,7 +8683,7 @@ var StreamChat = /*#__PURE__*/function () {
8656
8683
  }, _callee54, this);
8657
8684
  }));
8658
8685
 
8659
- function getCampaign(_x72) {
8686
+ function getCampaign(_x74) {
8660
8687
  return _getCampaign.apply(this, arguments);
8661
8688
  }
8662
8689
 
@@ -8695,7 +8722,7 @@ var StreamChat = /*#__PURE__*/function () {
8695
8722
  }, _callee55, this);
8696
8723
  }));
8697
8724
 
8698
- function listCampaigns(_x73) {
8725
+ function listCampaigns(_x75) {
8699
8726
  return _listCampaigns.apply(this, arguments);
8700
8727
  }
8701
8728
 
@@ -8738,7 +8765,7 @@ var StreamChat = /*#__PURE__*/function () {
8738
8765
  }, _callee56, this);
8739
8766
  }));
8740
8767
 
8741
- function updateCampaign(_x74, _x75) {
8768
+ function updateCampaign(_x76, _x77) {
8742
8769
  return _updateCampaign.apply(this, arguments);
8743
8770
  }
8744
8771
 
@@ -8770,7 +8797,7 @@ var StreamChat = /*#__PURE__*/function () {
8770
8797
  }, _callee57, this);
8771
8798
  }));
8772
8799
 
8773
- function deleteCampaign(_x76) {
8800
+ function deleteCampaign(_x78) {
8774
8801
  return _deleteCampaign.apply(this, arguments);
8775
8802
  }
8776
8803
 
@@ -8814,7 +8841,7 @@ var StreamChat = /*#__PURE__*/function () {
8814
8841
  }, _callee58, this);
8815
8842
  }));
8816
8843
 
8817
- function scheduleCampaign(_x77, _x78) {
8844
+ function scheduleCampaign(_x79, _x80) {
8818
8845
  return _scheduleCampaign.apply(this, arguments);
8819
8846
  }
8820
8847
 
@@ -8854,7 +8881,7 @@ var StreamChat = /*#__PURE__*/function () {
8854
8881
  }, _callee59, this);
8855
8882
  }));
8856
8883
 
8857
- function stopCampaign(_x79) {
8884
+ function stopCampaign(_x81) {
8858
8885
  return _stopCampaign.apply(this, arguments);
8859
8886
  }
8860
8887
 
@@ -8894,7 +8921,7 @@ var StreamChat = /*#__PURE__*/function () {
8894
8921
  }, _callee60, this);
8895
8922
  }));
8896
8923
 
8897
- function resumeCampaign(_x80) {
8924
+ function resumeCampaign(_x82) {
8898
8925
  return _resumeCampaign.apply(this, arguments);
8899
8926
  }
8900
8927
 
@@ -8937,12 +8964,182 @@ var StreamChat = /*#__PURE__*/function () {
8937
8964
  }, _callee61, this);
8938
8965
  }));
8939
8966
 
8940
- function testCampaign(_x81, _x82) {
8967
+ function testCampaign(_x83, _x84) {
8941
8968
  return _testCampaign.apply(this, arguments);
8942
8969
  }
8943
8970
 
8944
8971
  return testCampaign;
8945
8972
  }()
8973
+ /**
8974
+ * enrichURL - Get OpenGraph data of the given link
8975
+ *
8976
+ * @param {string} url link
8977
+ * @return {OGAttachment} OG Attachment
8978
+ */
8979
+
8980
+ }, {
8981
+ key: "enrichURL",
8982
+ value: function () {
8983
+ var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(url) {
8984
+ return _regeneratorRuntime.wrap(function _callee62$(_context62) {
8985
+ while (1) {
8986
+ switch (_context62.prev = _context62.next) {
8987
+ case 0:
8988
+ return _context62.abrupt("return", this.get(this.baseURL + "/og", {
8989
+ url: url
8990
+ }));
8991
+
8992
+ case 1:
8993
+ case "end":
8994
+ return _context62.stop();
8995
+ }
8996
+ }
8997
+ }, _callee62, this);
8998
+ }));
8999
+
9000
+ function enrichURL(_x85) {
9001
+ return _enrichURL.apply(this, arguments);
9002
+ }
9003
+
9004
+ return enrichURL;
9005
+ }()
9006
+ /**
9007
+ * getTask - Gets status of a long running task
9008
+ *
9009
+ * @param {string} id Task ID
9010
+ *
9011
+ * @return {TaskStatus} The task status
9012
+ */
9013
+
9014
+ }, {
9015
+ key: "getTask",
9016
+ value: function () {
9017
+ var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(id) {
9018
+ return _regeneratorRuntime.wrap(function _callee63$(_context63) {
9019
+ while (1) {
9020
+ switch (_context63.prev = _context63.next) {
9021
+ case 0:
9022
+ return _context63.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
9023
+
9024
+ case 1:
9025
+ case "end":
9026
+ return _context63.stop();
9027
+ }
9028
+ }
9029
+ }, _callee63, this);
9030
+ }));
9031
+
9032
+ function getTask(_x86) {
9033
+ return _getTask.apply(this, arguments);
9034
+ }
9035
+
9036
+ return getTask;
9037
+ }()
9038
+ /**
9039
+ * deleteChannels - Deletes a list of channel
9040
+ *
9041
+ * @param {string[]} cids Channel CIDs
9042
+ * @param {boolean} [options.hard_delete] Defines if the channel is hard deleted or not
9043
+ *
9044
+ * @return {DeleteChannelsResponse} Result of the soft deletion, if server-side, it holds the task ID as well
9045
+ */
9046
+
9047
+ }, {
9048
+ key: "deleteChannels",
9049
+ value: function () {
9050
+ var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(cids) {
9051
+ var options,
9052
+ _args64 = arguments;
9053
+ return _regeneratorRuntime.wrap(function _callee64$(_context64) {
9054
+ while (1) {
9055
+ switch (_context64.prev = _context64.next) {
9056
+ case 0:
9057
+ options = _args64.length > 1 && _args64[1] !== undefined ? _args64[1] : {};
9058
+ _context64.next = 3;
9059
+ return this.post(this.baseURL + "/channels/delete", _objectSpread({
9060
+ cids: cids
9061
+ }, options));
9062
+
9063
+ case 3:
9064
+ return _context64.abrupt("return", _context64.sent);
9065
+
9066
+ case 4:
9067
+ case "end":
9068
+ return _context64.stop();
9069
+ }
9070
+ }
9071
+ }, _callee64, this);
9072
+ }));
9073
+
9074
+ function deleteChannels(_x87) {
9075
+ return _deleteChannels.apply(this, arguments);
9076
+ }
9077
+
9078
+ return deleteChannels;
9079
+ }()
9080
+ /**
9081
+ * deleteUsers - Batch Delete Users
9082
+ *
9083
+ * @param {string[]} user_ids which users to delete
9084
+ * @param {DeleteUserOptions} options Configuration how to delete users
9085
+ *
9086
+ * @return {APIResponse} A task ID
9087
+ */
9088
+
9089
+ }, {
9090
+ key: "deleteUsers",
9091
+ value: function () {
9092
+ var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(user_ids, options) {
9093
+ return _regeneratorRuntime.wrap(function _callee65$(_context65) {
9094
+ while (1) {
9095
+ switch (_context65.prev = _context65.next) {
9096
+ case 0:
9097
+ if (!((options === null || options === void 0 ? void 0 : options.user) !== 'soft' && (options === null || options === void 0 ? void 0 : options.user) !== 'hard')) {
9098
+ _context65.next = 2;
9099
+ break;
9100
+ }
9101
+
9102
+ throw new Error('Invalid delete user options. user must be one of [soft hard]');
9103
+
9104
+ case 2:
9105
+ if (!(options.messages !== undefined && options.messages !== 'soft' && options.messages !== 'hard')) {
9106
+ _context65.next = 4;
9107
+ break;
9108
+ }
9109
+
9110
+ throw new Error('Invalid delete user options. messages must be one of [soft hard]');
9111
+
9112
+ case 4:
9113
+ if (!(options.conversations !== undefined && options.conversations !== 'soft' && options.conversations !== 'hard')) {
9114
+ _context65.next = 6;
9115
+ break;
9116
+ }
9117
+
9118
+ throw new Error('Invalid delete user options. conversations must be one of [soft hard]');
9119
+
9120
+ case 6:
9121
+ _context65.next = 8;
9122
+ return this.post(this.baseURL + "/users/delete", _objectSpread({
9123
+ user_ids: user_ids
9124
+ }, options));
9125
+
9126
+ case 8:
9127
+ return _context65.abrupt("return", _context65.sent);
9128
+
9129
+ case 9:
9130
+ case "end":
9131
+ return _context65.stop();
9132
+ }
9133
+ }
9134
+ }, _callee65, this);
9135
+ }));
9136
+
9137
+ function deleteUsers(_x88, _x89) {
9138
+ return _deleteUsers.apply(this, arguments);
9139
+ }
9140
+
9141
+ return deleteUsers;
9142
+ }()
8946
9143
  }], [{
8947
9144
  key: "getInstance",
8948
9145
  value: function getInstance(key, secretOrOptions, options) {