机器人接口添加更新朋友圈接口
This commit is contained in:
@@ -1656,7 +1656,7 @@ public class Main {
|
||||
|
||||
//仅专业版支持,且服务器端支持朋友圈
|
||||
if (robotMomentsEnabled) {
|
||||
IMResult<FeedPojo> postResult = robotService.postMomentsFeed(ProtoConstants.MomentsContentType.Moments_Content_Text_Type, "hello from robot", null, null, null, null, null);
|
||||
IMResult<FeedPojo> postResult = robotService.postMomentsFeed(ProtoConstants.MomentsContentType.Moments_Content_Text_Type, "hello from robot", null, null, null, null, "hello_extra");
|
||||
if (postResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("post moments feed success");
|
||||
} else {
|
||||
@@ -1672,14 +1672,12 @@ public class Main {
|
||||
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<FeedPojo> feedResult = robotService.getMomentsFeed(postResult.getResult().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);
|
||||
@@ -1698,6 +1696,14 @@ public class Main {
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
IMResult<Void> updateResult = robotService.updateMomentsFeed(postResult.getResult().feedId, ProtoConstants.MomentsContentType.Moments_Content_Text_Type, "hello from robot2", null, null, null, null, "hello_extra2");
|
||||
if (updateResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) {
|
||||
System.out.println("update moments feed success");
|
||||
} else {
|
||||
System.out.println("update moments feed failure:" + updateResult.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");
|
||||
|
||||
@@ -302,6 +302,20 @@ public class RobotService {
|
||||
return feedResult;
|
||||
}
|
||||
|
||||
public IMResult<Void> updateMomentsFeed(long feedId, 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_Update_Feed;
|
||||
FeedPojo feedPojo = new FeedPojo();
|
||||
feedPojo.feedId = feedId;
|
||||
feedPojo.type = type;
|
||||
feedPojo.text = text;
|
||||
feedPojo.medias = medias;
|
||||
feedPojo.to = toUsers;
|
||||
feedPojo.ex = excludeUsers;
|
||||
feedPojo.mu = mentionedUsers;
|
||||
feedPojo.extra = extra;
|
||||
return robotHttpUtils.httpJsonPost(path, feedPojo, Void.class);
|
||||
}
|
||||
|
||||
public IMResult<FeedsPojo> getMomentsFeeds(long feedId, int count, String user) throws Exception {
|
||||
String path = APIPath.Robot_Moments_Pull_Feeds;
|
||||
PullFeedRequestPojo requestPojo = new PullFeedRequestPojo();
|
||||
|
||||
Reference in New Issue
Block a user