alter
Change-Id: I41778522ca9a4079ccbf190c5d0f40182a23b8b2
This commit is contained in:
parent
8e36a746c6
commit
5341159ca1
57
src/main/java/org/chobit/wp/enums/PostFormat.java
Normal file
57
src/main/java/org/chobit/wp/enums/PostFormat.java
Normal file
@ -0,0 +1,57 @@
|
||||
package org.chobit.wp.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
public enum PostFormat {
|
||||
/**
|
||||
* 特征即是没有标题的文章
|
||||
*/
|
||||
ASIDE("aside"),
|
||||
/**
|
||||
* 图像相册
|
||||
*/
|
||||
GALLERY("gallery"),
|
||||
/**
|
||||
* 指向其他站点的链接
|
||||
*/
|
||||
LINK("link"),
|
||||
/**
|
||||
* 一个图片,文章中的第一个<img/>标签
|
||||
*/
|
||||
IMAGE("image"),
|
||||
/**
|
||||
* 引文
|
||||
*/
|
||||
QUOTE("quote"),
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
STATUS("status"),
|
||||
/**
|
||||
* 视频
|
||||
*/
|
||||
VIDEO("video"),
|
||||
/**
|
||||
* 音频
|
||||
*/
|
||||
AUDIO("audio"),
|
||||
/**
|
||||
* 聊天
|
||||
*/
|
||||
CHAT("chat"),
|
||||
|
||||
;
|
||||
|
||||
|
||||
public final String format;
|
||||
|
||||
|
||||
PostFormat(String format) {
|
||||
this.format = format;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getFormat() {
|
||||
return format;
|
||||
}
|
||||
}
|
@ -4,6 +4,10 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
public enum PostOrderBy {
|
||||
|
||||
/**
|
||||
* 无序
|
||||
*/
|
||||
NONE("none"),
|
||||
/**
|
||||
* 按发布日期排序
|
||||
*/
|
||||
@ -17,7 +21,7 @@ public enum PostOrderBy {
|
||||
*/
|
||||
ID("ID "),
|
||||
/**
|
||||
* 按评论最多排序
|
||||
* 按评论数量排序
|
||||
*/
|
||||
COMMENT_COUNT("comment_count "),
|
||||
/**
|
||||
@ -28,6 +32,27 @@ public enum PostOrderBy {
|
||||
* 随机排序
|
||||
*/
|
||||
RAND("rand"),
|
||||
/**
|
||||
* 按post_name(即post slug)排序
|
||||
*/
|
||||
NAME("name"),
|
||||
/**
|
||||
* 按post_type排序
|
||||
*/
|
||||
TYPE("type"),
|
||||
/**
|
||||
* 按author排序
|
||||
*/
|
||||
AUTHOR("author"),
|
||||
/**
|
||||
* 按文章/页面的parent id排序
|
||||
*/
|
||||
PARENT("parent"),
|
||||
/**
|
||||
* 适用于搜索文章的情况。按搜索结果的相关性排序。
|
||||
* 首先,是否整句匹配;第二,是否全部搜索内容都在文章标题里面;第三:是否部分搜索内容在文章标题里面;第四:是否整句都出现在文章内容里面
|
||||
*/
|
||||
RELEVANCE("relevance"),
|
||||
|
||||
;
|
||||
|
||||
|
42
src/main/java/org/chobit/wp/enums/PostType.java
Normal file
42
src/main/java/org/chobit/wp/enums/PostType.java
Normal file
@ -0,0 +1,42 @@
|
||||
package org.chobit.wp.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
public enum PostType {
|
||||
|
||||
/**
|
||||
* 文章
|
||||
*/
|
||||
POST("post"),
|
||||
/**
|
||||
* 页面
|
||||
*/
|
||||
PAGE("page"),
|
||||
/**
|
||||
* 修订版数据
|
||||
*/
|
||||
REVISION("revision"),
|
||||
/**
|
||||
* 附件
|
||||
*/
|
||||
ATTACHMENT("attachment"),
|
||||
/**
|
||||
* 导航菜单条目
|
||||
*/
|
||||
NAV_MENU_ITEM("nav_menu_item"),
|
||||
/**
|
||||
* 除修订版数据以及禁止搜索引擎搜索到的数据之外的全部内容
|
||||
*/
|
||||
ANY("any");
|
||||
|
||||
public final String type;
|
||||
|
||||
PostType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.chobit.wp.enums.CommentStatus;
|
||||
import org.chobit.wp.enums.PingStatus;
|
||||
import org.chobit.wp.enums.PostStatus;
|
||||
import org.chobit.wp.enums.PostType;
|
||||
import org.chobit.wp.model.interval.Enclosure;
|
||||
|
||||
import java.beans.Transient;
|
||||
@ -14,6 +15,7 @@ import java.util.Map;
|
||||
|
||||
import static org.chobit.wp.enums.PostTaxonomy.CATEGORY;
|
||||
import static org.chobit.wp.enums.PostTaxonomy.TAG;
|
||||
import static org.chobit.wp.enums.PostType.POST;
|
||||
|
||||
/**
|
||||
* @author robin
|
||||
@ -24,7 +26,7 @@ public class PostRequest extends Request {
|
||||
}
|
||||
|
||||
@JsonProperty("post_type")
|
||||
private String postType;
|
||||
private String postType = POST.type;
|
||||
|
||||
@JsonProperty("post_status")
|
||||
private PostStatus postStatus = PostStatus.PUBLISH;
|
||||
@ -83,6 +85,10 @@ public class PostRequest extends Request {
|
||||
this.postType = postType;
|
||||
}
|
||||
|
||||
public void setPostType(PostType postType) {
|
||||
this.postType = postType.type;
|
||||
}
|
||||
|
||||
public PostStatus getPostStatus() {
|
||||
return postStatus;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user