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.
@@ -1065,7 +1065,8 @@ var Channel = /*#__PURE__*/function () {
1065
1065
  * sendMessage - Send a message to this channel
1066
1066
  *
1067
1067
  * @param {Message<AttachmentType, MessageType, UserType>} message The Message object
1068
- * @param {{ skip_push?: boolean }} [options] Option object, {skip_push: true} to skip sending push notifications
1068
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
1069
+ * @param {boolean} [options.skip_push] Skip sending push notifications
1069
1070
  *
1070
1071
  * @return {Promise<SendMessageAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The Server Response
1071
1072
  */
@@ -1260,8 +1261,8 @@ var Channel = /*#__PURE__*/function () {
1260
1261
  * queryMembers - Query Members
1261
1262
  *
1262
1263
  * @param {UserFilters<UserType>} filterConditions object MongoDB style filters
1263
- * @param {UserSort<UserType>} [sort] Sort options, for instance [{created_at: -1}].
1264
- * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_active: -1}, {created_at: 1}]
1264
+ * @param {MemberSort<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 [{name: -1}, {created_at: 1}]
1265
1266
  * @param {{ limit?: number; offset?: number }} [options] Option object, {limit: 10, offset:10}
1266
1267
  *
1267
1268
  * @return {Promise<ChannelMemberAPIResponse<UserType>>} Query Members response
@@ -2513,6 +2514,7 @@ var Channel = /*#__PURE__*/function () {
2513
2514
  if (message.silent) return false;
2514
2515
  if (((_message$user = message.user) === null || _message$user === void 0 ? void 0 : _message$user.id) === this.getClient().userID) return false;
2515
2516
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
2517
+ if (message.type === 'system') return false;
2516
2518
  if (this.muteStatus().muted) return false;
2517
2519
  return true;
2518
2520
  }
@@ -3703,14 +3705,22 @@ var StableWSConnection = /*#__PURE__*/function () {
3703
3705
  });
3704
3706
 
3705
3707
  _defineProperty(this, "_listenForConnectionChanges", function () {
3706
- if (typeof window !== 'undefined' && window != null && window.addEventListener != null) {
3708
+ var _window;
3709
+
3710
+ // (typeof window !== 'undefined') check is for environments where window is not defined, such as nextjs environment,
3711
+ // and thus (window === undefined) will result in ReferenceError.
3712
+ if (typeof window !== 'undefined' && (_window = window) !== null && _window !== void 0 && _window.addEventListener) {
3707
3713
  window.addEventListener('offline', _this.onlineStatusChanged);
3708
3714
  window.addEventListener('online', _this.onlineStatusChanged);
3709
3715
  }
3710
3716
  });
3711
3717
 
3712
3718
  _defineProperty(this, "_removeConnectionListeners", function () {
3713
- if (typeof window !== 'undefined' && window != null && window.addEventListener != null) {
3719
+ var _window2;
3720
+
3721
+ // (typeof window !== 'undefined') check is for environments where window is not defined, such as nextjs environment,
3722
+ // and thus (window === undefined) will result in ReferenceError.
3723
+ if (typeof window !== 'undefined' && (_window2 = window) !== null && _window2 !== void 0 && _window2.removeEventListener) {
3714
3724
  window.removeEventListener('offline', _this.onlineStatusChanged);
3715
3725
  window.removeEventListener('online', _this.onlineStatusChanged);
3716
3726
  }
@@ -5372,6 +5382,8 @@ var StreamChat = /*#__PURE__*/function () {
5372
5382
 
5373
5383
  _defineProperty(this, "updateUser", this.upsertUser);
5374
5384
 
5385
+ _defineProperty(this, "markAllRead", this.markChannelsRead);
5386
+
5375
5387
  _defineProperty(this, "_isUsingServerAuth", function () {
5376
5388
  return !!_this.secret;
5377
5389
  });
@@ -5777,6 +5789,7 @@ var StreamChat = /*#__PURE__*/function () {
5777
5789
  apnTemplate: '{}', //if app doesn't have apn configured it will error
5778
5790
  firebaseTemplate: '{}', //if app doesn't have firebase configured it will error
5779
5791
  firebaseDataTemplate: '{}', //if app doesn't have firebase configured it will error
5792
+ huaweiDataTemplate: '{}' //if app doesn't have huawei configured it will error
5780
5793
  skipDevices: true, // skip config/device checks and sending to real devices
5781
5794
  }
5782
5795
  */
@@ -5793,7 +5806,7 @@ var StreamChat = /*#__PURE__*/function () {
5793
5806
  case 0:
5794
5807
  data = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
5795
5808
  _context11.next = 3;
5796
- return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
5809
+ return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
5797
5810
  user_id: userID
5798
5811
  }, data.messageID ? {
5799
5812
  message_id: data.messageID
@@ -5803,6 +5816,8 @@ var StreamChat = /*#__PURE__*/function () {
5803
5816
  firebase_template: data.firebaseTemplate
5804
5817
  } : {}), data.firebaseDataTemplate ? {
5805
5818
  firebase_data_template: data.firebaseDataTemplate
5819
+ } : {}), data.huaweiDataTemplate ? {
5820
+ huawei_data_template: data.huaweiDataTemplate
5806
5821
  } : {}), data.skipDevices ? {
5807
5822
  skip_devices: true
5808
5823
  } : {}));
@@ -5827,13 +5842,11 @@ var StreamChat = /*#__PURE__*/function () {
5827
5842
  /**
5828
5843
  * testSQSSettings - Tests that the given or configured SQS configuration is valid
5829
5844
  *
5830
- * @param {string} userID User ID. If user has no devices, it will error
5831
- * @param {TestPushDataInput} [data] Overrides for push templates/message used
5845
+ * @param {TestSQSDataInput} [data] Overrides SQS settings for testing if needed
5832
5846
  * IE: {
5833
- messageID: 'id-of-message',//will error if message does not exist
5834
- apnTemplate: '{}', //if app doesn't have apn configured it will error
5835
- firebaseTemplate: '{}', //if app doesn't have firebase configured it will error
5836
- firebaseDataTemplate: '{}', //if app doesn't have firebase configured it will error
5847
+ sqs_key: 'auth_key',
5848
+ sqs_secret: 'auth_secret',
5849
+ sqs_url: 'url_to_queue',
5837
5850
  }
5838
5851
  */
5839
5852
 
@@ -6706,7 +6719,7 @@ var StreamChat = /*#__PURE__*/function () {
6706
6719
  *
6707
6720
  * @param {BaseDeviceFields} device the device object
6708
6721
  * @param {string} device.id device id
6709
- * @param {string} device.push_provider the push provider (apn or firebase)
6722
+ * @param {string} device.push_provider the push provider
6710
6723
  *
6711
6724
  */
6712
6725
 
@@ -6723,7 +6736,7 @@ var StreamChat = /*#__PURE__*/function () {
6723
6736
  * addDevice - Adds a push device for a user.
6724
6737
  *
6725
6738
  * @param {string} id the device id
6726
- * @param {'apn' | 'firebase'} push_provider the push provider (apn or firebase)
6739
+ * @param {PushProvider} push_provider the push provider
6727
6740
  * @param {string} [userID] the user id (defaults to current user)
6728
6741
  *
6729
6742
  */
@@ -7714,6 +7727,8 @@ var StreamChat = /*#__PURE__*/function () {
7714
7727
  return unflagUser;
7715
7728
  }()
7716
7729
  /**
7730
+ * @deprecated use markChannelsRead instead
7731
+ *
7717
7732
  * markAllRead - marks all channels for this user as read
7718
7733
  * @param {MarkAllReadOptions<UserType>} [data]
7719
7734
  *
@@ -7721,9 +7736,18 @@ var StreamChat = /*#__PURE__*/function () {
7721
7736
  */
7722
7737
 
7723
7738
  }, {
7724
- key: "markAllRead",
7725
- value: function () {
7726
- var _markAllRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41() {
7739
+ key: "markChannelsRead",
7740
+ value:
7741
+ /**
7742
+ * markChannelsRead - marks channels read -
7743
+ * it accepts a map of cid:messageid pairs, if messageid is empty, the whole channel will be marked as read
7744
+ *
7745
+ * @param {MarkChannelsReadOptions <UserType>} [data]
7746
+ *
7747
+ * @return {Promise<APIResponse>}
7748
+ */
7749
+ function () {
7750
+ var _markChannelsRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41() {
7727
7751
  var data,
7728
7752
  _args41 = arguments;
7729
7753
  return _regeneratorRuntime.wrap(function _callee41$(_context41) {
@@ -7742,11 +7766,11 @@ var StreamChat = /*#__PURE__*/function () {
7742
7766
  }, _callee41, this);
7743
7767
  }));
7744
7768
 
7745
- function markAllRead() {
7746
- return _markAllRead.apply(this, arguments);
7769
+ function markChannelsRead() {
7770
+ return _markChannelsRead.apply(this, arguments);
7747
7771
  }
7748
7772
 
7749
- return markAllRead;
7773
+ return markChannelsRead;
7750
7774
  }()
7751
7775
  }, {
7752
7776
  key: "createCommand",
@@ -7927,6 +7951,7 @@ var StreamChat = /*#__PURE__*/function () {
7927
7951
  *
7928
7952
  * @param {Omit<MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>, 'mentioned_users'> & { mentioned_users?: string[] }} message object, id needs to be specified
7929
7953
  * @param {string | { id: string }} [userId]
7954
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
7930
7955
  *
7931
7956
  * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the message
7932
7957
  */
@@ -7934,7 +7959,7 @@ var StreamChat = /*#__PURE__*/function () {
7934
7959
  }, {
7935
7960
  key: "updateMessage",
7936
7961
  value: function () {
7937
- var _updateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(message, userId) {
7962
+ var _updateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(message, userId, options) {
7938
7963
  var clonedMessage, reservedMessageFields;
7939
7964
  return _regeneratorRuntime.wrap(function _callee43$(_context43) {
7940
7965
  while (1) {
@@ -7979,9 +8004,9 @@ var StreamChat = /*#__PURE__*/function () {
7979
8004
  }
7980
8005
 
7981
8006
  _context43.next = 10;
7982
- return this.post(this.baseURL + "/messages/".concat(message.id), {
8007
+ return this.post(this.baseURL + "/messages/".concat(message.id), _objectSpread({
7983
8008
  message: clonedMessage
7984
- });
8009
+ }, options));
7985
8010
 
7986
8011
  case 10:
7987
8012
  return _context43.abrupt("return", _context43.sent);
@@ -7994,7 +8019,7 @@ var StreamChat = /*#__PURE__*/function () {
7994
8019
  }, _callee43, this);
7995
8020
  }));
7996
8021
 
7997
- function updateMessage(_x55, _x56) {
8022
+ function updateMessage(_x55, _x56, _x57) {
7998
8023
  return _updateMessage.apply(this, arguments);
7999
8024
  }
8000
8025
 
@@ -8009,13 +8034,15 @@ var StreamChat = /*#__PURE__*/function () {
8009
8034
  * example: {id: "user1", set:{text: "hi"}, unset:["color"]}
8010
8035
  * @param {string | { id: string }} [userId]
8011
8036
  *
8037
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
8038
+ *
8012
8039
  * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the updated message
8013
8040
  */
8014
8041
 
8015
8042
  }, {
8016
8043
  key: "partialUpdateMessage",
8017
8044
  value: function () {
8018
- var _partialUpdateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(id, partialMessageObject, userId) {
8045
+ var _partialUpdateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(id, partialMessageObject, userId, options) {
8019
8046
  var user;
8020
8047
  return _regeneratorRuntime.wrap(function _callee44$(_context44) {
8021
8048
  while (1) {
@@ -8038,7 +8065,7 @@ var StreamChat = /*#__PURE__*/function () {
8038
8065
  }
8039
8066
 
8040
8067
  _context44.next = 6;
8041
- return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread({}, partialMessageObject), {}, {
8068
+ return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
8042
8069
  user: user
8043
8070
  }));
8044
8071
 
@@ -8053,7 +8080,7 @@ var StreamChat = /*#__PURE__*/function () {
8053
8080
  }, _callee44, this);
8054
8081
  }));
8055
8082
 
8056
- function partialUpdateMessage(_x57, _x58, _x59) {
8083
+ function partialUpdateMessage(_x58, _x59, _x60, _x61) {
8057
8084
  return _partialUpdateMessage.apply(this, arguments);
8058
8085
  }
8059
8086
 
@@ -8090,7 +8117,7 @@ var StreamChat = /*#__PURE__*/function () {
8090
8117
  }, _callee45, this);
8091
8118
  }));
8092
8119
 
8093
- function deleteMessage(_x60, _x61) {
8120
+ function deleteMessage(_x62, _x63) {
8094
8121
  return _deleteMessage.apply(this, arguments);
8095
8122
  }
8096
8123
 
@@ -8118,7 +8145,7 @@ var StreamChat = /*#__PURE__*/function () {
8118
8145
  }, _callee46, this);
8119
8146
  }));
8120
8147
 
8121
- function getMessage(_x62) {
8148
+ function getMessage(_x64) {
8122
8149
  return _getMessage.apply(this, arguments);
8123
8150
  }
8124
8151
 
@@ -8127,7 +8154,7 @@ var StreamChat = /*#__PURE__*/function () {
8127
8154
  }, {
8128
8155
  key: "getUserAgent",
8129
8156
  value: function getUserAgent() {
8130
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "4.2.0");
8157
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "4.3.0");
8131
8158
  }
8132
8159
  }, {
8133
8160
  key: "setUserAgent",
@@ -8329,7 +8356,7 @@ var StreamChat = /*#__PURE__*/function () {
8329
8356
  }, _callee47, this);
8330
8357
  }));
8331
8358
 
8332
- function sendUserCustomEvent(_x63, _x64) {
8359
+ function sendUserCustomEvent(_x65, _x66) {
8333
8360
  return _sendUserCustomEvent.apply(this, arguments);
8334
8361
  }
8335
8362
 
@@ -8417,7 +8444,7 @@ var StreamChat = /*#__PURE__*/function () {
8417
8444
  }, _callee48, this);
8418
8445
  }));
8419
8446
 
8420
- function createSegment(_x65) {
8447
+ function createSegment(_x67) {
8421
8448
  return _createSegment.apply(this, arguments);
8422
8449
  }
8423
8450
 
@@ -8457,7 +8484,7 @@ var StreamChat = /*#__PURE__*/function () {
8457
8484
  }, _callee49, this);
8458
8485
  }));
