com.afrozaar.wordpress.wpapi.v2.api.Posts Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wp-api-v2-client-java Show documentation
Show all versions of wp-api-v2-client-java Show documentation
A Java client implementation to the WordPress WP-API v2 plugin.
package com.afrozaar.wordpress.wpapi.v2.api;
import com.afrozaar.wordpress.wpapi.v2.exception.PostCreateException;
import com.afrozaar.wordpress.wpapi.v2.exception.PostNotFoundException;
import com.afrozaar.wordpress.wpapi.v2.model.Post;
import com.afrozaar.wordpress.wpapi.v2.model.PostStatus;
import com.afrozaar.wordpress.wpapi.v2.request.Request;
import com.afrozaar.wordpress.wpapi.v2.request.SearchRequest;
import java.util.Map;
public interface Posts {
/**
* @param post {@code Map}
* @param status
* @return Created {@link Post}
* @throws PostCreateException
* @see Create a Post - v1 documentation
*
* status - Post status of the post:
* * draft,
* * publish,
* * pending,
* * future,
* * private
* or any custom registered status.
* If providing a status of future, you must specify a date in order for the post to be published as expected.
* Default is draft. (string) optional
*
*/
Post createPost(Map post, PostStatus status) throws PostCreateException;
Post createPost(Post post, PostStatus status) throws PostCreateException;
Post getPost(Long id) throws PostNotFoundException;
/**
*
* PUT /post/{id}
*
*/
Post updatePost(Post post);
Post updatePostField(Long postId, String field, Object value);
Post deletePost(Post post);
/**
* Search request just returning the first page of posts.
*/
static SearchRequest list() {
return SearchRequest.Builder.aSearchRequest(Post.class)
.withUri(Request.POSTS)
.build();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy