From e88060459d2afd2707d13837508180187621c4ae Mon Sep 17 00:00:00 2001 From: ooail <1184010001@qq.com> Date: Mon, 15 Dec 2025 17:19:26 +0800 Subject: [PATCH 1/7] =?UTF-8?q?feat(group):=20=E6=B7=BB=E5=8A=A0=E7=BE=A4?= =?UTF-8?q?=E6=88=90=E5=91=98=E5=9C=A8=E7=BA=BF=E7=8A=B6=E6=80=81=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 MemberProfile 类中新增 onlineStatus 字段 - 更新构造函数以支持在线状态参数 - 添加在线状态的 getter 和 setter 方法 - 在 Builder 模式中增加 onlineStatus 方法 - 更新 toString 方法以包含在线状态信息 --- .../doocs/im/model/group/MemberProfile.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/java/io/github/doocs/im/model/group/MemberProfile.java b/src/main/java/io/github/doocs/im/model/group/MemberProfile.java index 69013f4a..cfa34093 100644 --- a/src/main/java/io/github/doocs/im/model/group/MemberProfile.java +++ b/src/main/java/io/github/doocs/im/model/group/MemberProfile.java @@ -62,6 +62,12 @@ public class MemberProfile implements Serializable { @JsonProperty("NameCard") private String nameCard; + /** + * 在线状态 + */ + @JsonProperty("OnlineStatus") + private String onlineStatus; + /** * 返回的群成员自定义字段信息 */ @@ -73,6 +79,7 @@ public MemberProfile() { public MemberProfile(String memberAccount, String role, Integer joinTime, Long msgSeq, String msgFlag, Integer lastSendMsgTime, Long muteUntil, String nameCard, + String onlineStatus, List appMemberDefinedData) { this.memberAccount = memberAccount; this.role = role; @@ -82,6 +89,7 @@ public MemberProfile(String memberAccount, String role, Integer joinTime, Long m this.lastSendMsgTime = lastSendMsgTime; this.muteUntil = muteUntil; this.nameCard = nameCard; + this.onlineStatus = onlineStatus; this.appMemberDefinedData = appMemberDefinedData; } @@ -165,6 +173,14 @@ public void setNameCard(String nameCard) { this.nameCard = nameCard; } + public String getOnlineStatus() { + return onlineStatus; + } + + public void setOnlineStatus(String onlineStatus) { + this.onlineStatus = onlineStatus; + } + public List getAppMemberDefinedData() { return appMemberDefinedData; } @@ -186,6 +202,7 @@ public static final class Builder { private Integer lastSendMsgTime; private Long muteUntil; private String nameCard; + private String onlineStatus; private List appMemberDefinedData; private Builder() { @@ -235,6 +252,11 @@ public Builder nameCard(String nameCard) { return this; } + public Builder onlineStatus(String onlineStatus) { + this.onlineStatus = onlineStatus; + return this; + } + public Builder appMemberDefinedData(List appMemberDefinedData) { this.appMemberDefinedData = appMemberDefinedData; return this; @@ -252,6 +274,7 @@ public String toString() { ", lastSendMsgTime=" + lastSendMsgTime + ", muteUntil=" + muteUntil + ", nameCard='" + nameCard + '\'' + + ", onlineStatus='" + onlineStatus + '\'' + ", appMemberDefinedData=" + appMemberDefinedData + '}'; } From ce486b6415a8a5a81ef896ed7b6efc0a106f827c Mon Sep 17 00:00:00 2001 From: ooail <1184010001@qq.com> Date: Tue, 16 Dec 2025 13:38:34 +0800 Subject: [PATCH 2/7] =?UTF-8?q?feat(sns):=20=E6=96=B0=E5=A2=9E=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=85=B3=E6=B3=A8=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增关注用户接口及其实现 - 新增取消关注用户接口及其实现 - 新增拉取关注、粉丝与互关列表接口及其实现 - 新增检查关注关系接口及其实现 - 新增获取用户关注、粉丝与互关数接口及其实现 - 添加相关请求和响应模型类 - 在Sns类中定义新的服务名和命令字常量 - 添加对应的单元测试方法 --- .../java/io/github/doocs/im/core/Sns.java | 92 ++++++++++++ .../im/model/request/FollowAddRequest.java | 89 ++++++++++++ .../im/model/request/FollowCheckRequest.java | 88 ++++++++++++ .../im/model/request/FollowDeleteRequest.java | 88 ++++++++++++ .../model/request/FollowGetInfoRequest.java | 88 ++++++++++++ .../im/model/request/FollowGetRequest.java | 134 ++++++++++++++++++ .../im/model/request/FollowRequestItem.java | 62 ++++++++ .../im/model/response/FollowAddResult.java | 57 ++++++++ .../im/model/response/FollowCheckResult.java | 57 ++++++++ .../model/response/FollowCheckResultItem.java | 45 ++++++ .../im/model/response/FollowDeleteResult.java | 57 ++++++++ .../model/response/FollowGetInfoResult.java | 57 ++++++++ .../im/model/response/FollowGetResult.java | 57 ++++++++ .../model/response/FollowInfoResultItem.java | 72 ++++++++++ .../im/model/response/FollowResultItem.java | 70 +++++++++ .../java/io/github/doocs/im/core/SnsTest.java | 60 ++++++++ 16 files changed, 1173 insertions(+) create mode 100644 src/main/java/io/github/doocs/im/model/request/FollowAddRequest.java create mode 100644 src/main/java/io/github/doocs/im/model/request/FollowCheckRequest.java create mode 100644 src/main/java/io/github/doocs/im/model/request/FollowDeleteRequest.java create mode 100644 src/main/java/io/github/doocs/im/model/request/FollowGetInfoRequest.java create mode 100644 src/main/java/io/github/doocs/im/model/request/FollowGetRequest.java create mode 100644 src/main/java/io/github/doocs/im/model/request/FollowRequestItem.java create mode 100644 src/main/java/io/github/doocs/im/model/response/FollowAddResult.java create mode 100644 src/main/java/io/github/doocs/im/model/response/FollowCheckResult.java create mode 100644 src/main/java/io/github/doocs/im/model/response/FollowCheckResultItem.java create mode 100644 src/main/java/io/github/doocs/im/model/response/FollowDeleteResult.java create mode 100644 src/main/java/io/github/doocs/im/model/response/FollowGetInfoResult.java create mode 100644 src/main/java/io/github/doocs/im/model/response/FollowGetResult.java create mode 100644 src/main/java/io/github/doocs/im/model/response/FollowInfoResultItem.java create mode 100644 src/main/java/io/github/doocs/im/model/response/FollowResultItem.java diff --git a/src/main/java/io/github/doocs/im/core/Sns.java b/src/main/java/io/github/doocs/im/core/Sns.java index dcd222ef..6d76159d 100644 --- a/src/main/java/io/github/doocs/im/core/Sns.java +++ b/src/main/java/io/github/doocs/im/core/Sns.java @@ -18,6 +18,7 @@ public class Sns { * 关系链管理服务名 */ public static final String SERVICE_NAME = "sns"; + public static final String SERVICE_NAME_FOLLOW = "follow"; /** * 关系链管理相关命令字 @@ -37,6 +38,11 @@ public class Sns { public static final String GROUP_ADD_COMMAND = "group_add"; public static final String GROUP_DELETE_COMMAND = "group_delete"; public static final String GROUP_GET_COMMAND = "group_get"; + public static final String FOLLOW_ADD_COMMAND = "follow_add"; + public static final String FOLLOW_DELETE_COMMAND = "follow_delete"; + public static final String FOLLOW_GET_COMMAND = "follow_get"; + public static final String FOLLOW_CHECK_COMMAND = "follow_check"; + public static final String FOLLOW_GET_INFO_COMMAND = "follow_get_info"; private final ImClient imClient; @@ -298,4 +304,90 @@ public GroupGetResult groupGet(GroupGetRequest groupGetRequest, long random) thr String url = imClient.getUrl(SERVICE_NAME, GROUP_GET_COMMAND, random); return HttpUtil.post(url, groupGetRequest, GroupGetResult.class, imClient.getConfig()); } + + /** + * 关注用户 + * + * @param followAddRequest 关注用户请求参数 + * @return 关注用户结果 + * @throws IOException 关注用户异常 + */ + public FollowAddResult followAdd(FollowAddRequest followAddRequest) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_FOLLOW, FOLLOW_ADD_COMMAND); + return HttpUtil.post(url, followAddRequest, FollowAddResult.class, imClient.getConfig()); + } + + public FollowAddResult followAdd(FollowAddRequest followAddRequest, long random) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_FOLLOW, FOLLOW_ADD_COMMAND, random); + return HttpUtil.post(url, followAddRequest, FollowAddResult.class, imClient.getConfig()); + } + + /** + * 取消关注用户 + * + * @param followDeleteRequest 取消关注用户请求参数 + * @return 取消关注用户结果 + * @throws IOException 取消关注用户异常 + */ + public FollowDeleteResult followDelete(FollowDeleteRequest followDeleteRequest) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_FOLLOW, FOLLOW_DELETE_COMMAND); + return HttpUtil.post(url, followDeleteRequest, FollowDeleteResult.class, imClient.getConfig()); + } + + public FollowDeleteResult followDelete(FollowDeleteRequest followDeleteRequest, long random) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_FOLLOW, FOLLOW_DELETE_COMMAND, random); + return HttpUtil.post(url, followDeleteRequest, FollowDeleteResult.class, imClient.getConfig()); + } + + /** + * 拉取关注、粉丝与互关列表 + * + * @param followGetRequest 拉取关注请求参数 + * @return 拉取关注结果 + * @throws IOException 拉取关注异常 + */ + public FollowGetResult followGet(FollowGetRequest followGetRequest) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_FOLLOW, FOLLOW_GET_COMMAND); + return HttpUtil.post(url, followGetRequest, FollowGetResult.class, imClient.getConfig()); + } + + public FollowGetResult followGet(FollowGetRequest followGetRequest, long random) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_FOLLOW, FOLLOW_GET_COMMAND, random); + return HttpUtil.post(url, followGetRequest, FollowGetResult.class, imClient.getConfig()); + } + + /** + * 检查关注关系 + * + * @param followCheckRequest 检查关注关系请求参数 + * @return 检查关注关系结果 + * @throws IOException 检查关注关系异常 + */ + public FollowCheckResult followCheck(FollowCheckRequest followCheckRequest) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_FOLLOW, FOLLOW_CHECK_COMMAND); + return HttpUtil.post(url, followCheckRequest, FollowCheckResult.class, imClient.getConfig()); + } + + public FollowCheckResult followCheck(FollowCheckRequest followCheckRequest, long random) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_FOLLOW, FOLLOW_CHECK_COMMAND, random); + return HttpUtil.post(url, followCheckRequest, FollowCheckResult.class, imClient.getConfig()); + } + + /** + * 获取用户的关注、粉丝与互关数 + * + * @param followGetInfoRequest 获取用户的关注、粉丝与互关数请求参数 + * @return 获取用户的关注、粉丝与互关数结果 + * @throws IOException 拉取关注异常 + */ + public FollowGetInfoResult followGetInfo(FollowGetInfoRequest followGetInfoRequest) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_FOLLOW, FOLLOW_GET_INFO_COMMAND); + return HttpUtil.post(url, followGetInfoRequest, FollowGetInfoResult.class, imClient.getConfig()); + } + + public FollowGetInfoResult followGetInfo(FollowGetInfoRequest followGetInfoRequest, long random) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_FOLLOW, FOLLOW_GET_INFO_COMMAND, random); + return HttpUtil.post(url, followGetInfoRequest, FollowGetInfoResult.class, imClient.getConfig()); + } + } diff --git a/src/main/java/io/github/doocs/im/model/request/FollowAddRequest.java b/src/main/java/io/github/doocs/im/model/request/FollowAddRequest.java new file mode 100644 index 00000000..f09f446f --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/request/FollowAddRequest.java @@ -0,0 +1,89 @@ +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 MC.Yang + * @version V1.0 + **/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class FollowAddRequest extends GenericRequest implements Serializable { + private static final long serialVersionUID = -4998729848603268465L; + + /** + * 发起关注操作的用户的 UserID + */ + @JsonProperty("From_Account") + private String fromAccount; + + /** + * 关注结构体对象 + */ + @JsonProperty("FollowItem") + List followItemList; + + public FollowAddRequest() { + } + + public FollowAddRequest(String fromAccount, List followItemList) { + this.fromAccount = fromAccount; + this.followItemList = followItemList; + } + + private FollowAddRequest(Builder builder) { + this.fromAccount = builder.fromAccount; + this.followItemList = builder.followItemList; + } + + public static Builder builder() { + return new Builder(); + } + + public String getFromAccount() { + return fromAccount; + } + + public void setFromAccount(String fromAccount) { + this.fromAccount = fromAccount; + } + + public List getFollowItemList() { + return followItemList; + } + + public void setFollowItemList(List followRequestItemList) { + this.followItemList = followRequestItemList; + } + + public static final class Builder { + private String fromAccount; + private List followItemList; + + private Builder() { + } + + public FollowAddRequest build() { + return new FollowAddRequest(this); + } + + public Builder fromAccount(String fromAccount) { + this.fromAccount = fromAccount; + return this; + } + + public Builder followItemList(List followRequestItemList) { + this.followItemList = followRequestItemList; + return this; + } + + } + +} diff --git a/src/main/java/io/github/doocs/im/model/request/FollowCheckRequest.java b/src/main/java/io/github/doocs/im/model/request/FollowCheckRequest.java new file mode 100644 index 00000000..6db2aa3a --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/request/FollowCheckRequest.java @@ -0,0 +1,88 @@ +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 MC.Yang + * @version V1.0 + **/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class FollowCheckRequest extends GenericRequest implements Serializable { + private static final long serialVersionUID = -1540312147327812439L; + + /** + * 请求检查该用户与 To_Account 之间的关注关系 + */ + @JsonProperty("From_Account") + private String fromAccount; + + /** + * 待检查的用户列表,单次请求的 To_Account 数不得超过100 + */ + @JsonProperty("To_Account") + private List toAccount; + + public FollowCheckRequest() { + } + + public FollowCheckRequest(String fromAccount, List toAccount) { + this.fromAccount = fromAccount; + this.toAccount = toAccount; + } + + private FollowCheckRequest(FollowCheckRequest.Builder builder) { + this.fromAccount = builder.fromAccount; + this.toAccount = builder.toAccount; + } + + public static FollowCheckRequest.Builder builder() { + return new FollowCheckRequest.Builder(); + } + + public String getFromAccount() { + return fromAccount; + } + + public void setFromAccount(String fromAccount) { + this.fromAccount = fromAccount; + } + + public List getToAccount() { + return toAccount; + } + + public void setToAccount(List toAccount) { + this.toAccount = toAccount; + } + + + public static final class Builder { + private String fromAccount; + private List toAccount; + + private Builder() { + } + + public FollowCheckRequest build() { + return new FollowCheckRequest(this); + } + + public FollowCheckRequest.Builder fromAccount(String fromAccount) { + this.fromAccount = fromAccount; + return this; + } + + public FollowCheckRequest.Builder toAccount(List toAccount) { + this.toAccount = toAccount; + return this; + } + } +} diff --git a/src/main/java/io/github/doocs/im/model/request/FollowDeleteRequest.java b/src/main/java/io/github/doocs/im/model/request/FollowDeleteRequest.java new file mode 100644 index 00000000..f21d429e --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/request/FollowDeleteRequest.java @@ -0,0 +1,88 @@ +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 MC.Yang + * @version V1.0 + **/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class FollowDeleteRequest extends GenericRequest implements Serializable { + private static final long serialVersionUID = -6307672357208946936L; + + /** + * 发起取关操作的用户的 UserID + */ + @JsonProperty("From_Account") + private String fromAccount; + + /** + * 待取关的用户的 UserID,单次请求的 To_Account 数不得超过20 + */ + @JsonProperty("To_Account") + private List toAccount; + + public FollowDeleteRequest() { + } + + public FollowDeleteRequest(String fromAccount, List toAccount) { + this.fromAccount = fromAccount; + this.toAccount = toAccount; + } + + private FollowDeleteRequest(FollowDeleteRequest.Builder builder) { + this.fromAccount = builder.fromAccount; + this.toAccount = builder.toAccount; + } + + public static FollowDeleteRequest.Builder builder() { + return new FollowDeleteRequest.Builder(); + } + + public String getFromAccount() { + return fromAccount; + } + + public void setFromAccount(String fromAccount) { + this.fromAccount = fromAccount; + } + + public List getToAccount() { + return toAccount; + } + + public void setToAccount(List toAccount) { + this.toAccount = toAccount; + } + + + public static final class Builder { + private String fromAccount; + private List toAccount; + + private Builder() { + } + + public FollowDeleteRequest build() { + return new FollowDeleteRequest(this); + } + + public FollowDeleteRequest.Builder fromAccount(String fromAccount) { + this.fromAccount = fromAccount; + return this; + } + + public FollowDeleteRequest.Builder toAccount(List toAccount) { + this.toAccount = toAccount; + return this; + } + } +} diff --git a/src/main/java/io/github/doocs/im/model/request/FollowGetInfoRequest.java b/src/main/java/io/github/doocs/im/model/request/FollowGetInfoRequest.java new file mode 100644 index 00000000..112a5f29 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/request/FollowGetInfoRequest.java @@ -0,0 +1,88 @@ +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 MC.Yang + * @version V1.0 + **/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class FollowGetInfoRequest extends GenericRequest implements Serializable { + private static final long serialVersionUID = 198471997889646572L; + + /** + * 发起拉取操作的用户的 UserID + */ + @JsonProperty("From_Account") + private String fromAccount; + + /** + * 待拉取计数的用户的 UserID,单次请求的 To_Account 数不得超过20 + */ + @JsonProperty("To_Account") + private List toAccount; + + public FollowGetInfoRequest() { + } + + public FollowGetInfoRequest(String fromAccount, List toAccount) { + this.fromAccount = fromAccount; + this.toAccount = toAccount; + } + + private FollowGetInfoRequest(FollowGetInfoRequest.Builder builder) { + this.fromAccount = builder.fromAccount; + this.toAccount = builder.toAccount; + } + + public static FollowGetInfoRequest.Builder builder() { + return new FollowGetInfoRequest.Builder(); + } + + public String getFromAccount() { + return fromAccount; + } + + public void setFromAccount(String fromAccount) { + this.fromAccount = fromAccount; + } + + public List getToAccount() { + return toAccount; + } + + public void setToAccount(List toAccount) { + this.toAccount = toAccount; + } + + + public static final class Builder { + private String fromAccount; + private List toAccount; + + private Builder() { + } + + public FollowGetInfoRequest build() { + return new FollowGetInfoRequest(this); + } + + public FollowGetInfoRequest.Builder fromAccount(String fromAccount) { + this.fromAccount = fromAccount; + return this; + } + + public FollowGetInfoRequest.Builder toAccount(List toAccount) { + this.toAccount = toAccount; + return this; + } + } +} diff --git a/src/main/java/io/github/doocs/im/model/request/FollowGetRequest.java b/src/main/java/io/github/doocs/im/model/request/FollowGetRequest.java new file mode 100644 index 00000000..f31bf0ed --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/request/FollowGetRequest.java @@ -0,0 +1,134 @@ +package io.github.doocs.im.model.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +/** + *

+ * 拉取关注、粉丝与互关列表-请求参数 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class FollowGetRequest extends GenericRequest implements Serializable { + private static final long serialVersionUID = 1259725175653532351L; + + /** + * 用户的 UserID + */ + @JsonProperty("From_Account") + private String fromAccount; + + /** + * 待拉取的类型: + * 1 - 粉丝 + * 2 - 关注 + * 3 - 互关 + */ + @JsonProperty("FollowType") + private Integer followType; + + /** + * 分页的起始位置:首页为空,续拉请求填上一页回包返回的 NextCursor 字段 + */ + @JsonProperty("StartCursor") + private String startCursor; + + /** + * 拉取的数量:默认每页返回100条数据,最多支持1000条数据 + */ + @JsonProperty("WantNum") + private Integer wantNum; + + public FollowGetRequest() { + } + + public FollowGetRequest(String fromAccount, Integer followType, String startCursor, Integer wantNum) { + this.fromAccount = fromAccount; + this.followType = followType; + this.startCursor = startCursor; + this.wantNum = wantNum; + } + + private FollowGetRequest(FollowGetRequest.Builder builder) { + this.fromAccount = builder.fromAccount; + this.followType = builder.followType; + this.startCursor = builder.startCursor; + this.wantNum = builder.wantNum; + } + + public static FollowGetRequest.Builder builder() { + return new FollowGetRequest.Builder(); + } + + public String getFromAccount() { + return fromAccount; + } + + public void setFromAccount(String fromAccount) { + this.fromAccount = fromAccount; + } + + public Integer getFollowType() { + return followType; + } + + public void setFollowType(Integer followType) { + this.followType = followType; + } + + public String getStartCursor() { + return startCursor; + } + + public void setStartCursor(String startCursor) { + this.startCursor = startCursor; + } + + public Integer getWantNum() { + return wantNum; + } + + public void setWantNum(Integer wantNum) { + this.wantNum = wantNum; + } + + public static final class Builder { + private String fromAccount; + private Integer followType; + private String startCursor; + private Integer wantNum; + + private Builder() { + } + + public FollowGetRequest build() { + return new FollowGetRequest(this); + } + + public FollowGetRequest.Builder fromAccount(String fromAccount) { + this.fromAccount = fromAccount; + return this; + } + + public FollowGetRequest.Builder followType(Integer followType) { + this.followType = followType; + return this; + } + + public FollowGetRequest.Builder startCursor(String startCursor) { + this.startCursor = startCursor; + return this; + } + + public FollowGetRequest.Builder wantNum(Integer wantNum) { + this.wantNum = wantNum; + return this; + } + + } +} diff --git a/src/main/java/io/github/doocs/im/model/request/FollowRequestItem.java b/src/main/java/io/github/doocs/im/model/request/FollowRequestItem.java new file mode 100644 index 00000000..dd2f5f52 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/request/FollowRequestItem.java @@ -0,0 +1,62 @@ +package io.github.doocs.im.model.request; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +/** + *

+ * 关注请求结构体对象 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +public class FollowRequestItem implements Serializable { + private static final long serialVersionUID = -9020322405344913908L; + + /** + * 待关注的用户的 UserID,单次请求的 To_Account 数不得超过20 + */ + @JsonProperty("To_Account") + private String toAccount; + + public FollowRequestItem() { + } + + public FollowRequestItem(String toAccount) { + this.toAccount = toAccount; + } + + private FollowRequestItem(FollowRequestItem.Builder builder) { + this.toAccount = builder.toAccount; + } + + public static FollowRequestItem.Builder builder() { + return new FollowRequestItem.Builder(); + } + + public String getToAccount() { + return toAccount; + } + + public void setToAccount(String toAccount) { + this.toAccount = toAccount; + } + + public static final class Builder { + private String toAccount; + + private Builder() { + } + + public FollowRequestItem build() { + return new FollowRequestItem(this); + } + + public FollowRequestItem.Builder toAccount(String toAccount) { + this.toAccount = toAccount; + return this; + } + } +} diff --git a/src/main/java/io/github/doocs/im/model/response/FollowAddResult.java b/src/main/java/io/github/doocs/im/model/response/FollowAddResult.java new file mode 100644 index 00000000..cf295631 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/FollowAddResult.java @@ -0,0 +1,57 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 关注用户-结果 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +public class FollowAddResult extends GenericResult implements Serializable { + private static final long serialVersionUID = -8463119745041284748L; + + /** + * 批量关注的结果对象数组 + */ + @JsonProperty("ResultItem") + private List resultItemList; + + /** + * 详细的客户端展示信息 + */ + @JsonProperty("ErrorDisplay") + private String errorDisplay; + + public List getResultItemList() { + return resultItemList; + } + + public void setResultItemList(List resultItemList) { + this.resultItemList = resultItemList; + } + + public String getErrorDisplay() { + return errorDisplay; + } + + public void setErrorDisplay(String errorDisplay) { + this.errorDisplay = errorDisplay; + } + + @Override + public String toString() { + return "FriendAddResult{" + + "resultItemList=" + resultItemList + + ", errorDisplay='" + errorDisplay + '\'' + + ", actionStatus='" + actionStatus + '\'' + + ", errorInfo='" + errorInfo + '\'' + + ", errorCode=" + errorCode + + '}'; + } +} diff --git a/src/main/java/io/github/doocs/im/model/response/FollowCheckResult.java b/src/main/java/io/github/doocs/im/model/response/FollowCheckResult.java new file mode 100644 index 00000000..5b399828 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/FollowCheckResult.java @@ -0,0 +1,57 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 检查关注关系-结果 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +public class FollowCheckResult extends GenericResult implements Serializable { + private static final long serialVersionUID = 950703576946301497L; + + /** + * 校验结果对象数组 + */ + @JsonProperty("ResultItem") + private List resultItemList; + + /** + * 详细的客户端展示信息 + */ + @JsonProperty("ErrorDisplay") + private String errorDisplay; + + public List getResultItemList() { + return resultItemList; + } + + public void setResultItemList(List resultItemList) { + this.resultItemList = resultItemList; + } + + public String getErrorDisplay() { + return errorDisplay; + } + + public void setErrorDisplay(String errorDisplay) { + this.errorDisplay = errorDisplay; + } + + @Override + public String toString() { + return "FollowCheckResult{" + + "resultItemList=" + resultItemList + + ", errorDisplay='" + errorDisplay + '\'' + + ", actionStatus='" + actionStatus + '\'' + + ", errorInfo='" + errorInfo + '\'' + + ", errorCode=" + errorCode + + '}'; + } +} diff --git a/src/main/java/io/github/doocs/im/model/response/FollowCheckResultItem.java b/src/main/java/io/github/doocs/im/model/response/FollowCheckResultItem.java new file mode 100644 index 00000000..bd5a3387 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/FollowCheckResultItem.java @@ -0,0 +1,45 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +/** + *

+ * 校验结果对象 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +public class FollowCheckResultItem extends ResultItem implements Serializable { + private static final long serialVersionUID = -6833184498334647596L; + + /** + * 校验成功时 To_Account 与 From_Account 之间的关注关系: + * 0 - From_Account 没有关注 To_Account,To_Account 也没有关注 From_Account。 + * 1 - From_Account 没有关注 To_Account,To_Account 关注了 From_Account。 + * 2 - From_Account 关注了 To_Account,To_Account 没有关注 From_Account。 + * 3 - From_Account 关注了 To_Account,To_Account 也关注了 From_Account。 + */ + @JsonProperty("FollowType") + private Integer followType; + + public Integer getFollowType() { + return followType; + } + + public void setFollowType(Integer followType) { + this.followType = followType; + } + + @Override + public String toString() { + return "FollowCheckResultItem{" + + "toAccount='" + getToAccount() + '\'' + + ", resultCode=" + getResultCode() + + ", resultInfo='" + getResultInfo() + '\'' + + ", followType=" + followType + + '}'; + } +} diff --git a/src/main/java/io/github/doocs/im/model/response/FollowDeleteResult.java b/src/main/java/io/github/doocs/im/model/response/FollowDeleteResult.java new file mode 100644 index 00000000..987ff188 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/FollowDeleteResult.java @@ -0,0 +1,57 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 取消关注用户-结果 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +public class FollowDeleteResult extends GenericResult implements Serializable { + private static final long serialVersionUID = 3253549117573601073L; + + /** + * 批量取关的结果对象数组 + */ + @JsonProperty("ResultItem") + private List resultItemList; + + /** + * 详细的客户端展示信息 + */ + @JsonProperty("ErrorDisplay") + private String errorDisplay; + + public List getResultItemList() { + return resultItemList; + } + + public void setResultItemList(List resultItemList) { + this.resultItemList = resultItemList; + } + + public String getErrorDisplay() { + return errorDisplay; + } + + public void setErrorDisplay(String errorDisplay) { + this.errorDisplay = errorDisplay; + } + + @Override + public String toString() { + return "FriendAddResult{" + + "resultItemList=" + resultItemList + + ", errorDisplay='" + errorDisplay + '\'' + + ", actionStatus='" + actionStatus + '\'' + + ", errorInfo='" + errorInfo + '\'' + + ", errorCode=" + errorCode + + '}'; + } +} diff --git a/src/main/java/io/github/doocs/im/model/response/FollowGetInfoResult.java b/src/main/java/io/github/doocs/im/model/response/FollowGetInfoResult.java new file mode 100644 index 00000000..d8d2a4e3 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/FollowGetInfoResult.java @@ -0,0 +1,57 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 获取用户的关注、粉丝与互关数-结果 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +public class FollowGetInfoResult extends GenericResult implements Serializable { + private static final long serialVersionUID = 6489950260163429701L; + + /** + * 拉取的结果对象数组 + */ + @JsonProperty("FollowInfo") + private List followInfoList; + + /** + * 详细的客户端展示信息 + */ + @JsonProperty("ErrorDisplay") + private String errorDisplay; + + public List getFollowInfoList() { + return followInfoList; + } + + public void setFollowInfoList(List followInfoList) { + this.followInfoList = followInfoList; + } + + public String getErrorDisplay() { + return errorDisplay; + } + + public void setErrorDisplay(String errorDisplay) { + this.errorDisplay = errorDisplay; + } + + @Override + public String toString() { + return "FollowGetInfoResult{" + + "followInfoList=" + followInfoList + + ", errorDisplay='" + errorDisplay + '\'' + + ", actionStatus='" + actionStatus + '\'' + + ", errorInfo='" + errorInfo + '\'' + + ", errorCode=" + errorCode + + '}'; + } +} diff --git a/src/main/java/io/github/doocs/im/model/response/FollowGetResult.java b/src/main/java/io/github/doocs/im/model/response/FollowGetResult.java new file mode 100644 index 00000000..154c50fe --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/FollowGetResult.java @@ -0,0 +1,57 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 拉取关注、粉丝与互关列表-结果 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +public class FollowGetResult extends GenericResult implements Serializable { + private static final long serialVersionUID = -374927471394227839L; + + /** + * 粉丝/关注/互关列表 + */ + @JsonProperty("FollowItem") + private List followItemList; + + /** + * 下一页的起始位置,为空时表示已拉到全量数据 + */ + @JsonProperty("NextCursor") + private String nextCursor; + + public List getFollowItemList() { + return followItemList; + } + + public void setFollowItemList(List followItemList) { + this.followItemList = followItemList; + } + + public String getNextCursor() { + return nextCursor; + } + + public void setNextCursor(String nextCursor) { + this.nextCursor = nextCursor; + } + + @Override + public String toString() { + return "FollowGetResult{" + + "followItemList=" + followItemList + + ", nextCursor='" + nextCursor + '\'' + + ", actionStatus='" + actionStatus + '\'' + + ", errorInfo='" + errorInfo + '\'' + + ", errorCode=" + errorCode + + '}'; + } +} diff --git a/src/main/java/io/github/doocs/im/model/response/FollowInfoResultItem.java b/src/main/java/io/github/doocs/im/model/response/FollowInfoResultItem.java new file mode 100644 index 00000000..1ba313e4 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/FollowInfoResultItem.java @@ -0,0 +1,72 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +/** + *

+ * 拉取的结果对象 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +public class FollowInfoResultItem extends ResultItem implements Serializable { + private static final long serialVersionUID = 6150410504453879405L; + + /** + * To_Account 的粉丝数 + */ + @JsonProperty("FollowerCount") + private Integer followerCount; + + /** + * To_Account 的关注数 + */ + @JsonProperty("FollowingCount") + private Integer followingCount; + + /** + * To_Account 的互关数 + */ + @JsonProperty("MutualFollowingCount") + private Integer mutualFollowingCount; + + public Integer getFollowerCount() { + return followerCount; + } + + public void setFollowerCount(Integer followerCount) { + this.followerCount = followerCount; + } + + public Integer getFollowingCount() { + return followingCount; + } + + public void setFollowingCount(Integer followingCount) { + this.followingCount = followingCount; + } + + public Integer getMutualFollowingCount() { + return mutualFollowingCount; + } + + public void setMutualFollowingCount(Integer mutualFollowingCount) { + this.mutualFollowingCount = mutualFollowingCount; + } + + @Override + public String toString() { + return "FollowInfoResultItem{" + + "followerCount=" + followerCount + + ", followingCount=" + followingCount + + ", mutualFollowingCount=" + mutualFollowingCount + + ", toAccount='" + getToAccount() + '\'' + + ", resultCode=" + getResultCode() + + ", resultInfo='" + getResultInfo() + '\'' + + '}'; + } + +} diff --git a/src/main/java/io/github/doocs/im/model/response/FollowResultItem.java b/src/main/java/io/github/doocs/im/model/response/FollowResultItem.java new file mode 100644 index 00000000..13fc0861 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/FollowResultItem.java @@ -0,0 +1,70 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.github.doocs.im.model.request.ProfileItem; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 粉丝/关注/互关列表 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +public class FollowResultItem implements Serializable { + private static final long serialVersionUID = -3806086675364942543L; + + /** + * 粉丝/关注/互关的用户的 UserID + */ + @JsonProperty("To_Account") + private String toAccount; + + /** + * 关注时间 + */ + @JsonProperty("FollowTime") + private Integer followTime; + + /** + * 用户资料 + */ + @JsonProperty("ProfileItem") + private List profileItemList; + + public String getToAccount() { + return toAccount; + } + + public void setToAccount(String toAccount) { + this.toAccount = toAccount; + } + + public Integer getFollowTime() { + return followTime; + } + + public void setFollowTime(Integer followTime) { + this.followTime = followTime; + } + + public List getProfileItemList() { + return profileItemList; + } + + public void setProfileItemList(List profileItemList) { + this.profileItemList = profileItemList; + } + + @Override + public String toString() { + return "FollowResultItem{" + + "toAccount='" + toAccount + '\'' + + ", followTime=" + followTime + + ", profileItemList=" + profileItemList + + '}'; + } +} diff --git a/src/test/java/io/github/doocs/im/core/SnsTest.java b/src/test/java/io/github/doocs/im/core/SnsTest.java index 00e4ed7f..49b177a3 100644 --- a/src/test/java/io/github/doocs/im/core/SnsTest.java +++ b/src/test/java/io/github/doocs/im/core/SnsTest.java @@ -254,4 +254,64 @@ void testGroupGet() throws IOException { System.out.println(result); Assertions.assertEquals(ActionStatus.OK, result.getActionStatus()); } + + @Test + void testFollowAdd() throws IOException { + FollowRequestItem followRequestItem = FollowRequestItem.builder().toAccount("test2").build(); + List followRequestItemList = Collections.singletonList(followRequestItem); + FollowAddRequest request = FollowAddRequest.builder() + .fromAccount("test1") + .followItemList(followRequestItemList) + .build(); + FollowAddResult result = client.sns.followAdd(request); + System.out.println(result); + Assertions.assertEquals(ActionStatus.OK, result.getActionStatus()); + } + + @Test + void testFollowDelete() throws IOException { + List toAccount = Collections.singletonList("test2"); + FollowDeleteRequest request = FollowDeleteRequest.builder() + .fromAccount("test1") + .toAccount(toAccount) + .build(); + FollowDeleteResult result = client.sns.followDelete(request); + System.out.println(result); + Assertions.assertEquals(ActionStatus.OK, result.getActionStatus()); + } + + @Test + void testFollowGet() throws IOException { + FollowGetRequest request = FollowGetRequest.builder() + .fromAccount("test2") + .followType(1) + .build(); + FollowGetResult result = client.sns.followGet(request); + System.out.println(result); + Assertions.assertEquals(ActionStatus.OK, result.getActionStatus()); + } + + @Test + void testFollowCheck() throws IOException { + List toAccount = Collections.singletonList("test2"); + FollowCheckRequest request = FollowCheckRequest.builder() + .fromAccount("test1") + .toAccount(toAccount) + .build(); + FollowCheckResult result = client.sns.followCheck(request); + System.out.println(result); + Assertions.assertEquals(ActionStatus.OK, result.getActionStatus()); + } + + @Test + void testFollowGetInfo() throws IOException { + List toAccount = Collections.singletonList("test2"); + FollowGetInfoRequest request = FollowGetInfoRequest.builder() + .fromAccount("test1") + .toAccount(toAccount) + .build(); + FollowGetInfoResult result = client.sns.followGetInfo(request); + System.out.println(result); + Assertions.assertEquals(ActionStatus.OK, result.getActionStatus()); + } } From b43bf06a914fb211af7620df35227222858b1c95 Mon Sep 17 00:00:00 2001 From: ooail <1184010001@qq.com> Date: Thu, 29 Jan 2026 14:55:24 +0800 Subject: [PATCH 3/7] =?UTF-8?q?feat(core):=20=E6=B7=BB=E5=8A=A0=E4=BA=91?= =?UTF-8?q?=E7=AB=AF=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 CloudSearch 核心类,支持用户、群组、群成员搜索 - 实现隐藏搜索对象的设置与查询接口 - 在 ImClient 中集成 cloudSearch 实例,支持搜索功能调用 - 添加 GroupSearchRequest、GroupMemberSearchRequest、GetNoVisibilityRequest 等请求参数类 - 添加 GroupSearchResult、GroupMemberSearchResult、GetNoVisibilitySearchResult 等响应结果类 - 建立 GroupSearchItem、GroupMemberItem、NoVisibleDataItem、ProfileItemValue 等辅助数据模型 - 新增 CloudSearchTest 测试类,覆盖各种搜索接口调用验证 - 更新 .gitignore 排除测试资源文件路径 /src/test/resources/app.properties --- .gitignore | 3 +- .../java/io/github/doocs/im/ImClient.java | 2 + .../io/github/doocs/im/core/CloudSearch.java | 125 +++++++++++ .../model/request/GetNoVisibilityRequest.java | 115 ++++++++++ .../request/GroupMemberSearchRequest.java | 180 ++++++++++++++++ .../im/model/request/GroupSearchRequest.java | 157 ++++++++++++++ .../model/request/SetVisibilityRequest.java | 137 ++++++++++++ .../im/model/request/UserSearchRequest.java | 204 ++++++++++++++++++ .../response/GetNoVisibilitySearchResult.java | 89 ++++++++ .../im/model/response/GroupMemberItem.java | 126 +++++++++++ .../response/GroupMemberSearchResult.java | 87 ++++++++ .../im/model/response/GroupSearchItem.java | 175 +++++++++++++++ .../im/model/response/GroupSearchResult.java | 89 ++++++++ .../im/model/response/NoVisibleDataItem.java | 61 ++++++ .../im/model/response/ProfileItemValue.java | 77 +++++++ .../response/SetVisibilitySearchResult.java | 15 ++ .../model/response/UserProfileResultItem.java | 62 ++++++ .../im/model/response/UserSearchResult.java | 89 ++++++++ .../github/doocs/im/core/CloudSearchTest.java | 98 +++++++++ 19 files changed, 1890 insertions(+), 1 deletion(-) create mode 100644 src/main/java/io/github/doocs/im/core/CloudSearch.java create mode 100644 src/main/java/io/github/doocs/im/model/request/GetNoVisibilityRequest.java create mode 100644 src/main/java/io/github/doocs/im/model/request/GroupMemberSearchRequest.java create mode 100644 src/main/java/io/github/doocs/im/model/request/GroupSearchRequest.java create mode 100644 src/main/java/io/github/doocs/im/model/request/SetVisibilityRequest.java create mode 100644 src/main/java/io/github/doocs/im/model/request/UserSearchRequest.java create mode 100644 src/main/java/io/github/doocs/im/model/response/GetNoVisibilitySearchResult.java create mode 100644 src/main/java/io/github/doocs/im/model/response/GroupMemberItem.java create mode 100644 src/main/java/io/github/doocs/im/model/response/GroupMemberSearchResult.java create mode 100644 src/main/java/io/github/doocs/im/model/response/GroupSearchItem.java create mode 100644 src/main/java/io/github/doocs/im/model/response/GroupSearchResult.java create mode 100644 src/main/java/io/github/doocs/im/model/response/NoVisibleDataItem.java create mode 100644 src/main/java/io/github/doocs/im/model/response/ProfileItemValue.java create mode 100644 src/main/java/io/github/doocs/im/model/response/SetVisibilitySearchResult.java create mode 100644 src/main/java/io/github/doocs/im/model/response/UserProfileResultItem.java create mode 100644 src/main/java/io/github/doocs/im/model/response/UserSearchResult.java create mode 100644 src/test/java/io/github/doocs/im/core/CloudSearchTest.java diff --git a/.gitignore b/.gitignore index 0cbb1bdc..ad1c45ac 100644 --- a/.gitignore +++ b/.gitignore @@ -48,4 +48,5 @@ yarn.lock ### Cloudflare ### .wrangler/ .dev.vars -wrangler.toml.local \ No newline at end of file +wrangler.toml.local +/src/test/resources/app.properties diff --git a/src/main/java/io/github/doocs/im/ImClient.java b/src/main/java/io/github/doocs/im/ImClient.java index 15de1c74..4c2e4f5e 100644 --- a/src/main/java/io/github/doocs/im/ImClient.java +++ b/src/main/java/io/github/doocs/im/ImClient.java @@ -40,6 +40,7 @@ public class ImClient { public final Robot robot; public final Audit audit; public final OfficialAccount officialAccount; + public final CloudSearch cloudSearch; public static ImClient getInstance(long sdkAppId, String userId, String key) { return new ImClient(sdkAppId, userId, key); @@ -97,6 +98,7 @@ public ImClient(long sdkAppId, String userId, String key, String domain, ClientC robot = new Robot(this); audit = new Audit(this); officialAccount = new OfficialAccount(this); + cloudSearch = new CloudSearch(this); } /** diff --git a/src/main/java/io/github/doocs/im/core/CloudSearch.java b/src/main/java/io/github/doocs/im/core/CloudSearch.java new file mode 100644 index 00000000..a4f73b67 --- /dev/null +++ b/src/main/java/io/github/doocs/im/core/CloudSearch.java @@ -0,0 +1,125 @@ +package io.github.doocs.im.core; + +import io.github.doocs.im.ImClient; +import io.github.doocs.im.model.request.*; +import io.github.doocs.im.model.response.*; +import io.github.doocs.im.util.HttpUtil; + +import java.io.IOException; + +/** + *