8459
8486
 
8460
- function getSegment(_x66) {
8487
+ function getSegment(_x68) {
8461
8488
  return _getSegment.apply(this, arguments);
8462
8489
  }
8463
8490
 
@@ -8496,7 +8523,7 @@ var StreamChat = /*#__PURE__*/function () {
8496
8523
  }, _callee50, this);
8497
8524
  }));
8498
8525
 
8499
- function listSegments(_x67) {
8526
+ function listSegments(_x69) {
8500
8527
  return _listSegments.apply(this, arguments);
8501
8528
  }
8502
8529
 
@@ -8539,7 +8566,7 @@ var StreamChat = /*#__PURE__*/function () {
8539
8566
  }, _callee51, this);
8540
8567
  }));
8541
8568
 
8542
- function updateSegment(_x68, _x69) {
8569
+ function updateSegment(_x70, _x71) {
8543
8570
  return _updateSegment.apply(this, arguments);
8544
8571
  }
8545
8572
 
@@ -8571,7 +8598,7 @@ var StreamChat = /*#__PURE__*/function () {
8571
8598
  }, _callee52, this);
8572
8599
  }));
8573
8600
 
8574
- function deleteSegment(_x70) {
8601
+ function deleteSegment(_x72) {
8575
8602
  return _deleteSegment.apply(this, arguments);
8576
8603
  }
8577
8604
 
@@ -8613,7 +8640,7 @@ var StreamChat = /*#__PURE__*/function () {
8613
8640
  }, _callee53, this);
