easemob-websdk 4.2.1-beta → 4.3.0-beta

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changes to easemob chat
2
2
 
3
+ # 4.3.0 (Nov 13, 2023)
4
+
5
+ - Adds contact API
6
+ - setContactRemark
7
+ - getAllContacts
8
+ - getContactsWithCursor
9
+ - Adds chatRoom broadcast
10
+
3
11
  # 4.2.1 (SEP 26, 2023)
4
12
 
5
13
  - Adds LocalCache API
package/Easemob-chat.d.ts CHANGED
@@ -836,6 +836,24 @@ export declare namespace EasemobChat {
836
836
  /** The UNIX timestamp when the conversation is pinned. The unit is millisecond. This value is `0` when the conversation is not pinned. */
837
837
  pinnedTime: number;
838
838
  }
839
+ interface ContactItem {
840
+ /** The user ID. */
841
+ userId: UserId;
842
+ /** The user remark. */
843
+ remark: string;
844
+ }
845
+ interface CursorContactsResult {
846
+ /** The position from which to start getting data for the next query. If the number of returned data entries is smaller than that specified in the request, the cursor is an empty string (''), which indicates that the current page is the last page; otherwise, the SDK returns the specific cursor position which indicates where to start getting data for the next query.*/
847
+ cursor?: string;
848
+ /** The contact list. */
849
+ contacts: ContactItem[];
850
+ }
851
+
852
+ interface OperateResult {
853
+ /** The userIds of the operation successfully. */
854
+ userIds: UserId[];
855
+ }
856
+
839
857
  // The contact api result end.
840
858
 
