Change-Id: Ife6e3d3c7ce13b3c8432d0a138686d4994967450
This commit is contained in:
rui.zhang 2018-12-30 20:34:56 +08:00
parent c9f42b42f1
commit fee61d6b64
5 changed files with 10 additions and 13 deletions

View File

@ -18,7 +18,7 @@ WordPress Client是一个Java版的WordPress客户端操作库 主要基于[W
<version>x.x.x</version> <version>x.x.x</version>
</dependency> </dependency>
``` ```
目前wp-client的版本是0.1.2。请尽量使用最新版本。 目前wp-client的版本是0.1.3。请尽量使用最新版本。
## 创建WordPress操作实例 ## 创建WordPress操作实例
@ -96,8 +96,8 @@ getAuthors()方法返回的是用户相关的信息:
PostRequest post = new PostRequest(); PostRequest post = new PostRequest();
post.setPostTitle("测试Title"); post.setPostTitle("测试Title");
post.setPostContent("这是一段测试文章内容"); post.setPostContent("这是一段测试文章内容");
post.addCategories("分类1","分类2"); post.setCategories("分类1","分类2");
post.addTags("a", "b", "c"); post.setTags("a", "b", "c");
post.setPostName("test-post-name"); post.setPostName("test-post-name");
int postId = wp.newPost(post); int postId = wp.newPost(post);
``` ```

View File

@ -12,7 +12,7 @@
<groupId>org.chobit.wp</groupId> <groupId>org.chobit.wp</groupId>
<artifactId>wordpress-client</artifactId> <artifactId>wordpress-client</artifactId>
<version>0.1.2</version> <version>0.1.3</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>WordPress-Client</name> <name>WordPress-Client</name>

View File

@ -218,7 +218,7 @@ public class PostRequest extends Request {
} }
@Transient @Transient
public void addCategories(String... categories) { public void setCategories(String... categories) {
if (null == termsNames) { if (null == termsNames) {
setTermsNames(new HashMap<>(2)); setTermsNames(new HashMap<>(2));
} }
@ -228,7 +228,7 @@ public class PostRequest extends Request {
} }
@Transient @Transient
public void addTags(String... tags) { public void setTags(String... tags) {
if (null == termsNames) { if (null == termsNames) {
setTermsNames(new HashMap<>(2)); setTermsNames(new HashMap<>(2));
} }

View File

@ -1,7 +1,5 @@
package org.chobit.wp; package org.chobit.wp;
import org.chobit.wp.model.request.PostRequest;
import java.io.IOException; import java.io.IOException;
/** /**
@ -10,8 +8,7 @@ import java.io.IOException;
public class Test { public class Test {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
PostRequest request = new PostRequest(); System.out.println((char)(0X87));
request.setPostAuthor(11);
System.out.println(request.toMap());
} }
} }

View File

@ -73,8 +73,8 @@ public class WordPressTest {
PostRequest post = new PostRequest(); PostRequest post = new PostRequest();
post.setPostTitle("测试PostName"); post.setPostTitle("测试PostName");
post.setPostContent("这是一段测试文章内容"); post.setPostContent("这是一段测试文章内容");
post.addCategories("分类"); post.setCategories("分类");
post.addTags("a", "b", "c"); post.setTags("a", "b", "c");
post.setPostName("test-post-name"); post.setPostName("test-post-name");
int postId = wp.newPost(post); int postId = wp.newPost(post);
System.out.println(postId); System.out.println(postId);