easemob-websdk 4.17.0 → 4.19.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/Easemob-chat.d.ts CHANGED
@@ -278,6 +278,8 @@ export declare namespace EasemobChat {
278
278
  customOSPlatform?: number;
279
279
  /** Customize device name. The device name can only be set through this parameter after configuring customOSPlatform. */
280
280
  customDeviceName?: string;
281
+ /** Whether to enable auto login mode. Only supported on uniapp platform. */
282
+ isAutoLogin?: boolean;
281
283
  };
282
284
 
283
285
  interface RegisterUserResult extends AsyncResult {
@@ -1425,12 +1427,18 @@ export declare namespace EasemobChat {
1425
1427
  WEBIM_CONNCTION_USER_LOGIN_ANOTHER_DEVICE = 206,
1426
1428
  /** The user was removed. */
1427
1429
  WEBIM_CONNCTION_USER_REMOVED = 207,
1430
+ /** The user is already logged in. */
1431
+ WEBIM_USER_ALREADY_LOGIN = 208,
1432
+ /** The number of devices the user is logged in to exceeds the limit. */
1433
+ USER_LOGIN_TOO_MANY_DEVICES = 214,
1428
1434
  /** The password is renewed. */
1429
1435
  WEBIM_CONNCTION_USER_KICKED_BY_CHANGE_PASSWORD = 216,
1430
1436
  /** The user was kicked off from another device. */
1431
1437
  WEBIM_CONNCTION_USER_KICKED_BY_OTHER_DEVICE = 217,
1432
1438
  /** Global muted. */
1433
1439
  USER_MUTED_BY_ADMIN = 219,
1440
+ /** The user device is changed. */
1441
+ USER_DEVICE_CHANGED = 220,
1434
1442
  /**
1435
1443
  * The user is not on your contact list, and you cannot send messages to him or her.
1436
1444
  * Note: You can send messages to strangers by default. This error occurs only when you enable the function of allowing to send messages only to your contacts.
@@ -1577,6 +1585,7 @@ export declare namespace EasemobChat {
1577
1585
  };
1578
1586
 
1579
1587
  eventHandler?: EventHandler;
1588
+ /// #if !IS_LITE
1580
1589
  /**
1581
1590
  * @deprecated
1582
1591
  */
@@ -1586,6 +1595,7 @@ export declare namespace EasemobChat {
1586
1595
  */
1587
1596
  onPresence?: (msg: PresenceMsg) => void;
1588
1597
  onTextMessage?: (msg: TextMsgBody) => void;
1598
+ onStreamMessage?: (msg: StreamMsgBody) => void;
1589
1599
  onPictureMessage?: (msg: ImgMsgBody) => void;
1590
1600
  onAudioMessage?: (msg: AudioMsgBody) => void;
1591
1601
  onVideoMessage?: (msg: VideoMsgBody) => void;
@@ -1608,6 +1618,7 @@ export declare namespace EasemobChat {
1608
1618
  onContactAdded?: (msg: ContactMsgBody) => void;
1609
1619
  onTokenWillExpire?: () => void;
1610
1620
  onTokenExpired?: () => void;
1621
+ /// #endif
1611
1622
  // eslint-disable-next-line no-undef
1612
1623
  [key: string]: any;
1613
1624
  constructor(options: ConnectionParameters);
@@ -1651,6 +1662,7 @@ export declare namespace EasemobChat {
1651
1662
  /** Updates token. */
1652
1663
  renewToken(token: string): Promise<NewTokenResult>;
1653
1664
 
1665
+ /// #if !IS_LITE
1654
1666
  // ChatRoom API
1655
1667
  /**
1656
1668
  * Gets chat room list (paging).
@@ -1717,6 +1729,7 @@ export declare namespace EasemobChat {
1717
1729
  }
1718
1730
  ): Promise<AsyncResult<CreateDeleteChatRoomResult>>;
1719
1731
 
1732
+ /// #endif
1720
1733
  /**
1721
1734
  * Gets specifications of the chat room.
1722
1735
  *
@@ -1736,6 +1749,7 @@ export declare namespace EasemobChat {
1736
1749
  }
1737
1750
  ): Promise<AsyncResult<Array<GetChatRoomDetailsResult>>>;
1738
1751
 
1752
+ /// #if !IS_LITE
1739
1753
  /**
1740
1754
  * Modifies the specifications of the chat room.
1741
1755
  *
@@ -1842,6 +1856,8 @@ export declare namespace EasemobChat {
1842
1856
  }
1843
1857
  ): Promise<AsyncResult<AddUsersToChatRoomResult>>;
1844
1858
 
1859
+ /// #endif
1860
+
1845
1861
  /**
1846
1862
  * Joins the chat room.
1847
1863
  *
@@ -1871,6 +1887,8 @@ export declare namespace EasemobChat {
1871
1887
  }
1872
1888
  ): Promise<AsyncResult<JoinChatRoomResult>>;
1873
1889
 
1890
+ /// #if !IS_LITE
1891
+
1874
1892
  /**
1875
1893
  * @deprecated Use {@link leaveChatRoom} instead.
1876
1894
  * Exits the chat room.
@@ -1895,6 +1913,8 @@ export declare namespace EasemobChat {
1895
1913
  }
1896
1914
  ): Promise<AsyncResult<{ result: boolean }>>;
1897
1915
 
1916
+ /// #endif
1917
+
1898
1918
  /**
1899
1919
  * Exits the chat room.
1900
1920
  *
@@ -1915,6 +1935,7 @@ export declare namespace EasemobChat {
1915
1935
  }
1916
1936
  ): Promise<AsyncResult<{ result: boolean }>>;
1917
1937
 
1938
+ /// #if !IS_LITE
1918
1939
  /** @deprecated */
1919
1940
  listChatRoomMember(
1920
1941
  this: Connection,
@@ -1953,6 +1974,8 @@ export declare namespace EasemobChat {
1953
1974
  }
1954
1975
  ): Promise<AsyncResult<{ member: string }[]>>;
1955
1976
 
1977
+ /// #endif
1978
+
1956
1979
  /**
1957
1980
  * Gets the list chat room members with pagination.
1958
1981
  *
@@ -1977,6 +2000,8 @@ export declare namespace EasemobChat {
1977
2000
  }>
1978
2001
  >;
1979
2002
 
2003
+ /// #if !IS_LITE
2004
+
1980
2005
  /**
1981
2006
  * Gets all admins of the chat room.
1982
2007
  *
@@ -2555,6 +2580,8 @@ export declare namespace EasemobChat {
2555
2580
  }
2556
2581
  ): Promise<AsyncResult<boolean>>;
2557
2582
 
2583
+ /// #endif
2584
+
2558
2585
  /**
2559
2586
  * Gets the announcement of the chat room.
2560
2587
  *
@@ -2574,6 +2601,8 @@ export declare namespace EasemobChat {
2574
2601
  }
2575
2602
  ): Promise<AsyncResult<FetchChatRoomAnnouncementResult>>;
2576
2603
 
2604
+ /// #if !IS_LITE
2605
+
2577
2606
  /**
2578
2607
  * Updates the announcement of the chat room.
2579
2608
  *
@@ -4404,6 +4433,8 @@ export declare namespace EasemobChat {
4404
4433
  }
4405
4434
  ): Promise<AsyncResult<DeleteSessionResult>>;
4406
4435
 
4436
+ /// #endif
4437
+
4407
4438
  /**
4408
4439
  * Deletes the conversation.
4409
4440
  *
@@ -4431,6 +4462,8 @@ export declare namespace EasemobChat {
4431
4462
  }
4432
4463
  ): Promise<AsyncResult<DeleteSessionResult>>;
4433
4464
 
4465
+ /// #if !IS_LITE
4466
+
4434
4467
  /**
4435
4468
  * @deprecated Use {@link updateUserInfo} instead.
4436
4469
  * Updates own information.
@@ -4526,6 +4559,8 @@ export declare namespace EasemobChat {
4526
4559
  }
4527
4560
  ): Promise<MessageBody[]>;
4528
4561
 
4562
+ /// #endif
4563
+
4529
4564
  /**
4530
4565
  * Gets the message history.
4531
4566
  *
@@ -4601,6 +4636,8 @@ export declare namespace EasemobChat {
4601
4636
  }
4602
4637
  ): Promise<void>;
4603
4638
 
4639
+ /// #if !IS_LITE
4640
+
4604
4641
  /**
4605
4642
  * Adds a friend.
4606
4643
  *
@@ -4717,6 +4754,8 @@ export declare namespace EasemobChat {
4717
4754
  }
4718
4755
  ): Promise<void>;
4719
4756
 
4757
+ /// #endif
4758
+
4720
4759
  /**
4721
4760
  * Recalls a message.
4722
4761
  *
@@ -4752,6 +4791,8 @@ export declare namespace EasemobChat {
4752
4791
  }
4753
4792
  ): Promise<SendMsgResult>;
4754
4793
 
4794
+ /// #if !IS_LITE
4795
+
4755
4796
  /**
4756
4797
  * Modifies a message in the server.
4757
4798
  *
@@ -4788,6 +4829,8 @@ export declare namespace EasemobChat {
4788
4829
  // listen @deprecated
4789
4830
  listen(this: Connection, parameters: ListenParameters): void;
4790
4831
 
4832
+ /// #endif
4833
+
4791
4834
  /**
4792
4835
  * Adds listening events.
4793
4836
  *
@@ -4810,6 +4853,8 @@ export declare namespace EasemobChat {
4810
4853
  */
4811
4854
  removeEventHandler(id: string): void;
4812
4855
 
4856
+ /// #if !IS_LITE
4857
+
4813
4858
  /** Download combined message. */
4814
4859
  downloadAndParseCombineMessage(
4815
4860
  options: DownloadCombineMessagesParams
@@ -5145,6 +5190,8 @@ export declare namespace EasemobChat {
5145
5190
  }
5146
5191
  ): Promise<void>;
5147
5192
 
5193
+ /// #endif
5194
+
5148
5195
  /**
5149
5196
  * Gets the list of conversations from the server with pagination.
5150
5197
  *
@@ -5171,6 +5218,9 @@ export declare namespace EasemobChat {
5171
5218
  includeEmptyConversations?: boolean;
5172
5219
  }
5173
5220
  ): Promise<AsyncResult<ServerConversations>>;
5221
+
5222
+ /// #if !IS_LITE
5223
+
5174
5224
  /**
5175
5225
  * Get the list of pinned conversations from the server with pagination.
5176
5226
  *
@@ -5195,6 +5245,9 @@ export declare namespace EasemobChat {
5195
5245
  includeEmptyConversations?: boolean;
5196
5246
  }
5197
5247
  ): Promise<AsyncResult<ServerConversations>>;
5248
+
5249
+ /// #endif
5250
+
5198
5251
  /**
5199
5252
  * Sets whether to pin a conversation.
5200
5253
  *
@@ -5217,6 +5270,8 @@ export declare namespace EasemobChat {
5217
5270
  }
5218
5271
  ): Promise<AsyncResult<PinConversation>>;
5219
5272
 
5273
+ /// #if !IS_LITE
5274
+
5220
5275
  /**
5221
5276
  * Set contact remark.
5222
5277
  *
@@ -5855,6 +5910,8 @@ export declare namespace EasemobChat {
5855
5910
  }
5856
5911
  ): Promise<AsyncResult<JoinedChatRoomsResult>>;
5857
5912
 
5913
+ /// #endif
5914
+
5858
5915
  /** Execute this method during the onShow declaration cycle of the application, which will actively detect whether the current connection is valid. */
5859
5916
  onShow(): void;
5860
5917
  }
@@ -5947,6 +6004,7 @@ export declare namespace EasemobChat {
5947
6004
  | 'onReadMessage'
5948
6005
  | 'onRecallMessage'
5949
6006
  | 'onChannelMessage'
6007
+ | 'onStreamMessage'
5950
6008
  | 'onError'
5951
6009
  | 'onOffline'
5952
6010
  | 'onOnline'
@@ -6151,6 +6209,8 @@ export declare namespace EasemobChat {
6151
6209
  ) => void;
6152
6210
  /** The callback to receive a text message. */
6153
6211
  onTextMessage?: (msg: TextMsgBody) => void;
6212
+ /** The callback to receive a stream message. */
6213
+ onStreamMessage?: (msg: StreamMsgBody) => void;
6154
6214
  /** The callback to receive a image message. */
6155
6215
  onImageMessage?: (msg: ImgMsgBody) => void;
6156
6216
  /** The callback to receive a audio message. */
@@ -6260,6 +6320,8 @@ export declare namespace EasemobChat {
6260
6320
  ): void;
6261
6321
  }
6262
6322
 
6323
+ /// #if !IS_LITE
6324
+
6263
6325
  /**
6264
6326
  * @module listen
6265
6327
  * @deprecated
@@ -6294,6 +6356,8 @@ export declare namespace EasemobChat {
6294
6356
  onPresenceStatusChange?: (msg: PresenceType[]) => void;
6295
6357
  }
6296
6358
 
6359
+ /// #endif
6360
+
6297
6361
  // ----- for Error -----
6298
6362
 
6299
6363
  interface ErrorParameters {
@@ -6785,6 +6849,39 @@ export declare namespace EasemobChat {
6785
6849
  receiverList?: string[];
6786
6850
  }
6787
6851
 
6852
+ interface StreamChunk {
6853
+ /** The custom type. */
6854
+ customType: string;
6855
+ /** The sequence number. */
6856
+ seq: number;
6857
+ /** The status. */
6858
+ status: StreamStatus;
6859
+ /** The error type. */
6860
+ errorType: number;
6861
+ /** The text. */
6862
+ text: string; // 增量内容
6863
+ /** The finish reason. */
6864
+ finishReason?: number;
6865
+ }
6866
+
6867
+ enum StreamStatus {
6868
+ /** The stream start. */
6869
+ START = 0,
6870
+ /** The stream start and completed. */
6871
+ START_AND_COMPLETED = 1,
6872
+ /** The stream in progress. */
6873
+ IN_PROGRESS = 2,
6874
+ /** The stream completed. */
6875
+ COMPLETED = 3,
6876
+ /** The stream error. */
6877
+ ERROR = 4,
6878
+ }
6879
+
6880
+ interface StreamMsgBody extends TextMsgBody {
6881
+ /** The stream chunk. */
6882
+ stream: Omit<StreamChunk, 'seq'>;
6883
+ }
6884
+
6788
6885
  interface CombineMsgBody {
6789
6886
  /** The message ID. */
6790
6887
  id: string;
@@ -7953,7 +8050,8 @@ export declare namespace EasemobChat {
7953
8050
  | VideoMsgBody
7954
8051
  | FileMsgBody
7955
8052
  | ReadMsgBody
7956
- | CombineMsgBody;
8053
+ | CombineMsgBody
8054
+ | StreamMsgBody;
7957
8055
 
7958
8056
  type MessageSetParameters =
7959
8057
  | ReadMsgSetParameters
@@ -7994,7 +8092,8 @@ export declare namespace EasemobChat {
7994
8092
  | AudioMsgBody
7995
8093
  | VideoMsgBody
7996
8094
  | FileMsgBody
7997
- | CombineMsgBody;
8095
+ | CombineMsgBody
8096
+ | StreamMsgBody;
7998
8097
 
7999
8098
  type MessagePriority = 'high' | 'normal' | 'low';
8000
8099
  interface MetaExts {