Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:Support post delete for xmlrpc #181

Merged
merged 1 commit into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,77 +15,97 @@
public interface IMetaWeblog {
/**
* 获取博客信息:blogger.getUsersBlogs
* @param appKey
* @param username
* @param password
* @return
* @throws XmlRpcException
*
* @param appKey appKey
* @param username 用户名
* @param password 密码
* @return 博客数组
* @throws XmlRpcException 异常
*/
List<Map<String, Object>> getUsersBlogs(String appKey, String username, String password) throws XmlRpcException;

/**
* 发布博客文章:metaWeblog.newPost
* @param blogid
* @param username
* @param password
* @param post
* @param publish
* @return
* @throws XmlRpcException
*
* @param blogid blogid
* @param username 用户名
* @param password 密码
* @param post 文章
* @param publish 是否发布
* @return postid
* @throws XmlRpcException 异常
*/
String newPost(String blogid, String username, String password, Map<String, Object> post, boolean publish) throws XmlRpcException;

/**
* 编辑博客文章:metaWeblog.editPost
* @param postid
* @param username
* @param password
* @param post
* @param publish
* @return
* @throws XmlRpcException
*
* @param postid postid
* @param username 用户名
* @param password 密码
* @param post 文章
* @param publish 是否发布
* @return flag
* @throws XmlRpcException 异常
*/
boolean editPost(String postid, String username, String password, Map<String, Object> post, boolean publish) throws XmlRpcException;

/**
* 获取博客文章:metaWeblog.getPost
* @param postid
* @param username
* @param password
* @return
* @throws XmlRpcException
*
* @param postid postid
* @param username 用户名
* @param password 密码
* @return 文章
* @throws XmlRpcException 异常
*/
Map<String, Object> getPost(String postid, String username, String password) throws XmlRpcException;

/**
* 获取博客分类:metaWeblog.getCategories
* @param blogid
* @param username
* @param password
* @return
* @throws XmlRpcException
*
* @param blogid blogid
* @param username 用户名
* @param password 密码
* @return 分类列表
* @throws XmlRpcException 异常
*/
List<Map<String, String>> getCategories(String blogid, String username, String password) throws XmlRpcException;

/**
* 获取最近的文章列表:metaWeblog.getRecentPosts
* @param blogid
* @param username
* @param password
* @param numberOfPosts
* @return
* @throws XmlRpcException
*
* @param blogid blogid
* @param username 用户名
* @param password 密码
* @param numberOfPosts 数目
* @return 文章列表
* @throws XmlRpcException 异常
*/
List<Map<String, Object>> getRecentPosts(String blogid, String username, String password, int numberOfPosts) throws XmlRpcException;

/**
* 上传媒体对象:metaWeblog.newMediaObject
* @param blogid
* @param username
* @param password
* @param post
* @return
* @throws XmlRpcException
*
* @param blogid blogid
* @param username 用户名
* @param password 密码
* @param post 文章
* @return 媒体信息
* @throws XmlRpcException 异常
*/
Map<String, String> newMediaObject(String blogid, String username, String password, Map<String, Object> post) throws XmlRpcException;

/**
* 删除博客文章:blogger.deletePost
*
* @param appKey appKey
* @param postid postid
* @param username 用户名
* @param password 密码
* @param publish 是否发布
* @return flag
* @throws XmlRpcException 异常
*/
boolean deletePost(String appKey, String postid, String username, String password, boolean publish) throws XmlRpcException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,22 @@ public Map<String, String> newMediaObject(String blogid, String username, String
logger.info("urlData = {}", urlData);
return urlData;
}

@Override
public boolean deletePost(String appKey, String postid, String username, String password, boolean publish) throws XmlRpcException {
// logger.info("metaWeblog.editPost -> postid: {}, post: {}", postid, JSON.toJSONString(post));
logger.info("metaWeblog.editPost -> postid: {}", postid);

Map<String, Object> rtnResult = isValid(username, password);

boolean flag = false;
try {
flag = getPostService().deletePostById(Integer.valueOf(postid));
logger.info("flag = {}", flag);
} catch (Exception e) {
e.printStackTrace();
throw new XmlRpcException(500, e.getMessage());
}
return flag;
}
}