+ * 云端搜索 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +public class CloudSearch { + /** + * 账号管理服务名 + */ + public static final String SERVICE_NAME_USER = "user_search"; + public static final String SERVICE_NAME_GROUP = "group_search"; + public static final String SERVICE_NAME_GROUP_MEMBER = "group_member_search"; + public static final String SERVICE_NAME_IM_OPEN = "im_open_search"; + + /** + * 账号管理相关命令字 + */ + public static final String SEARCH_COMMAND = "search"; + public static final String SET_VISIBILITY_COMMAND = "set_visibility"; + public static final String GET_NO_VISIBILITY_COMMAND = "get_no_visibility"; + + private final ImClient imClient; + + public CloudSearch(ImClient imClient) { + this.imClient = imClient; + } + + /** + * 用户搜索 + * + * @param userSearchRequest 用户搜索请求参数 + * @return 用户搜索结果 + * @throws IOException 用户搜索异常 + */ + public UserSearchResult userSearch(UserSearchRequest userSearchRequest) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_USER, SEARCH_COMMAND); + return HttpUtil.post(url, userSearchRequest, UserSearchResult.class, imClient.getConfig()); + } + + public UserSearchResult userSearch(UserSearchRequest userSearchRequest, long random) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_USER, SEARCH_COMMAND, random); + return HttpUtil.post(url, userSearchRequest, UserSearchResult.class, imClient.getConfig()); + } + + /** + * 群组搜索 + * + * @param groupSearchRequest 群组搜索请求参数 + * @return 群组搜索结果 + * @throws IOException 群组搜索异常 + */ + public GroupSearchResult groupSearch(GroupSearchRequest groupSearchRequest) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_GROUP, SEARCH_COMMAND); + return HttpUtil.post(url, groupSearchRequest, GroupSearchResult.class, imClient.getConfig()); + } + + public GroupSearchResult groupSearch(GroupSearchRequest groupSearchRequest, long random) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_GROUP, SEARCH_COMMAND, random); + return HttpUtil.post(url, groupSearchRequest, GroupSearchResult.class, imClient.getConfig()); + } + + /** + * 群成员搜索 + * + * @param groupMemberSearchRequest 群成员搜索请求参数 + * @return 群成员搜索结果 + * @throws IOException 群成员搜索异常 + */ + public GroupMemberSearchResult groupMemberSearch(GroupMemberSearchRequest groupMemberSearchRequest) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_GROUP_MEMBER, SEARCH_COMMAND); + return HttpUtil.post(url, groupMemberSearchRequest, GroupMemberSearchResult.class, imClient.getConfig()); + } + + public GroupMemberSearchResult groupMemberSearch(GroupMemberSearchRequest groupMemberSearchRequest, long random) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_GROUP_MEMBER, SEARCH_COMMAND, random); + return HttpUtil.post(url, groupMemberSearchRequest, GroupMemberSearchResult.class, imClient.getConfig()); + } + + /** + * 隐藏搜索对象 + * + * @param setVisibilityRequest 隐藏搜索对象请求参数 + * @return 隐藏搜索对象结果 + * @throws IOException 隐藏搜索对象异常 + */ + public SetVisibilitySearchResult setVisibility(SetVisibilityRequest setVisibilityRequest) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_IM_OPEN, SET_VISIBILITY_COMMAND); + return HttpUtil.post(url, setVisibilityRequest, SetVisibilitySearchResult.class, imClient.getConfig()); + } + + public SetVisibilitySearchResult setVisibility(SetVisibilityRequest setVisibilityRequest, long random) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_IM_OPEN, SET_VISIBILITY_COMMAND, random); + return HttpUtil.post(url, setVisibilityRequest, SetVisibilitySearchResult.class, imClient.getConfig()); + } + + /** + * 查询隐藏搜索对象 + * + * @param getNoVisibilityRequest 查询隐藏搜索对象请求参数 + * @return 查询隐藏搜索对象结果 + * @throws IOException 查询隐藏搜索对象异常 + */ + public GetNoVisibilitySearchResult getNoVisibility(GetNoVisibilityRequest getNoVisibilityRequest) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_IM_OPEN, GET_NO_VISIBILITY_COMMAND); + return HttpUtil.post(url, getNoVisibilityRequest, GetNoVisibilitySearchResult.class, imClient.getConfig()); + } + + public GetNoVisibilitySearchResult getNoVisibility(GetNoVisibilityRequest getNoVisibilityRequest, long random) throws IOException { + String url = imClient.getUrl(SERVICE_NAME_IM_OPEN, GET_NO_VISIBILITY_COMMAND, random); + return HttpUtil.post(url, getNoVisibilityRequest, GetNoVisibilitySearchResult.class, imClient.getConfig()); + } + +} diff --git a/src/main/java/io/github/doocs/im/model/request/GetNoVisibilityRequest.java b/src/main/java/io/github/doocs/im/model/request/GetNoVisibilityRequest.java new file mode 100644 index 00000000..f3ea073a --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/request/GetNoVisibilityRequest.java @@ -0,0 +1,115 @@ +package io.github.doocs.im.model.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +/** + *

+ * 查询隐藏搜索对象-请求参数 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GetNoVisibilityRequest extends GenericRequest implements Serializable { + private static final long serialVersionUID = 8616458085271489051L; + + /** + * 搜索对象类型: + * 1=用户搜索。 + * 2=群组搜索。 + * 3=群成员搜索。 + */ + @JsonProperty("SetType") + private Integer setType; + + /** + * 当次查询搜索对象的数量。 + */ + @JsonProperty("Count") + private Integer count; + + /** + * 续拉参数,上个请求的 Response 中带回,首次请求为空。 + */ + @JsonProperty("Cursor") + private String cursor; + + public GetNoVisibilityRequest() { + } + + public GetNoVisibilityRequest(Integer setType) { + this.setType = setType; + } + + public GetNoVisibilityRequest(Integer setType, Integer count, String cursor) { + this.setType = setType; + this.count = count; + this.cursor = cursor; + } + + private GetNoVisibilityRequest(Builder builder) { + this.setType = builder.setType; + this.count = builder.count; + this.cursor = builder.cursor; + } + + public static Builder builder() { + return new Builder(); + } + + public Integer getSetType() { + return setType; + } + + public void setSetType(Integer setType) { + this.setType = setType; + } + + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public String getCursor() { + return cursor; + } + + public void setCursor(String cursor) { + this.cursor = cursor; + } + + public static final class Builder { + private Integer setType; + private Integer count; + private String cursor; + + private Builder() { + } + + public GetNoVisibilityRequest build() { + return new GetNoVisibilityRequest(this); + } + + public Builder setType(Integer setType) { + this.setType = setType; + return this; + } + + public Builder count(Integer count) { + this.count = count; + return this; + } + + public Builder cursor(String cursor) { + this.cursor = cursor; + return this; + } + } +} diff --git a/src/main/java/io/github/doocs/im/model/request/GroupMemberSearchRequest.java b/src/main/java/io/github/doocs/im/model/request/GroupMemberSearchRequest.java new file mode 100644 index 00000000..e5934df1 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/request/GroupMemberSearchRequest.java @@ -0,0 +1,180 @@ +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 MC.Yang + * @version V1.0 + **/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GroupMemberSearchRequest extends GenericRequest implements Serializable { + private static final long serialVersionUID = -8624057806267198381L; + + /** + * 群组类型 + * {@link io.github.doocs.im.constant.GroupType} + */ + @JsonProperty("GroupType") + private List groupType; + + /** + * 过滤群组范围 + */ + @JsonProperty("GroupIdList") + private List groupIdList; + + /** + * 逻辑运算符。 + * 1:and + * 0:or + * 默认为 or。 + */ + @JsonProperty("KeywordMatchType") + private Integer keywordMatchType; + + /** + * 模糊搜索的 Keywords。 + */ + @JsonProperty("Keywords") + private List keywords; + + /** + * 一次请求最大记录数,最大100条,超过100条按100处理。 + */ + @JsonProperty("Count") + private Integer count; + + /** + * 续拉参数,上个请求的 Response 中带回,首次请求为空。 + */ + @JsonProperty("Cursor") + private String cursor; + + public GroupMemberSearchRequest() { + } + + public GroupMemberSearchRequest(List groupType, List groupIdList, Integer keywordMatchType, + List keywords, Integer count, String cursor) { + this.groupType = groupType; + this.groupIdList = groupIdList; + this.keywordMatchType = keywordMatchType; + this.keywords = keywords; + this.count = count; + this.cursor = cursor; + } + + private GroupMemberSearchRequest(Builder builder) { + this.groupType = builder.groupType; + this.groupIdList = builder.groupIdList; + this.keywordMatchType = builder.keywordMatchType; + this.keywords = builder.keywords; + this.count = builder.count; + this.cursor = builder.cursor; + } + + public static Builder builder() { + return new Builder(); + } + + public List getGroupType() { + return groupType; + } + + public void setGroupType(List groupType) { + this.groupType = groupType; + } + + public List getGroupIdList() { + return groupIdList; + } + + public void setGroupIdList(List groupIdList) { + this.groupIdList = groupIdList; + } + + public Integer getKeywordMatchType() { + return keywordMatchType; + } + + public void setKeywordMatchType(Integer keywordMatchType) { + this.keywordMatchType = keywordMatchType; + } + + public List getKeywords() { + return keywords; + } + + public void setKeywords(List keywords) { + this.keywords = keywords; + } + + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public String getCursor() { + return cursor; + } + + public void setCursor(String cursor) { + this.cursor = cursor; + } + + public static final class Builder { + private List groupType; + private List groupIdList; + private Integer keywordMatchType; + private List keywords; + private Integer count; + private String cursor; + + private Builder() { + } + + public GroupMemberSearchRequest build() { + return new GroupMemberSearchRequest(this); + } + + public Builder groupType(List groupType) { + this.groupType = groupType; + return this; + } + + public Builder groupIdList(List groupIdList) { + this.groupIdList = groupIdList; + return this; + } + + public Builder keywordMatchType(Integer keywordMatchType) { + this.keywordMatchType = keywordMatchType; + return this; + } + + public Builder keywords(List keywords) { + this.keywords = keywords; + return this; + } + + public Builder count(Integer count) { + this.count = count; + return this; + } + + public Builder cursor(String cursor) { + this.cursor = cursor; + return this; + } + } +} diff --git a/src/main/java/io/github/doocs/im/model/request/GroupSearchRequest.java b/src/main/java/io/github/doocs/im/model/request/GroupSearchRequest.java new file mode 100644 index 00000000..3939e0d2 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/request/GroupSearchRequest.java @@ -0,0 +1,157 @@ +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 MC.Yang + * @version V1.0 + **/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GroupSearchRequest extends GenericRequest implements Serializable { + private static final long serialVersionUID = 2674240830817188609L; + + /** + * 群组类型 + * {@link io.github.doocs.im.constant.GroupType} + */ + @JsonProperty("GroupType") + private List groupType; + + /** + * 逻辑运算符。 + * 1:and + * 0:or + * 默认为 or。 + */ + @JsonProperty("KeywordMatchType") + private Integer keywordMatchType; + + /** + * 模糊搜索的 Keywords。 + */ + @JsonProperty("Keywords") + private List keywords; + + /** + * 一次请求最大记录数,最大100条,超过100条按100条处理。 + */ + @JsonProperty("Count") + private Integer count; + + /** + * 续拉参数,上个请求的 Response 中带回,首次请求为空。 + */ + @JsonProperty("Cursor") + private String cursor; + + public GroupSearchRequest() { + } + + public GroupSearchRequest(List groupType, Integer keywordMatchType, List keywords, Integer count, String cursor) { + this.groupType = groupType; + this.keywordMatchType = keywordMatchType; + this.keywords = keywords; + this.count = count; + this.cursor = cursor; + } + + private GroupSearchRequest(Builder builder) { + this.groupType = builder.groupType; + this.keywordMatchType = builder.keywordMatchType; + this.keywords = builder.keywords; + this.count = builder.count; + this.cursor = builder.cursor; + } + + public static Builder builder() { + return new Builder(); + } + + public List getGroupType() { + return groupType; + } + + public void setGroupType(List groupType) { + this.groupType = groupType; + } + + public Integer getKeywordMatchType() { + return keywordMatchType; + } + + public void setKeywordMatchType(Integer keywordMatchType) { + this.keywordMatchType = keywordMatchType; + } + + public List getKeywords() { + return keywords; + } + + public void setKeywords(List keywords) { + this.keywords = keywords; + } + + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public String getCursor() { + return cursor; + } + + public void setCursor(String cursor) { + this.cursor = cursor; + } + + public static final class Builder { + private List groupType; + private Integer keywordMatchType; + private List keywords; + private Integer count; + private String cursor; + + private Builder() { + } + + public GroupSearchRequest build() { + return new GroupSearchRequest(this); + } + + public Builder groupType(List groupType) { + this.groupType = groupType; + return this; + } + + public Builder keywordMatchType(Integer keywordMatchType) { + this.keywordMatchType = keywordMatchType; + return this; + } + + public Builder keywords(List keywords) { + this.keywords = keywords; + return this; + } + + public Builder count(Integer count) { + this.count = count; + return this; + } + + public Builder cursor(String cursor) { + this.cursor = cursor; + return this; + } + } +} diff --git a/src/main/java/io/github/doocs/im/model/request/SetVisibilityRequest.java b/src/main/java/io/github/doocs/im/model/request/SetVisibilityRequest.java new file mode 100644 index 00000000..5a4fabeb --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/request/SetVisibilityRequest.java @@ -0,0 +1,137 @@ +package io.github.doocs.im.model.request; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +/** + *

+ * 隐藏搜索对象-请求参数 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class SetVisibilityRequest extends GenericRequest implements Serializable { + private static final long serialVersionUID = -5968159529237231169L; + + /** + * 搜索对象类型: + * 1=用户搜索。 + * 2=群组搜索。 + * 3=群成员搜索。 + */ + @JsonProperty("SetType") + private Integer setType; + + /** + * 需要隐藏的用户 UserID,SetType为1和3时需要。 + */ + @JsonProperty("UserID") + private String userId; + + /** + * 需要隐藏的群组 GroupID,SetType为1和2时需要。 + */ + @JsonProperty("GroupID") + private String groupId; + + /** + * 默认为 false,true 表示隐藏对应搜索对象,false 表示显示对应搜索对象。 + */ + @JsonProperty("IsDisable") + private Boolean isDisable; + + public SetVisibilityRequest() { + } + + public SetVisibilityRequest(Integer setType) { + this.setType = setType; + } + + public SetVisibilityRequest(Integer setType, String userId, String groupId, Boolean isDisable) { + this.setType = setType; + this.userId = userId; + this.groupId = groupId; + this.isDisable = isDisable; + } + + private SetVisibilityRequest(Builder builder) { + this.setType = builder.setType; + this.userId = builder.userId; + this.groupId = builder.groupId; + this.isDisable = builder.isDisable; + } + + public static Builder builder() { + return new Builder(); + } + + public Integer getSetType() { + return setType; + } + + public void setSetType(Integer setType) { + this.setType = setType; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public Boolean getIsDisable() { + return isDisable; + } + + public void setIsDisable(Boolean isDisable) { + this.isDisable = isDisable; + } + + public static final class Builder { + private Integer setType; + private String userId; + private String groupId; + private Boolean isDisable; + + private Builder() { + } + + public SetVisibilityRequest build() { + return new SetVisibilityRequest(this); + } + + public Builder setType(Integer setType) { + this.setType = setType; + return this; + } + + public Builder userId(String userId) { + this.userId = userId; + return this; + } + + public Builder groupId(String groupId) { + this.groupId = groupId; + return this; + } + + public Builder isDisable(Boolean isDisable) { + this.isDisable = isDisable; + return this; + } + } +} diff --git a/src/main/java/io/github/doocs/im/model/request/UserSearchRequest.java b/src/main/java/io/github/doocs/im/model/request/UserSearchRequest.java new file mode 100644 index 00000000..38af94b4 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/request/UserSearchRequest.java @@ -0,0 +1,204 @@ +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 MC.Yang + * @version V1.0 + **/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class UserSearchRequest extends GenericRequest implements Serializable { + private static final long serialVersionUID = 5480624981347621262L; + + /** + * 过滤性别,为空表示未指定 + * {@link io.github.doocs.im.constant.GenderType} + */ + @JsonProperty("UserGenderType") + private String userGenderType; + + /** + * 过滤起始出生日期,该字段意义由用户决定,我们只保证为整型 + */ + @JsonProperty("UserBirthStart") + private Integer userBirthStart; + + /** + * 过滤结束出生日期,该字段要比 user_birth_start 大 + */ + @JsonProperty("UserBirthEnd") + private Integer userBirthEnd; + + /** + * 逻辑运算符。1:and 0:or 默认为 or + */ + @JsonProperty("KeywordMatchType") + private Integer keywordMatchType; + + /** + * 模糊搜索的 Keywords + */ + @JsonProperty("Keywords") + private List keywords; + + /** + * 一次请求最大记录数,最大100条,超过100条按100处理 + */ + @JsonProperty("Count") + private Integer count; + + /** + * 续拉参数,上个请求的 Response 中带回,首次请求为空 + */ + @JsonProperty("Cursor") + private String cursor; + + public UserSearchRequest() { + } + + public UserSearchRequest(List keywords, Integer count) { + this.keywords = keywords; + this.count = count; + } + + public UserSearchRequest(String userGenderType, Integer userBirthStart, Integer userBirthEnd, + Integer keywordMatchType, List keywords, Integer count, String cursor) { + this.userGenderType = userGenderType; + this.userBirthStart = userBirthStart; + this.userBirthEnd = userBirthEnd; + this.keywordMatchType = keywordMatchType; + this.keywords = keywords; + this.count = count; + this.cursor = cursor; + } + + private UserSearchRequest(Builder builder) { + this.userGenderType = builder.userGenderType; + this.userBirthStart = builder.userBirthStart; + this.userBirthEnd = builder.userBirthEnd; + this.keywordMatchType = builder.keywordMatchType; + this.keywords = builder.keywords; + this.count = builder.count; + this.cursor = builder.cursor; + } + + public static Builder builder() { + return new Builder(); + } + + public String getUserGenderType() { + return userGenderType; + } + + public void setUserGenderType(String userGenderType) { + this.userGenderType = userGenderType; + } + + public Integer getUserBirthStart() { + return userBirthStart; + } + + public void setUserBirthStart(Integer userBirthStart) { + this.userBirthStart = userBirthStart; + } + + public Integer getUserBirthEnd() { + return userBirthEnd; + } + + public void setUserBirthEnd(Integer userBirthEnd) { + this.userBirthEnd = userBirthEnd; + } + + public Integer getKeywordMatchType() { + return keywordMatchType; + } + + public void setKeywordMatchType(Integer keywordMatchType) { + this.keywordMatchType = keywordMatchType; + } + + public List getKeywords() { + return keywords; + } + + public void setKeywords(List keywords) { + this.keywords = keywords; + } + + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public String getCursor() { + return cursor; + } + + public void setCursor(String cursor) { + this.cursor = cursor; + } + + public static final class Builder { + private String userGenderType; + private Integer userBirthStart; + private Integer userBirthEnd; + private Integer keywordMatchType; + private List keywords; + private Integer count; + private String cursor; + + private Builder() { + } + + public UserSearchRequest build() { + return new UserSearchRequest(this); + } + + public Builder userGenderType(String userGenderType) { + this.userGenderType = userGenderType; + return this; + } + + public Builder userBirthStart(Integer userBirthStart) { + this.userBirthStart = userBirthStart; + return this; + } + + public Builder userBirthEnd(Integer userBirthEnd) { + this.userBirthEnd = userBirthEnd; + return this; + } + + public Builder keywordMatchType(Integer keywordMatchType) { + this.keywordMatchType = keywordMatchType; + return this; + } + + public Builder keywords(List keywords) { + this.keywords = keywords; + return this; + } + + public Builder count(Integer count) { + this.count = count; + return this; + } + + public Builder cursor(String cursor) { + this.cursor = cursor; + return this; + } + } +} diff --git a/src/main/java/io/github/doocs/im/model/response/GetNoVisibilitySearchResult.java b/src/main/java/io/github/doocs/im/model/response/GetNoVisibilitySearchResult.java new file mode 100644 index 00000000..eaf7d86b --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/GetNoVisibilitySearchResult.java @@ -0,0 +1,89 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 查询隐藏搜索对象-结果 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GetNoVisibilitySearchResult extends GenericResult implements Serializable { + private static final long serialVersionUID = 2158713832423564373L; + + /** + * 搜索是否结束 + */ + @JsonProperty("IsFinish") + private Boolean isFinish; + + /** + * 命中的搜索结果个数 + */ + @JsonProperty("TotalCount") + private Integer totalCount; + + /** + * 命中的隐藏搜索对象 + */ + @JsonProperty("NoVisibleData") + private List noVisibleData; + + /** + * 续拉参数,下个请求的 Response 中带回 + */ + @JsonProperty("Cursor") + private Integer cursor; + + public Boolean getIsFinish() { + return isFinish; + } + + public void setIsFinish(Boolean isFinish) { + this.isFinish = isFinish; + } + + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(Integer totalCount) { + this.totalCount = totalCount; + } + + public List getNoVisibleData() { + return noVisibleData; + } + + public void setNoVisibleData(List noVisibleData) { + this.noVisibleData = noVisibleData; + } + + public Integer getCursor() { + return cursor; + } + + public void setCursor(Integer cursor) { + this.cursor = cursor; + } + + @Override + public String toString() { + return "GetNoVisibilitySearchResult{" + + "isFinish=" + isFinish + + ", totalCount=" + totalCount + + ", noVisibleData=" + noVisibleData + + ", cursor=" + cursor + + ", actionStatus='" + actionStatus + '\'' + + ", errorInfo='" + errorInfo + '\'' + + ", errorCode=" + errorCode + + '}'; + } +} diff --git a/src/main/java/io/github/doocs/im/model/response/GroupMemberItem.java b/src/main/java/io/github/doocs/im/model/response/GroupMemberItem.java new file mode 100644 index 00000000..4ff2664d --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/GroupMemberItem.java @@ -0,0 +1,126 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +/** + * 群成员搜索结果项 + * + * @author MC.Yang + * @since 2024/01/29 + */ +public class GroupMemberItem implements Serializable { + private static final long serialVersionUID = 7517968104472517297L; + + /** + * 群组类型 + */ + @JsonProperty("GroupType") + private String groupType; + + /** + * 群组 ID + */ + @JsonProperty("GroupID") + private String groupId; + + /** + * 群组名称 + */ + @JsonProperty("GroupName") + private String groupName; + + /** + * 群成员 UserID + */ + @JsonProperty("GroupMemberUserID") + private String groupMemberUserId; + + /** + * 群成员 TinyID + */ + @JsonProperty("GroupMemberTinyID") + private Long groupMemberTinyId; + + /** + * 群成员用户名 + */ + @JsonProperty("GroupMemberUserName") + private String groupMemberUserName; + + /** + * 群成员名片 + */ + @JsonProperty("GroupMemberNameCard") + private String groupMemberNameCard; + + public String getGroupType() { + return groupType; + } + + public void setGroupType(String groupType) { + this.groupType = groupType; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getGroupName() { + return groupName; + } + + public void setGroupName(String groupName) { + this.groupName = groupName; + } + + public String getGroupMemberUserId() { + return groupMemberUserId; + } + + public void setGroupMemberUserId(String groupMemberUserId) { + this.groupMemberUserId = groupMemberUserId; + } + + public Long getGroupMemberTinyId() { + return groupMemberTinyId; + } + + public void setGroupMemberTinyId(Long groupMemberTinyId) { + this.groupMemberTinyId = groupMemberTinyId; + } + + public String getGroupMemberUserName() { + return groupMemberUserName; + } + + public void setGroupMemberUserName(String groupMemberUserName) { + this.groupMemberUserName = groupMemberUserName; + } + + public String getGroupMemberNameCard() { + return groupMemberNameCard; + } + + public void setGroupMemberNameCard(String groupMemberNameCard) { + this.groupMemberNameCard = groupMemberNameCard; + } + + @Override + public String toString() { + return "GroupMemberItem{" + + "groupType='" + groupType + '\'' + + ", groupId='" + groupId + '\'' + + ", groupName='" + groupName + '\'' + + ", groupMemberUserId='" + groupMemberUserId + '\'' + + ", groupMemberTinyId=" + groupMemberTinyId + + ", groupMemberUserName='" + groupMemberUserName + '\'' + + ", groupMemberNameCard='" + groupMemberNameCard + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/src/main/java/io/github/doocs/im/model/response/GroupMemberSearchResult.java b/src/main/java/io/github/doocs/im/model/response/GroupMemberSearchResult.java new file mode 100644 index 00000000..37f898c1 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/GroupMemberSearchResult.java @@ -0,0 +1,87 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 群成员搜索-结果 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +public class GroupMemberSearchResult extends GenericResult implements Serializable { + private static final long serialVersionUID = 1884672813872948553L; + + /** + * 搜索是否结束 + */ + @JsonProperty("IsFinish") + private Boolean isFinish; + + /** + * 命中的搜索结果个数 + */ + @JsonProperty("TotalCount") + private Integer totalCount; + + /** + * 命中的用户数 + */ + @JsonProperty("GroupMembers") + private List groupMembers; + + /** + * 续拉参数,下个请求的 Response 中带回 + */ + @JsonProperty("Cursor") + private String cursor; + + public Boolean getIsFinish() { + return isFinish; + } + + public void setIsFinish(Boolean isFinish) { + this.isFinish = isFinish; + } + + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(Integer totalCount) { + this.totalCount = totalCount; + } + + public List getGroupMembers() { + return groupMembers; + } + + public void setGroupMembers(List groupMembers) { + this.groupMembers = groupMembers; + } + + public String getCursor() { + return cursor; + } + + public void setCursor(String cursor) { + this.cursor = cursor; + } + + @Override + public String toString() { + return "GroupMemberSearchResult{" + + "isFinish=" + isFinish + + ", totalCount=" + totalCount + + ", groupMembers=" + groupMembers + + ", cursor='" + cursor + '\'' + + ", actionStatus='" + actionStatus + '\'' + + ", errorInfo='" + errorInfo + '\'' + + ", errorCode=" + errorCode + + '}'; + } +} diff --git a/src/main/java/io/github/doocs/im/model/response/GroupSearchItem.java b/src/main/java/io/github/doocs/im/model/response/GroupSearchItem.java new file mode 100644 index 00000000..ec86b042 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/GroupSearchItem.java @@ -0,0 +1,175 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +/** + * 群组搜索结果中的单个群组信息 + * + * @author MC.Yang + * @version V1.0 + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GroupSearchItem implements Serializable { + private static final long serialVersionUID = -42884255649710655L; + + /** + * 群组类型 + */ + @JsonProperty("GroupType") + private String groupType; + + /** + * 群组 ID + */ + @JsonProperty("GroupID") + private String groupId; + + /** + * 群组名称 + */ + @JsonProperty("GroupName") + private String groupName; + + /** + * 群组人数 + */ + @JsonProperty("GroupMemberNum") + private Integer groupMemberNum; + + /** + * 群组头像 + */ + @JsonProperty("GroupFaceUrl") + private String groupFaceUrl; + + /** + * 群组简介 + */ + @JsonProperty("GroupIntroduction") + private String groupIntroduction; + + /** + * 群主 UserID + */ + @JsonProperty("GroupOwnerUserID") + private String groupOwnerUserId; + + /** + * 群主 TinyID + */ + @JsonProperty("GroupOwnerTinyID") + private Integer groupOwnerTinyId; + + /** + * 群主昵称 + */ + @JsonProperty("GroupOwnerUserName") + private String groupOwnerUserName; + + public GroupSearchItem() { + } + + public GroupSearchItem(String groupType, String groupId, String groupName, Integer groupMemberNum, + String groupFaceUrl, String groupIntroduction, String groupOwnerUserId, + Integer groupOwnerTinyId, String groupOwnerUserName) { + this.groupType = groupType; + this.groupId = groupId; + this.groupName = groupName; + this.groupMemberNum = groupMemberNum; + this.groupFaceUrl = groupFaceUrl; + this.groupIntroduction = groupIntroduction; + this.groupOwnerUserId = groupOwnerUserId; + this.groupOwnerTinyId = groupOwnerTinyId; + this.groupOwnerUserName = groupOwnerUserName; + } + + public String getGroupType() { + return groupType; + } + + public void setGroupType(String groupType) { + this.groupType = groupType; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getGroupName() { + return groupName; + } + + public void setGroupName(String groupName) { + this.groupName = groupName; + } + + public Integer getGroupMemberNum() { + return groupMemberNum; + } + + public void setGroupMemberNum(Integer groupMemberNum) { + this.groupMemberNum = groupMemberNum; + } + + public String getGroupFaceUrl() { + return groupFaceUrl; + } + + public void setGroupFaceUrl(String groupFaceUrl) { + this.groupFaceUrl = groupFaceUrl; + } + + public String getGroupIntroduction() { + return groupIntroduction; + } + + public void setGroupIntroduction(String groupIntroduction) { + this.groupIntroduction = groupIntroduction; + } + + public String getGroupOwnerUserId() { + return groupOwnerUserId; + } + + public void setGroupOwnerUserId(String groupOwnerUserId) { + this.groupOwnerUserId = groupOwnerUserId; + } + + public Integer getGroupOwnerTinyId() { + return groupOwnerTinyId; + } + + public void setGroupOwnerTinyId(Integer groupOwnerTinyId) { + this.groupOwnerTinyId = groupOwnerTinyId; + } + + public String getGroupOwnerUserName() { + return groupOwnerUserName; + } + + public void setGroupOwnerUserName(String groupOwnerUserName) { + this.groupOwnerUserName = groupOwnerUserName; + } + + @Override + public String toString() { + return "GroupSearchItem{" + + "groupType='" + groupType + '\'' + + ", groupId='" + groupId + '\'' + + ", groupName='" + groupName + '\'' + + ", groupMemberNum=" + groupMemberNum + + ", groupFaceUrl='" + groupFaceUrl + '\'' + + ", groupIntroduction='" + groupIntroduction + '\'' + + ", groupOwnerUserId='" + groupOwnerUserId + '\'' + + ", groupOwnerTinyId=" + groupOwnerTinyId + + ", groupOwnerUserName='" + groupOwnerUserName + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/src/main/java/io/github/doocs/im/model/response/GroupSearchResult.java b/src/main/java/io/github/doocs/im/model/response/GroupSearchResult.java new file mode 100644 index 00000000..e9d782fa --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/GroupSearchResult.java @@ -0,0 +1,89 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 群组搜索-结果 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class GroupSearchResult extends GenericResult implements Serializable { + private static final long serialVersionUID = 615574387851889873L; + + /** + * 搜索是否结束 + */ + @JsonProperty("IsFinish") + private Boolean isFinish; + + /** + * 命中的搜索结果个数 + */ + @JsonProperty("TotalCount") + private Integer totalCount; + + /** + * 命中的群组数 + */ + @JsonProperty("Groups") + private List groups; + + /** + * 续拉参数,下个请求的 Response 中带回 + */ + @JsonProperty("Cursor") + private Integer cursor; + + public Boolean getIsFinish() { + return isFinish; + } + + public void setIsFinish(Boolean isFinish) { + this.isFinish = isFinish; + } + + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(Integer totalCount) { + this.totalCount = totalCount; + } + + public List getGroups() { + return groups; + } + + public void setGroups(List groups) { + this.groups = groups; + } + + public Integer getCursor() { + return cursor; + } + + public void setCursor(Integer cursor) { + this.cursor = cursor; + } + + @Override + public String toString() { + return "GroupSearchResult{" + + "isFinish=" + isFinish + + ", totalCount=" + totalCount + + ", groups=" + groups + + ", cursor=" + cursor + + ", actionStatus='" + actionStatus + '\'' + + ", errorInfo='" + errorInfo + '\'' + + ", errorCode=" + errorCode + + '}'; + } +} diff --git a/src/main/java/io/github/doocs/im/model/response/NoVisibleDataItem.java b/src/main/java/io/github/doocs/im/model/response/NoVisibleDataItem.java new file mode 100644 index 00000000..b3aaa7a7 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/NoVisibleDataItem.java @@ -0,0 +1,61 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +/** + * 隐藏搜索对象数据 + * + * @author MC.Yang + * @version V1.0 + **/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class NoVisibleDataItem implements Serializable { + private static final long serialVersionUID = -842842556497106534L; + + /** + * 隐藏群成员/用户的 UserID,当 SetType 为2时,表示群成员的 UserID + */ + @JsonProperty("UserID") + private String userId; + + /** + * 隐藏群组 GroupID,当 SetType 为2时,表示群成员所属群组 GroupID + */ + @JsonProperty("GroupID") + private String groupId; + + public NoVisibleDataItem() { + } + + public NoVisibleDataItem(String userId, String groupId) { + this.userId = userId; + this.groupId = groupId; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + @Override + public String toString() { + return "NoVisibleData{" + + "userID='" + userId + '\'' + + ", groupID='" + groupId + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/src/main/java/io/github/doocs/im/model/response/ProfileItemValue.java b/src/main/java/io/github/doocs/im/model/response/ProfileItemValue.java new file mode 100644 index 00000000..3ac649b2 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/ProfileItemValue.java @@ -0,0 +1,77 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; + +/** + * 搜索结果中的资料字段值 + * + * @author MC.Yang + * @version V1.0 + **/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ProfileItemValue implements Serializable { + private static final long serialVersionUID = -42884255649710653L; + + /** + * 资料字段名 + */ + @JsonProperty("Tag") + private String tag; + + /** + * 整型值 + */ + @JsonProperty("IntValue") + private Integer intValue; + + /** + * 字符串值 + */ + @JsonProperty("StrValue") + private String strValue; + + public ProfileItemValue() { + } + + public ProfileItemValue(String tag, Integer intValue, String strValue) { + this.tag = tag; + this.intValue = intValue; + this.strValue = strValue; + } + + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + public Integer getIntValue() { + return intValue; + } + + public void setIntValue(Integer intValue) { + this.intValue = intValue; + } + + public String getStrValue() { + return strValue; + } + + public void setStrValue(String strValue) { + this.strValue = strValue; + } + + @Override + public String toString() { + return "ProfileItemValue{" + + "tag='" + tag + '\'' + + ", intValue=" + intValue + + ", strValue='" + strValue + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/src/main/java/io/github/doocs/im/model/response/SetVisibilitySearchResult.java b/src/main/java/io/github/doocs/im/model/response/SetVisibilitySearchResult.java new file mode 100644 index 00000000..cfc9e555 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/SetVisibilitySearchResult.java @@ -0,0 +1,15 @@ +package io.github.doocs.im.model.response; + +import java.io.Serializable; + +/** + *

+ * 隐藏搜索对象-结果 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +public class SetVisibilitySearchResult extends GenericResult implements Serializable { + private static final long serialVersionUID = -4429134075732633581L; +} diff --git a/src/main/java/io/github/doocs/im/model/response/UserProfileResultItem.java b/src/main/java/io/github/doocs/im/model/response/UserProfileResultItem.java new file mode 100644 index 00000000..b1142a9f --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/UserProfileResultItem.java @@ -0,0 +1,62 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.List; + +/** + * 用户搜索结果中的单个用户信息 + * + * @author MC.Yang + * @version V1.0 + **/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class UserProfileResultItem implements Serializable { + private static final long serialVersionUID = -42884255649710654L; + + /** + * 命中的用户 UserID + */ + @JsonProperty("UserID") + private String userId; + + /** + * 命中的用户所有标准资料字段 + */ + @JsonProperty("ProfileItems") + private List profileItems; + + public UserProfileResultItem() { + } + + public UserProfileResultItem(String userId, List profileItems) { + this.userId = userId; + this.profileItems = profileItems; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public List getProfileItems() { + return profileItems; + } + + public void setProfileItems(List profileItems) { + this.profileItems = profileItems; + } + + @Override + public String toString() { + return "UserProfileResultItem{" + + "userId='" + userId + '\'' + + ", profileItems=" + profileItems + + '}'; + } +} \ No newline at end of file diff --git a/src/main/java/io/github/doocs/im/model/response/UserSearchResult.java b/src/main/java/io/github/doocs/im/model/response/UserSearchResult.java new file mode 100644 index 00000000..a25a6917 --- /dev/null +++ b/src/main/java/io/github/doocs/im/model/response/UserSearchResult.java @@ -0,0 +1,89 @@ +package io.github.doocs.im.model.response; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.List; + +/** + *

+ * 用户搜索-结果 + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class UserSearchResult extends GenericResult implements Serializable { + private static final long serialVersionUID = 42884255649710653L; + + /** + * 搜索是否结束 + */ + @JsonProperty("IsFinish") + private Boolean isFinish; + + /** + * 命中的搜索结果个数 + */ + @JsonProperty("TotalCount") + private Integer totalCount; + + /** + * 命中的用户数 + */ + @JsonProperty("Users") + private List users; + + /** + * 续拉参数,下个请求的 Response 中带回 + */ + @JsonProperty("Cursor") + private Integer cursor; + + public Boolean getIsFinish() { + return isFinish; + } + + public void setIsFinish(Boolean isFinish) { + this.isFinish = isFinish; + } + + public Integer getTotalCount() { + return totalCount; + } + + public void setTotalCount(Integer totalCount) { + this.totalCount = totalCount; + } + + public List getUsers() { + return users; + } + + public void setUsers(List users) { + this.users = users; + } + + public Integer getCursor() { + return cursor; + } + + public void setCursor(Integer cursor) { + this.cursor = cursor; + } + + @Override + public String toString() { + return "UserSearchResult{" + + "isFinish=" + isFinish + + ", totalCount=" + totalCount + + ", users=" + users + + ", cursor=" + cursor + + ", actionStatus='" + actionStatus + '\'' + + ", errorInfo='" + errorInfo + '\'' + + ", errorCode=" + errorCode + + '}'; + } +} diff --git a/src/test/java/io/github/doocs/im/core/CloudSearchTest.java b/src/test/java/io/github/doocs/im/core/CloudSearchTest.java new file mode 100644 index 00000000..e36558d1 --- /dev/null +++ b/src/test/java/io/github/doocs/im/core/CloudSearchTest.java @@ -0,0 +1,98 @@ +package io.github.doocs.im.core; + +import io.github.doocs.im.ClientFactory; +import io.github.doocs.im.ImClient; +import io.github.doocs.im.constant.ActionStatus; +import io.github.doocs.im.constant.GenderType; +import io.github.doocs.im.model.request.*; +import io.github.doocs.im.model.response.*; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; + +/** + *

+ * 云搜索测试类 {@link io.github.doocs.im.core.CloudSearch} + *

+ * + * @author MC.Yang + * @version V1.0 + **/ +public class CloudSearchTest { + + private static ImClient client; + + @BeforeAll + static void setup() { + client = ClientFactory.getInstance(); + Assertions.assertNotNull(client, "client is null"); + } + + @Test + void testUserSearch() throws IOException { + List keywords = Collections.singletonList("test1"); + UserSearchRequest request = UserSearchRequest.builder() + .count(1) + .userGenderType(GenderType.MALE) + .keywordMatchType(1) + .keywords(keywords) + .build(); + UserSearchResult result = client.cloudSearch.userSearch(request); + System.out.println(result); + Assertions.assertEquals(ActionStatus.OK, result.getActionStatus()); + } + + @Test + void testGroupSearch() throws IOException { + GroupSearchRequest request = GroupSearchRequest.builder() + .count(100) + .groupType(Collections.singletonList("Public")) + .keywordMatchType(1) + .keywords(Collections.singletonList("test")) + .build(); + GroupSearchResult result = client.cloudSearch.groupSearch(request); + System.out.println(result); + Assertions.assertEquals(ActionStatus.OK, result.getActionStatus()); + } + + @Test + void testGroupMemberSearch() throws IOException { + GroupMemberSearchRequest request = GroupMemberSearchRequest.builder() + .count(1) + .groupType(Collections.singletonList("Public")) + .keywordMatchType(1) + .keywords(Collections.singletonList("test")) + .build(); + GroupMemberSearchResult result = client.cloudSearch.groupMemberSearch(request); + System.out.println(result); + Assertions.assertEquals(ActionStatus.OK, result.getActionStatus()); + } + + @Test + void testSetVisibility() throws IOException { + SetVisibilityRequest request = SetVisibilityRequest.builder() + .setType(1) + .userId("test") + .isDisable(true) + .build(); + SetVisibilitySearchResult result = client.cloudSearch.setVisibility(request); + System.out.println(result); + Assertions.assertEquals(ActionStatus.OK, result.getActionStatus()); + } + + @Test + void testGetNoVisibility() throws IOException { + GetNoVisibilityRequest request = GetNoVisibilityRequest.builder() + .setType(1) + .count(1) + .build(); + GetNoVisibilitySearchResult result = client.cloudSearch.getNoVisibility(request); + System.out.println(result); + Assertions.assertEquals(ActionStatus.OK, result.getActionStatus()); + } + +} From 92c186fbd9f8130a0bedc5e556255a1fd306ea8b Mon Sep 17 00:00:00 2001 From: ooail <1184010001@qq.com> Date: Thu, 29 Jan 2026 15:10:18 +0800 Subject: [PATCH 4/7] =?UTF-8?q?feat(response):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E8=87=AA=E5=AE=9A=E4=B9=89=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 cloudCustomData 字段用于消息自定义数据存储 - 提供 cloudCustomData 字段的 getter 和 setter 方法 - 修改 toString 方法,增加 cloudCustomData 的输出内容 - 该数据云端保存,可发送到对端,程序重装后仍能拉取 --- .../doocs/im/model/response/RspMsgItem.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/io/github/doocs/im/model/response/RspMsgItem.java b/src/main/java/io/github/doocs/im/model/response/RspMsgItem.java index 5d062e7e..a59f6353 100644 --- a/src/main/java/io/github/doocs/im/model/response/RspMsgItem.java +++ b/src/main/java/io/github/doocs/im/model/response/RspMsgItem.java @@ -56,6 +56,12 @@ public class RspMsgItem implements Serializable { @JsonProperty("MsgKey") private String msgKey; + /** + * 消息自定义数据(云端保存,会发送到对端,程序卸载重装后还能拉取到) + */ + @JsonProperty("CloudCustomData") + private String cloudCustomData; + /** * 消息序列号,用于标记该条消息,值越小发送的越早,数据范围 [0,4294967295] */ @@ -147,6 +153,14 @@ public void setMsgKey(String msgKey) { this.msgKey = msgKey; } + public String getCloudCustomData() { + return cloudCustomData; + } + + public void setCloudCustomData(String cloudCustomData) { + this.cloudCustomData = cloudCustomData; + } + @Override public String toString() { return "RspMsgItem{" + @@ -157,6 +171,7 @@ public String toString() { ", msgPriority=" + msgPriority + ", msgRandom=" + msgRandom + ", msgKey='" + msgKey + '\'' + + ", cloudCustomData='" + cloudCustomData + '\'' + ", msgSeq=" + msgSeq + ", msgTimeStamp=" + msgTimeStamp + '}'; From ac1acb58b2566a60a77b747a8c4d09c4303fa99e Mon Sep 17 00:00:00 2001 From: ooail <1184010001@qq.com> Date: Thu, 29 Jan 2026 17:30:42 +0800 Subject: [PATCH 5/7] =?UTF-8?q?refactor(core):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BA=91=E7=AB=AF=E6=90=9C=E7=B4=A2=E6=9C=8D=E5=8A=A1=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E5=8F=8A=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/io/github/doocs/im/core/CloudSearch.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/doocs/im/core/CloudSearch.java b/src/main/java/io/github/doocs/im/core/CloudSearch.java index a4f73b67..29f52b84 100644 --- a/src/main/java/io/github/doocs/im/core/CloudSearch.java +++ b/src/main/java/io/github/doocs/im/core/CloudSearch.java @@ -17,7 +17,7 @@ **/ public class CloudSearch { /** - * 账号管理服务名 + * 云端搜索服务名 */ public static final String SERVICE_NAME_USER = "user_search"; public static final String SERVICE_NAME_GROUP = "group_search"; @@ -25,7 +25,7 @@ public class CloudSearch { public static final String SERVICE_NAME_IM_OPEN = "im_open_search"; /** - * 账号管理相关命令字 + * 云端搜索相关命令字 */ public static final String SEARCH_COMMAND = "search"; public static final String SET_VISIBILITY_COMMAND = "set_visibility"; From a1780e58b8fc782bf6e60f66d06f4a2a1b836bb1 Mon Sep 17 00:00:00 2001 From: Beginner <40513600+BeginnerA@users.noreply.github.com> Date: Thu, 29 Jan 2026 17:40:53 +0800 Subject: [PATCH 6/7] refactor(core): Update service name and command descriptions --- src/main/java/io/github/doocs/im/core/CloudSearch.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/doocs/im/core/CloudSearch.java b/src/main/java/io/github/doocs/im/core/CloudSearch.java index a4f73b67..29f52b84 100644 --- a/src/main/java/io/github/doocs/im/core/CloudSearch.java +++ b/src/main/java/io/github/doocs/im/core/CloudSearch.java @@ -17,7 +17,7 @@ **/ public class CloudSearch { /** - * 账号管理服务名 + * 云端搜索服务名 */ public static final String SERVICE_NAME_USER = "user_search"; public static final String SERVICE_NAME_GROUP = "group_search"; @@ -25,7 +25,7 @@ public class CloudSearch { public static final String SERVICE_NAME_IM_OPEN = "im_open_search"; /** - * 账号管理相关命令字 + * 云端搜索相关命令字 */ public static final String SEARCH_COMMAND = "search"; public static final String SET_VISIBILITY_COMMAND = "set_visibility"; From 272d5498fb9efe2641315c25e41a13088ca9b1de Mon Sep 17 00:00:00 2001 From: ooail <1184010001@qq.com> Date: Fri, 30 Jan 2026 09:02:19 +0800 Subject: [PATCH 7/7] =?UTF-8?q?docs(sns):=20=E6=B7=BB=E5=8A=A0=E5=85=B3?= =?UTF-8?q?=E6=B3=A8=E7=94=A8=E6=88=B7=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增批量关注用户的说明和示例代码 - 新增批量取消关注用户的说明和示例代码 - 新增分页拉取关注、粉丝与互关列表的说明和示例代码 - 新增批量检查关注关系的说明和示例代码 - 新增批量查询关注、粉丝与互关数的说明和示例代码 --- docs/guide/sns.md | 80 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/docs/guide/sns.md b/docs/guide/sns.md index a4a1b4e3..aca17103 100644 --- a/docs/guide/sns.md +++ b/docs/guide/sns.md @@ -283,3 +283,83 @@ GroupGetRequest request = GroupGetRequest.builder() GroupGetResult result = client.sns.groupGet(request); ``` + +## 关注用户 + +关注用户,支持批量关注用户。 + +使用示例: + +```java +FollowRequestItem followRequestItem = FollowRequestItem.builder().toAccount("test2").build(); +List followRequestItemList = Collections.singletonList(followRequestItem); +FollowAddRequest request = FollowAddRequest.builder() + .fromAccount("test1") + .followItemList(followRequestItemList) + .build(); + +FollowAddResult result = client.sns.followAdd(request); +``` + +## 取消关注用户 + +取消关注用户,支持批量取关。 + +使用示例: + +```java +List toAccount = Collections.singletonList("test2"); +FollowDeleteRequest request = FollowDeleteRequest.builder() + .fromAccount("test1") + .toAccount(toAccount) + .build(); + +FollowDeleteResult result = client.sns.followDelete(request); +``` + +## 拉取关注、粉丝与互关列表 + +分页拉取指定用户的粉丝/关注/互关列表。 + +使用示例: + +```java +FollowGetRequest request = FollowGetRequest.builder() + .fromAccount("test2") + .followType(1) + .build(); + +FollowGetResult result = client.sns.followGet(request); +``` + +## 检查关注关系 + +支持批量检查关注关系。 + +使用示例: + +```java +List toAccount = Collections.singletonList("test2"); +FollowCheckRequest request = FollowCheckRequest.builder() + .fromAccount("test1") + .toAccount(toAccount) + .build(); + +FollowCheckResult result = client.sns.followCheck(request); +``` + +## 获取用户的关注、粉丝与互关数 + +批量查询指定用户的粉丝/关注/互关数。 + +使用示例: + +```java +List toAccount = Collections.singletonList("test2"); +FollowGetInfoRequest request = FollowGetInfoRequest.builder() + .fromAccount("test1") + .toAccount(toAccount) + .build(); + +FollowGetInfoResult result = client.sns.followGetInfo(request); +``` \ No newline at end of file