8614
8641
  }));
8615
8642
 
8616
- function createCampaign(_x71) {
8643
+ function createCampaign(_x73) {
8617
8644
  return _createCampaign.apply(this, arguments);
8618
8645
  }
8619
8646
 
@@ -8653,7 +8680,7 @@ var StreamChat = /*#__PURE__*/function () {
8653
8680
  }, _callee54, this);
8654
8681
  }));
8655
8682
 
8656
- function getCampaign(_x72) {
8683
+ function getCampaign(_x74) {
8657
8684
  return _getCampaign.apply(this, arguments);
8658
8685
  }
8659
8686
 
@@ -8692,7 +8719,7 @@ var StreamChat = /*#__PURE__*/function () {
8692
8719
  }, _callee55, this);
8693
8720
  }));
8694
8721
 
8695
- function listCampaigns(_x73) {
8722
+ function listCampaigns(_x75) {
8696
8723
  return _listCampaigns.apply(this, arguments);
8697
8724
  }
8698
8725
 
@@ -8735,7 +8762,7 @@ var StreamChat = /*#__PURE__*/function () {
8735
8762
  }, _callee56, this);
8736
8763
  }));
8737
8764
 
8738
- function updateCampaign(_x74, _x75) {
8765
+ function updateCampaign(_x76, _x77) {
8739
8766
  return _updateCampaign.apply(this, arguments);
8740
8767
  }
8741
8768
 
@@ -8767,7 +8794,7 @@ var StreamChat = /*#__PURE__*/function () {
8767
8794
  }, _callee57, this);
