easemob-websdk 4.3.1 → 4.4.1

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,15 @@
1
1
  # Changes to easemob chat
2
2
 
3
+ # 4.4.0 (Dec 22, 2023)
4
+
5
+ - Adds conversation Conversation Mark
6
+ - addConversationMark
7
+ - removeConversationMark
8
+ - getServerConversationsByFilter
9
+ - Adds Attach Slice Upload
10
+ - Adds `onMessage` Event
11
+ - Adds thumbnail to video message
12
+
3
13
  # 4.3.1 (Dec 13, 2023)
4
14
 
5
15
  - Adds use replaced message contents
package/Easemob-chat.d.ts CHANGED
@@ -195,11 +195,15 @@ export declare namespace EasemobChat {
195
195
  operation:
196
196
  | 'pinnedConversation'
197
197
  | 'unpinnedConversation'
198
- | 'deleteConversation';
198
+ | 'deleteConversation'
199
+ | 'markConversation'
200
+ | 'unMarkConversation';
199
201
  /** The conversation ID. */
200
202
  conversationId: string;
201
203
  /** The conversation type. */
202
204
  conversationType: 'singleChat' | 'groupChat';
205
+ /** The conversation mark. */
206
+ conversationMark?: MarkType;
203
207
  /** The UNIX timestamp of the current operation. The unit is millisecond.*/
204
208
  timestamp: number;
205
209
  }
@@ -831,6 +835,8 @@ export declare namespace EasemobChat {
831
835
  lastMessage: MessageBody | Record<string, never> | null;
832
836
  /** The number of unread messages. */
833
837
  unReadCount: number;
838
+ /** The conversation marks. */
839
+ marks?: Array<MarkType>;
834
840
  }
835
841
  interface PinConversation {
836
842
  /** Whether the conversation is pinned. `true`: pinned; `false`: unpinned.*/
@@ -851,6 +857,30 @@ export declare namespace EasemobChat {
851
857
  contacts: ContactItem[];
852
858
  }
853
859
 
860
+ /** The conversation mark types. The mapping between each type of conversation mark and their actual meanings is maintained by the developer. */
861
+ enum MarkType {
862
+ mark_0,
863
+ mark_1,
864
+ mark_2,
865
+ mark_3,
866
+ mark_4,
867
+ mark_5,
868
+ mark_6,
869
+ mark_7,
870
+ mark_8,
871
+ mark_9,
872
+ mark_10,
873
+ mark_11,
874
+ mark_12,
875
+ mark_13,
876
+ mark_14,
877
+ mark_15,
878
+ mark_16,
879
+ mark_17,
880
+ mark_18,
881
+ mark_19,
882
+ }
883
+
854
884
  interface OperateResult {
855
885
  /** The userIds of the operation successfully. */
856
886
  userIds: UserId[];
@@ -2367,7 +2397,7 @@ export declare namespace EasemobChat {
2367
2397
  /** The chat room ID. */
2368
2398
  chatRoomId: string;
2369
2399
  }
2370
- ): Promise<boolean>;
2400
+ ): Promise<AsyncResult<boolean>>;
2371
2401
 
2372
2402
  /**
2373
2403
  * Gets the announcement of the chat room.
@@ -3710,7 +3740,7 @@ export declare namespace EasemobChat {
3710
3740
  /** The group ID. */
3711
3741
  groupId: string;
3712
3742
  }
3713
- ): Promise<boolean>;
3743
+ ): Promise<AsyncResult<boolean>>;
3714
3744
 
