easemob-websdk 4.1.0-beta2 → 4.1.0-beta4

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +0 -12
  2. package/Easemob-chat.d.ts +987 -110
  3. package/Easemob-chat.js +2 -1
  4. package/package.json +1 -1
  5. package/chatroom/chatroom.d.ts +0 -590
  6. package/chatroom/chatroom.js +0 -1
  7. package/contact/contact.d.ts +0 -322
  8. package/contact/contact.js +0 -1
  9. package/group/group.d.ts +0 -645
  10. package/group/group.js +0 -1
  11. package/message/audio.d.ts +0 -140
  12. package/message/channel.d.ts +0 -58
  13. package/message/cmd.d.ts +0 -102
  14. package/message/custom.d.ts +0 -94
  15. package/message/delivery.d.ts +0 -53
  16. package/message/file.d.ts +0 -134
  17. package/message/img.d.ts +0 -150
  18. package/message/index.d.ts +0 -147
  19. package/message/location.d.ts +0 -98
  20. package/message/read.d.ts +0 -61
  21. package/message/text.d.ts +0 -107
  22. package/message/video.d.ts +0 -140
  23. package/miniCore/miniCore.d.ts +0 -148
  24. package/miniCore/miniCore.js +0 -1
  25. package/presence/presence.d.ts +0 -67
  26. package/presence/presence.js +0 -1
  27. package/silent/silent.d.ts +0 -110
  28. package/silent/silent.js +0 -1
  29. package/thread/thread.d.ts +0 -157
  30. package/thread/thread.js +0 -1
  31. package/translation/translation.d.ts +0 -28
  32. package/translation/translation.js +0 -1
  33. package/types/chatRoomApi.d.ts +0 -198
  34. package/types/common.d.ts +0 -56
  35. package/types/engineCore.d.ts +0 -83
  36. package/types/error.d.ts +0 -12
  37. package/types/eventHandler.d.ts +0 -201
  38. package/types/groupApi.d.ts +0 -235
  39. package/types/indexApi.d.ts +0 -134
  40. package/types/presenceApi.d.ts +0 -66
  41. package/types/reactionApi.d.ts +0 -74
  42. package/types/restApis.d.ts +0 -6
  43. package/types/silentModeApi.d.ts +0 -90
  44. package/types/threadApi.d.ts +0 -169
  45. package/types/translation.d.ts +0 -25
package/Easemob-chat.d.ts CHANGED
@@ -137,6 +137,17 @@ export declare namespace EasemobChat {
137
137
  parentId?: string;
138
138
  }
139
139
 
