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/browser.js CHANGED
@@ -1085,7 +1085,8 @@ var Channel = /*#__PURE__*/function () {
1085
1085
  * sendMessage - Send a message to this channel
1086
1086
  *
1087
1087
  * @param {Message<AttachmentType, MessageType, UserType>} message The Message object
1088
- * @param {{ skip_push?: boolean }} [options] Option object, {skip_push: true} to skip sending push notifications
1088
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
1089
+ * @param {boolean} [options.skip_push] Skip sending push notifications
1089
1090
  *
1090
1091
  * @return {Promise<SendMessageAPIResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>>} The Server Response
1091
1092
  */
@@ -1280,8 +1281,8 @@ var Channel = /*#__PURE__*/function () {
1280
1281
  * queryMembers - Query Members
1281
1282
  *
1282
1283
  * @param {UserFilters<UserType>} filterConditions object MongoDB style filters
1283
- * @param {UserSort<UserType>} [sort] Sort options, for instance [{created_at: -1}].
1284
- * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{last_active: -1}, {created_at: 1}]
1284
+ * @param {MemberSort<UserType>} [sort] Sort options, for instance [{created_at: -1}].
1285
+ * When using multiple fields, make sure you use array of objects to guarantee field order, for instance [{name: -1}, {created_at: 1}]
1285
1286
  * @param {{ limit?: number; offset?: number }} [options] Option object, {limit: 10, offset:10}
1286
1287
  *
1287
1288
  * @return {Promise<ChannelMemberAPIResponse<UserType>>} Query Members response
@@ -2533,6 +2534,7 @@ var Channel = /*#__PURE__*/function () {
2533
2534
  if (message.silent) return false;
2534
2535
  if (((_message$user = message.user) === null || _message$user === void 0 ? void 0 : _message$user.id) === this.getClient().userID) return false;
2535
2536
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
2537
+ if (message.type === 'system') return false;
2536
2538
  if (this.muteStatus().muted) return false;
2537
2539
  return true;
2538
2540
  }
@@ -3723,14 +3725,22 @@ var StableWSConnection = /*#__PURE__*/function () {
3723
3725
  });
3724
3726
 