8768
8795
  }));
8769
8796
 
8770
- function deleteCampaign(_x76) {
8797
+ function deleteCampaign(_x78) {
8771
8798
  return _deleteCampaign.apply(this, arguments);
8772
8799
  }
8773
8800
 
@@ -8811,7 +8838,7 @@ var StreamChat = /*#__PURE__*/function () {
8811
8838
  }, _callee58, this);
8812
8839
  }));
8813
8840
 
8814
- function scheduleCampaign(_x77, _x78) {
8841
+ function scheduleCampaign(_x79, _x80) {
8815
8842
  return _scheduleCampaign.apply(this, arguments);
8816
8843
  }
8817
8844
 
@@ -8851,7 +8878,7 @@ var StreamChat = /*#__PURE__*/function () {
8851
8878
  }, _callee59, this);
8852
8879
  }));
8853
8880
 
8854
- function stopCampaign(_x79) {
8881
+ function stopCampaign(_x81) {
8855
8882
  return _stopCampaign.apply(this, arguments);
8856
8883
  }
8857
8884
 
@@ -8891,7 +8918,7 @@ var StreamChat = /*#__PURE__*/function () {
8891
8918
  }, _callee60, this);
8892
8919
  }));
8893
8920
 
8894
- function resumeCampaign(_x80) {
8921
+ function resumeCampaign(_x82) {
8895
8922
  return _resumeCampaign.apply(this, arguments);
8896
8923
  }
8897
8924
 
@@ -8934,12 +8961,182 @@ var StreamChat = /*#__PURE__*/function () {
8934
8961
  }, _callee61, this);
