easemob-websdk 4.12.1 → 4.14.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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changes to easemob chat
2
2
 
3
+ ## 4.14.0 (Apr 18, 2025)
4
+
5
+ ### 新增特性
6
+
7
+ - 支持 [GIF 图片消息]。
8
+ - 支持 [群组头像功能]。
9
+ - 支持 [附件鉴权功能]。该功能需要联系商务开通,开通后必须调用 SDK 的 API 才能下载消息附件。
10
+ - 支持 [支持自定义设备平台]。
11
+ - unipush 推送安卓平台支持 Google FCM
12
+
13
+ ## 4.13.0 (Mar 12, 2025)
14
+
15
+ ### 新增特性
16
+
17
+ 1. `modifyMessage` 发送后修改消息接口新增可修改的消息类型:
18
+ 支持修改的消息类型如下:
19
+ - 文本消息:支持修改 `msg` 和 `ext` 字段。
20
+ - 自定义消息:支持修改 `customEvent` 、 `customExts` 和 `ext` 字段。
21
+ - 图片/语音/视频/文件/位置/合并消息:仅支持修改 `ext` 字段。
22
+ - 命令消息:不支持修改。
23
+ 2. 小程序 SDK 支持运行到微信小游戏平台
24
+
25
+ ### 优化
26
+
27
+ 1. SDK 内部捕获重试 DNS 失败的错误
28
+
3
29
  ## 4.12.0 (Jan 9, 2025)
4
30
 
5
31
  ### 新增特性
@@ -9,15 +35,14 @@
9
35
 
10
36
  ### 修复
11
37
 
12
- 1. 格式化小程序SDK API 请求失败错误码, 和Web端统一。
13
- 2. 修复uniapp sdk 在4.36版本运行到鸿蒙平台,无限重连的问题。
38
+ 1. 格式化小程序 SDK API 请求失败错误码, 和 Web 端统一。
39
+ 2. 修复 uniapp sdk 在 4.36 版本运行到鸿蒙平台,无限重连的问题。
14
40
  3. 修复偶现无法拉取消息的问题。
15
41
 
16
42
  ### 优化
17
43
 
18
44
  1. 优化重连时间间隔
19
- 2. 小程序SDK支持httpDNS, 默认开启
20
-
45
+ 2. 小程序 SDK 支持 httpDNS, 默认开启
21
46
 
22
47
  ## 4.11.0 (Nov 29, 2024)
23
48
 
package/Easemob-chat.d.ts CHANGED
@@ -59,14 +59,14 @@ export declare namespace EasemobChat {
59
59
  }
60
60
 
61
61
  /** The modified message. */
62
- type ModifiedMsg = TextMsgBody;
62
+ type ModifiedMsg = ExcludeAckMessageBody;
63
63
 
64
64
  /** Messages supported by the `onModifiedMessage` event. */
65
- type ModifiedEventMessage = TextMsgBody | CustomMsgBody;
65
+ type ModifiedEventMessage = ExcludeAckMessageBody;
66
66
 
67
67
  interface ModifyMsgResult extends SendMsgResult {
68
- /** The modified message. */
69
- message: ModifiedMsg;
68
+ /** The modified info of the message. */
69
+ modifiedInfo: ModifiedMsgInfo;
70
70
  }
71
71
 