3725
3727
  _defineProperty__default['default'](this, "_listenForConnectionChanges", function () {
3726
- if (typeof window !== 'undefined' && window != null && window.addEventListener != null) {
3728
+ var _window;
3729
+
3730
+ // (typeof window !== 'undefined') check is for environments where window is not defined, such as nextjs environment,
3731
+ // and thus (window === undefined) will result in ReferenceError.
3732
+ if (typeof window !== 'undefined' && (_window = window) !== null && _window !== void 0 && _window.addEventListener) {
3727
3733
  window.addEventListener('offline', _this.onlineStatusChanged);
3728
3734
  window.addEventListener('online', _this.onlineStatusChanged);
3729
3735
  }
3730
3736
  });
3731
3737
 
3732
3738
  _defineProperty__default['default'](this, "_removeConnectionListeners", function () {
3733
- if (typeof window !== 'undefined' && window != null && window.addEventListener != null) {
3739
+ var _window2;
3740
+
3741
+ // (typeof window !== 'undefined') check is for environments where window is not defined, such as nextjs environment,
3742
+ // and thus (window === undefined) will result in ReferenceError.
3743
+ if (typeof window !== 'undefined' && (_window2 = window) !== null && _window2 !== void 0 && _window2.removeEventListener) {
3734
3744
  window.removeEventListener('offline', _this.onlineStatusChanged);
3735
3745
  window.removeEventListener('online', _this.onlineStatusChanged);
3736
3746
  }
@@ -5392,6 +5402,8 @@ var StreamChat = /*#__PURE__*/function () {
5392
5402
 
5393
5403
  _defineProperty__default['default'](this, "updateUser", this.upsertUser);
5394
5404
 
5405
+ _defineProperty__default['default'](this, "markAllRead", this.markChannelsRead);
5406
+
5395
5407
  _defineProperty__default['default'](this, "_isUsingServerAuth", function () {
5396
5408
  return !!_this.secret;
5397
5409
  });
@@ -5797,6 +5809,7 @@ var StreamChat = /*#__PURE__*/function () {
5797
5809
  apnTemplate: '{}', //if app doesn't have apn configured it will error
5798
5810
  firebaseTemplate: '{}', //if app doesn't have firebase configured it will error
5799
5811
  firebaseDataTemplate: '{}', //if app doesn't have firebase configured it will error
5812
+ huaweiDataTemplate: '{}' //if app doesn't have huawei configured it will error
5800
5813
  skipDevices: true, // skip config/device checks and sending to real devices
5801
5814
  }
5802
5815
  */
@@ -5813,7 +5826,7 @@ var StreamChat = /*#__PURE__*/function () {
5813
5826
  case 0:
5814
5827
  data = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
5815
5828
  _context11.next = 3;
5816
- return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
5829
+ return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
5817
5830
  user_id: userID
5818
5831
  }, data.messageID ? {
5819
5832
  message_id: data.messageID
@@ -5823,6 +5836,8 @@ var StreamChat = /*#__PURE__*/function () {
5823
5836
  firebase_template: data.firebaseTemplate
5824
5837
  } : {}), data.firebaseDataTemplate ? {
5825
5838
  firebase_data_template: data.firebaseDataTemplate
5839
+ } : {}), data.huaweiDataTemplate ? {
5840
+ huawei_data_template: data.huaweiDataTemplate
5826
5841
  } : {}), data.skipDevices ? {
5827
5842
  skip_devices: true
5828
5843
  } : {}));
@@ -5847,13 +5862,11 @@ var StreamChat = /*#__PURE__*/function () {
5847
5862
  /**
5848
5863
  * testSQSSettings - Tests that the given or configured SQS configuration is valid
5849
5864
  *
5850
- * @param {string} userID User ID. If user has no devices, it will error
5851
- * @param {TestPushDataInput} [data] Overrides for push templates/message used
5865
+ * @param {TestSQSDataInput} [data] Overrides SQS settings for testing if needed
5852
5866
  * IE: {
5853
- messageID: 'id-of-message',//will error if message does not exist
5854
- apnTemplate: '{}', //if app doesn't have apn configured it will error
5855
- firebaseTemplate: '{}', //if app doesn't have firebase configured it will error
5856
- firebaseDataTemplate: '{}', //if app doesn't have firebase configured it will error
5867
+ sqs_key: 'auth_key',
5868
+ sqs_secret: 'auth_secret',
5869
+ sqs_url: 'url_to_queue',
5857
5870
  }
5858
5871
  */
5859
5872
 
@@ -6726,7 +6739,7 @@ var StreamChat = /*#__PURE__*/function () {
6726
6739
  *
6727
6740
  * @param {BaseDeviceFields} device the device object
6728
6741
  * @param {string} device.id device id
6729
- * @param {string} device.push_provider the push provider (apn or firebase)
6742
+ * @param {string} device.push_provider the push provider
6730
6743
  *
6731
6744
  */
6732
6745
 
@@ -6743,7 +6756,7 @@ var StreamChat = /*#__PURE__*/function () {
6743
6756
  * addDevice - Adds a push device for a user.
6744
6757
  *
6745
6758
  * @param {string} id the device id
6746
- * @param {'apn' | 'firebase'} push_provider the push provider (apn or firebase)
6759
+ * @param {PushProvider} push_provider the push provider
6747
6760
  * @param {string} [userID] the user id (defaults to current user)
6748
6761
  *
6749
6762
  */
@@ -7734,6 +7747,8 @@ var StreamChat = /*#__PURE__*/function () {
7734
7747
  return unflagUser;
7735
7748
  }()
7736
7749
  /**
7750
+ * @deprecated use markChannelsRead instead
7751
+ *
7737
7752
  * markAllRead - marks all channels for this user as read
7738
7753
  * @param {MarkAllReadOptions<UserType>} [data]
7739
7754
  *
@@ -7741,9 +7756,18 @@ var StreamChat = /*#__PURE__*/function () {
7741
7756
  */
7742
7757
 
7743
7758
  }, {
7744
- key: "markAllRead",
7745
- value: function () {
7746
- var _markAllRead = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee41() {
7759
+ key: "markChannelsRead",
7760
+ value:
7761
+ /**
7762
+ * markChannelsRead - marks channels read -
7763
+ * it accepts a map of cid:messageid pairs, if messageid is empty, the whole channel will be marked as read
7764
+ *
7765
+ * @param {MarkChannelsReadOptions <UserType>} [data]
7766
+ *
7767
+ * @return {Promise<APIResponse>}
7768
+ */
7769
+ function () {
7770
+ var _markChannelsRead = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee41() {
7747
7771
  var data,
7748
7772
  _args41 = arguments;
7749
7773
  return _regeneratorRuntime__default['default'].wrap(function _callee41$(_context41) {
@@ -7762,11 +7786,11 @@ var StreamChat = /*#__PURE__*/function () {
7762
7786
  }, _callee41, this);
7763
7787
  }));
7764
7788
 
7765
- function markAllRead() {
7766
- return _markAllRead.apply(this, arguments);
7789
+ function markChannelsRead() {
7790
+ return _markChannelsRead.apply(this, arguments);
7767
7791
  }
7768
7792
 
7769
- return markAllRead;
7793
+ return markChannelsRead;
7770
7794
  }()
7771
7795
  }, {
7772
7796
  key: "createCommand",
@@ -7947,6 +7971,7 @@ var StreamChat = /*#__PURE__*/function () {
7947
7971
  *
7948
7972
  * @param {Omit<MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType>, 'mentioned_users'> & { mentioned_users?: string[] }} message object, id needs to be specified
7949
7973
  * @param {string | { id: string }} [userId]
7974
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
7950
7975
  *
7951
7976
  * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the message
7952
7977
  */
@@ -7954,7 +7979,7 @@ var StreamChat = /*#__PURE__*/function () {
7954
7979
  }, {
7955
7980
  key: "updateMessage",
7956
7981
  value: function () {
7957
- var _updateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee43(message, userId) {
7982
+ var _updateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee43(message, userId, options) {
7958
7983
  var clonedMessage, reservedMessageFields;
7959
7984
  return _regeneratorRuntime__default['default'].wrap(function _callee43$(_context43) {
7960
7985
  while (1) {
@@ -7999,9 +8024,9 @@ var StreamChat = /*#__PURE__*/function () {
7999
8024
  }
8000
8025
 
8001
8026
  _context43.next = 10;
8002
- return this.post(this.baseURL + "/messages/".concat(message.id), {
8027
+ return this.post(this.baseURL + "/messages/".concat(message.id), _objectSpread({
8003
8028
  message: clonedMessage
8004
- });
8029
+ }, options));
8005
8030
 
8006
8031
  case 10:
8007
8032
  return _context43.abrupt("return", _context43.sent);
@@ -8014,7 +8039,7 @@ var StreamChat = /*#__PURE__*/function () {
8014
8039
  }, _callee43, this);
8015
8040
  }));
8016
8041
 
8017
- function updateMessage(_x55, _x56) {
8042
+ function updateMessage(_x55, _x56, _x57) {
8018
8043
  return _updateMessage.apply(this, arguments);
8019
8044
  }
8020
8045
 
@@ -8029,13 +8054,15 @@ var StreamChat = /*#__PURE__*/function () {
8029
8054
  * example: {id: "user1", set:{text: "hi"}, unset:["color"]}
8030
8055
  * @param {string | { id: string }} [userId]
8031
8056
  *
8057
+ * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
8058
+ *
8032
8059
  * @return {APIResponse & { message: MessageResponse<AttachmentType, ChannelType, CommandType, MessageType, ReactionType, UserType> }} Response that includes the updated message
8033
8060
  */
8034
8061
 
8035
8062
  }, {
8036
8063
  key: "partialUpdateMessage",
8037
8064
  value: function () {
8038
- var _partialUpdateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee44(id, partialMessageObject, userId) {
8065
+ var _partialUpdateMessage = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee44(id, partialMessageObject, userId, options) {
8039
8066
  var user;
8040
8067
  return _regeneratorRuntime__default['default'].wrap(function _callee44$(_context44) {
8041
8068
  while (1) {
@@ -8058,7 +8085,7 @@ var StreamChat = /*#__PURE__*/function () {
8058
8085
  }
8059
8086
 
8060
8087
  _context44.next = 6;
8061
- return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread({}, partialMessageObject), {}, {
8088
+ return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
8062
8089
  user: user
8063
8090
  }));
8064
8091
 
@@ -8073,7 +8100,7 @@ var StreamChat = /*#__PURE__*/function () {
8073
8100
  }, _callee44, this);
8074
8101
  }));
8075
8102
 
8076
- function partialUpdateMessage(_x57, _x58, _x59) {
8103
+ function partialUpdateMessage(_x58, _x59, _x60, _x61) {
8077
8104
  return _partialUpdateMessage.apply(this, arguments);
8078
8105
  }
8079
8106
 
@@ -8110,7 +8137,7 @@ var StreamChat = /*#__PURE__*/function () {
8110
8137
  }, _callee45, this);
8111
8138
  }));
8112
8139
 
8113
- function deleteMessage(_x60, _x61) {
8140
+ function deleteMessage(_x62, _x63) {
8114
8141
  return _deleteMessage.apply(this, arguments);
8115
8142
  }
8116
8143
 
@@ -8138,7 +8165,7 @@ var StreamChat = /*#__PURE__*/function () {
8138
8165
  }, _callee46, this);
8139
8166
  }));
8140
8167
 
8141
- function getMessage(_x62) {
8168
+ function getMessage(_x64) {
8142
8169
  return _getMessage.apply(this, arguments);
8143
8170
  }
8144
8171
 
@@ -8147,7 +8174,7 @@ var StreamChat = /*#__PURE__*/function () {
8147
8174
  }, {
8148
8175
  key: "getUserAgent",
8149
8176
  value: function getUserAgent() {
8150
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "4.2.0");
8177
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "4.3.0");
8151
8178
  }
8152
8179
  }, {
8153
8180
  key: "setUserAgent",
@@ -8349,7 +8376,7 @@ var StreamChat = /*#__PURE__*/function () {
8349
8376
  }, _callee47, this);
8350
8377
  }));
8351
8378
 
8352
- function sendUserCustomEvent(_x63, _x64) {
8379
+ function sendUserCustomEvent(_x65, _x66) {
8353
8380
  return _sendUserCustomEvent.apply(this, arguments);
8354
8381
  }
8355
8382
 
@@ -8437,7 +8464,7 @@ var StreamChat = /*#__PURE__*/function () {
8437
8464
  }, _callee48, this);
8438
8465
  }));
