diff --git a/src/main/java/com/buttercms/model/Page.java b/src/main/java/com/buttercms/model/Page.java index 876f795..656efbc 100644 --- a/src/main/java/com/buttercms/model/Page.java +++ b/src/main/java/com/buttercms/model/Page.java @@ -1,7 +1,9 @@ package com.buttercms.model; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Date; import java.util.Objects; import java.util.StringJoiner; @@ -10,6 +12,8 @@ public class Page { private String slug; private String pageType; private T fields; + private Status status; + private Date scheduled; public String getSlug() { return slug; @@ -35,6 +39,22 @@ public void setFields(T fields) { this.fields = fields; } + public Status getStatus() { + return status; + } + + public void setStatus(Status status) { + this.status = status; + } + + public Date getScheduled() { + return scheduled; + } + + public void setScheduled(Date scheduled) { + this.scheduled = scheduled; + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -56,4 +76,14 @@ public String toString() { .add("fields=" + fields) .toString(); } + + public enum Status { + @JsonProperty("draft") + DRAFT, + @JsonProperty("published") + PUBLISHED, + @JsonProperty("scheduled") + SCHEDULED + } } + diff --git a/src/main/java/com/buttercms/model/Post.java b/src/main/java/com/buttercms/model/Post.java index 45923fc..304380d 100644 --- a/src/main/java/com/buttercms/model/Post.java +++ b/src/main/java/com/buttercms/model/Post.java @@ -16,6 +16,7 @@ public class Post { private Date created; private String metaDescription; private Date published; + private Date scheduled; private String seoTitle; private String slug; private Status status; @@ -74,6 +75,14 @@ public void setPublished(Date published) { this.published = published; } + public Date getScheduled() { + return scheduled; + } + + public void setScheduled(Date scheduled) { + this.scheduled = scheduled; + } + public String getSeoTitle() { return seoTitle; } @@ -151,6 +160,7 @@ public boolean equals(Object o) { Objects.equals(created, post.created) && Objects.equals(metaDescription, post.metaDescription) && Objects.equals(published, post.published) && + Objects.equals(scheduled, post.scheduled) && Objects.equals(seoTitle, post.seoTitle) && Objects.equals(slug, post.slug) && status == post.status && @@ -164,7 +174,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(author, body, categories, created, metaDescription, published, seoTitle, slug, status, summary, tags, title, url, featuredImage, featuredImageAlt); + return Objects.hash(author, body, categories, created, metaDescription, published, scheduled, seoTitle, slug, status, summary, tags, title, url, featuredImage, featuredImageAlt); } @Override @@ -188,6 +198,10 @@ public enum Status { DRAFT, @JsonProperty("published") - PUBLISHED + PUBLISHED, + + @JsonProperty("scheduled") + SCHEDULED } } +