easemob-websdk 4.1.0-beta2 → 4.1.0-beta3

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 +948 -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
@@ -1076,8 +1076,8 @@ export declare namespace EasemobChat {
1076
1076
  NO_PERMISSION = 52,
1077
1077
  /** Unsupported Operation. */
1078
1078
  OPERATION_UNSUPPORTED = 53,
1079
- /** An operation that is not allowed. */
1080
- OPERATION_NOT_ALLOWED = 54,
1079
+ /** The current operation object does not exist. */
1080
+ NOT_EXIST = 54,
1081
1081
  /** The uploading of the file failed. */
1082
1082
  WEBIM_UPLOADFILE_ERROR = 101,
1083
1083
  /** The current user is not logged in when uploading the file. */
@@ -1132,8 +1132,8 @@ export declare namespace EasemobChat {
1132
1132
  PERMISSION_DENIED = 603,
1133
1133
  /** Internal error. */
1134
1134
  WEBIM_LOAD_MSG_ERROR = 604,
1135
- /** The current user is already in the group. */
1136
- GROUP_ALREADY_JOINED = 601,
1135
+ /** The current user has joined. */
1136
+ ALREADY_JOINED = 601,
1137
1137
  /** The maximum number of group members exceeds the limit during group creation. */
1138
1138
  GROUP_MEMBERS_LIMIT = 607,
1139
1139
  /** Group disabled */
@@ -2256,6 +2256,8 @@ export declare namespace EasemobChat {
2256
2256
  inviteNeedConfirm: boolean;
2257
2257
  /** The group max users. */
2258
2258
  maxusers: number;
2259
+ /** Group detail extensions which can be in the JSON format to contain more group information. */
2260
+ ext?: string;
2259
2261
  };
2260
2262
  success?: (res: AsyncResult<CreateGroupResult>) => void;
2261
2263
  error?: (error: ErrorEvent) => void;
@@ -2263,22 +2265,22 @@ export declare namespace EasemobChat {
2263
2265
  ): Promise<AsyncResult<CreateGroupResult>>;
2264
2266
 
2265
2267
  /**
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
- */
2268
+ * Creates group
2269
+ *
2270
+ * ```typescript
2271
+ * connection.createGroup({
2272
+ data: {
2273
+ groupname: 'groupname',
2274
+ desc: 'this is my group',
2275
+ members: ['user1', 'user2'],
2276
+ public: true,
2277
+ approval: false,
2278
+ allowinvites: true,
2279
+ inviteNeedConfirm: false
2280
+ }
2281
+ })
2282
+ * ```
2283
+ */
2282
2284
  createGroup(
2283
2285
  this: Connection,
2284
2286
  params: {
@@ -2303,6 +2305,8 @@ export declare namespace EasemobChat {
2303
2305
  inviteNeedConfirm: boolean;
2304
2306
  /** The group max users. */
2305
2307
  maxusers: number;
2308
+ /** Group detail extensions which can be in the JSON format to contain more group information. */
2309
+ ext?: string;
2306
2310
  };
2307
2311
  success?: (res: AsyncResult<CreateGroupResult>) => void;
2308
2312
  error?: (error: ErrorEvent) => void;
@@ -2475,9 +2479,11 @@ export declare namespace EasemobChat {
2475
2479
  /** The Group ID. */
2476
2480
  groupId: string;
2477
2481
  /** The group name. */
2478
- groupName: string;
2482
+ groupName?: string;
2479
2483
  /** The group description. */
2480
- description: string;
2484
+ description?: string;
2485
+ /** Group detail extensions which can be in the JSON format to contain more group information. */
2486
+ ext?: string;
2481
2487
  success?: (res: AsyncResult<ModifyGroupResult>) => void;
2482
2488
  error?: (error: ErrorEvent) => void;
2483
2489
  }
@@ -4630,121 +4636,707 @@ export declare namespace EasemobChat {
4630
4636
  ): Promise<AsyncResult<GetReactionDetailResult>>;
4631
4637
 
4632
4638
  /**
4633
- * Get the chat room all properties.
4639
+ * Creates a server.
4634
4640
  *
4635
4641
  * ```typescript
4636
- * connection.getChatRoomAttributes({chatRoomId: 'roomId')
4642
+ * connection.createServer({name: 'serverName',icon: '',description: 'the description of the server',ext: 'ext'})
4637
4643
  * ```
4638
4644
  */
4639
- getChatRoomAttributes(
4645
+ createServer(
4640
4646
  this: Connection,
4641
4647
  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>;
4648
+ /** The server name. */
4649
+ name: string;
4650
+ /** The profile picture of the server. */
4651
+ icon?: string;
4652
+ /** The description of the server. */
4653
+ description?: string;
4654
+ /** The extension field. */
4655
+ ext?: string;
4646
4656
  }
4647
- ): Promise<AsyncResult<GetChatroomAttributesResult>>;
4657
+ ): Promise<AsyncResult<ServerInfo>>;
4658
+ /**
4659
+ * Deletes a server.
4660
+ *
4661
+ * ```typescript
4662
+ * connection.destroyServer({serverId: 'serverId'})
4663
+ * ```
4664
+ */
4665
+ destroyServer(
4666
+ this: Connection,
4667
+ params: {
4668
+ /** The server ID. */
4669
+ serverId: string;
4670
+ }
4671
+ ): Promise<void>;
4648
4672
 
4649
4673
  /**
4650
- * Set chat room properties in batches.
4674
+ * Updates server.
4651
4675
  *
4652
4676
  * ```typescript
4653
- * connection.setChatRoomAttributes({chatRoomId: 'roomId', attributes: {"key1": "value1","key2":"value2"}, autoDelete: true, isForced: false})
4677
+ * connection.updateServer({serverId: 'serverId',name: 'name',icon: '',description: 'new description'})
4654
4678
  * ```
4655
4679
  */
4656
- setChatRoomAttributes(
4680
+ updateServer(
4657
4681
  this: Connection,
4658
4682
  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;
4683
+ /** The server ID. */
4684
+ serverId: string;
4685
+ /** The server name. */
4686
+ name?: string;
4687
+ /** The profile picture of the server. */
4688
+ icon?: string;
4689
+ /** The description of the server. */
4690
+ description?: string;
4691
+ /** The extension field. */
4692
+ ext?: string;
4673
4693
  }
4674
- ): Promise<AsyncResult<ChatroomAttributes>>;
4694
+ ): Promise<AsyncResult<ServerInfo>>;
4675
4695
 
4676
4696
  /**
4677
- * Set chat room properties individually.
4697
+ * Joins a server.
4678
4698
  *
4679
4699
  * ```typescript
4680
- * connection.setChatroomAttribute({chatRoomId: 'roomId', attributeKey:"key1", attributeValue:"value1", autoDelete: true, isForced: false})
4700
+ * connection.joinServer({serverId: 'serverId'})
4681
4701
  * ```
4682
4702
  */
4683
- setChatRoomAttribute(
4703
+ joinServer(
4684
4704
  this: Connection,
4685
4705
  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;
4706
+ /** The server ID. */
4707
+ serverId: string;
4708
+ }
4709
+ ): Promise<AsyncResult<ServerInfo>>;
4710
+
4711
+ /**
4712
+ * Leaves the server.
4713
+ *
4714
+ * ```typescript
4715
+ * connection.leaveServer({serverId: 'serverId'})
4716
+ * ```
4717
+ */
4718
+ leaveServer(
4719
+ this: Connection,
4720
+ params: {
4721
+ /** The server ID. */
4722
+ serverId: string;
4723
+ }
4724
+ ): Promise<void>;
4725
+
4726
+ /**
4727
+ * Removes a member from the server.
4728
+ *
4729
+ * ```typescript
4730
+ * connection.removeServerMember({serverId: 'serverId',userId: 'userId})
4731
+ * ```
4732
+ */
4733
+ removeServerMember(
4734
+ this: Connection,
4735
+ params: {
4736
+ /** The server ID. */
4737
+ serverId: string;
4738
+ /** The user ID of the member to remove. */
4739
+ userId: string;
4740
+ }
4741
+ ): Promise<void>;
4742
+
4743
+ /**
4744
+ * Adds tags to server.
4745
+ *
4746
+ * ```typescript
4747
+ * connection.addServerTags({serverId: 'serverId',tags: ['A', 'B']})
4748
+ * ```
4749
+ */
4750
+ addServerTags(
4751
+ this: Connection,
4752
+ params: {
4753
+ /** The server ID. */
4754
+ serverId: string;
4755
+ /** The tag name list to add. The maximum length of the list is 10. */
4756
+ tags: string[];
4757
+ }
4758
+ ): Promise<AsyncResult<ServerTagList>>;
4759
+
4760
+ /**
4761
+ * Removes tags from server.
4762
+ *
4763
+ * ```typescript
4764
+ * connection.removeServerTags({serverId: 'serverId',tagIds: ['1', '2']})
4765
+ * ```
4766
+ */
4767
+ removeServerTags(
4768
+ this: Connection,
4769
+ params: {
4770
+ /** The server ID. */
4771
+ serverId: string;
4772
+ /** The tag ID list to remove. */
4773
+ tagIds: string[];
4774
+ }
4775
+ ): Promise<void>;
4776
+
4777
+ /**
4778
+ * 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.
4779
+ *
4780
+ * ```typescript
4781
+ * connection.getServers({keyword: 'keyword'})
4782
+ * ```
4783
+ */
4784
+ getServers(
4785
+ this: Connection,
4786
+ params: {
4787
+ /** The key word. */
4788
+ keyword: string;
4789
+ /** The number of servers that you expect to get on each page. The value range is [1,20] and the default value is `20`. */
4790
+ pageSize?: number;
4791
+ /** The position from which to start getting data. At the first method call, if you set `cursor` to an empty string.*/
4792
+ cursor?: string;
4793
+ }
4794
+ ): Promise<AsyncResult<ServerInfoList>>;
4795
+
4796
+ /**
4797
+ * Gets the list of joined servers with pagination.
4798
+ *
4799
+ * ```typescript
4800
+ * connection.getJoinedServers({pageSize: '10',cursor: ''})
4801
+ * ```
4802
+ */
4803
+ getJoinedServers(
4804
+ this: Connection,
4805
+ params: {
4806
+ /** The number of servers that you expect to get on each page. The value range is [1,20] and the default value is `20`. */
4807
+ pageSize?: number;
4808
+ /** The position from which to start getting data. At the first method call, if you set `cursor` to an empty string.*/
4809
+ cursor?: string;
4810
+ }
4811
+ ): Promise<AsyncResult<ServerInfoList>>;
4812
+
4813
+ /**
4814
+ * Gets detail of the server.
4815
+ *
4816
+ * ```typescript
4817
+ * connection.getServerDetail({serverId: 'serverId'})
4818
+ * ```
4819
+ */
4820
+ getServerDetail(
4821
+ this: Connection,
4822
+ params: {
4823
+ /** The server ID. */
4824
+ serverId: string;
4825
+ }
4826
+ ): Promise<AsyncResult<ServerInfo>>;
4827
+
4828
+ /**
4829
+ * Gets members in the server with pagination.
4830
+ *
4831
+ * ```typescript
4832
+ * connection.getServerMembers({serverId: 'serverId',pageSize:20,cursor:'cursor'})
4833
+ * ```
4834
+ */
4835
+ getServerMembers(
4836
+ this: Connection,
4837
+ params: {
4838
+ /** The server ID. */
4839
+ serverId: string;
4840
+ /** The number of servers that you expect to get on each page. The value range is [1,20] and the default value is `20`. */
4841
+ pageSize?: number;
4842
+ /** The position from which to start getting data. At the first method call, if you set `cursor` to an empty string.*/
4843
+ cursor?: string;
4844
+ }
4845
+ ): Promise<AsyncResult<ServerMemberData>>;
4846
+
4847
+ /**
4848
+ * Sets a server admin. Only the server owner can call this method.
4849
+ *
4850
+ * ```typescript
4851
+ * connection.setServerAdmin({serverId: 'serverId',userId:'userId'})
4852
+ * ```
4853
+ */
4854
+ setServerAdmin(
4855
+ this: Connection,
4856
+ params: {
4857
+ /** The server ID. */
4858
+ serverId: string;
4859
+ /** The user ID to set as admin. */
4860
+ userId: string;
4861
+ }
4862
+ ): Promise<void>;
4863
+
4864
+ /**
4865
+ * Removes a server admin. Only the server owner can call this method.
4866
+ *
4867
+ * ```typescript
4868
+ * connection.removeServerAdmin({serverId: 'serverId',userId:'userId'})
4869
+ * ```
4870
+ */
4871
+ removeServerAdmin(
4872
+ this: Connection,
4873
+ params: {
4874
+ /** The server ID. */
4875
+ serverId: string;
4876
+ /** The use ID to remove server admin privileges. */
4877
+ userId: string;
4878
+ }
4879
+ ): Promise<void>;
4880
+
4881
+ /**
4882
+ * Invites users into a server.
4883
+ *
4884
+ * ```typescript
4885
+ * connection.inviteUserToServer({serverId: 'serverId', userId: 'userId'})
4886
+ * ```
4887
+ */
4888
+
4889
+ inviteUserToServer(
4890
+ this: Connection,
4891
+ params: {
4892
+ /** The server ID. */
4893
+ serverId: string;
4894
+ /** The Invited user ID. */
4895
+ userId: string;
4896
+ /** A message inviting users to join the server. */
4897
+ message?: string;
4898
+ }
4899
+ ): Promise<void>;
4900
+
4901
+ /**
4902
+ * Accepts to the invitation to join the server.
4903
+ *
4904
+ * ```typescript
4905
+ * connection.acceptServerInvite({serverId: 'serverId',inviter: 'uid')
4906
+ * ```
4907
+ */
4908
+ acceptServerInvite(
4909
+ this: Connection,
4910
+ params: {
4911
+ /** The server ID. */
4912
+ serverId: string;
4913
+ /** The inviter user ID. */
4914
+ inviter: string;
4915
+ }
4916
+ ): Promise<AsyncResult<ServerInfo>>;
4917
+
4918
+ /**
4919
+ * Rejects to the invitation to join the server.
4920
+ *
4921
+ * ```typescript
4922
+ * connection.rejectServerInvite({serverId: 'serverId',inviter: 'uid')
4923
+ * ```
4924
+ */
4925
+ rejectServerInvite(
4926
+ this: Connection,
4927
+ params: {
4928
+ /** The server ID. */
4929
+ serverId: string;
4930
+ /** The inviter user ID. */
4931
+ inviter: string;
4932
+ }
4933
+ ): Promise<void>;
4934
+
4935
+ /**
4936
+ * Gets current user role in the server.
4937
+ *
4938
+ * ```typescript
4939
+ * connection.getServerRole({serverId: 'serverId'})
4940
+ * ```
4941
+ */
4942
+ getServerRole(
4943
+ this: Connection,
4944
+ params: {
4945
+ /** The server ID. */
4946
+ serverId: string;
4947
+ }
4948
+ ): Promise<AsyncResult<ServerRole>>;
4949
+
4950
+ /**
4951
+ * Checks whether the current member is in the server.
4952
+ *
4953
+ * ```typescript
4954
+ * connection.isInServer({serverId: 'serverId'})
4955
+ * ```
4956
+ */
4957
+ isInServer(
4958
+ this: Connection,
4959
+ params: {
4960
+ /** The server ID. */
4961
+ serverId: string;
4962
+ }
4963
+ ): Promise<AsyncResult<OperationResult>>;
4964
+
4965
+ /**
4966
+ * Gets the tag list of the current server.
4967
+ *
4968
+ * ```typescript
4969
+ * connection.getServerTags({serverId: 'serverId'})
4970
+ * ```
4971
+ */
4972
+ getServerTags(
4973
+ this: Connection,
4974
+ params: {
4975
+ /** The server ID. */
4976
+ serverId: string;
4977
+ }
4978
+ ): Promise<AsyncResult<ServerTagList>>;
4979
+
4980
+ /**
4981
+ * Creates a channel.
4982
+ *
4983
+ * ```typescript
4984
+ * connection.createChannel({
4985
+ * serverId: 'serverID',
4986
+ * isPublic: true,
4987
+ * name: 'channelName',
4988
+ * description: 'this is my channel',
4989
+ * ext: 'ext'
4990
+ * })
4991
+ * ```
4992
+ */
4993
+ createChannel(
4994
+ this: Connection,
4995
+ params: {
4996
+ /** The server ID. */
4997
+ serverId: string;
4998
+ /** Whether it is a public channel. Public channel: the channel that others can query by calling `getChannels`.
4999
+ * - (default)`true`: Yes.
4695
5000
  * - `false`: No.
4696
5001
  */
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;
5002
+ isPublic?: boolean;
5003
+ /** The channel name. */
5004
+ name: string;
5005
+ /** The description of the channel. */
5006
+ description?: string;
5007
+ /** The users max amount of the channel.
5008
+ * - (default)`0`: 2,000.
5009
+ * - `1`: 20,000
5010
+ * - `2`: 100,000; */
5011
+ rank?: ChannelRank;
5012
+ /** The extension field. */
5013
+ ext?: string;
5014
+ }
5015
+ ): Promise<AsyncResult<ChannelInfo>>;
5016
+
5017
+ /**
5018
+ * Deletes a channel.
5019
+ *
5020
+ * ```typescript
5021
+ * connection.destroyChannel({serverId: 'serverId', channelId: 'channelId'})
5022
+ * ```
5023
+ */
5024
+ destroyChannel(
5025
+ this: Connection,
5026
+ params: {
5027
+ /** The server ID. */
5028
+ serverId: string;
5029
+ /** The channel ID. */
5030
+ channelId: string;
4704
5031
  }
4705
5032
  ): Promise<void>;
4706
5033
 
4707
5034
  /**
4708
- * Batch remove chat room attributes.
5035
+ * Updates the channel information.
5036
+ *
5037
+ * Only the channel admin can call this method.
4709
5038
  *
4710
5039
  * ```typescript
4711
- * connection.removeChatRoomAttributes({chatRoomId: 'roomId', attributeKeys: ['key1','key2',...], isForced: false })
5040
+ * connection.updateChannel({
5041
+ * serverId: 'serverId',
5042
+ * channelId: 'channelId',
5043
+ * name: 'the channel name',
5044
+ * description: 'the channel description',
5045
+ * })
4712
5046
  * ```
4713
5047
  */
4714
- removeChatRoomAttributes(
5048
+ updateChannel(
4715
5049
  this: Connection,
4716
5050
  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.
5051
+ /** The server ID. */
5052
+ serverId: string;
5053
+ /** The channel ID. */
5054
+ channelId: string;
5055
+ /** The channel name. */
5056
+ name?: string;
5057
+ /** The channel description. */
5058
+ description?: string;
5059
+ /** The users max amount of the channel.
5060
+ * - (default)`0`: 2,000.
5061
+ * - `1`: 20,000.
5062
+ * - `2`: 100,000.
4725
5063
  */
4726
- isForced?: boolean;
5064
+ rank?: ChannelRank;
5065
+ /** The extension field. */
5066
+ ext?: string;
4727
5067
  }
4728
- ): Promise<AsyncResult<ChatroomAttributes>>;
5068
+ ): Promise<AsyncResult<ChannelInfo>>;
4729
5069
 
4730
5070
  /**
4731
- * Remove chat room attributes individually.
5071
+ * Gets the channel detail.
4732
5072
  *
4733
5073
  * ```typescript
4734
- * connection.removeChatRoomAttribute({chatRoomId: 'roomId', attributeKey: 'attributeValue', isForced: false })
5074
+ * connection.getChannelDetail({serverId: 'serverId', channelId: 'channelId'})
4735
5075
  * ```
5076
+ *
4736
5077
  */
4737
- removeChatRoomAttribute(
5078
+ getChannelDetail(
4738
5079
  this: Connection,
4739
5080
  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;
5081
+ /** The server ID. */
5082
+ serverId: string;
5083
+ /** The channel ID. */
5084
+ channelId: string;
5085
+ }
5086
+ ): Promise<AsyncResult<ChannelInfo>>;
5087
+
5088
+ /**
5089
+ * Joins the channel.
5090
+ *
5091
+ * ```typescript
5092
+ * connection.joinChannel({serverId: 'serverId', channelId: 'channelId'})
5093
+ * ```
5094
+ *
5095
+ */
5096
+ joinChannel(
5097
+ this: Connection,
5098
+ params: {
5099
+ /** The server ID. */
5100
+ serverId: string;
5101
+ /** The channel ID. */
5102
+ channelId: string;
5103
+ }
5104
+ ): Promise<AsyncResult<ChannelInfo>>;
5105
+
5106
+ /**
5107
+ * Leaves the channel.
5108
+ *
5109
+ * ```typescript
5110
+ * connection.leaveChannel({serverId: 'serverId', channelId: 'channelId'})
5111
+ * ```
5112
+ *
5113
+ */
5114
+ leaveChannel(
5115
+ this: Connection,
5116
+ params: {
5117
+ /** The server ID. */
5118
+ serverId: string;
5119
+ /** The channel ID. */
5120
+ channelId: string;
5121
+ }
5122
+ ): Promise<void>;
5123
+
5124
+ /**
5125
+ * Removes a member from the channel.
5126
+ *
5127
+ * ```typescript
5128
+ * connection.removeChannelMember({serverId: 'serverId', channelId: 'channelId',userId: 'userId'})
5129
+ * ```
5130
+ *
5131
+ */
5132
+ removeChannelMember(
5133
+ this: Connection,
5134
+ params: {
5135
+ /** The server ID. */
5136
+ serverId: string;
5137
+ /** The channel ID. */
5138
+ channelId: string;
5139
+ /** The user ID. */
5140
+ userId: string;
5141
+ }
5142
+ ): Promise<void>;
5143
+
5144
+ /**
5145
+ * Gets the list of visible channels with pagination.
5146
+ *
5147
+ * User can get the joined channels, while the admin and creator can get all private channels.
5148
+ *
5149
+ * ```typescript
5150
+ * connection.getVisiblePrivateChannels({pageSize: 10,cursor: ''})
5151
+ * ```
5152
+ *
5153
+ */
5154
+ getVisiblePrivateChannels(
5155
+ this: Connection,
5156
+ params: {
5157
+ /** The server ID. */
5158
+ serverId: string;
5159
+ /** 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`. */
5160
+ pageSize?: number;
5161
+ /** The position from which to start getting data. At the first method call, if you set `cursor` to an empty string.*/
5162
+ cursor?: string;
5163
+ }
5164
+ ): Promise<AsyncResult<ChannelInfoListResult>>;
5165
+
5166
+ /**
5167
+ * Gets the public channels list in the server with pagination.
5168
+ *
5169
+ * ```typescript
5170
+ * connection.getPublicChannels({pageSize: 10,cursor: ''})
5171
+ * ```
5172
+ *
5173
+ */
5174
+ getPublicChannels(
5175
+ this: Connection,
5176
+ params: {
5177
+ /** The server ID. */
5178
+ serverId: string;
5179
+ /** 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`. */
5180
+ pageSize?: number;
5181
+ /** The position from which to start getting data. At the first method call, if you set `cursor` to an empty string.*/
5182
+ cursor?: string;
5183
+ }
5184
+ ): Promise<AsyncResult<ChannelInfoListResult>>;
5185
+
5186
+ /**
5187
+ * Gets members in the channel with pagination..
5188
+ *
5189
+ * ```typescript
5190
+ * connection.getChannelMembers({serverId:'serverId', channelId: 'channelId', pageSize: 10,cursor: ''})
5191
+ * ```
5192
+ *
5193
+ */
5194
+ getChannelMembers(
5195
+ this: Connection,
5196
+ params: {
5197
+ /** The server ID. */
5198
+ serverId: string;
5199
+ /** The channel ID. */
5200
+ channelId: string;
5201
+ /** The number of member that you expect to get on each page. The value range is [1,20] and the default value is `20`. */
5202
+ pageSize?: number;
5203
+ /** The position from which to start getting data. At the first method call, if you set `cursor` to an empty string.*/
5204
+ cursor?: string;
5205
+ }
5206
+ ): Promise<AsyncResult<ChannelMemberListResult>>;
5207
+
5208
+ /**
5209
+ * Invites users into a channel.
5210
+ *
5211
+ * ```typescript
5212
+ * connection.inviteUserToChannel({serverId: 'serverId',channelId: 'channelId',userId: 'userId'})
5213
+ * ```
5214
+ */
5215
+ inviteUserToChannel(
5216
+ this: Connection,
5217
+ params: {
5218
+ /** The server ID. */
5219
+ serverId: string;
5220
+ /** The channel ID. */
5221
+ channelId: string;
5222
+ /** The channel member ID. */
5223
+ userId: string;
5224
+ /** The invite message. */
5225
+ inviteMessage?: string;
5226
+ }
5227
+ ): Promise<void>;
5228
+
5229
+ /**
5230
+ * Accepts a channel request.
5231
+ *
5232
+ * ```typescript
5233
+ * connection.acceptChannelInvite({serverId: 'serverId',channelId: 'channelId',inviter:'inviter'})
5234
+ * ```
5235
+ */
5236
+ acceptChannelInvite(
5237
+ this: Connection,
5238
+ params: {
5239
+ /** The server ID. */
5240
+ serverId: string;
5241
+ /** The channel ID. */
5242
+ channelId: string;
5243
+ /** The inviter user ID. */
5244
+ inviter: string;
5245
+ }
5246
+ ): Promise<AsyncResult<ChannelInfo>>;
5247
+
5248
+ /**
5249
+ * Refuses a channel request.
5250
+ *
5251
+ * ```typescript
5252
+ * connection.rejectChannelInvite({serverId: 'serverId',channelId: 'channelId'})
5253
+ * ```
5254
+ */
5255
+ rejectChannelInvite(
5256
+ this: Connection,
5257
+ params: {
5258
+ /** The server ID. */
5259
+ serverId: string;
5260
+ /** The channel ID. */
5261
+ channelId: string;
5262
+ /** The inviter user ID. */
5263
+ inviter: string;
5264
+ }
5265
+ ): Promise<void>;
5266
+
5267
+ /**
5268
+ * Mutes a channel member.
5269
+ *
5270
+ * ```typescript
5271
+ * connection.muteChannelMember({serverId: 'serverId',channelId: 'channelId',userId: 'userId'})
5272
+ * ```
5273
+ */
5274
+ muteChannelMember(
5275
+ this: Connection,
5276
+ params: {
5277
+ /** The server ID. */
5278
+ serverId: string;
5279
+ /** The channel ID. */
5280
+ channelId: string;
5281
+ /** The channel member ID. */
5282
+ userId: string;
5283
+ /** The mute duration in milliseconds. The value `-1` indicates that the member is muted permanently.*/
5284
+ duration: number;
5285
+ }
5286
+ ): Promise<void>;
5287
+
5288
+ /**
5289
+ * Unmuted a channel member.
5290
+ *
5291
+ * ```typescript
5292
+ * connection.muteChannelMember({serverId: 'serverId',channelId: 'channelId',userId: 'userId'})
5293
+ * ```
5294
+ */
5295
+ unmuteChannelMember(
5296
+ this: Connection,
5297
+ params: {
5298
+ /** The server ID. */
5299
+ serverId: string;
5300
+ /** The channel ID. */
5301
+ channelId: string;
5302
+ /** The channel member ID. */
5303
+ userId: string;
4746
5304
  }
4747
5305
  ): Promise<void>;
5306
+
5307
+ /**
5308
+ * Gets the mute list of the channel.
5309
+ * Only the channel admin or creator can call this method.
5310
+ * ```typescript
5311
+ * connection.getChannelMutelist({channelId: 'channelId'})
5312
+ * ```
5313
+ */
5314
+ getChannelMutelist(
5315
+ this: Connection,
5316
+ params: {
5317
+ /** The server ID. */
5318
+ serverId: string;
5319
+ /** The channel ID. */
5320
+ channelId: string;
5321
+ }
5322
+ ): Promise<AsyncResult<ChannelMuteMemberListResult>>;
5323
+
5324
+ /**
5325
+ * Checks whether the current member is in the channel.
5326
+ *
5327
+ * ```typescript
5328
+ * connection.isInChannel({serverId: 'serverId', channelId: "channelId"})
5329
+ * ```
5330
+ */
5331
+ isInChannel(
5332
+ this: Connection,
5333
+ params: {
5334
+ /** The server ID. */
5335
+ serverId: string;
5336
+ /** The channel ID. */
5337
+ channelId: string;
5338
+ }
5339
+ ): Promise<AsyncResult<OperationResult>>;
4748
5340
  }