8439
8466
 
8440
- function createSegment(_x65) {
8467
+ function createSegment(_x67) {
8441
8468
  return _createSegment.apply(this, arguments);
8442
8469
  }
8443
8470
 
@@ -8477,7 +8504,7 @@ var StreamChat = /*#__PURE__*/function () {
8477
8504
  }, _callee49, this);
8478
8505
  }));
8479
8506
 
8480
- function getSegment(_x66) {
8507
+ function getSegment(_x68) {
8481
8508
  return _getSegment.apply(this, arguments);
8482
8509
  }
8483
8510
 
@@ -8516,7 +8543,7 @@ var StreamChat = /*#__PURE__*/function () {
8516
8543
  }, _callee50, this);
8517
8544
  }));
8518
8545
 
8519
- function listSegments(_x67) {
8546
+ function listSegments(_x69) {
8520
8547
  return _listSegments.apply(this, arguments);
8521
8548
  }
8522
8549
 
@@ -8559,7 +8586,7 @@ var StreamChat = /*#__PURE__*/function () {
8559
8586
  }, _callee51, this);
8560
8587
  }));
8561
8588
 
8562
- function updateSegment(_x68, _x69) {
8589
+ function updateSegment(_x70, _x71) {
8563
8590
  return _updateSegment.apply(this, arguments);
8564
8591
  }
8565
8592
 
@@ -8591,7 +8618,7 @@ var StreamChat = /*#__PURE__*/function () {
8591
8618
  }, _callee52, this);
