Skip to content

Commit

Permalink
Merge pull request #181 from terwer/v4.x
Browse files Browse the repository at this point in the history
feat:Support post delete for xmlrpc
  • Loading branch information
terwer authored Aug 17, 2022
2 parents bf67f7d + 15b5ba5 commit 78b3fdb
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 41 deletions.
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;
}
}

1 comment on commit 78b3fdb

@vercel
Copy link

@vercel vercel bot commented on 78b3fdb Aug 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

jvue – ./

jvue-terwergreen.vercel.app
jvue-pi.vercel.app
jvue-git-master-terwergreen.vercel.app

Please sign in to comment.