4749
5341
 
4750
5342
  // ----- for EventHandler ------
@@ -4781,30 +5373,270 @@ export declare namespace EasemobChat {
4781
5373
  /** Message sender. */
4782
5374
  from: string;
4783
5375
  /** Message receiver. */
5376
+ to: string;
5377
+ /** Additional data for the operation event. */
4784
5378
  data?: any;
4785
- /** ChatRoom Attributes. */
4786
- /** 聊天室属性。 */
4787
- attributes?: {
4788
- [key: string]: string;
4789
- };
4790
5379
  }
4791
5380
 
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>;
5381
+ type ServerChangeType =
5382
+ | 'update'
5383
+ | 'destroy'
5384
+ | 'memberPresence'
5385
+ | 'memberAbsence'
5386
+ | 'inviteToJoin'
5387
+ | 'acceptInvite'
5388
+ | 'refuseInvite'
5389
+ | 'removed'
5390
+ | 'updateRole';
5391
+
5392
+ type ServerMultiDeviceEventType =
5393
+ | 'serverCreate'
5394
+ | 'serverDestroy'
5395
+ | 'serverUpdate'
5396
+ | 'serverJoin'
5397
+ | 'serverLeave'
5398
+ | 'serverRemoveMember'
5399
+ | 'serverInviteUser'
5400
+ | 'serverAcceptInvite'
5401
+ | 'serverRefuseInvite'
5402
+ | 'serverSetRole';
5403
+ interface CreateServerResult {
5404
+ /** The server ID. */
5405
+ serverId: string;
5406
+ /** The default channel ID. */
5407
+ defaultChannelId: string;
5408
+ }
5409
+ interface OperationResult {
5410
+ result: boolean;
4797
5411
  }
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>;
5412
+ interface ServerInfo {
5413
+ /** The server ID. */
5414
+ id: string;
5415
+ /** The server name. */
5416
+ name: string;
5417
+ /** The profile picture of the server. */
5418
+ icon?: string;
5419
+ /** The default channel ID. */
5420
+ defaultChannelId: string;
5421
+ /** The owner of the server. */
5422
+ owner: string;
5423
+ /** The description of the server. */
5424
+ description?: string;
5425
+ /** The tags list of the server. */
5426
+ tags?: ServerTag[];
5427
+ /** The extension field. */
5428
+ ext?: string;
5429
+ /** The Unix timestamp when the server created. The unit is millisecond. */
5430
+ created?: number;
5431
+ }
5432
+ interface ServerInfoList {
5433
+ /** The serer information list */
5434
+ list: ServerInfo[];
5435
+ /** The position from which to start getting data. At the first method call, if you set `cursor` to an empty string.*/
5436
+ cursor: string;
5437
+ }
5438
+
5439
+ interface ServerMember {
5440
+ /** The member ID. */
5441
+ userId: string;
5442
+ /** The member role. */
5443
+ role: RoleType;
5444
+ }
5445
+ interface ServerMemberData {
5446
+ /** The server member list. */
5447
+ list: ServerMember[];
5448
+ /** The position from which to start getting data. At the first method call*/
5449
+ cursor?: string;
5450
+ }
5451
+ interface ServerRole {
5452
+ role: RoleType;
5453
+ }
5454
+ type RoleType = 'owner' | 'moderator' | 'user';
5455
+
5456
+ interface ServerTag {
5457
+ /** The server tag ID. */
5458
+ tagId: string;
5459
+ /** The server tag name. */
5460
+ tagName: string;
5461
+ }
5462
+
5463
+ interface ServerTagList {
5464
+ /** The server tag list. */
5465
+ tags: ServerTag[];
5466
+ }
5467
+ interface ServerChangeInfo {
5468
+ /** The server ID. */
5469
+ serverId: string;
5470
+ /** The type of operation. */
5471
+ operation: ServerChangeType | ServerMultiDeviceEventType;
5472
+ /** The operator. */
5473
+ operator: string;
5474
+ /** The Unix timestamp when the event occurs. The unit is millisecond. */
5475
+ timestamp: number;
5476
+ /** The operated member ID. */
5477
+ userId?: string;
5478
+ /** The operated member IDs. */
5479
+ userIds?: string[];
5480
+ /** The user role. */
5481
+ role?: string;
5482
+ /** The server name. */
5483
+ name?: string;
5484
+ /** The description of the server. */
5485
+ description?: string;
5486
+ /** The extension field. */
5487
+ ext?: string;
5488
+ /** The profile picture of the server. */
5489
+ icon?: string;
5490
+ }
5491
+
5492
+ enum ChannelRank {
5493
+ /** 2,000 channel. */
5494
+ RANK_2000,
5495
+ /** 20000 channel. */
5496
+ RANK_20000,
5497
+ /** 100000 channel. */
5498
+ RANK_100000,
5499
+ }
5500
+ interface ChannelInfo {
5501
+ /** The server ID. */
5502
+ serverId: string;
5503
+ /** The channel ID. */
5504
+ channelId: string;
5505
+ /** The channel name. */
5506
+ name: string;
5507
+ /** The description of the channel. */
5508
+ description: string;
5509
+ /** The Unix timestamp when the server created. The unit is millisecond. */
5510
+ created?: number;
5511
+ /** Whether it is the default channel.
5512
+ * - `0`: No.
5513
+ * - `1`: Yes.
5514
+ */
5515
+ defaultChannel: 0 | 1;
5516
+ /** The users max amount of the channel.
5517
+ * - `0`(default): 2,000.
5518
+ * - `1`: 20,000.
5519
+ * - `2`: 100,000.
5520
+ */
5521
+ rank: ChannelRank;
5522
+ /** The extension field of the channel. */
5523
+ ext: string;
5524
+ /** Whether it is a public channel.
5525
+ * - `true`: Yes.
5526
+ * - `false`: No.
5527
+ */
5528
+ isPublic: boolean;
5529
+ /** Whether the invitee needs to accept the invitation before joining the group.
5530
+ - `true`: The invitee's consent is required.
5531
+ - `false`: The invitee will be directly added to the group without confirmation.
5532
+ */
5533
+ inviteNeedConfirm: boolean;
5534
+ }
5535
+
5536
+ interface ChannelInfoListResult {
5537
+ /** The channel information list. */
5538
+ list: ChannelInfo[];
5539
+ /** The position from which to start getting data. */
5540
+ cursor?: string;
5541
+ }
5542
+
5543
+ interface ChannelMuteMemberItem {
5544
+ /** The timestamp when the mute expires. */
5545
+ expire: number;
5546
+ /** The muted user ID */
5547
+ userId: string;
4807
5548
  }