8592
8619
  }));
8593
8620
 
8594
- function deleteSegment(_x70) {
8621
+ function deleteSegment(_x72) {
8595
8622
  return _deleteSegment.apply(this, arguments);
8596
8623
  }
8597
8624
 
@@ -8633,7 +8660,7 @@ var StreamChat = /*#__PURE__*/function () {
8633
8660
  }, _callee53, this);
8634
8661
  }));
8635
8662
 
8636
- function createCampaign(_x71) {
8663
+ function createCampaign(_x73) {
8637
8664
  return _createCampaign.apply(this, arguments);
8638
8665
  }
8639
8666
 
@@ -8673,7 +8700,7 @@ var StreamChat = /*#__PURE__*/function () {
8673
8700
  }, _callee54, this);
8674
8701
  }));
8675
8702
 
8676
- function getCampaign(_x72) {
8703
+ function getCampaign(_x74) {
8677
8704
  return _getCampaign.apply(this, arguments);
8678
8705
  }
8679
8706
 
@@ -8712,7 +8739,7 @@ var StreamChat = /*#__PURE__*/function () {
8712
8739
  }, _callee55, this);
8713
8740
  }));
8714
8741
 
8715
- function listCampaigns(_x73) {
8742
+ function listCampaigns(_x75) {
8716
8743
  return _listCampaigns.apply(this, arguments);
8717
8744
  }
8718
8745
 
@@ -8755,7 +8782,7 @@ var StreamChat = /*#__PURE__*/function () {
8755
8782
  }, _callee56, this);
