添加机器人的朋友圈接口
This commit is contained in:
@@ -157,5 +157,16 @@ public interface APIPath {
|
||||
String Robot_Group_Transfer = "/robot/group/transfer";
|
||||
String Robot_Group_Set_Manager = "/robot/group/manager/set";
|
||||
|
||||
String Robot_Moments_Post_Feed = "/robot/moments/feed/post";
|
||||
String Robot_Moments_Pull_Feeds = "/robot/moments/feed/pull";
|
||||
String Robot_Moments_Post_Comment = "/robot/moments/comment/post";
|
||||
String Robot_Moments_Pull_Comment = "/robot/moments/comment/pull";
|
||||
String Robot_Moments_Fetch_Feed = "/robot/moments/feed/pull_one";
|
||||
String Robot_Moments_Fetch_Profiles = "/robot/moments/profiles/pull";
|
||||
String Robot_Moments_Recall_Comment = "/robot/moments/comment/recall";
|
||||
String Robot_Moments_Recall_Feed = "/robot/moments/feed/recall";
|
||||
String Robot_Moments_Update_Profiles_List_Value = "/robot/moments/profiles/list/push";
|
||||
String Robot_Moments_Update_Profiles_Value = "/robot/moments/profiles/value/push";
|
||||
|
||||
String Robot_Conference_Request = "/robot/conference/request";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.wildfirechat.pojos.moments;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CommentMsgPojo {
|
||||
//commentId;
|
||||
public long commentId;
|
||||
|
||||
//sender;
|
||||
public String sender;
|
||||
|
||||
//timestamp
|
||||
public long serverTime;
|
||||
|
||||
//feedId
|
||||
public long feedId;
|
||||
|
||||
//type
|
||||
public int type;
|
||||
|
||||
//content
|
||||
public String text;
|
||||
|
||||
//to replyTo
|
||||
public String replyTo;
|
||||
|
||||
//extra
|
||||
public String extra;
|
||||
|
||||
public int ftype;
|
||||
|
||||
public String fcontent;
|
||||
|
||||
public String fsender;
|
||||
|
||||
public List<MediaEntry> fmedias;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.wildfirechat.pojos.moments;
|
||||
|
||||
public class CommentPojo {
|
||||
//commentId;
|
||||
public long commentId;
|
||||
|
||||
//replyId;
|
||||
public long replyId;
|
||||
|
||||
//sender;
|
||||
public String sender;
|
||||
|
||||
//timestamp
|
||||
public long timestamp;
|
||||
|
||||
//feedId
|
||||
public long feedId;
|
||||
|
||||
//type
|
||||
public int type;
|
||||
|
||||
//content
|
||||
public String text;
|
||||
|
||||
//to replyTo
|
||||
public String replyTo;
|
||||
|
||||
//extra
|
||||
public String extra;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.wildfirechat.pojos.moments;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FeedPojo {
|
||||
//feedid
|
||||
public long feedId;
|
||||
|
||||
//sender
|
||||
public String sender;
|
||||
|
||||
//timestamp
|
||||
public long timestamp;
|
||||
|
||||
//type
|
||||
public int type;
|
||||
|
||||
//content
|
||||
public String text;
|
||||
|
||||
//media urls
|
||||
public List<MediaEntry> medias;
|
||||
|
||||
//to users
|
||||
public List<String> to;
|
||||
|
||||
//excloud users
|
||||
public List<String> ex;
|
||||
|
||||
//mentioned users
|
||||
public List<String> mu;
|
||||
|
||||
//extra
|
||||
public String extra;
|
||||
|
||||
public List<CommentPojo> comments;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package cn.wildfirechat.pojos.moments;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FeedsPojo {
|
||||
public List<FeedPojo> feeds;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.wildfirechat.pojos.moments;
|
||||
|
||||
public class IdPojo {
|
||||
//feedid
|
||||
public long id;
|
||||
|
||||
//feedid
|
||||
public long id2;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package cn.wildfirechat.pojos.moments;
|
||||
|
||||
public class MediaEntry {
|
||||
public String m;
|
||||
public String t;
|
||||
public int w;
|
||||
public int h;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.wildfirechat.pojos.moments;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MomentProfilePojo {
|
||||
public String bgUrl;
|
||||
public List<String> blackList;
|
||||
public List<String> blockList;
|
||||
//stranger visiable count
|
||||
public int svc;
|
||||
public int visiableScope;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package cn.wildfirechat.pojos.moments;
|
||||
|
||||
public class PostFeedResult {
|
||||
public long id;
|
||||
public long timestamp;
|
||||
|
||||
public PostFeedResult(long id, long timestamp) {
|
||||
this.id = id;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package cn.wildfirechat.pojos.moments;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PullCommentsRequestPojo {
|
||||
public static class IdPair {
|
||||
public long fid;
|
||||
public long cid;
|
||||
}
|
||||
public List<IdPair> ids;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package cn.wildfirechat.pojos.moments;
|
||||
|
||||
public class PullFeedRequestPojo {
|
||||
//feedid
|
||||
public long feedId;
|
||||
public int count;
|
||||
public String user;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package cn.wildfirechat.pojos.moments;
|
||||
|
||||
public class PullOneFeedRequestPojo {
|
||||
public long feedId;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.wildfirechat.pojos.moments;
|
||||
|
||||
public class PullProfileRequestPojo {
|
||||
//userId
|
||||
public String u;
|
||||
|
||||
//update date
|
||||
public long d;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.wildfirechat.pojos.moments;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PushProfileListRequestPojo {
|
||||
//block or black
|
||||
public boolean b;
|
||||
|
||||
//add user list
|
||||
public List<String> al;
|
||||
|
||||
//remove user list
|
||||
public List<String> rl;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.wildfirechat.pojos.moments;
|
||||
|
||||
public class PushProfileValueRequestPojo {
|
||||
/*
|
||||
WFMUpdateUserProfileType_BackgroudUrl,
|
||||
WFMUpdateUserProfileType_StrangerVisiableCount,
|
||||
WFMUpdateUserProfileType_VisiableScope
|
||||
*/
|
||||
public int t;
|
||||
|
||||
//string value depends on t
|
||||
public String v;
|
||||
|
||||
//int value depends on t
|
||||
public int i;
|
||||
}
|
||||
@@ -347,6 +347,25 @@ public class ProtoConstants {
|
||||
int Forbidden_Mute_Group_Member = 0x800;
|
||||
}
|
||||
|
||||
public interface MomentsContentType {
|
||||
int Moments_Content_Text_Type = 0;
|
||||
int Moments_Content_Image_Type = 1;
|
||||
int Moments_Content_Video_Type = 2;
|
||||
int Moments_Content_Link_Type = 3;
|
||||
}
|
||||
|
||||
public interface MomentsCommentType {
|
||||
int Moments_Comment_Text_Type = 0;
|
||||
int Moments_Comment_Thumbup_Type = 1;
|
||||
}
|
||||
|
||||
public interface MomentsVisibleScope {
|
||||
int Moments_VisibleScope_NoLimit = 0;
|
||||
int Moments_VisibleScope_3Days = 1;
|
||||
int Moments_VisibleScope_1Month = 2;
|
||||
int Moments_VisibleScope_6Months = 3;
|
||||
};
|
||||
|
||||
public static final int MESSAGE_CONTENT_TYPE_CREATE_GROUP = 104;
|
||||
public static final int MESSAGE_CONTENT_TYPE_ADD_GROUP_MEMBER = 105;
|
||||
public static final int MESSAGE_CONTENT_TYPE_KICKOF_GROUP_MEMBER = 106;
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package cn.wildfirechat.sdk;
|
||||
|
||||
import cn.wildfirechat.common.ErrorCode;
|
||||
import cn.wildfirechat.pojos.moments.CommentPojo;
|
||||
import cn.wildfirechat.pojos.moments.FeedPojo;
|
||||
import cn.wildfirechat.pojos.moments.FeedsPojo;
|
||||
import cn.wildfirechat.pojos.moments.MomentProfilePojo;
|
||||
import cn.wildfirechat.proto.WFCMessage;
|
||||
import cn.wildfirechat.sdk.messagecontent.*;
|
||||
import cn.wildfirechat.pojos.*;
|
||||
@@ -19,6 +23,7 @@ import static cn.wildfirechat.proto.ProtoConstants.SystemSettingType.Group_Max_M
|
||||
public class Main {
|
||||
private static boolean commercialServer = false;
|
||||
private static boolean advanceVoip = false;
|
||||
private static boolean robotMomentsEnabled = false;
|
||||
//管理端口是8080
|
||||
private static String AdminUrl = "http://localhost:18080";
|
||||
private static String AdminSecret = "123456";
|
||||
@@ -1575,8 +1580,6 @@ public class Main {
|
||||
System.out.println(config);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//仅专业版支持
|
||||
if (commercialServer) {
|
||||
//开启群成员禁言
|
||||
@@ -1643,6 +1646,82 @@ public class Main {
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
//仅专业版支持,且服务器端支持朋友圈
|
||||
if (robotMomentsEnabled) {
|
||||
IMResult<FeedPojo> postResult = robotService.postMomentsFeed(ProtoConstants.MomentsContentType.Moments_Content_Text_Type, "hello from robot", null, null, null, null, null);
|
||||
if (postResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("post moments feed success");
|
||||
} else {
|
||||
System.out.println("post moments feed failure:" + postResult.getErrorCode().code);
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
IMResult<FeedsPojo> pullResult = robotService.getMomentsFeeds(0, 10, null);
|
||||
if (pullResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("pull moments feeds success");
|
||||
} else {
|
||||
System.out.println("pull moments feeds failure:" + pullResult.getErrorCode().code);
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
if(!pullResult.getResult().feeds.isEmpty()) {
|
||||
IMResult<FeedPojo> feedResult = robotService.getMomentsFeed(pullResult.getResult().feeds.get(0).feedId);
|
||||
if (feedResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("pull moments one feed success");
|
||||
} else {
|
||||
System.out.println("pull moments one feed failure:" + feedResult.getErrorCode().code);
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
IMResult<CommentPojo> commentThumbUpResult = robotService.postMomentsComment(postResult.result.feedId, 0, ProtoConstants.MomentsCommentType.Moments_Comment_Thumbup_Type, null, null, null);
|
||||
if (commentThumbUpResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("post moments thumb up success");
|
||||
} else {
|
||||
System.out.println("post moments thumb up failure:" + commentThumbUpResult.getErrorCode().code);
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
IMResult<CommentPojo> commentTextResult = robotService.postMomentsComment(postResult.result.feedId, 0, ProtoConstants.MomentsCommentType.Moments_Comment_Text_Type, "comment hello", null, null);
|
||||
if (commentTextResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("post moments comment text success");
|
||||
} else {
|
||||
System.out.println("post moments comment text failure:" + commentTextResult.getErrorCode().code);
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
IMResult<Void> deleteCommentThumbUpResult = robotService.deleteMomentsComment(postResult.result.feedId, commentThumbUpResult.result.commentId);
|
||||
if (deleteCommentThumbUpResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("delete moments thumb up success");
|
||||
} else {
|
||||
System.out.println("delete moments thumb up failure:" + deleteCommentThumbUpResult.getErrorCode().code);
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
IMResult<Void> deleteCommentTextResult = robotService.deleteMomentsComment(postResult.result.feedId, commentTextResult.result.commentId);
|
||||
if (deleteCommentTextResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("delete moments comment text success");
|
||||
} else {
|
||||
System.out.println("delete moments comment text failure:" + deleteCommentTextResult.getErrorCode().code);
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
IMResult<Void> deleteFeedResult = robotService.deleteMomentsFeed(postResult.result.feedId);
|
||||
if (deleteFeedResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("delete moments feed success");
|
||||
} else {
|
||||
System.out.println("delete moments feed failure:" + deleteFeedResult.getErrorCode().code);
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
IMResult<MomentProfilePojo> profileResult = robotService.getUserMomentsProfile(robotId);
|
||||
if (profileResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("get user moments profile success");
|
||||
} else {
|
||||
System.out.println("get user moments profile failure:" + profileResult.getErrorCode().code);
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//***测试频道API功能,仅专业版支持***
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package cn.wildfirechat.sdk;
|
||||
|
||||
import cn.wildfirechat.common.APIPath;
|
||||
import cn.wildfirechat.common.ErrorCode;
|
||||
import cn.wildfirechat.pojos.*;
|
||||
import cn.wildfirechat.pojos.moments.*;
|
||||
import cn.wildfirechat.sdk.model.IMResult;
|
||||
import cn.wildfirechat.sdk.utilities.RobotHttpUtils;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
@@ -96,7 +98,7 @@ public class RobotService {
|
||||
return robotHttpUtils.httpJsonPost(path, pojo, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<OutputCreateGroupResult> createGroup(PojoGroupInfo group_info, List<PojoGroupMember> members, String member_extra, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
public IMResult<OutputCreateGroupResult> createGroup(PojoGroupInfo group_info, List<PojoGroupMember> members, String member_extra, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Robot_Create_Group;
|
||||
PojoGroup pojoGroup = new PojoGroup();
|
||||
pojoGroup.setGroup_info(group_info);
|
||||
@@ -118,7 +120,7 @@ public class RobotService {
|
||||
return robotHttpUtils.httpJsonPost(path, input, PojoGroupInfo.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> dismissGroup(String groupId, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
public IMResult<Void> dismissGroup(String groupId, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Robot_Group_Dismiss;
|
||||
InputDismissGroup dismissGroup = new InputDismissGroup();
|
||||
dismissGroup.setGroup_id(groupId);
|
||||
@@ -127,7 +129,7 @@ public class RobotService {
|
||||
return robotHttpUtils.httpJsonPost(path, dismissGroup, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> transferGroup(String groupId, String newOwner, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
public IMResult<Void> transferGroup(String groupId, String newOwner, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Robot_Group_Transfer;
|
||||
InputTransferGroup transferGroup = new InputTransferGroup();
|
||||
transferGroup.setGroup_id(groupId);
|
||||
@@ -137,7 +139,7 @@ public class RobotService {
|
||||
return robotHttpUtils.httpJsonPost(path, transferGroup, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> modifyGroupInfo(String groupId, /*ModifyGroupInfoType*/int type, String value, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
public IMResult<Void> modifyGroupInfo(String groupId, /*ModifyGroupInfoType*/int type, String value, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Robot_Group_Modify_Info;
|
||||
InputModifyGroupInfo modifyGroupInfo = new InputModifyGroupInfo();
|
||||
modifyGroupInfo.setGroup_id(groupId);
|
||||
@@ -164,7 +166,7 @@ public class RobotService {
|
||||
return robotHttpUtils.httpJsonPost(path, input, PojoGroupMember.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> addGroupMembers(String groupId, List<PojoGroupMember> groupMembers, String member_extra, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
public IMResult<Void> addGroupMembers(String groupId, List<PojoGroupMember> groupMembers, String member_extra, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Robot_Group_Member_Add;
|
||||
InputAddGroupMember addGroupMember = new InputAddGroupMember();
|
||||
addGroupMember.setGroup_id(groupId);
|
||||
@@ -175,7 +177,7 @@ public class RobotService {
|
||||
return robotHttpUtils.httpJsonPost(path, addGroupMember, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> setGroupManager(String groupId, List<String> groupMemberIds, boolean isManager, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
public IMResult<Void> setGroupManager(String groupId, List<String> groupMemberIds, boolean isManager, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Robot_Group_Set_Manager;
|
||||
InputSetGroupManager addGroupMember = new InputSetGroupManager();
|
||||
addGroupMember.setGroup_id(groupId);
|
||||
@@ -186,7 +188,7 @@ public class RobotService {
|
||||
return robotHttpUtils.httpJsonPost(path, addGroupMember, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> muteGroupMember(String groupId, List<String> groupMemberIds, boolean isMute, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
public IMResult<Void> muteGroupMember(String groupId, List<String> groupMemberIds, boolean isMute, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Robot_Group_Mute_Member;
|
||||
InputMuteGroupMember addGroupMember = new InputMuteGroupMember();
|
||||
addGroupMember.setGroup_id(groupId);
|
||||
@@ -197,7 +199,7 @@ public class RobotService {
|
||||
return robotHttpUtils.httpJsonPost(path, addGroupMember, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> allowGroupMember(String groupId, List<String> groupMemberIds, boolean isAllow, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
public IMResult<Void> allowGroupMember(String groupId, List<String> groupMemberIds, boolean isAllow, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Robot_Group_Allow_Member;
|
||||
InputMuteGroupMember addGroupMember = new InputMuteGroupMember();
|
||||
addGroupMember.setGroup_id(groupId);
|
||||
@@ -208,7 +210,7 @@ public class RobotService {
|
||||
return robotHttpUtils.httpJsonPost(path, addGroupMember, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> kickoffGroupMembers(String groupId, List<String> groupMemberIds, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
public IMResult<Void> kickoffGroupMembers(String groupId, List<String> groupMemberIds, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Robot_Group_Member_Kickoff;
|
||||
InputKickoffGroupMember kickoffGroupMember = new InputKickoffGroupMember();
|
||||
kickoffGroupMember.setGroup_id(groupId);
|
||||
@@ -218,7 +220,7 @@ public class RobotService {
|
||||
return robotHttpUtils.httpJsonPost(path, kickoffGroupMember, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> quitGroup(String groupId, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
public IMResult<Void> quitGroup(String groupId, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Robot_Group_Member_Quit;
|
||||
InputQuitGroup quitGroup = new InputQuitGroup();
|
||||
quitGroup.setGroup_id(groupId);
|
||||
@@ -227,7 +229,7 @@ public class RobotService {
|
||||
return robotHttpUtils.httpJsonPost(path, quitGroup, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> setGroupMemberAlias(String groupId, String memberId, String alias, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
public IMResult<Void> setGroupMemberAlias(String groupId, String memberId, String alias, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Robot_Group_Set_Member_Alias;
|
||||
InputSetGroupMemberAlias input = new InputSetGroupMemberAlias();
|
||||
input.setGroup_id(groupId);
|
||||
@@ -238,7 +240,7 @@ public class RobotService {
|
||||
return robotHttpUtils.httpJsonPost(path, input, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> setGroupMemberExtra(String groupId, String memberId, String extra, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
public IMResult<Void> setGroupMemberExtra(String groupId, String memberId, String extra, List<Integer> to_lines, MessagePayload notify_message) throws Exception {
|
||||
String path = APIPath.Robot_Group_Set_Member_Extra;
|
||||
InputSetGroupMemberExtra input = new InputSetGroupMemberExtra();
|
||||
input.setGroup_id(groupId);
|
||||
@@ -276,4 +278,130 @@ public class RobotService {
|
||||
return robotHttpUtils.httpJsonPost(path, input, String.class);
|
||||
}
|
||||
|
||||
public IMResult<FeedPojo> postMomentsFeed(int/*MomentsContentType*/ type, String text, List<MediaEntry> medias, List<String> toUsers, List<String> excludeUsers, List<String> mentionedUsers, String extra) throws Exception {
|
||||
String path = APIPath.Robot_Moments_Post_Feed;
|
||||
FeedPojo feedPojo = new FeedPojo();
|
||||
feedPojo.type = type;
|
||||
feedPojo.text = text;
|
||||
feedPojo.medias = medias;
|
||||
feedPojo.to = toUsers;
|
||||
feedPojo.ex = excludeUsers;
|
||||
feedPojo.mu = mentionedUsers;
|
||||
feedPojo.extra = extra;
|
||||
IMResult<PostFeedResult> imResult = robotHttpUtils.httpJsonPost(path, feedPojo, PostFeedResult.class);
|
||||
IMResult<FeedPojo> feedResult = new IMResult<>();
|
||||
if(imResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
feedPojo.feedId = imResult.result.id;
|
||||
feedPojo.timestamp = imResult.result.timestamp;
|
||||
feedResult.setCode(ErrorCode.ERROR_CODE_SUCCESS.getCode());
|
||||
feedResult.setResult(feedPojo);
|
||||
} else {
|
||||
feedResult.setCode(imResult.getCode());
|
||||
feedResult.setMsg(imResult.getMsg());
|
||||
}
|
||||
return feedResult;
|
||||
}
|
||||
|
||||
public IMResult<FeedsPojo> getMomentsFeeds(long feedId, int count, String user) throws Exception {
|
||||
String path = APIPath.Robot_Moments_Pull_Feeds;
|
||||
PullFeedRequestPojo requestPojo = new PullFeedRequestPojo();
|
||||
requestPojo.feedId = feedId;
|
||||
requestPojo.count = count;
|
||||
requestPojo.user = user;
|
||||
return robotHttpUtils.httpJsonPost(path, requestPojo, FeedsPojo.class);
|
||||
}
|
||||
|
||||
public IMResult<FeedPojo> getMomentsFeed(long feedId) throws Exception {
|
||||
String path = APIPath.Robot_Moments_Fetch_Feed;
|
||||
PullOneFeedRequestPojo requestPojo = new PullOneFeedRequestPojo();
|
||||
requestPojo.feedId = feedId;
|
||||
return robotHttpUtils.httpJsonPost(path, requestPojo, FeedPojo.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> deleteMomentsFeed(long feedId) throws Exception {
|
||||
String path = APIPath.Robot_Moments_Recall_Feed;
|
||||
IdPojo requestPojo = new IdPojo();
|
||||
requestPojo.id = feedId;
|
||||
return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<CommentPojo> postMomentsComment(long feedId, long replyId, int/*MomentsCommentType*/ type, String text, String replyTo, String extra) throws Exception {
|
||||
String path = APIPath.Robot_Moments_Post_Comment;
|
||||
CommentPojo commentPojo = new CommentPojo();
|
||||
commentPojo.type = type;
|
||||
commentPojo.text = text;
|
||||
commentPojo.replyId = replyId;
|
||||
commentPojo.feedId = feedId;
|
||||
commentPojo.replyTo = replyTo;
|
||||
commentPojo.extra = extra;
|
||||
IMResult<PostFeedResult> imResult = robotHttpUtils.httpJsonPost(path, commentPojo, PostFeedResult.class);
|
||||
IMResult<CommentPojo> feedResult = new IMResult<>();
|
||||
if(imResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
commentPojo.commentId = imResult.result.id;
|
||||
commentPojo.timestamp = imResult.result.timestamp;
|
||||
feedResult.setCode(ErrorCode.ERROR_CODE_SUCCESS.getCode());
|
||||
feedResult.setResult(commentPojo);
|
||||
} else {
|
||||
feedResult.setCode(imResult.getCode());
|
||||
feedResult.setMsg(imResult.getMsg());
|
||||
}
|
||||
return feedResult;
|
||||
}
|
||||
|
||||
public IMResult<Void> deleteMomentsComment(long feedId, long commentId) throws Exception {
|
||||
String path = APIPath.Robot_Moments_Recall_Comment;
|
||||
IdPojo requestPojo = new IdPojo();
|
||||
requestPojo.id = commentId;
|
||||
requestPojo.id2 = feedId;
|
||||
return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<MomentProfilePojo> getUserMomentsProfile(String userId) throws Exception {
|
||||
String path = APIPath.Robot_Moments_Fetch_Profiles;
|
||||
PullProfileRequestPojo requestPojo = new PullProfileRequestPojo();
|
||||
requestPojo.u = userId;
|
||||
return robotHttpUtils.httpJsonPost(path, requestPojo, MomentProfilePojo.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> updateMomentsBackgroundUrl(String url) throws Exception {
|
||||
String path = APIPath.Robot_Moments_Update_Profiles_Value;
|
||||
PushProfileValueRequestPojo requestPojo = new PushProfileValueRequestPojo();
|
||||
requestPojo.t = 0;
|
||||
requestPojo.v = url;
|
||||
return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> updateMomentsStrangerVisibleCount(int count) throws Exception {
|
||||
String path = APIPath.Robot_Moments_Update_Profiles_Value;
|
||||
PushProfileValueRequestPojo requestPojo = new PushProfileValueRequestPojo();
|
||||
requestPojo.t = 1;
|
||||
requestPojo.i = count;
|
||||
return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> updateMomentsVisibleScope(int/*MomentsVisibleScope*/ scope) throws Exception {
|
||||
String path = APIPath.Robot_Moments_Update_Profiles_Value;
|
||||
PushProfileValueRequestPojo requestPojo = new PushProfileValueRequestPojo();
|
||||
requestPojo.t = 2;
|
||||
requestPojo.i = scope;
|
||||
return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> updateMomentsBlackList(List<String> addList, List<String> removeList) throws Exception {
|
||||
String path = APIPath.Robot_Moments_Update_Profiles_List_Value;
|
||||
PushProfileListRequestPojo requestPojo = new PushProfileListRequestPojo();
|
||||
requestPojo.b = false;
|
||||
requestPojo.al = addList;
|
||||
requestPojo.rl = removeList;
|
||||
return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<Void> updateMomentsBlockList(List<String> addList, List<String> removeList) throws Exception {
|
||||
String path = APIPath.Robot_Moments_Update_Profiles_List_Value;
|
||||
PushProfileListRequestPojo requestPojo = new PushProfileListRequestPojo();
|
||||
requestPojo.b = true;
|
||||
requestPojo.al = addList;
|
||||
requestPojo.rl = removeList;
|
||||
return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user