diff --git a/README.md b/README.md index 21eaa08..70f9d0c 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ If you're using Maven, just add the following dependency in `pom.xml`. io.github.doocs im-server-sdk-java - 0.4.09 + 0.4.10 ``` diff --git a/README_CN.md b/README_CN.md index b023a3c..c47ce49 100644 --- a/README_CN.md +++ b/README_CN.md @@ -25,7 +25,7 @@ https://doocs.github.io/qcloud-im-server-sdk-java io.github.doocs im-server-sdk-java - 0.4.09 + 0.4.10 ``` diff --git a/docs/guide/README.md b/docs/guide/README.md index 7eb2ab6..a80fabd 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -1,6 +1,6 @@ # 介绍 -本文档基于腾讯云 IM Server SDK Java 编写。 +本文档基于腾讯云 IM Server SDK Java 编写。 ## 前提条件 diff --git a/docs/guide/group.md b/docs/guide/group.md index 761fd80..87f32cf 100644 --- a/docs/guide/group.md +++ b/docs/guide/group.md @@ -116,6 +116,35 @@ GetGroupMemberInfoRequest request = GetGroupMemberInfoRequest.builder() GetGroupMemberInfoResult result = client.group.getGroupMemberInfo(request); ``` +## 获取指定群成员详细资料 + +App 管理员可根据群组 ID 与群内指定成员 UserID 列表等参数获取指定群组成员的资料。 + +::: tip +适用的群组类型 + +| 群组类型 ID | 是否支持此 REST API | +| ----------------- | ---------------------------------------- | +| Private | 支持,同新版本中的 Work(好友工作群) | +| Public | 支持 | +| ChatRoom | 支持,同新版本中的 Meeting(临时会议群) | +| AVChatRoom | 不支持 | +| Community(社群) | 支持 | + +即时通信 IM 内置上述群组类型,详情介绍请参见 [群组系统](https://cloud.tencent.com/document/product/269/1502)。 +::: + +使用示例: + +```java +GetSpecifiedGroupMemberInfoRequest request = GetSpecifiedGroupMemberInfoRequest.builder() + .groupId("MyFirstGroup") + .memberInfoFilter(Collections.singletonList("bingo")) + .build(); + +GetSpecifiedGroupMemberInfoResult result = client.group.getSpecifiedGroupMemberInfo(request); +``` + ## 修改群基础资料 App 管理员可以通过该接口修改指定群组的基础信息。 @@ -1471,4 +1500,4 @@ CheckMembersRequest request = CheckMembersRequest.builder() .build(); CheckMembersResult result = client.group.checkMembers(request); -``` \ No newline at end of file +``` diff --git a/docs/guide/quickstart.md b/docs/guide/quickstart.md index 3b2aa9d..4f9923a 100644 --- a/docs/guide/quickstart.md +++ b/docs/guide/quickstart.md @@ -10,14 +10,14 @@ io.github.doocs im-server-sdk-java - 0.4.09 + 0.4.10 ``` ### Gradle ```gradle -implementation group: 'io.github.doocs', name: 'im-server-sdk-java', version: '0.4.09' +implementation group: 'io.github.doocs', name: 'im-server-sdk-java', version: '0.4.10' ``` ### 下载 JAR diff --git a/package-lock.json b/package-lock.json index 3b5d340..74d5ef3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "qcloud-im-server-sdk-java", - "version": "0.4.09", + "version": "0.4.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "qcloud-im-server-sdk-java", - "version": "0.4.09", + "version": "0.4.10", "license": "Apache-2.0", "devDependencies": { "@vuepress/bundler-vite": "^2.0.0-rc.18", diff --git a/package.json b/package.json index 0ed680b..8ff9213 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "qcloud-im-server-sdk-java", - "version": "0.4.09", + "version": "0.4.10", "description": "腾讯云 IM 服务端 SDK API 文档 Java 版", "main": "index.js", "scripts": { diff --git a/pom.xml b/pom.xml index 8aefb54..149f058 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.github.doocs im-server-sdk-java - 0.4.09 + 0.4.10 jar qcloud-im-server-sdk-java diff --git a/src/main/java/io/github/doocs/im/core/Group.java b/src/main/java/io/github/doocs/im/core/Group.java index 603f7e4..4745aa8 100644 --- a/src/main/java/io/github/doocs/im/core/Group.java +++ b/src/main/java/io/github/doocs/im/core/Group.java @@ -31,6 +31,7 @@ public class Group { public static final String CREATE_GROUP_COMMAND = "create_group"; public static final String GET_GROUP_INFO_COMMAND = "get_group_info"; public static final String GET_GROUP_MEMBER_INFO_COMMAND = "get_group_member_info"; + public static final String GET_SPECIFIED_GROUP_MEMBER_INFO_COMMAND = "get_specified_group_member_info"; public static final String MODIFY_GROUP_BASE_INFO_COMMAND = "modify_group_base_info"; public static final String ADD_GROUP_MEMBER_COMMAND = "add_group_member"; public static final String DELETE_GROUP_MEMBER_COMMAND = "delete_group_member"; @@ -154,6 +155,23 @@ public GetGroupMemberInfoResult getGroupMemberInfo(GetGroupMemberInfoRequest get return HttpUtil.post(url, getGroupMemberInfoRequest, GetGroupMemberInfoResult.class, imClient.getConfig()); } + /** + * 获取指定群成员详细资料 + * + * @param getSpecifiedGroupMemberInfoRequest 请求参数 + * @return 结果 + * @throws IOException 异常 + */ + public GetSpecifiedGroupMemberInfoResult getSpecifiedGroupMemberInfo(GetSpecifiedGroupMemberInfoRequest getSpecifiedGroupMemberInfoRequest) throws IOException { + String url = imClient.getUrl(SERVICE_NAME, GET_SPECIFIED_GROUP_MEMBER_INFO_COMMAND); + return HttpUtil.post(url, getSpecifiedGroupMemberInfoRequest, GetSpecifiedGroupMemberInfoResult.class, imClient.getConfig()); + } + + public GetSpecifiedGroupMemberInfoResult getSpecifiedGroupMemberInfo(GetSpecifiedGroupMemberInfoRequest getSpecifiedGroupMemberInfoRequest, long random) throws IOException { + String url = imClient.getUrl(SERVICE_NAME, GET_SPECIFIED_GROUP_MEMBER_INFO_COMMAND, random); + return HttpUtil.post(url, getSpecifiedGroupMemberInfoRequest, GetSpecifiedGroupMemberInfoResult.class, imClient.getConfig()); + } + /** * 修改群基础资料 * diff --git a/src/main/java/io/github/doocs/im/model/request/GetSpecifiedGroupMemberInfoRequest.java b/src/main/java/io/github/doocs/im/model/request/GetSpecifiedGroupMemberInfoRequest.java new file mode 100644 index 0000000..26b0c6c --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/request/GetSpecifiedGroupMemberInfoRequest.java @@ -0,0 +1,143 @@ +package io.github.doocs.im.model.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.List; + +/** + * 获取指定群成员详细资料-请求参数 + * + * @author bingo + * @since 2024/12/02 08:04 + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GetSpecifiedGroupMemberInfoRequest extends GenericRequest implements Serializable { + private static final long serialVersionUID = -1588717038990106029L; + + @JsonProperty("GroupId") + private String groupId; + + @JsonProperty("Member_List_Account") + private List memberListAccount; + + @JsonProperty("MemberInfoFilter") + private List memberInfoFilter; + + @JsonProperty("MemberRoleFilter") + private List memberRoleFilter; + + @JsonProperty("AppDefinedDataFilter_GroupMember") + private List appDefinedDataFilterGroupMember; + + public GetSpecifiedGroupMemberInfoRequest() { + } + + public GetSpecifiedGroupMemberInfoRequest(String groupId, List memberListAccount) { + this.groupId = groupId; + this.memberListAccount = memberListAccount; + } + + public GetSpecifiedGroupMemberInfoRequest(String groupId, List memberListAccount, + List memberInfoFilter, List memberRoleFilter, + List appDefinedDataFilterGroupMember) { + this.groupId = groupId; + this.memberListAccount = memberListAccount; + this.memberInfoFilter = memberInfoFilter; + this.memberRoleFilter = memberRoleFilter; + this.appDefinedDataFilterGroupMember = appDefinedDataFilterGroupMember; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public List getMemberListAccount() { + return memberListAccount; + } + + public void setMemberListAccount(List memberListAccount) { + this.memberListAccount = memberListAccount; + } + + public List getMemberInfoFilter() { + return memberInfoFilter; + } + + public void setMemberInfoFilter(List memberInfoFilter) { + this.memberInfoFilter = memberInfoFilter; + } + + public List getMemberRoleFilter() { + return memberRoleFilter; + } + + public void setMemberRoleFilter(List memberRoleFilter) { + this.memberRoleFilter = memberRoleFilter; + } + + public List getAppDefinedDataFilterGroupMember() { + return appDefinedDataFilterGroupMember; + } + + public void setAppDefinedDataFilterGroupMember(List appDefinedDataFilterGroupMember) { + this.appDefinedDataFilterGroupMember = appDefinedDataFilterGroupMember; + } + + private GetSpecifiedGroupMemberInfoRequest(Builder builder) { + this.groupId = builder.groupId; + this.memberListAccount = builder.memberListAccount; + this.memberInfoFilter = builder.memberInfoFilter; + this.memberRoleFilter = builder.memberRoleFilter; + this.appDefinedDataFilterGroupMember = builder.appDefinedDataFilterGroupMember; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private String groupId; + private List memberListAccount; + private List memberInfoFilter; + private List memberRoleFilter; + private List appDefinedDataFilterGroupMember; + + private Builder() { + } + + public GetSpecifiedGroupMemberInfoRequest build() { + return new GetSpecifiedGroupMemberInfoRequest(this); + } + + public Builder groupId(String groupId) { + this.groupId = groupId; + return this; + } + + public Builder memberListAccount(List memberListAccount) { + this.memberListAccount = memberListAccount; + return this; + } + + public Builder memberInfoFilter(List memberInfoFilter) { + this.memberInfoFilter = memberInfoFilter; + return this; + } + + public Builder memberRoleFilter(List memberRoleFilter) { + this.memberRoleFilter = memberRoleFilter; + return this; + } + + public Builder appDefinedDataFilterGroupMember(List appDefinedDataFilterGroupMember) { + this.appDefinedDataFilterGroupMember = appDefinedDataFilterGroupMember; + return this; + } + } +} diff --git a/src/main/java/io/github/doocs/im/model/response/GetSpecifiedGroupMemberInfoResult.java b/src/main/java/io/github/doocs/im/model/response/GetSpecifiedGroupMemberInfoResult.java new file mode 100644 index 0000000..04b3bd9 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/GetSpecifiedGroupMemberInfoResult.java @@ -0,0 +1,50 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.github.doocs.im.model.group.MemberProfile; + +import java.io.Serializable; +import java.util.List; + +/** + * 获取群成员详细资料-结果 + * + * @author bingo + * @since 2024/12/02 08:18 + */ +public class GetSpecifiedGroupMemberInfoResult extends GenericResult implements Serializable { + private static final long serialVersionUID = -5466167278504273597L; + + @JsonProperty("GroupId") + private String groupId; + + @JsonProperty("MemberList") + private List memberList; + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public List getMemberList() { + return memberList; + } + + public void setMemberList(List memberList) { + this.memberList = memberList; + } + + @Override + public String toString() { + return "GetSpecifiedGroupMemberInfoResult{" + + "groupId='" + groupId + '\'' + + ", memberList=" + memberList + + ", actionStatus='" + actionStatus + '\'' + + ", errorInfo='" + errorInfo + '\'' + + ", errorCode=" + errorCode + + '}'; + } +} diff --git a/src/main/resources/version.properties b/src/main/resources/version.properties index 50de117..ba57729 100644 --- a/src/main/resources/version.properties +++ b/src/main/resources/version.properties @@ -1 +1 @@ -version=0.4.09 +version=0.4.10 diff --git a/src/test/java/io/github/doocs/im/core/GroupTest.java b/src/test/java/io/github/doocs/im/core/GroupTest.java index fc13f6c..fd6bcee 100644 --- a/src/test/java/io/github/doocs/im/core/GroupTest.java +++ b/src/test/java/io/github/doocs/im/core/GroupTest.java @@ -90,6 +90,18 @@ void testGetGroupMemberInfo() throws IOException { Assertions.assertEquals(ErrorCode.SUCCESS.getCode(), result.getErrorCode()); } + @Test + void testGetSpecifiedGroupMemberInfo() throws IOException { +GetSpecifiedGroupMemberInfoRequest request = GetSpecifiedGroupMemberInfoRequest.builder() + .groupId("MyFirstGroup") + .memberInfoFilter(Collections.singletonList("bingo")) + .build(); + +GetSpecifiedGroupMemberInfoResult result = client.group.getSpecifiedGroupMemberInfo(request); +System.out.println(result); +Assertions.assertEquals(ErrorCode.SUCCESS.getCode(), result.getErrorCode()); + } + @Test void testModifyGroupBaseInfo() throws IOException { ModifyGroupBaseInfoRequest request = ModifyGroupBaseInfoRequest.builder()