72
72
  interface ModifiedMsgInfo {
@@ -274,6 +274,10 @@ export declare namespace EasemobChat {
274
274
  * <br> This parameter has an impact on the kicking policy during a multi-device login scenario.
275
275
  */
276
276
  isFixedDeviceId?: boolean;
277
+ /** Custom platform, optional values [1-100]. Please refer to the multi device login document for details. */
278
+ customOSPlatform?: number;
279
+ /** Customize device name. The device name can only be set through this parameter after configuring customOSPlatform. */
280
+ customDeviceName?: string;
277
281
  };
278
282
 
279
283
  interface RegisterUserResult extends AsyncResult {
@@ -551,6 +555,8 @@ export declare namespace EasemobChat {
551
555
  public: boolean;
552
556
  /** Whether on the blacklist. */
553
557
  shieldgroup: boolean;
558
+ /** The group avatar. */
559
+ avatar: string;
554
560
  }
555
561
 
556
562
  interface ModifyGroupResult {
@@ -564,6 +570,8 @@ export declare namespace EasemobChat {
564
570
  membersonly?: boolean;
565
571
  /** Whether the permission invitation is modified successfully. */
566
572
  allowinvites?: boolean;
573
+ /** Whether the group avatar is changed successfully. -`true`: Yes; -`false`: No. */
574
+ avatar?: boolean;
567
575
  }
568
576
 
569
577
  type GroupMember = { owner: UserId } | { member: UserId };
@@ -739,7 +747,7 @@ export declare namespace EasemobChat {
739
747
  name?: string;
740
748
  /** The description of a group. */
741
749
  description?: string;
742
- /** Whether it is a public group. -`true`: Yes; -`false`: No. Public group: the group that others can query by calling `listgroups`. */
750
+ /** Whether it is a public group. -`true`: Yes; -`false`: No. Public group: the group that others can query by calling `getPublicGroups`. */
743
751
  public?: boolean;
744
752
  /** Whether a user requires the approval from the group owner or admin to join the group. -`true`: Yes; -`false`: No. */
745
753
  approval?: boolean;
@@ -756,6 +764,8 @@ export declare namespace EasemobChat {
756
764
  ext?: string;
757
765
  /** Last Modified Timestamp. */
758
766
  lastModified?: number;
767
+ /** The group avatar. */
768
+ avatar?: string;
759
769
  }
760
770
 
761
771
  // The group api result end.
@@ -1420,6 +1430,11 @@ export declare namespace EasemobChat {
1420
1430
  */
1421
1431
  USER_NOT_FRIEND = 221,
1422
1432
 
1433
+ /** No permission to download file. */
1434
+ WEBIM_DOWNLOADFILE_ERROR_NO_PERMISSION = 222,
1435
+ /** The file has expired. */
1436
+ WEBIM_DOWNLOADFILE_ERROR_EXPIRED = 223,
1437
+
1423
1438
  /** get DNS failed */
1424
1439
  SERVER_GET_DNSLIST_FAILED = 304,
1425
1440
 
@@ -1727,11 +1742,11 @@ export declare namespace EasemobChat {
1727
1742
  /** The chat room ID. */
1728
1743
  chatRoomId: string;
1729
1744
  /** The chat room name. */
1730
- chatRoomName: string;
1745
+ chatRoomName?: string;
1731
1746
  /** The description of the chat room. */
1732
- description: string;
1747
+ description?: string;
1733
1748
  /** The maximum number of members in the chat room. */
1734
- maxusers: number;
1749
+ maxusers?: number;
1735
1750
  success?: (res: AsyncResult<ModifyChatRoomResult>) => void;
1736
1751
  error?: (error: ErrorEvent) => void;
1737
1752
  }
@@ -2641,11 +2656,13 @@ export declare namespace EasemobChat {
2641
2656
  data: {
2642
2657
  /** The group name. */
2643
2658
  groupname: string;
2659
+ /** The group avatar. */
2660
+ avatar?: string;
2644
2661
  /** The description of the group. */
2645
2662
  desc: string;
2646
2663
  /** The array of member IDs to add to the group. These users will be added directly into the group and receive "operation: 'directJoined'" in the callback of onGroupEvent. */
2647
2664
  members: UserId[];
2648
- /** Whether it is a public group. -`true`: Yes; -`false`: No. Public group: the group that others can query by calling `listgroups`. */
2665
+ /** Whether it is a public group. -`true`: Yes; -`false`: No. Public group: the group that others can query by calling `getPublicGroups`. */
2649
2666
  public: boolean;
2650
2667
  /** Whether a user requires the approval from the group admin to join the group. -`true`: Yes; -`false`: No.*/
2651
2668
  approval: boolean;
@@ -2668,11 +2685,13 @@ export declare namespace EasemobChat {
2668
2685
 
2669
2686
  /**
2670
2687
  * Creates group
2688
+ * @deprecated Use {@link createGroupVNext instead.}
2671
2689
  *
2672
2690
  * ```typescript
2673
2691
  * connection.createGroup({
2674
2692
  data: {
2675
2693
  groupname: 'groupname',
2694
+ avatar: 'avatar',
2676
2695
  desc: 'this is my group',
2677
2696
  members: ['user1', 'user2'],
2678
2697
  public: true,
@@ -2690,11 +2709,13 @@ export declare namespace EasemobChat {
2690
2709
  data: {
2691
2710
  /** The group name. */
2692
2711
  groupname: string;
2712
+ /** The group avatar. */
2713
+ avatar?: string;
2693
2714
  /** The description of the group. */
2694
2715
  desc: string;
2695
2716
  /** The array of member IDs to add to the group. These users will be added directly into the group and receive "operation: 'directJoined'" in the callback of onGroupEvent. */
2696
2717
  members: UserId[];
2697
- /** Whether it is a public group. -`true`: Yes; -`false`: No. Public group: the group that others can query by calling `listgroups`. */
2718
+ /** Whether it is a public group. -`true`: Yes; -`false`: No. Public group: the group that others can query by calling `getPublicGroups`. */
2698
2719
  public: boolean;
2699
2720
  /** Whether a user requires the approval from the group admin to join the group. -`true`: Yes; -`false`: No.*/
2700
2721
  approval: boolean;
@@ -2715,6 +2736,54 @@ export declare namespace EasemobChat {
2715
2736
  }
2716
2737
  ): Promise<AsyncResult<CreateGroupResult>>;
2717
2738
 
2739
+ /**
2740
+ * Creates a group instance.
2741
+ *
2742
+ * ```typescript
2743
+ * connection.createGroupVNext({
2744
+ * groupName: 'groupname',
2745
+ * avatar: 'group avatar',
2746
+ * description: 'this is my group',
2747
+ * members: ['user1', 'user2'],
2748
+ * isPublic: true,
2749
+ * needApprovalToJoin: false,
2750
+ * allowMemberToInvite: true,
2751
+ * inviteNeedConfirm: false,
2752
+ * maxMemberCount: 200,
2753
+ * extension: JSON.stringify({info: 'group info'})
2754
+ * })
2755
+ * ```
2756
+ */
2757
+ createGroupVNext(
2758
+ this: Connection,
2759
+ params: {
2760
+ /** The group name. */
2761
+ groupName?: string;
2762
+ /** The group avatar. */
2763
+ avatar?: string;
2764
+ /** The description of the group. */
2765
+ description?: string;
2766
+ /** The array of member IDs to add to the group. These users will be added directly into the group and receive "operation: 'directJoined'" in the callback of onGroupEvent. */
2767
+ members?: UserId[];
2768
+ /** Whether it is a public group. -`true`: Yes; -`false`: No. Public group: the group that others can query by calling `getPublicGroups`. */
2769
+ isPublic?: boolean;
2770
+ /** Whether a user requires the approval from the group admin to join the group. -`true`: Yes; -`false`: No.*/
2771
+ needApprovalToJoin?: boolean;
2772
+ /** Whether to allow group members to invite others to the group. `true`: Allow; `false`: Do not allow.*/
2773
+ allowMemberToInvite?: boolean;
2774
+ /**
2775
+ * Whether the invitee needs to accept the invitation before joining the group.
2776
+ * - `true`: The invitee's consent is required. The default value is `true`.
2777
+ * - `false`: The invitee will be directly added to the group without confirmation.
2778
+ */
2779
+ inviteNeedConfirm?: boolean;
2780
+ /** The group max users. */
2781
+ maxMemberCount?: number;
2782
+ /** Group detail extensions which can be in the JSON format to contain more group information. */
2783
+ extension?: string;
2784
+ }
2785
+ ): Promise<AsyncResult<{ groupId: string }>>;
2786
+
2718
2787
  /** @deprecated Use {@link blockGroupMessages instead.} */
2719
2788
  blockGroup(
2720
2789
  this: Connection,
@@ -2912,6 +2981,8 @@ export declare namespace EasemobChat {
2912
2981
  groupName?: string;
2913
2982
  /** The group description. */
2914
2983
  description?: string;
2984
+ /** The group avatar. */
2985
+ avatar?: string;
2915
2986
  /** Group detail extensions which can be in the JSON format to contain more group information. */
2916
2987
  ext?: string;
2917
2988
  success?: (res: AsyncResult<ModifyGroupResult>) => void;
@@ -4588,11 +4659,15 @@ export declare namespace EasemobChat {
4588
4659
  ): Promise<SendMsgResult>;
4589
4660
 
4590
4661
  /**
4591
- * Modifies a message on the server.
4662
+ * Modifies a message in the server.
4592
4663
  *
4593
- * This method can only modify a text message in one-to-one chats or group chats, but not in chat rooms.
4664
+ * - Text message: Both the message body `msg` and extension information `ext` can be modified.
4665
+ * - Custom message: The custom extension property field `customExts`, custom event type field `customEvent` , and message extension field `ext` can be modified.
4666
+ * - Image/video/voice/file/location/combined message: Only the message extension field `ext` can be modified.
4667
+ * - Command message: This type of message cannot be modified.
4668
+ *
4669
+ * The message recipient can listen for message changes via `onModifiedMessage`. Also, this callback applies in multi-device scenarios.
4594
4670
  *
4595
- * Upon a message modification, the callback `onModifiedMessage` will be received by the message recipient(s) and in multi-device login scenarios.
4596
4671
  *
4597
4672
  * ```typescript
4598
4673
  *
@@ -6612,6 +6687,8 @@ export declare namespace EasemobChat {
6612
6687
  * - (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.
6613
6688
  */
6614
6689
  deliverOnlineOnly?: boolean;
6690
+ /** Message modified info. */
6691
+ modifiedInfo?: ModifiedMsgInfo;
6615
6692
  /** The list of message recipients. */
6616
6693
  receiverList?: string[];
6617
6694
  /** The file URL. */
@@ -6764,6 +6841,8 @@ export declare namespace EasemobChat {
6764
6841
  * - (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.
6765
6842
  */
6766
6843
  deliverOnlineOnly?: boolean;
6844
+ /** Message modified info. */
6845
+ modifiedInfo?: ModifiedMsgInfo;
6767
6846
  /** The list of message recipients. */
6768
6847
  receiverList?: string[];
6769
6848
  /** Has the message been read (only single chat messages have this field). */
@@ -7006,6 +7085,8 @@ export declare namespace EasemobChat {
7006
7085
  * - (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.
7007
7086
  */
7008
7087
  deliverOnlineOnly?: boolean;
7088
+ /** Message modified info. */
7089
+ modifiedInfo?: ModifiedMsgInfo;
7009
7090
  /** The list of message recipients. */
7010
7091
  receiverList?: string[];
7011
7092
  /** Has the message been read (only single chat messages have this field). */
@@ -7156,6 +7237,8 @@ export declare namespace EasemobChat {
7156
7237
  * - (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.
7157
7238
  */
7158
7239
  deliverOnlineOnly?: boolean;
7240
+ /** Message modified info. */
7241
+ modifiedInfo?: ModifiedMsgInfo;
7159
7242
  /** Has the message been read (only single chat messages have this field). */
7160
7243
  isRead?: boolean;
7161
7244
  /** Has the message been delivered (only single chat messages have this field). */
@@ -7306,6 +7389,8 @@ export declare namespace EasemobChat {
7306
7389
  thumbnailWidth?: number;
7307
7390
  /** The thumbnail height. */
7308
7391
  thumbnailHeight?: number;
7392
+ /** Message modified info. */
7393
+ modifiedInfo?: ModifiedMsgInfo;
7309
7394
  /** Has the message been read (only single chat messages have this field). */
7310
7395
  isRead?: boolean;
7311
7396
  /** Has the message been delivered (only single chat messages have this field). */
@@ -7365,6 +7450,8 @@ export declare namespace EasemobChat {
7365
7450
  thumbnailWidth?: number;
7366
7451
  /** The thumbnail height. */
7367
7452
  thumbnailHeight?: number;
7453
+ /** Whether the image is a gif. */
7454
+ isGif?: boolean;
7368
7455
  }
7369
7456
 
7370
7457
  interface AudioParameters {
@@ -7457,6 +7544,8 @@ export declare namespace EasemobChat {
7457
7544
  * - (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.
7458
7545
  */
7459
7546
  deliverOnlineOnly?: boolean;
7547
+ /** Message modified info. */
7548
+ modifiedInfo?: ModifiedMsgInfo;
7460
7549
  /** The list of message recipients. */
7461
7550
  receiverList?: string[];
7462
7551
  /** Has the message been read (only single chat messages have this field). */
@@ -7610,6 +7699,8 @@ export declare namespace EasemobChat {
7610
7699
  * - (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.
7611
7700
  */
7612
7701
  deliverOnlineOnly?: boolean;
7702
+ /** Message modified info. */
7703
+ modifiedInfo?: ModifiedMsgInfo;
7613
7704
  /** The list of message recipients. */
7614
7705
  receiverList?: string[];
7615
7706
  /** Has the message been read (only single chat messages have this field). */