841
859
  interface LoginResult {
@@ -1456,7 +1474,7 @@ export declare namespace EasemobChat {
1456
1474
  pwd?: string;
1457
1475
  /** Token required to connect to the message service. */
1458
1476
  accessToken?: string;
1459
- /** The Agora token. */
1477
+ /** @deprecated Use 'accessToken' instead. */
1460
1478
  agoraToken?: string;
1461
1479
  success?: (res: any) => void;
1462
1480
  error?: (res: any) => void;
@@ -1465,7 +1483,6 @@ export declare namespace EasemobChat {
1465
1483
  isOpened(): boolean;
1466
1484
  /** Closes the connection. */
1467
1485
  close(): void;
1468
- private getChatToken(agoraToken: string): Promise<any>;
1469
1486
  private reconnect(): void;
1470
1487
  /** send message */
1471
1488
  send(params: MessageBody): Promise<SendMsgResult>;
@@ -4307,7 +4324,7 @@ export declare namespace EasemobChat {
4307
4324
  /** The user ID. You can type a specific user ID to add a single user to the blocklist or type an array of user IDs, like ["user1","user2"], to add multiple users. */
4308
4325
  name: UserId | UserId[];
4309
4326
  }
4310
- ): Promise<void>;
4327
+ ): Promise<OperateResult>;
4311
4328
 
4312
4329
  /**
4313
4330
  * @deprecated Use {@link addUsersToBlocklist} instead.
@@ -4804,7 +4821,7 @@ export declare namespace EasemobChat {
4804
4821
  * ```
4805
4822
  */
4806
4823
  getServerConversations(
4807
- this: any,
4824
+ this: Connection,
4808
4825
  params: {
4809
4826
  /** The number of conversations that you expect to get on each page. The value range is [1,50] and the default value is `20`. */
4810
4827
  pageSize?: number;
@@ -4822,7 +4839,7 @@ export declare namespace EasemobChat {
4822
4839
  * ```
4823
4840
  */
4824
4841
  getServerPinnedConversations(
4825
- this: any,
4842
+ this: Connection,
4826
4843
  params: {
4827
4844
  /** The number of conversations that you expect to get on each page. The value range is [1,50] and the default value is `20`. */
4828
4845
  pageSize?: number;
@@ -4838,7 +4855,7 @@ export declare namespace EasemobChat {
4838
4855
  * ```
4839
4856
  */
4840
4857
  pinConversation(
4841
- this: any,
4858
+ this: Connection,
4842
4859
  params: {
4843
4860
  /** The conversation ID. */
4844
4861
  conversationId: string;
@@ -4852,6 +4869,53 @@ export declare namespace EasemobChat {
4852
4869
  }
4853
4870
  ): Promise<AsyncResult<PinConversation>>;
4854
4871
 
4872
+ /**
4873
+ * Set contact remark.
4874
+ *
4875
+ * ```typescript
4876
+ * setContactRemark({userId: 'userId', remark: 'remark'})
4877
+ * ```
4878
+ */
4879
+ setContactRemark(
4880
+ this: Connection,
4881
+ params: {
4882
+ /**
4883
+ * The ID of the contact to set the remark for.
4884
+ */
4885
+ userId: UserId;
4886
+ /**
4887
+ * The remark to set.
4888
+ */
4889
+ remark: string;
4890
+ }
4891
+ ): Promise<void>;
4892
+
4893
+ /**
4894
+ * Gets the all contacts.
4895
+ *
4896
+ * ```typescript
4897
+ * connection.getAllContacts()
4898
+ * ```
4899
+ */
4900
+ getAllContacts(this: Connection): Promise<AsyncResult<ContactItem[]>>;
4901
+
4902
+ /**
4903
+ * Gets the list of contacts with pagination.
4904
+ *
4905
+ * ```typescript
4906
+ * connection.getContactsWithCursor({pageSize:50, cursor: ''})
4907
+ * ```
4908
+ */
4909
+ getContactsWithCursor(
4910
+ this: Connection,
4911
+ params: {
4912
+ /** The number of contacts that you expect to get on each page. The value range is [1,50] and the default value is `20`. */
4913
+ pageSize?: number;
4914
+ /** The position from which to start getting data. */
4915
+ cursor?: string;
4916
+ }
4917
+ ): Promise<AsyncResult<CursorContactsResult>>;
4918
+
4855
4919
  /**
4856
4920
  * Set the DND Settings for the current login user.
4857
4921
  *
@@ -6026,6 +6090,8 @@ export declare namespace EasemobChat {
6026
6090
  onlineState?: ONLINESTATETYPE;
6027
6091
  /** Message priority. */
6028
6092
  priority?: MessagePriority;
6093
+ /** Whether global notify message or not. */
6094
+ broadcast?: boolean;
6029
6095
  /** Whether the message is delivered only when the recipient(s) is/are online:
6030
6096
  * - `true`: The message is delivered only when the recipient(s) is/are online. If the recipient is offline, the message is discarded.
6031
6097
  * - (Default) `false`: The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.
@@ -6089,6 +6155,8 @@ export declare namespace EasemobChat {
6089
6155
  isChatThread?: boolean;
6090
6156
  /** Message priority. */
6091
6157
  priority?: MessagePriority;
6158
+ /** Whether global notify message or not. */
6159
+ broadcast?: boolean;
6092
6160
  /** Whether the message is delivered only when the recipient(s) is/are online:
6093
6161
  * - `true`: The message is delivered only when the recipient(s) is/are online. If the recipient is offline, the message is discarded.
6094
6162
  * - (Default) `false`: The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.
@@ -6233,6 +6301,8 @@ export declare namespace EasemobChat {
6233
6301
  onlineState?: ONLINESTATETYPE;
6234
6302
  /** Message priority. */
6235
6303
  priority?: MessagePriority;
6304
+ /** Whether global notify message or not. */
6305
+ broadcast?: boolean;
6236
6306
  /** Whether the message is delivered only when the recipient(s) is/are online:
6237
6307
  * - `true`: The message is delivered only when the recipient(s) is/are online. If the recipient is offline, the message is discarded.
6238
6308
  * - (Default) `false`: The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.
@@ -6269,7 +6339,6 @@ export declare namespace EasemobChat {
6269
6339
  */
6270
6340
  deliverOnlineOnly?: boolean;
6271
6341
  /** The list of message recipients. */
6272
- /** 消息接收方列表。 */
6273
6342
  receiverList?: string[];
6274
6343
  }
6275
6344
 
@@ -6342,13 +6411,14 @@ export declare namespace EasemobChat {
6342
6411
  onlineState?: ONLINESTATETYPE;
6343
6412
  /** Message priority. */
6344
6413
  priority?: MessagePriority;
6414
+ /** Whether global notify message or not. */
6415
+ broadcast?: boolean;
6345
6416
  /** Whether the message is delivered only when the recipient(s) is/are online:
6346
6417
  * - `true`: The message is delivered only when the recipient(s) is/are online. If the recipient is offline, the message is discarded.
6347
6418
  * - (Default) `false`: The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.
6348
6419
  */
6349
6420
  deliverOnlineOnly?: boolean;
6350
6421
  /** The list of message recipients. */
6351
- /** 消息接收方列表。 */
6352
6422
  receiverList?: string[];
6353
6423
  }
6354
6424
 
@@ -6379,7 +6449,6 @@ export declare namespace EasemobChat {
6379
6449
  */
6380
6450
  deliverOnlineOnly?: boolean;
6381
6451
  /** The list of message recipients. */
6382
- /** 消息接收方列表。 */
6383
6452
  receiverList?: string[];
6384
6453
  }
6385
6454
 
@@ -6460,6 +6529,8 @@ export declare namespace EasemobChat {
6460
6529
  onlineState?: ONLINESTATETYPE;
6461
6530
  /** Message priority. */
6462
6531
  priority?: MessagePriority;
6532
+ /** Whether global notify message or not. */
6533
+ broadcast?: boolean;
6463
6534
  /** Whether the message is delivered only when the recipient(s) is/are online:
6464
6535
  * - `true`: The message is delivered only when the recipient(s) is/are online. If the recipient is offline, the message is discarded.
6465
6536
  * - (Default) `false`: The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.
@@ -6500,7 +6571,6 @@ export declare namespace EasemobChat {
6500
6571
  */
6501
6572
  deliverOnlineOnly?: boolean;
6502
6573
  /** The list of message recipients. */
6503
- /** 消息接收方列表。 */
6504
6574
  receiverList?: string[];
6505
6575
  }
6506
6576
 
@@ -6603,6 +6673,8 @@ export declare namespace EasemobChat {
6603
6673
  isChatThread?: boolean;
6604
6674
  /** Message priority. */
6605
6675
  priority?: MessagePriority;
6676
+ /** Whether global notify message or not. */
6677
+ broadcast?: boolean;
6606
6678
  /** Whether the message is delivered only when the recipient(s) is/are online:
6607
6679
  * - `true`: The message is delivered only when the recipient(s) is/are online. If the recipient is offline, the message is discarded.
6608
6680
  * - (Default) `false`: The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.
@@ -6656,7 +6728,6 @@ export declare namespace EasemobChat {
6656
6728
  */
6657
6729
  deliverOnlineOnly?: boolean;
6658
6730
  /** The list of message recipients. */
6659
- /** 消息接收方列表。 */
6660
6731
  receiverList?: string[];
6661
6732
  }
6662
6733
 
@@ -6740,6 +6811,8 @@ export declare namespace EasemobChat {
6740
6811
  onlineState?: ONLINESTATETYPE;
6741
6812
  /** Message priority. */
6742
6813
  priority?: MessagePriority;
6814
+ /** Whether global notify message or not. */
6815
+ broadcast?: boolean;
6743
6816
  /** Whether the message is delivered only when the recipient(s) is/are online:
6744
6817
  * - `true`: The message is delivered only when the recipient(s) is/are online. If the recipient is offline, the message is discarded.
6745
6818
  * - (Default) `false`: The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.
@@ -6889,13 +6962,14 @@ export declare namespace EasemobChat {
6889
6962
  onlineState?: ONLINESTATETYPE;
6890
6963
  /** Message priority. */
6891
6964
  priority?: MessagePriority;
6965
+ /** Whether global notify message or not. */
6966
+ broadcast?: boolean;
6892
6967
  /** Whether the message is delivered only when the recipient(s) is/are online:
6893
6968
  * - `true`: The message is delivered only when the recipient(s) is/are online. If the recipient is offline, the message is discarded.
6894
6969
  * - (Default) `false`: The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.
6895
6970
  */
6896
6971
  deliverOnlineOnly?: boolean;
6897
6972
  /** The list of message recipients. */
6898
- /** 消息接收方列表。 */
6899
6973
  receiverList?: string[];
6900
6974
  }
6901
6975
 
@@ -6947,7 +7021,6 @@ export declare namespace EasemobChat {
6947
7021
  */
6948
7022
  deliverOnlineOnly?: boolean;
6949
7023
  /** The list of message recipients. */
6950
- /** 消息接收方列表。 */
6951
7024
  receiverList?: string[];
6952
7025
  }
6953
7026
 
@@ -7032,13 +7105,14 @@ export declare namespace EasemobChat {
7032
7105
  onlineState?: ONLINESTATETYPE;
7033
7106
  /** Message priority. */
7034
7107
  priority?: MessagePriority;
7108
+ /** Whether global notify message or not. */
7109
+ broadcast?: boolean;
7035
7110
  /** Whether the message is delivered only when the recipient(s) is/are online:
7036
7111
  * - `true`: The message is delivered only when the recipient(s) is/are online. If the recipient is offline, the message is discarded.
7037
7112
  * - (Default) `false`: The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.
7038
7113
  */
7039
7114
  deliverOnlineOnly?: boolean;
7040
7115
  /** The list of message recipients. */
7041
- /** 消息接收方列表。 */
7042
7116
  receiverList?: string[];
7043
7117
  }
7044
7118
 
@@ -7092,7 +7166,6 @@ export declare namespace EasemobChat {
7092
7166
  */
7093
7167
  deliverOnlineOnly?: boolean;
7094
7168
  /** The list of message recipients. */
7095
- /** 消息接收方列表。 */
7096
7169
  receiverList?: string[];
7097
7170
  }
7098
7171
 
@@ -7198,8 +7271,9 @@ export declare namespace EasemobChat {
7198
7271
  | CombineMsgBody;
7199
7272
 
7200
7273
  type MessagePriority = 'high' | 'normal' | 'low';
7201
- interface PriorityExt {
7274
+ interface MetaExts {
7202
7275
  chatroom_msg_tag: number;
7276
+ is_broadcast?: boolean;
7203
7277
  }
7204
7278
  /**
7205
7279
  * Message class is used to create a message.