5549
+ interface ChannelMuteMemberListResult {
5550
+ list: ChannelMuteMemberItem[];
5551
+ }
5552
+
5553
+ interface ChannelMemberListResult {
5554
+ /** The channel member list */
5555
+ list: ChannelMember[];
5556
+ /** The position from which to start getting data.*/
5557
+ cursor?: string;
5558
+ }
5559
+ type ChannelRole = 'owner' | 'moderator' | 'user';
5560
+
5561
+ interface ChannelMember {
5562
+ /** The member ID. */
5563
+ userId: string;
5564
+ /** The member role. */
5565
+ role: ChannelRole;
5566
+ }
5567
+
5568
+ type ChannelChangeType =
5569
+ | 'create'
5570
+ | 'destroy'
5571
+ | 'update'
5572
+ | 'memberAbsence'
5573
+ | 'memberPresence'
5574
+ | 'removed'
5575
+ | 'muteMember'
5576
+ | 'unmuteMember'
5577
+ | 'inviteToJoin'
5578
+ | 'acceptInvite'
5579
+ | 'rejectInvite'
5580
+ | 'directJoined';
5581
+
5582
+ type ChannelMultiDeviceEventType =
5583
+ | 'channelCreate'
5584
+ | 'channelDestroy'
5585
+ | 'channelUpdate'
5586
+ | 'channelJoin'
5587
+ | 'channelLeave'
5588
+ | 'channelRemoveMember'
5589
+ | 'channelInviteUser'
5590
+ | 'channelMuteMember'
5591
+ | 'channelUnMuteMember'
5592
+ | 'channelAcceptInvite'
5593
+ | 'channelRejectInvite';
5594
+
5595
+ interface InviteChannelServerInfo {
5596
+ /** The server ID. */
5597
+ /** 社区 ID。 */
5598
+ id: string;
5599
+ /** The profile picture of the server. */
5600
+ /** 社区头像。*/
5601
+ icon?: string;
5602
+ /** The server name. */
5603
+ /** 社区名称。 */
5604
+ name?: string;
5605
+ /** The description of the server. */
5606
+ /** 社区描述。 */
5607
+ description?: string;
5608
+ }
5609
+ interface ChannelChangeInfo {
5610
+ /** The type of operation. */
5611
+ /** 操作类型。 */
5612
+ operation: ChannelChangeType | ChannelMultiDeviceEventType;
5613
+ /** The channel ID. */
5614
+ /** 频道 ID。 */
5615
+ id: string;
5616
+ /** The channel name. */
5617
+ /** 频道名称。 */
5618
+ name?: string;
5619
+ /** The operator. */
5620
+ /** 操作者。 */
5621
+ operator: string;
5622
+ /** The operated object. */
5623
+ /** 被操作的对象。 */
5624
+ to: string;
5625
+ /** The invite message. */
5626
+ /** 邀请用户加入频道的消息。*/
5627
+ inviteMessage?: string;
5628
+ /** The invite channel server info. */
5629
+ /** 邀请加入频道的相关社区信息。*/
5630
+ serverInfo?: InviteChannelServerInfo;
5631
+ /** The description of the channel. */
5632
+ /** 频道描述。 */
5633
+ description?: string;
5634
+ }
5635
+
5636
+ type MultiDeviceData =
5637
+ | ThreadMultiDeviceInfo
5638
+ | ServerChangeInfo
5639
+ | ChannelChangeInfo;
4808
5640
 