3715
3745
  /**
3716
3746
  * Checks which members have read group message. This is a [value-added function] and .
@@ -4929,6 +4959,76 @@ export declare namespace EasemobChat {
4929
4959
  }
4930
4960
  ): Promise<AsyncResult<CursorContactsResult>>;
4931
4961
 
4962
+ /**
4963
+ * Marks conversations.
4964
+ *
4965
+ * ```typescript
4966
+ * connection.addConversationMark({
4967
+ * conversations: [{conversationId: 'conversationId', conversationType: 'singleChat'}],
4968
+ * mark: 0,
4969
+ * })
4970
+ * ```
4971
+ */
4972
+ addConversationMark(
4973
+ this: Connection,
4974
+ params: {
4975
+ /** The list of conversations. */
4976
+ conversations: Array<
4977
+ Pick<
4978
+ ConversationItem,
4979
+ 'conversationId' | 'conversationType'
4980
+ >
4981
+ >;
4982
+ /** The mark to add for the conversations. */
4983
+ mark: MarkType;
4984
+ }
4985
+ ): Promise<void>;
4986
+
4987
+ /**
4988
+ * Unmarks conversations.
4989
+ *
4990
+ * ```typescript
4991
+ * connection.removeConversationMark({
4992
+ * conversations: [{conversationId: 'conversationId', conversationType: 'singleChat'}],
4993
+ * mark: 0,
4994
+ * })
4995
+ * ```
4996
+ */
4997
+ removeConversationMark(
4998
+ this: Connection,
4999
+ params: {
5000
+ /** The list of conversations. */
5001
+ conversations: Array<
5002
+ Pick<
5003
+ ConversationItem,
5004
+ 'conversationId' | 'conversationType'
5005
+ >
5006
+ >;
5007
+ /** The conversation mark to remove. */
5008
+ mark: MarkType;
5009
+ }
5010
+ ): Promise<void>;
5011
+
5012
+ /**
5013
+ * Get the list of filter conversations from the server with pagination.
5014
+ *
5015
+ * ```typescript
5016
+ * connection.getServerConversationsByFilter({pageSize:10, cursor: '',filter: {mark: 0})
5017
+ * ```
5018
+ */
5019
+ getServerConversationsByFilter(
5020
+ this: Connection,
5021
+ params: {
5022
+ /** The number of conversations that you expect to get on each page. The value range is [1,10] and the default value is `10`. */
5023
+ pageSize?: number;
5024
+ /** The position from which to start getting data. */
5025
+ cursor?: string;
5026
+ filter: {
5027
+ mark: MarkType;
5028
+ };
5029
+ }
5030
+ ): Promise<AsyncResult<ServerConversations>>;
5031
+
4932
5032
  /**
4933
5033
  * Set the DND Settings for the current login user.
4934
5034
  *
@@ -5376,6 +5476,7 @@ export declare namespace EasemobChat {
5376
5476
  type Event =
5377
5477
  | 'onOpened'
5378
5478
  | 'onPresence'
5479
+ | 'onMessage'
5379
5480
  | 'onTextMessage'
5380
5481
  | 'onImageMessage'
5381
5482
  | 'onAudioMessage'
@@ -5542,6 +5643,13 @@ export declare namespace EasemobChat {
5542
5643
  onOpened?: (msg: any) => void;
5543
5644
  /** @deprecated */
5544
5645
  onPresence?: (msg: OnPresenceMsg) => void;
5646
+ /** Occurs when a message is received. This callback is triggered to notify the user when a message such as texts or an image, video, voice, location, or file is received. */
5647
+ onMessage?: (
5648
+ msg: Exclude<
5649
+ MessageBody,
5650
+ ReadMsgBody | DeliveryMsgBody | ChannelMsgBody | CmdMsgBody
5651
+ >[]
5652
+ ) => void;
5545
5653
  /** The callback to receive a text message. */
5546
5654
  onTextMessage?: (msg: TextMsgBody) => void;
5547
5655
  /** The callback to receive a image message. */
@@ -7112,6 +7220,10 @@ export declare namespace EasemobChat {
7112
7220
  url?: string;
7113
7221
  /** Secret required to download the video file. */
7114
7222
  secret?: string;
7223
+ /** The thumbnail URL. */
7224
+ thumb?: string;
7225
+ /** The key required to download the thumbnail. */
7226
+ thumb_secret?: string;
7115
7227
  /** The file type. */
7116
7228
  filetype?: string;
7117
7229
  /** AccessToken needed to download files */