8756
8783
  }));
8757
8784
 
8758
- function updateCampaign(_x74, _x75) {
8785
+ function updateCampaign(_x76, _x77) {
8759
8786
  return _updateCampaign.apply(this, arguments);
8760
8787
  }
8761
8788
 
@@ -8787,7 +8814,7 @@ var StreamChat = /*#__PURE__*/function () {
8787
8814
  }, _callee57, this);
8788
8815
  }));
8789
8816
 
8790
- function deleteCampaign(_x76) {
8817
+ function deleteCampaign(_x78) {
8791
8818
  return _deleteCampaign.apply(this, arguments);
8792
8819
  }
8793
8820
 
@@ -8831,7 +8858,7 @@ var StreamChat = /*#__PURE__*/function () {
8831
8858
  }, _callee58, this);
8832
8859
  }));
8833
8860
 
8834
- function scheduleCampaign(_x77, _x78) {
8861
+ function scheduleCampaign(_x79, _x80) {
8835
8862
  return _scheduleCampaign.apply(this, arguments);
8836
8863
  }
8837
8864
 
@@ -8871,7 +8898,7 @@ var StreamChat = /*#__PURE__*/function () {
8871
8898
  }, _callee59, this);
8872
8899
  }));
8873
8900
 
8874
- function stopCampaign(_x79) {
8901
+ function stopCampaign(_x81) {
8875
8902
  return _stopCampaign.apply(this, arguments);
8876
8903
  }
8877
8904
 
@@ -8911,7 +8938,7 @@ var StreamChat = /*#__PURE__*/function () {
8911
8938
  }, _callee60, this);
8912
8939
  }));
8913
8940
 
8914
- function resumeCampaign(_x80) {
8941
+ function resumeCampaign(_x82) {
8915
8942
  return _resumeCampaign.apply(this, arguments);
8916
8943
  }
8917
8944
 
@@ -8954,12 +8981,182 @@ var StreamChat = /*#__PURE__*/function () {
8954
8981
  }, _callee61, this);
8955
8982
  }));
8956
8983
 
8957
- function testCampaign(_x81, _x82) {
8984
+ function testCampaign(_x83, _x84) {
8958
8985
  return _testCampaign.apply(this, arguments);
8959
8986
  }
8960
8987
 
8961
8988
  return testCampaign;
8962
8989
  }()