4809
5641
  type Event =
4810
5642
  | 'onOpened'
@@ -4843,7 +5675,9 @@ export declare namespace EasemobChat {
4843
5675
  | 'onChatThreadChange'
4844
5676
  | 'onMultiDeviceEvent'
4845
5677
  | 'onGroupEvent'
4846
- | 'onChatroomEvent';
5678
+ | 'onChatroomEvent'
5679
+ | 'onServerEvent'
5680
+ | 'onChannelEvent';
4847
5681
 
4848
5682
  interface EventHandlerType {
4849
5683
  /** @deprecated Use { onConnected } instead. */
@@ -4913,13 +5747,17 @@ export declare namespace EasemobChat {
4913
5747
  /** The callback to receive a reaction message. */
4914
5748
  onChatThreadChange?: (msg: ThreadChangeInfo) => void;
4915
5749
  /** The callback to receive a multi device event. */
4916
- onMultiDeviceEvent?: (msg: ThreadMultiDeviceInfo) => void;
5750
+ onMultiDeviceEvent?: (msg: MultiDeviceData) => void;
4917
5751
  /** The callback to receive a reaction message. */
4918
5752
  onReactionChange?: (msg: ReactionMessage) => void;
4919
5753
  /** The callback to receive a group event. */
4920
5754
  onGroupEvent?: (eventData: EventData) => void;
4921
5755
  /** The callback to receive a chatroom event. */
4922
5756
  onChatroomEvent?: (eventData: EventData) => void;
5757
+ /** The callback to receive a server message. */
5758
+ onServerEvent?: (msg: ServerChangeInfo) => void;
5759
+ /** The callback to receive a channel message. */
5760
+ onChannelEvent?: (msg: ChannelChangeInfo) => void;
4923
5761
  }
4924
5762
 
4925
5763
  interface HandlerData {