8935
8962
  }));
8936
8963
 
8937
- function testCampaign(_x81, _x82) {
8964
+ function testCampaign(_x83, _x84) {
8938
8965
  return _testCampaign.apply(this, arguments);
8939
8966
  }
8940
8967
 
8941
8968
  return testCampaign;
8942
8969
  }()
8970
+ /**
8971
+ * enrichURL - Get OpenGraph data of the given link
8972
+ *
8973
+ * @param {string} url link
8974
+ * @return {OGAttachment} OG Attachment
8975
+ */
8976
+
8977
+ }, {
8978
+ key: "enrichURL",
8979
+ value: function () {
8980
+ var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(url) {
8981
+ return _regeneratorRuntime.wrap(function _callee62$(_context62) {
8982
+ while (1) {
8983
+ switch (_context62.prev = _context62.next) {
8984
+ case 0:
8985
+ return _context62.abrupt("return", this.get(this.baseURL + "/og", {
8986
+ url: url
8987
+ }));
8988
+
8989
+ case 1:
8990
+ case "end":
8991
+ return _context62.stop();
8992
+ }
8993
+ }
8994
+ }, _callee62, this);
8995
+ }));
8996
+
8997
+ function enrichURL(_x85) {
8998
+ return _enrichURL.apply(this, arguments);
8999
+ }
9000
+
9001
+ return enrichURL;
9002
+ }()
9003
+ /**
9004
+ * getTask - Gets status of a long running task
9005
+ *
9006
+ * @param {string} id Task ID
9007
+ *
9008
+ * @return {TaskStatus} The task status
9009
+ */
9010
+
9011
+ }, {
9012
+ key: "getTask",
9013
+ value: function () {
9014
+ var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(id) {
9015
+ return _regeneratorRuntime.wrap(function _callee63$(_context63) {
9016
+ while (1) {
9017
+ switch (_context63.prev = _context63.next) {
9018
+ case 0:
9019
+ return _context63.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
9020
+
9021
+ case 1:
9022
+ case "end":
9023
+ return _context63.stop();
9024
+ }
9025
+ }
9026
+ }, _callee63, this);
9027
+ }));
9028
+
9029
+ function getTask(_x86) {
9030
+ return _getTask.apply(this, arguments);
9031
+ }
9032
+
9033
+ return getTask;
9034
+ }()
9035
+ /**
9036
+ * deleteChannels - Deletes a list of channel
9037
+ *
9038
+ * @param {string[]} cids Channel CIDs
9039
+ * @param {boolean} [options.hard_delete] Defines if the channel is hard deleted or not
9040
+ *
9041
+ * @return {DeleteChannelsResponse} Result of the soft deletion, if server-side, it holds the task ID as well
9042
+ */
9043
+
9044
+ }, {
9045
+ key: "deleteChannels",
9046
+ value: function () {
9047
+ var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(cids) {
9048
+ var options,
9049
+ _args64 = arguments;
9050
+ return _regeneratorRuntime.wrap(function _callee64$(_context64) {
9051
+ while (1) {
9052
+ switch (_context64.prev = _context64.next) {
9053
+ case 0:
9054
+ options = _args64.length > 1 && _args64[1] !== undefined ? _args64[1] : {};
9055
+ _context64.next = 3;
9056
+ return this.post(this.baseURL + "/channels/delete", _objectSpread({
9057
+ cids: cids
9058
+ }, options));
9059
+
9060
+ case 3:
9061
+ return _context64.abrupt("return", _context64.sent);
9062
+
9063
+ case 4:
9064
+ case "end":
9065
+ return _context64.stop();
9066
+ }
9067
+ }
9068
+ }, _callee64, this);
9069
+ }));
9070
+
9071
+ function deleteChannels(_x87) {
9072
+ return _deleteChannels.apply(this, arguments);
9073
+ }
9074
+
9075
+ return deleteChannels;
9076
+ }()
9077
+ /**
9078
+ * deleteUsers - Batch Delete Users
9079
+ *
9080
+ * @param {string[]} user_ids which users to delete
9081
+ * @param {DeleteUserOptions} options Configuration how to delete users
9082
+ *
9083
+ * @return {APIResponse} A task ID
9084
+ */
9085
+
9086
+ }, {
9087
+ key: "deleteUsers",
9088
+ value: function () {
9089
+ var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(user_ids, options) {
9090
+ return _regeneratorRuntime.wrap(function _callee65$(_context65) {
9091
+ while (1) {
9092
+ switch (_context65.prev = _context65.next) {
9093
+ case 0:
9094
+ if (!((options === null || options === void 0 ? void 0 : options.user) !== 'soft' && (options === null || options === void 0 ? void 0 : options.user) !== 'hard')) {
9095
+ _context65.next = 2;
9096
+ break;
9097
+ }
9098
+
9099
+ throw new Error('Invalid delete user options. user must be one of [soft hard]');
9100
+
9101
+ case 2:
9102
+ if (!(options.messages !== undefined && options.messages !== 'soft' && options.messages !== 'hard')) {
9103
+ _context65.next = 4;
9104
+ break;
9105
+ }
9106
+
9107
+ throw new Error('Invalid delete user options. messages must be one of [soft hard]');
9108
+
9109
+ case 4:
9110
+ if (!(options.conversations !== undefined && options.conversations !== 'soft' && options.conversations !== 'hard')) {
9111
+ _context65.next = 6;
9112
+ break;
9113
+ }
9114
+
9115
+ throw new Error('Invalid delete user options. conversations must be one of [soft hard]');
9116
+
9117
+ case 6:
9118
+ _context65.next = 8;
9119
+ return this.post(this.baseURL + "/users/delete", _objectSpread({
9120
+ user_ids: user_ids
9121
+ }, options));
9122
+
9123
+ case 8:
9124
+ return _context65.abrupt("return", _context65.sent);
9125
+
9126
+ case 9:
9127
+ case "end":
9128
+ return _context65.stop();
9129
+ }
9130
+ }
9131
+ }, _callee65, this);
9132
+ }));
9133
+
9134
+ function deleteUsers(_x88, _x89) {
9135
+ return _deleteUsers.apply(this, arguments);
9136
+ }
9137
+
9138
+ return deleteUsers;
9139
+ }()
8943
9140
  }], [{
8944
9141
  key: "getInstance",
8945
9142
  value: function getInstance(key, secretOrOptions, options) {