8990
+ /**
8991
+ * enrichURL - Get OpenGraph data of the given link
8992
+ *
8993
+ * @param {string} url link
8994
+ * @return {OGAttachment} OG Attachment
8995
+ */
8996
+
8997
+ }, {
8998
+ key: "enrichURL",
8999
+ value: function () {
9000
+ var _enrichURL = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee62(url) {
9001
+ return _regeneratorRuntime__default['default'].wrap(function _callee62$(_context62) {
9002
+ while (1) {
9003
+ switch (_context62.prev = _context62.next) {
9004
+ case 0:
9005
+ return _context62.abrupt("return", this.get(this.baseURL + "/og", {
9006
+ url: url
9007
+ }));
9008
+
9009
+ case 1:
9010
+ case "end":
9011
+ return _context62.stop();
9012
+ }
9013
+ }
9014
+ }, _callee62, this);
9015
+ }));
9016
+
9017
+ function enrichURL(_x85) {
9018
+ return _enrichURL.apply(this, arguments);
9019
+ }
9020
+
9021
+ return enrichURL;
9022
+ }()
9023
+ /**
9024
+ * getTask - Gets status of a long running task
9025
+ *
9026
+ * @param {string} id Task ID
9027
+ *
9028
+ * @return {TaskStatus} The task status
9029
+ */
9030
+
9031
+ }, {
9032
+ key: "getTask",
9033
+ value: function () {
9034
+ var _getTask = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee63(id) {
9035
+ return _regeneratorRuntime__default['default'].wrap(function _callee63$(_context63) {
9036
+ while (1) {
9037
+ switch (_context63.prev = _context63.next) {
9038
+ case 0:
9039
+ return _context63.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
9040
+
9041
+ case 1:
9042
+ case "end":
9043
+ return _context63.stop();
9044
+ }
9045
+ }
9046
+ }, _callee63, this);
9047
+ }));
9048
+
9049
+ function getTask(_x86) {
9050
+ return _getTask.apply(this, arguments);
9051
+ }
9052
+
9053
+ return getTask;
9054
+ }()
9055
+ /**
9056
+ * deleteChannels - Deletes a list of channel
9057
+ *
9058
+ * @param {string[]} cids Channel CIDs
9059
+ * @param {boolean} [options.hard_delete] Defines if the channel is hard deleted or not
9060
+ *
9061
+ * @return {DeleteChannelsResponse} Result of the soft deletion, if server-side, it holds the task ID as well
9062
+ */
9063
+
9064
+ }, {
9065
+ key: "deleteChannels",
9066
+ value: function () {
9067
+ var _deleteChannels = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee64(cids) {
9068
+ var options,
9069
+ _args64 = arguments;
9070
+ return _regeneratorRuntime__default['default'].wrap(function _callee64$(_context64) {
9071
+ while (1) {
9072
+ switch (_context64.prev = _context64.next) {
9073
+ case 0:
9074
+ options = _args64.length > 1 && _args64[1] !== undefined ? _args64[1] : {};
9075
+ _context64.next = 3;
9076
+ return this.post(this.baseURL + "/channels/delete", _objectSpread({
9077
+ cids: cids
9078
+ }, options));
9079
+
9080
+ case 3:
9081
+ return _context64.abrupt("return", _context64.sent);
9082
+
9083
+ case 4:
9084
+ case "end":
9085
+ return _context64.stop();
9086
+ }
9087
+ }
9088
+ }, _callee64, this);
9089
+ }));
9090
+
9091
+ function deleteChannels(_x87) {
9092
+ return _deleteChannels.apply(this, arguments);
9093
+ }
9094
+
9095
+ return deleteChannels;
9096
+ }()
9097
+ /**
9098
+ * deleteUsers - Batch Delete Users
9099
+ *
9100
+ * @param {string[]} user_ids which users to delete
9101
+ * @param {DeleteUserOptions} options Configuration how to delete users
9102
+ *
9103
+ * @return {APIResponse} A task ID
9104
+ */
9105
+
9106
+ }, {
9107
+ key: "deleteUsers",
9108
+ value: function () {
9109
+ var _deleteUsers = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee65(user_ids, options) {
9110
+ return _regeneratorRuntime__default['default'].wrap(function _callee65$(_context65) {
9111
+ while (1) {
9112
+ switch (_context65.prev = _context65.next) {
9113
+ case 0:
9114
+ if (!((options === null || options === void 0 ? void 0 : options.user) !== 'soft' && (options === null || options === void 0 ? void 0 : options.user) !== 'hard')) {
9115
+ _context65.next = 2;
9116
+ break;
9117
+ }
9118
+
9119
+ throw new Error('Invalid delete user options. user must be one of [soft hard]');
9120
+
9121
+ case 2:
9122
+ if (!(options.messages !== undefined && options.messages !== 'soft' && options.messages !== 'hard')) {
9123
+ _context65.next = 4;
9124
+ break;
9125
+ }
9126
+
9127
+ throw new Error('Invalid delete user options. messages must be one of [soft hard]');
9128
+
9129
+ case 4:
9130
+ if (!(options.conversations !== undefined && options.conversations !== 'soft' && options.conversations !== 'hard')) {
9131
+ _context65.next = 6;
9132
+ break;
9133
+ }
9134
+
9135
+ throw new Error('Invalid delete user options. conversations must be one of [soft hard]');
9136
+
9137
+ case 6:
9138
+ _context65.next = 8;
9139
+ return this.post(this.baseURL + "/users/delete", _objectSpread({
9140
+ user_ids: user_ids
9141
+ }, options));
9142
+
9143
+ case 8:
9144
+ return _context65.abrupt("return", _context65.sent);
9145
+
9146
+ case 9:
9147
+ case "end":
9148
+ return _context65.stop();
9149
+ }
9150
+ }
9151
+ }, _callee65, this);
9152
+ }));
9153
+
9154
+ function deleteUsers(_x88, _x89) {
9155
+ return _deleteUsers.apply(this, arguments);
9156
+ }
9157
+
9158
+ return deleteUsers;
9159
+ }()
8963
9160
  }], [{
8964
9161
  key: "getInstance",
8965
9162
  value: function getInstance(key, secretOrOptions, options) {