140
+ interface RoamingDeleteMultiDeviceInfo {
141
+ /** Event name of multi device event. */
142
+ operation: 'deleteRoaming';
143
+ /** The target user ID or group ID. */
144
+ conversationId: string;
145
+ /** The chat type. */
146
+ chatType: 'singleChat' | 'groupChat';
147
+ /** The client resource. */
148
+ resource: string;
149
+ }
150
+
140
151
  interface ConnectionParameters {
141
152
  /** The unique application key registered in console. */
142
153
  appKey: string;
@@ -1076,8 +1087,8 @@ export declare namespace EasemobChat {
1076
1087
  NO_PERMISSION = 52,
1077
1088
  /** Unsupported Operation. */
1078
1089
  OPERATION_UNSUPPORTED = 53,
1079
- /** An operation that is not allowed. */
1080
- OPERATION_NOT_ALLOWED = 54,
1090
+ /** The current operation object does not exist. */
1091
+ NOT_EXIST = 54,
1081
1092
  /** The uploading of the file failed. */
1082
1093
  WEBIM_UPLOADFILE_ERROR = 101,
1083
1094
  /** The current user is not logged in when uploading the file. */
@@ -1132,8 +1143,8 @@ export declare namespace EasemobChat {
1132
1143
  PERMISSION_DENIED = 603,
1133
1144
  /** Internal error. */
1134
1145
  WEBIM_LOAD_MSG_ERROR = 604,
1135
- /** The current user is already in the group. */
1136
- GROUP_ALREADY_JOINED = 601,
1146
+ /** The current user has joined. */
1147
+ ALREADY_JOINED = 601,
1137
1148
  /** The maximum number of group members exceeds the limit during group creation. */
1138
1149
  GROUP_MEMBERS_LIMIT = 607,
1139
1150
  /** Group disabled */
@@ -2256,6 +2267,8 @@ export declare namespace EasemobChat {
2256
2267
  inviteNeedConfirm: boolean;
2257
2268
  /** The group max users. */
2258
2269
  maxusers: number;
2270
+ /** Group detail extensions which can be in the JSON format to contain more group information. */
2271
+ ext?: string;
2259
2272
  };
2260
2273
  success?: (res: AsyncResult<CreateGroupResult>) => void;
2261
2274
  error?: (error: ErrorEvent) => void;
@@ -2263,22 +2276,22 @@ export declare namespace EasemobChat {
2263
2276
  ): Promise<AsyncResult<CreateGroupResult>>;
2264
2277
 
2265
2278
  /**
2266
- * Creates group
2267
- *
2268
- * ```typescript
2269
- * connection.createGroup({
2270
- data: {
2271
- groupname: 'groupname',
2272
- desc: 'this is my group',
2273
- members: ['user1', 'user2'],
2274
- public: true,
2275
- approval: false,
2276
- allowinvites: true,
2277
- inviteNeedConfirm: false
2278
- }
2279
- })
2280
- * ```
2281
- */
2279
+ * Creates group
2280
+ *
2281
+ * ```typescript
2282
+ * connection.createGroup({
2283
+ data: {
2284
+ groupname: 'groupname',
2285
+ desc: 'this is my group',
2286
+ members: ['user1', 'user2'],
2287
+ public: true,
2288
+ approval: false,
2289
+ allowinvites: true,
2290
+ inviteNeedConfirm: false
2291
+ }
2292
+ })
2293
+ * ```
2294
+ */
2282
2295
  createGroup(
2283
2296
  this: Connection,
2284
2297
  params: {
@@ -2303,6 +2316,8 @@ export declare namespace EasemobChat {
2303
2316
  inviteNeedConfirm: boolean;
2304
2317
  /** The group max users. */
2305
2318
  maxusers: number;
2319
+ /** Group detail extensions which can be in the JSON format to contain more group information. */
2320
+ ext?: string;
2306
2321
  };
2307
2322
  success?: (res: AsyncResult<CreateGroupResult>) => void;
2308
2323
  error?: (error: ErrorEvent) => void;
@@ -2475,9 +2490,11 @@ export declare namespace EasemobChat {
2475
2490
  /** The Group ID. */
2476
2491
  groupId: string;
2477
2492
  /** The group name. */
2478
- groupName: string;
2493
+ groupName?: string;
2479
2494
  /** The group description. */
2480
- description: string;
2495
+ description?: string;
2496
+ /** Group detail extensions which can be in the JSON format to contain more group information. */
2497
+ ext?: string;
2481
2498
  success?: (res: AsyncResult<ModifyGroupResult>) => void;
2482
2499
  error?: (error: ErrorEvent) => void;
2483
2500
  }
@@ -3872,6 +3889,33 @@ export declare namespace EasemobChat {
3872
3889
  }
3873
3890
  ): Promise<HistoryMessages>;
3874
3891
 
3892
+ /**
3893
+ * Delete roaming messages.
3894
+ *
3895
+ * ```typescript
3896
+ * connection.removeHistoryMessages({targetId: 'userId', chatType: 'singleChat', time: Date.now()})
3897
+ *
3898
+ * connection.removeHistoryMessages({targetId: 'userId', chatType: 'singleChat', messageIds: ['messageId']})
3899
+ * ```
3900
+ */
3901
+ removeHistoryMessages(
3902
+ this: Connection,
3903
+ options: {
3904
+ /** The ID of the peer user or group. */
3905
+ targetId: string;
3906
+ /**
3907
+ * conversation type:
3908
+ * - `singleChat`: single chat;
3909
+ * - `groupChat`: group chat.
3910
+ */
3911
+ chatType: 'singleChat' | 'groupChat';
3912
+ /** List of message IDs to be deleted, The number of IDs cannot exceed 20. */
3913
+ messageIds?: Array<string>;
3914
+ /** The starting point in time to delete the message. */
3915
+ beforeTimeStamp?: number;
3916
+ }
3917
+ ): Promise<void>;
3918
+
3875
3919
  /**
3876
3920
  * Adds a friend.
3877
3921
  *
@@ -4630,121 +4674,707 @@ export declare namespace EasemobChat {
4630
4674
  ): Promise<AsyncResult<GetReactionDetailResult>>;
4631
4675
 
4632
4676
  /**
4633
- * Get the chat room all properties.
4677
+ * Creates a server.
4634
4678
  *
4635
4679
  * ```typescript
4636
- * connection.getChatRoomAttributes({chatRoomId: 'roomId')
4680
+ * connection.createServer({name: 'serverName',icon: '',description: 'the description of the server',ext: 'ext'})
4637
4681
  * ```
4638
4682
  */
4639
- getChatRoomAttributes(
4683
+ createServer(
4640
4684
  this: Connection,
4641
4685
  params: {
4642
- /** The chat room ID. */
4643
- chatRoomId: string;
4644
- /** The custom attribute to get. If you pass the attribute key, the SDK returns the attribute value. If you set it as null, the SDK returns all the attributes value. */
4645
- attributeKeys?: Array<string>;
4686
+ /** The server name. */
4687
+ name: string;
4688
+ /** The profile picture of the server. */
4689
+ icon?: string;
4690
+ /** The description of the server. */
4691
+ description?: string;
4692
+ /** The extension field. */
4693
+ ext?: string;
4646
4694
  }
4647
- ): Promise<AsyncResult<GetChatroomAttributesResult>>;
4695
+ ): Promise<AsyncResult<ServerInfo>>;
4696
+ /**
4697
+ * Deletes a server.
4698
+ *
4699
+ * ```typescript
4700
+ * connection.destroyServer({serverId: 'serverId'})
4701
+ * ```
4702
+ */
4703
+ destroyServer(
4704
+ this: Connection,
4705
+ params: {
4706
+ /** The server ID. */
4707
+ serverId: string;
4708
+ }
4709
+ ): Promise<void>;
4648
4710
 
4649
4711
  /**
4650
- * Set chat room properties in batches.
4712
+ * Updates server.
4651
4713
  *
4652
4714
  * ```typescript
4653
- * connection.setChatRoomAttributes({chatRoomId: 'roomId', attributes: {"key1": "value1","key2":"value2"}, autoDelete: true, isForced: false})
4715
+ * connection.updateServer({serverId: 'serverId',name: 'name',icon: '',description: 'new description'})
4654
4716
  * ```
4655
4717
  */
4656
- setChatRoomAttributes(
4718
+ updateServer(
4657
4719
  this: Connection,
4658
4720
  params: {
4659
- /** The chat room ID. */
4660
- chatRoomId: string;
4661
- /** The attributes. */
4662
- attributes: {
4663
- [key: string]: string;
4664
- };
4665
- /** Whether to delete chat room attributes set by the member when he or she exits the chat room.
4666
- * (Default)`true`: Yes.
4667
- * `false`: No. */
4668
- autoDelete?: boolean;
4669
- /** Whether to allow a member to overwrite the chat room attribute set by another member.
4670
- * `true`: Yes.
4671
- * (Default)`false`: No. */
4672
- isForced?: boolean;
4721
+ /** The server ID. */
4722
+ serverId: string;
4723
+ /** The server name. */
4724
+ name?: string;
4725
+ /** The profile picture of the server. */
4726
+ icon?: string;
4727
+ /** The description of the server. */
4728
+ description?: string;
4729
+ /** The extension field. */
4730
+ ext?: string;
4673
4731
  }
4674
- ): Promise<AsyncResult<ChatroomAttributes>>;
4732
+ ): Promise<AsyncResult<ServerInfo>>;
4675
4733
 
4676
4734
  /**
4677
- * Set chat room properties individually.
4735
+ * Joins a server.
4678
4736
  *
4679
4737
  * ```typescript
4680
- * connection.setChatroomAttribute({chatRoomId: 'roomId', attributeKey:"key1", attributeValue:"value1", autoDelete: true, isForced: false})
4738
+ * connection.joinServer({serverId: 'serverId'})
4681
4739
  * ```
4682
4740
  */
4683
- setChatRoomAttribute(
4741
+ joinServer(
4684
4742
  this: Connection,
4685
4743
  params: {
4686
- /** The chat room ID. */
4687
- chatRoomId: string;
4688
- /** The custom attribute key. */
4689
- attributeKey: string;
4690
- /** The custom attribute value. */
4691
- attributeValue: string;
4692
- /**
4693
- * Whether to delete chat room attributes set by the member when he or she exits the chat room.
4694
- * - (Default)`true`: Yes;
4744
+ /** The server ID. */
4745
+ serverId: string;
4746
+ }
4747
+ ): Promise<AsyncResult<ServerInfo>>;
4748
+
4749
+ /**
4750
+ * Leaves the server.
4751
+ *
4752
+ * ```typescript
4753
+ * connection.leaveServer({serverId: 'serverId'})
4754
+ * ```
4755
+ */
4756
+ leaveServer(
4757
+ this: Connection,
4758
+ params: {
4759
+ /** The server ID. */
4760
+ serverId: string;
4761
+ }
4762
+ ): Promise<void>;
4763
+
4764
+ /**
4765
+ * Removes a member from the server.
4766
+ *
4767
+ * ```typescript
4768
+ * connection.removeServerMember({serverId: 'serverId',userId: 'userId})
4769
+ * ```
4770
+ */
4771
+ removeServerMember(
4772
+ this: Connection,
4773
+ params: {
4774
+ /** The server ID. */
4775
+ serverId: string;
4776
+ /** The user ID of the member to remove. */
4777
+ userId: string;
4778
+ }
4779
+ ): Promise<void>;
4780
+
4781
+ /**
4782
+ * Adds tags to server.
4783
+ *
4784
+ * ```typescript
4785
+ * connection.addServerTags({serverId: 'serverId',tags: ['A', 'B']})
4786
+ * ```
4787
+ */
4788
+ addServerTags(
4789
+ this: Connection,
4790
+ params: {
4791
+ /** The server ID. */
4792
+ serverId: string;
4793
+ /** The tag name list to add. The maximum length of the list is 10. */
4794
+ tags: string[];
4795
+ }
4796
+ ): Promise<AsyncResult<ServerTagList>>;
4797
+
4798
+ /**
4799
+ * Removes tags from server.
4800
+ *
4801
+ * ```typescript
4802
+ * connection.removeServerTags({serverId: 'serverId',tagIds: ['1', '2']})
4803
+ * ```
4804
+ */
4805
+ removeServerTags(
4806
+ this: Connection,
4807
+ params: {
4808
+ /** The server ID. */
4809
+ serverId: string;
4810
+ /** The tag ID list to remove. */
4811
+ tagIds: string[];
4812
+ }
4813
+ ): Promise<void>;
4814
+
4815
+ /**
4816
+ * Use the pagination to get the list of servers by the keyword.Only when the keyword is the full name of the server or the full name of the tag, the method will return results.
4817
+ *
4818
+ * ```typescript
4819
+ * connection.getServers({keyword: 'keyword'})
4820
+ * ```
4821
+ */
4822
+ getServers(
4823
+ this: Connection,
4824
+ params: {
4825
+ /** The key word. */
4826
+ keyword: string;
4827
+ /** The number of servers that you expect to get on each page. The value range is [1,20] and the default value is `20`. */
4828
+ pageSize?: number;
4829
+ /** The position from which to start getting data. At the first method call, if you set `cursor` to an empty string.*/
4830
+ cursor?: string;
4831
+ }
4832
+ ): Promise<AsyncResult<ServerInfoList>>;
4833
+
4834
+ /**
4835
+ * Gets the list of joined servers with pagination.
4836
+ *
4837
+ * ```typescript
4838
+ * connection.getJoinedServers({pageSize: '10',cursor: ''})
4839
+ * ```
4840
+ */
4841
+ getJoinedServers(
4842
+ this: Connection,
4843
+ params: {
4844
+ /** The number of servers that you expect to get on each page. The value range is [1,20] and the default value is `20`. */
4845
+ pageSize?: number;
4846
+ /** The position from which to start getting data. At the first method call, if you set `cursor` to an empty string.*/
4847
+ cursor?: string;
4848
+ }
4849
+ ): Promise<AsyncResult<ServerInfoList>>;
4850
+
4851
+ /**
4852
+ * Gets detail of the server.
4853
+ *
4854
+ * ```typescript
4855
+ * connection.getServerDetail({serverId: 'serverId'})
4856
+ * ```
4857
+ */
4858
+ getServerDetail(
4859
+ this: Connection,
4860
+ params: {
4861
+ /** The server ID. */
4862
+ serverId: string;
4863
+ }
4864
+ ): Promise<AsyncResult<ServerInfo>>;
4865
+
4866
+ /**
4867
+ * Gets members in the server with pagination.
4868
+ *
4869
+ * ```typescript
4870
+ * connection.getServerMembers({serverId: 'serverId',pageSize:20,cursor:'cursor'})
4871
+ * ```
4872
+ */
4873
+ getServerMembers(
4874
+ this: Connection,
4875
+ params: {
4876
+ /** The server ID. */
4877
+ serverId: string;
4878
+ /** The number of servers that you expect to get on each page. The value range is [1,20] and the default value is `20`. */
4879
+ pageSize?: number;
4880
+ /** The position from which to start getting data. At the first method call, if you set `cursor` to an empty string.*/
4881
+ cursor?: string;
4882
+ }
4883
+ ): Promise<AsyncResult<ServerMemberData>>;
4884
+
4885
+ /**
4886
+ * Sets a server admin. Only the server owner can call this method.
4887
+ *
4888
+ * ```typescript
4889
+ * connection.setServerAdmin({serverId: 'serverId',userId:'userId'})
4890
+ * ```
4891
+ */
4892
+ setServerAdmin(
4893
+ this: Connection,
4894
+ params: {
4895
+ /** The server ID. */
4896
+ serverId: string;
4897
+ /** The user ID to set as admin. */
4898
+ userId: string;
4899
+ }
4900
+ ): Promise<void>;
4901
+
4902
+ /**
4903
+ * Removes a server admin. Only the server owner can call this method.
4904
+ *
4905
+ * ```typescript
4906
+ * connection.removeServerAdmin({serverId: 'serverId',userId:'userId'})
4907
+ * ```
4908
+ */
4909
+ removeServerAdmin(
4910
+ this: Connection,
4911
+ params: {
4912
+ /** The server ID. */
4913
+ serverId: string;
4914
+ /** The use ID to remove server admin privileges. */
4915
+ userId: string;
4916
+ }
4917
+ ): Promise<void>;
4918
+
4919
+ /**
4920
+ * Invites users into a server.
4921
+ *
4922
+ * ```typescript
4923
+ * connection.inviteUserToServer({serverId: 'serverId', userId: 'userId'})
4924
+ * ```
4925
+ */
4926
+
4927
+ inviteUserToServer(
4928
+ this: Connection,
4929
+ params: {
4930
+ /** The server ID. */
4931
+ serverId: string;
4932
+ /** The Invited user ID. */
4933
+ userId: string;
4934
+ /** A message inviting users to join the server. */
4935
+ message?: string;
4936
+ }
4937
+ ): Promise<void>;
4938
+
4939
+ /**
4940
+ * Accepts to the invitation to join the server.
4941
+ *
4942
+ * ```typescript
4943
+ * connection.acceptServerInvite({serverId: 'serverId',inviter: 'uid')
4944
+ * ```
4945
+ */
4946
+ acceptServerInvite(
4947
+ this: Connection,
4948
+ params: {
4949
+ /** The server ID. */
4950
+ serverId: string;
4951
+ /** The inviter user ID. */
4952
+ inviter: string;
4953
+ }
4954
+ ): Promise<AsyncResult<ServerInfo>>;
4955
+
4956
+ /**
4957
+ * Rejects to the invitation to join the server.
4958
+ *
4959
+ * ```typescript
4960
+ * connection.rejectServerInvite({serverId: 'serverId',inviter: 'uid')
4961
+ * ```
4962
+ */
4963
+ rejectServerInvite(
4964
+ this: Connection,
4965
+ params: {
4966
+ /** The server ID. */
4967
+ serverId: string;
4968
+ /** The inviter user ID. */
4969
+ inviter: string;
4970
+ }
4971
+ ): Promise<void>;
4972
+
4973
+ /**
4974
+ * Gets current user role in the server.
4975
+ *
4976
+ * ```typescript
4977
+ * connection.getServerRole({serverId: 'serverId'})
4978
+ * ```
4979
+ */
4980
+ getServerRole(
4981
+ this: Connection,
4982
+ params: {
4983
+ /** The server ID. */
4984
+ serverId: string;
4985
+ }
4986
+ ): Promise<AsyncResult<ServerRole>>;
4987
+
4988
+ /**
4989
+ * Checks whether the current member is in the server.
4990
+ *
4991
+ * ```typescript
4992
+ * connection.isInServer({serverId: 'serverId'})
4993
+ * ```
4994
+ */
4995
+ isInServer(
4996
+ this: Connection,
4997
+ params: {
4998
+ /** The server ID. */
4999
+ serverId: string;
5000
+ }
5001
+ ): Promise<AsyncResult<OperationResult>>;
5002
+
5003
+ /**
5004
+ * Gets the tag list of the current server.
5005
+ *
5006
+ * ```typescript
5007
+ * connection.getServerTags({serverId: 'serverId'})
5008
+ * ```
5009
+ */
5010
+ getServerTags(
5011
+ this: Connection,
5012
+ params: {
5013
+ /** The server ID. */
5014
+ serverId: string;
5015
+ }
5016
+ ): Promise<AsyncResult<ServerTagList>>;
5017
+
5018
+ /**
5019
+ * Creates a channel.
5020
+ *
5021
+ * ```typescript
5022
+ * connection.createChannel({
5023
+ * serverId: 'serverID',
5024
+ * isPublic: true,
5025
+ * name: 'channelName',
5026
+ * description: 'this is my channel',
5027
+ * ext: 'ext'
5028
+ * })
5029
+ * ```
5030
+ */
5031
+ createChannel(
5032
+ this: Connection,
5033
+ params: {
5034
+ /** The server ID. */
5035
+ serverId: string;
5036
+ /** Whether it is a public channel. Public channel: the channel that others can query by calling `getChannels`.
5037
+ * - (default)`true`: Yes.
4695
5038
  * - `false`: No.
4696
5039
  */
4697
- autoDelete?: boolean;
4698
- /**
4699
- * Whether to allow a member to overwrite the chat room attribute set by another member.
4700
- * - `true`: Yes;
4701
- * - (Default)`false`: No.
4702
- */
4703
- isForced?: boolean;
5040
+ isPublic?: boolean;
5041
+ /** The channel name. */
5042
+ name: string;
5043
+ /** The description of the channel. */
5044
+ description?: string;
5045
+ /** The users max amount of the channel.
5046
+ * - (default)`0`: 2,000.
5047
+ * - `1`: 20,000
5048
+ * - `2`: 100,000; */
5049
+ rank?: ChannelRank;
5050
+ /** The extension field. */
5051
+ ext?: string;
5052
+ }
5053
+ ): Promise<AsyncResult<ChannelInfo>>;
5054
+
5055
+ /**
5056
+ * Deletes a channel.
5057
+ *
5058
+ * ```typescript
5059
+ * connection.destroyChannel({serverId: 'serverId', channelId: 'channelId'})
5060
+ * ```
5061
+ */
5062
+ destroyChannel(
5063
+ this: Connection,
5064
+ params: {
5065
+ /** The server ID. */
5066
+ serverId: string;
5067
+ /** The channel ID. */
5068
+ channelId: string;
4704
5069
  }
4705
5070
  ): Promise<void>;
4706
5071
 
4707
5072
  /**
4708
- * Batch remove chat room attributes.
5073
+ * Updates the channel information.
5074
+ *
5075
+ * Only the channel admin can call this method.
4709
5076
  *
4710
5077
  * ```typescript
4711
- * connection.removeChatRoomAttributes({chatRoomId: 'roomId', attributeKeys: ['key1','key2',...], isForced: false })
5078
+ * connection.updateChannel({
5079
+ * serverId: 'serverId',
5080
+ * channelId: 'channelId',
5081
+ * name: 'the channel name',
5082
+ * description: 'the channel description',
5083
+ * })
4712
5084
  * ```
4713
5085
  */
4714
- removeChatRoomAttributes(
5086
+ updateChannel(
4715
5087
  this: Connection,
4716
5088
  params: {
4717
- /** The chat room ID. */
4718
- chatRoomId: string;
4719
- /** The key of the chat room attribute to delete. */
4720
- attributeKey: string;
4721
- /**
4722
- * Whether to allow a member to delete any chat room attribute set by any member.
4723
- * - `true`: Yes;
4724
- * - (Default)`false`: No.
5089
+ /** The server ID. */
5090
+ serverId: string;
5091
+ /** The channel ID. */
5092
+ channelId: string;
5093
+ /** The channel name. */
5094
+ name?: string;
5095
+ /** The channel description. */
5096
+ description?: string;
5097
+ /** The users max amount of the channel.
5098
+ * - (default)`0`: 2,000.
5099
+ * - `1`: 20,000.
5100
+ * - `2`: 100,000.
4725
5101
  */
4726
- isForced?: boolean;
5102
+ rank?: ChannelRank;
5103
+ /** The extension field. */
5104
+ ext?: string;
4727
5105
  }
4728
- ): Promise<AsyncResult<ChatroomAttributes>>;
5106
+ ): Promise<AsyncResult<ChannelInfo>>;
4729
5107
 
4730
5108
  /**
4731
- * Remove chat room attributes individually.
5109
+ * Gets the channel detail.
4732
5110
  *
4733
5111
  * ```typescript
4734
- * connection.removeChatRoomAttribute({chatRoomId: 'roomId', attributeKey: 'attributeValue', isForced: false })
5112
+ * connection.getChannelDetail({serverId: 'serverId', channelId: 'channelId'})
4735
5113
  * ```
5114
+ *
4736
5115
  */
4737
- removeChatRoomAttribute(
5116
+ getChannelDetail(
4738
5117
  this: Connection,
4739
5118
  params: {
4740
- /** The chat room ID. */
4741
- chatRoomId: string;
4742
- /** Delete attribute key. */
4743
- attributeKey: string;
4744
- /** remove chatRoom attributes (Allow to delete all contents of the chat room). */
4745
- isForced?: boolean;
5119
+ /** The server ID. */
5120
+ serverId: string;
5121
+ /** The channel ID. */
5122
+ channelId: string;
5123
+ }
5124
+ ): Promise<AsyncResult<ChannelInfo>>;
5125
+
5126
+ /**
5127
+ * Joins the channel.
5128
+ *
5129
+ * ```typescript
5130
+ * connection.joinChannel({serverId: 'serverId', channelId: 'channelId'})
5131
+ * ```
5132
+ *
5133
+ */
5134
+ joinChannel(
5135
+ this: Connection,
5136
+ params: {
5137
+ /** The server ID. */
5138
+ serverId: string;
5139
+ /** The channel ID. */
5140
+ channelId: string;
5141
+ }
5142
+ ): Promise<AsyncResult<ChannelInfo>>;
5143
+
5144
+ /**
5145
+ * Leaves the channel.
5146
+ *
5147
+ * ```typescript
5148
+ * connection.leaveChannel({serverId: 'serverId', channelId: 'channelId'})
5149
+ * ```
5150
+ *
5151
+ */
5152
+ leaveChannel(
5153
+ this: Connection,
5154
+ params: {
5155
+ /** The server ID. */
5156
+ serverId: string;
5157
+ /** The channel ID. */
5158
+ channelId: string;
5159
+ }
5160
+ ): Promise<void>;
5161
+
5162
+ /**
5163
+ * Removes a member from the channel.
5164
+ *
5165
+ * ```typescript
5166
+ * connection.removeChannelMember({serverId: 'serverId', channelId: 'channelId',userId: 'userId'})
5167
+ * ```
5168
+ *
5169
+ */
5170
+ removeChannelMember(
5171
+ this: Connection,
5172
+ params: {
5173
+ /** The server ID. */
5174
+ serverId: string;
5175
+ /** The channel ID. */
5176
+ channelId: string;
5177
+ /** The user ID. */
5178
+ userId: string;
5179
+ }
5180
+ ): Promise<void>;
5181
+
5182
+ /**
5183
+ * Gets the list of visible channels with pagination.
5184
+ *
5185
+ * User can get the joined channels, while the admin and creator can get all private channels.
5186
+ *
5187
+ * ```typescript
5188
+ * connection.getVisiblePrivateChannels({pageSize: 10,cursor: ''})
5189
+ * ```
5190
+ *
5191
+ */
5192
+ getVisiblePrivateChannels(
5193
+ this: Connection,
5194
+ params: {
5195
+ /** The server ID. */
5196
+ serverId: string;
5197
+ /** The number of private channel id that you expect to get on each page. The value range is [1,20] and the default value is `20`. */
5198
+ pageSize?: number;
5199
+ /** The position from which to start getting data. At the first method call, if you set `cursor` to an empty string.*/
5200
+ cursor?: string;
5201
+ }
5202
+ ): Promise<AsyncResult<ChannelInfoListResult>>;
5203
+
5204
+ /**
5205
+ * Gets the public channels list in the server with pagination.
5206
+ *
5207
+ * ```typescript
5208
+ * connection.getPublicChannels({pageSize: 10,cursor: ''})
5209
+ * ```
5210
+ *
5211
+ */
5212
+ getPublicChannels(
5213
+ this: Connection,
5214
+ params: {
5215
+ /** The server ID. */
5216
+ serverId: string;
5217
+ /** The number of public channel ID that you expect to get on each page. The value range is [1,20] and the default value is `20`. */
5218
+ pageSize?: number;
5219
+ /** The position from which to start getting data. At the first method call, if you set `cursor` to an empty string.*/
5220
+ cursor?: string;
5221
+ }
5222
+ ): Promise<AsyncResult<ChannelInfoListResult>>;
5223
+
5224
+ /**
5225
+ * Gets members in the channel with pagination..
5226
+ *
5227
+ * ```typescript
5228
+ * connection.getChannelMembers({serverId:'serverId', channelId: 'channelId', pageSize: 10,cursor: ''})
5229
+ * ```
5230
+ *
5231
+ */
5232
+ getChannelMembers(
5233
+ this: Connection,
5234
+ params: {
5235
+ /** The server ID. */
5236
+ serverId: string;
5237
+ /** The channel ID. */
5238
+ channelId: string;
5239
+ /** The number of member that you expect to get on each page. The value range is [1,20] and the default value is `20`. */
5240
+ pageSize?: number;
5241
+ /** The position from which to start getting data. At the first method call, if you set `cursor` to an empty string.*/
5242
+ cursor?: string;
5243
+ }
5244
+ ): Promise<AsyncResult<ChannelMemberListResult>>;
5245
+
5246
+ /**
5247
+ * Invites users into a channel.
5248
+ *
5249
+ * ```typescript
5250
+ * connection.inviteUserToChannel({serverId: 'serverId',channelId: 'channelId',userId: 'userId'})
5251
+ * ```
5252
+ */
5253
+ inviteUserToChannel(
5254
+ this: Connection,
5255
+ params: {
5256
+ /** The server ID. */
5257
+ serverId: string;
5258
+ /** The channel ID. */
5259
+ channelId: string;
5260
+ /** The channel member ID. */
5261
+ userId: string;
5262
+ /** The invite message. */
5263
+ inviteMessage?: string;
4746
5264
  }
4747
5265
  ): Promise<void>;
5266
+
5267
+ /**
5268
+ * Accepts a channel request.
5269
+ *
5270
+ * ```typescript
5271
+ * connection.acceptChannelInvite({serverId: 'serverId',channelId: 'channelId',inviter:'inviter'})
5272
+ * ```
5273
+ */
5274
+ acceptChannelInvite(
5275
+ this: Connection,
5276
+ params: {
5277
+ /** The server ID. */
5278
+ serverId: string;
5279
+ /** The channel ID. */
5280
+ channelId: string;
5281
+ /** The inviter user ID. */
5282
+ inviter: string;
5283
+ }
5284
+ ): Promise<AsyncResult<ChannelInfo>>;
5285
+
5286
+ /**
5287
+ * Refuses a channel request.
5288
+ *
5289
+ * ```typescript
5290
+ * connection.rejectChannelInvite({serverId: 'serverId',channelId: 'channelId'})
5291
+ * ```
5292
+ */
5293
+ rejectChannelInvite(
5294
+ this: Connection,
5295
+ params: {
5296
+ /** The server ID. */
5297
+ serverId: string;
5298
+ /** The channel ID. */
5299
+ channelId: string;
5300
+ /** The inviter user ID. */
5301
+ inviter: string;
5302
+ }
5303
+ ): Promise<void>;
5304
+
5305
+ /**
5306
+ * Mutes a channel member.
5307
+ *
5308
+ * ```typescript
5309
+ * connection.muteChannelMember({serverId: 'serverId',channelId: 'channelId',userId: 'userId'})
5310
+ * ```
5311
+ */
5312
+ muteChannelMember(
5313
+ this: Connection,
5314
+ params: {
5315
+ /** The server ID. */
5316
+ serverId: string;
5317
+ /** The channel ID. */
5318
+ channelId: string;
5319
+ /** The channel member ID. */
5320
+ userId: string;
5321
+ /** The mute duration in milliseconds. The value `-1` indicates that the member is muted permanently.*/
5322
+ duration: number;
5323
+ }
5324
+ ): Promise<void>;
5325
+
5326
+ /**
5327
+ * Unmuted a channel member.
5328
+ *
5329
+ * ```typescript
5330
+ * connection.muteChannelMember({serverId: 'serverId',channelId: 'channelId',userId: 'userId'})
5331
+ * ```
5332
+ */
5333
+ unmuteChannelMember(
5334
+ this: Connection,
5335
+ params: {
5336
+ /** The server ID. */
5337
+ serverId: string;
5338
+ /** The channel ID. */
5339
+ channelId: string;
5340
+ /** The channel member ID. */
5341
+ userId: string;
5342
+ }
5343
+ ): Promise<void>;
5344
+
5345
+ /**
5346
+ * Gets the mute list of the channel.
5347
+ * Only the channel admin or creator can call this method.
5348
+ * ```typescript
5349
+ * connection.getChannelMutelist({channelId: 'channelId'})
5350
+ * ```
5351
+ */
5352
+ getChannelMutelist(
5353
+ this: Connection,
5354
+ params: {
5355
+ /** The server ID. */
5356
+ serverId: string;
5357
+ /** The channel ID. */
5358
+ channelId: string;
5359
+ }
5360
+ ): Promise<AsyncResult<ChannelMuteMemberListResult>>;
5361
+
5362
+ /**
5363
+ * Checks whether the current member is in the channel.
5364
+ *
5365
+ * ```typescript
5366
+ * connection.isInChannel({serverId: 'serverId', channelId: "channelId"})
5367
+ * ```
5368
+ */
5369
+ isInChannel(
5370
+ this: Connection,
5371
+ params: {
5372
+ /** The server ID. */
5373
+ serverId: string;
5374
+ /** The channel ID. */
5375
+ channelId: string;
5376
+ }
5377
+ ): Promise<AsyncResult<OperationResult>>;
4748
5378
  }
4749
5379
 
4750
5380
  // ----- for EventHandler ------
@@ -4781,31 +5411,272 @@ export declare namespace EasemobChat {
4781
5411
  /** Message sender. */
4782
5412
  from: string;
4783
5413
  /** Message receiver. */
5414
+ to: string;
5415
+ /** Additional data for the operation event. */
4784
5416
  data?: any;
4785
- /** ChatRoom Attributes. */
4786
- /** 聊天室属性。 */
4787
- attributes?: {
4788
- [key: string]: string;
4789
- };
4790
5417
  }
4791
5418
 
4792
- interface GetChatroomAttributesResult {
4793
- /** ChatRoom ID.*/
4794
- chatRoomId: string;
4795
- /** The custom attribute to get. If you pass the attribute key, the SDK returns the attribute value. If you set it as null, the SDK returns all the attributes value. */
4796
- attributeKeys: Array<string>;
5419
+ type ServerChangeType =
5420
+ | 'update'
5421
+ | 'destroy'
5422
+ | 'memberPresence'
5423
+ | 'memberAbsence'
5424
+ | 'inviteToJoin'
5425
+ | 'acceptInvite'
5426
+ | 'refuseInvite'
5427
+ | 'removed'
5428
+ | 'updateRole';
5429
+
5430
+ type ServerMultiDeviceEventType =
5431
+ | 'serverCreate'
5432
+ | 'serverDestroy'
5433
+ | 'serverUpdate'
5434
+ | 'serverJoin'
5435
+ | 'serverLeave'
5436
+ | 'serverRemoveMember'
5437
+ | 'serverInviteUser'
5438
+ | 'serverAcceptInvite'
5439
+ | 'serverRefuseInvite'
5440
+ | 'serverSetRole';
5441
+ interface CreateServerResult {
5442
+ /** The server ID. */
5443
+ serverId: string;
5444
+ /** The default channel ID. */
5445
+ defaultChannelId: string;
5446
+ }
5447
+ interface OperationResult {
5448
+ result: boolean;
4797
5449
  }
4798
- interface ChatroomAttributes {
4799
- /** Status code. */
4800
- status: 'success' | 'fail';
4801
- /** The keys of failure. */
4802
- errorKeys: {
4803
- [key: string]: string;
4804
- };
4805
- /** The keys of success. */
4806
- successKeys: Array<string>;
5450
+ interface ServerInfo {
5451
+ /** The server ID. */
5452
+ id: string;
5453
+ /** The server name. */
5454
+ name: string;
5455
+ /** The profile picture of the server. */
5456
+ icon?: string;
5457
+ /** The default channel ID. */
5458
+ defaultChannelId: string;
5459
+ /** The owner of the server. */
5460
+ owner: string;
5461
+ /** The description of the server. */
5462
+ description?: string;
5463
+ /** The tags list of the server. */
5464
+ tags?: ServerTag[];
5465
+ /** The extension field. */
5466
+ ext?: string;
5467
+ /** The Unix timestamp when the server created. The unit is millisecond. */
5468
+ created?: number;
5469
+ }
5470
+ interface ServerInfoList {
5471
+ /** The serer information list */
5472
+ list: ServerInfo[];
5473
+ /** The position from which to start getting data. At the first method call, if you set `cursor` to an empty string.*/
5474
+ cursor: string;
5475
+ }
5476
+
5477
+ interface ServerMember {
5478
+ /** The member ID. */
5479
+ userId: string;
5480
+ /** The member role. */
5481
+ role: RoleType;
5482
+ }
5483
+ interface ServerMemberData {
5484
+ /** The server member list. */
5485
+ list: ServerMember[];
5486
+ /** The position from which to start getting data. At the first method call*/
5487
+ cursor?: string;
5488
+ }
5489
+ interface ServerRole {
5490
+ role: RoleType;
5491
+ }
5492
+ type RoleType = 'owner' | 'moderator' | 'user';
5493
+
5494
+ interface ServerTag {
5495
+ /** The server tag ID. */
5496
+ tagId: string;
5497
+ /** The server tag name. */
5498
+ tagName: string;
5499
+ }
5500
+
5501
+ interface ServerTagList {
5502
+ /** The server tag list. */
5503
+ tags: ServerTag[];
5504
+ }
5505
+ interface ServerChangeInfo {
5506
+ /** The server ID. */
5507
+ serverId: string;
5508
+ /** The type of operation. */
5509
+ operation: ServerChangeType | ServerMultiDeviceEventType;
5510
+ /** The operator. */
5511
+ operator: string;
5512
+ /** The Unix timestamp when the event occurs. The unit is millisecond. */
5513
+ timestamp: number;
5514
+ /** The operated member ID. */
5515
+ userId?: string;
5516
+ /** The operated member IDs. */
5517
+ userIds?: string[];
5518
+ /** The user role. */
5519
+ role?: string;
5520
+ /** The server name. */
5521
+ name?: string;
5522
+ /** The description of the server. */
5523
+ description?: string;
5524
+ /** The extension field. */
5525
+ ext?: string;
5526
+ /** The profile picture of the server. */
5527
+ icon?: string;
5528
+ }
5529
+
5530
+ enum ChannelRank {
5531
+ /** 2,000 channel. */
5532
+ RANK_2000,
5533
+ /** 20000 channel. */
5534
+ RANK_20000,
5535
+ /** 100000 channel. */
5536
+ RANK_100000,
5537
+ }
5538
+ interface ChannelInfo {
5539
+ /** The server ID. */
5540
+ serverId: string;
5541
+ /** The channel ID. */
5542
+ channelId: string;
5543
+ /** The channel name. */
5544
+ name: string;
5545
+ /** The description of the channel. */
5546
+ description: string;
5547
+ /** The Unix timestamp when the server created. The unit is millisecond. */
5548
+ created?: number;
5549
+ /** Whether it is the default channel.
5550
+ * - `0`: No.
5551
+ * - `1`: Yes.
5552
+ */
5553
+ defaultChannel: 0 | 1;
5554
+ /** The users max amount of the channel.
5555
+ * - `0`(default): 2,000.
5556
+ * - `1`: 20,000.
5557
+ * - `2`: 100,000.
5558
+ */
5559
+ rank: ChannelRank;
5560
+ /** The extension field of the channel. */
5561
+ ext: string;
5562
+ /** Whether it is a public channel.
5563
+ * - `true`: Yes.
5564
+ * - `false`: No.
5565
+ */
5566
+ isPublic: boolean;
5567
+ /** Whether the invitee needs to accept the invitation before joining the group.
5568
+ - `true`: The invitee's consent is required.
5569
+ - `false`: The invitee will be directly added to the group without confirmation.
5570
+ */
5571
+ inviteNeedConfirm: boolean;
4807
5572
  }
4808
5573
 
5574
+ interface ChannelInfoListResult {
5575
+ /** The channel information list. */
5576
+ list: ChannelInfo[];
5577
+ /** The position from which to start getting data. */
5578
+ cursor?: string;
5579
+ }
5580
+
5581
+ interface ChannelMuteMemberItem {
5582
+ /** The timestamp when the mute expires. */
5583
+ expire: number;
5584
+ /** The muted user ID */
5585
+ userId: string;
5586
+ }
5587
+ interface ChannelMuteMemberListResult {
5588
+ list: ChannelMuteMemberItem[];
5589
+ }
5590
+
5591
+ interface ChannelMemberListResult {
5592
+ /** The channel member list */
5593
+ list: ChannelMember[];
5594
+ /** The position from which to start getting data.*/
5595
+ cursor?: string;
5596
+ }
5597
+ type ChannelRole = 'owner' | 'moderator' | 'user';
5598
+
5599
+ interface ChannelMember {
5600
+ /** The member ID. */
5601
+ userId: string;
5602
+ /** The member role. */
5603
+ role: ChannelRole;
5604
+ }
5605
+
5606
+ type ChannelChangeType =
5607
+ | 'create'
5608
+ | 'destroy'
5609
+ | 'update'
5610
+ | 'memberAbsence'
5611
+ | 'memberPresence'
5612
+ | 'removed'
5613
+ | 'muteMember'
5614
+ | 'unmuteMember'
5615
+ | 'inviteToJoin'
5616
+ | 'acceptInvite'
5617
+ | 'rejectInvite'
5618
+ | 'directJoined';
5619
+
5620
+ type ChannelMultiDeviceEventType =
5621
+ | 'channelCreate'
5622
+ | 'channelDestroy'
5623
+ | 'channelUpdate'
5624
+ | 'channelJoin'
5625
+ | 'channelLeave'
5626
+ | 'channelRemoveMember'
5627
+ | 'channelInviteUser'
5628
+ | 'channelMuteMember'
5629
+ | 'channelUnMuteMember'
5630
+ | 'channelAcceptInvite'
5631
+ | 'channelRejectInvite';
5632
+
5633
+ interface InviteChannelServerInfo {
5634
+ /** The server ID. */
5635
+ /** 社区 ID。 */
5636
+ id: string;
5637
+ /** The profile picture of the server. */
5638
+ /** 社区头像。*/
5639
+ icon?: string;
5640
+ /** The server name. */
5641
+ /** 社区名称。 */
5642
+ name?: string;
5643
+ /** The description of the server. */
5644
+ /** 社区描述。 */
5645
+ description?: string;
5646
+ }
5647
+ interface ChannelChangeInfo {
5648
+ /** The type of operation. */
5649
+ /** 操作类型。 */
5650
+ operation: ChannelChangeType | ChannelMultiDeviceEventType;
5651
+ /** The channel ID. */
5652
+ /** 频道 ID。 */
5653
+ id: string;
5654
+ /** The channel name. */
5655
+ /** 频道名称。 */
5656
+ name?: string;
5657
+ /** The operator. */
5658
+ /** 操作者。 */
5659
+ operator: string;
5660
+ /** The operated object. */
5661
+ /** 被操作的对象。 */
5662
+ to: string;
5663
+ /** The invite message. */
5664
+ /** 邀请用户加入频道的消息。*/
5665
+ inviteMessage?: string;
5666
+ /** The invite channel server info. */
5667
+ /** 邀请加入频道的相关社区信息。*/
5668
+ serverInfo?: InviteChannelServerInfo;
5669
+ /** The description of the channel. */
5670
+ /** 频道描述。 */
5671
+ description?: string;
5672
+ }
5673
+
5674
+ type MultiDeviceData =
5675
+ | ThreadMultiDeviceInfo
5676
+ | ServerChangeInfo
5677
+ | ChannelChangeInfo
5678
+ | RoamingDeleteMultiDeviceInfo;
5679
+
4809
5680
  type Event =
4810
5681
  | 'onOpened'
4811
5682
  | 'onPresence'
@@ -4843,7 +5714,9 @@ export declare namespace EasemobChat {
4843
5714
  | 'onChatThreadChange'
4844
5715
  | 'onMultiDeviceEvent'
4845
5716
  | 'onGroupEvent'
4846
- | 'onChatroomEvent';
5717
+ | 'onChatroomEvent'
5718
+ | 'onServerEvent'
5719
+ | 'onChannelEvent';
4847
5720
 
4848
5721
  interface EventHandlerType {
4849
5722
  /** @deprecated Use { onConnected } instead. */
@@ -4913,13 +5786,17 @@ export declare namespace EasemobChat {
4913
5786
  /** The callback to receive a reaction message. */
4914
5787
  onChatThreadChange?: (msg: ThreadChangeInfo) => void;
4915
5788
  /** The callback to receive a multi device event. */
4916
- onMultiDeviceEvent?: (msg: ThreadMultiDeviceInfo) => void;
5789
+ onMultiDeviceEvent?: (msg: MultiDeviceData) => void;
4917
5790
  /** The callback to receive a reaction message. */
4918
5791
  onReactionChange?: (msg: ReactionMessage) => void;
4919
5792
  /** The callback to receive a group event. */
4920
5793
  onGroupEvent?: (eventData: EventData) => void;
4921
5794
  /** The callback to receive a chatroom event. */
4922
5795
  onChatroomEvent?: (eventData: EventData) => void;
5796
+ /** The callback to receive a server message. */
5797
+ onServerEvent?: (msg: ServerChangeInfo) => void;
5798
+ /** The callback to receive a channel message. */
5799
+ onChannelEvent?: (msg: ChannelChangeInfo) => void;
4923
5800
  }
4924
5801
 
4925
5802
  interface HandlerData {