pub struct PostCreateEnvelope {
pub posts: Vec<PostCreate>,
}Expand description
Request envelope for POST /ghost/api/admin/posts/.
The Ghost Admin API requires the post payload to be wrapped in a
top-level posts array even when creating a single post.
§Example
use ghost_io_api::models::post::{PostCreate, PostCreateEnvelope};
use serde_json;
let envelope = PostCreateEnvelope::new(PostCreate::new("My Post"));
let json = serde_json::to_value(&envelope).unwrap();
assert!(json["posts"].is_array());
assert_eq!(json["posts"][0]["title"], "My Post");Fields§
§posts: Vec<PostCreate>Single-element array containing the post to create.
Implementations§
Source§impl PostCreateEnvelope
impl PostCreateEnvelope
Sourcepub fn new(post: PostCreate) -> Self
pub fn new(post: PostCreate) -> Self
Wraps a single PostCreate in the envelope Ghost expects.
§Example
use ghost_io_api::models::post::{PostCreate, PostCreateEnvelope};
let envelope = PostCreateEnvelope::new(PostCreate::new("Draft"));
assert_eq!(envelope.posts.len(), 1);
assert_eq!(envelope.posts[0].title, "Draft");Trait Implementations§
Source§impl Clone for PostCreateEnvelope
impl Clone for PostCreateEnvelope
Source§fn clone(&self) -> PostCreateEnvelope
fn clone(&self) -> PostCreateEnvelope
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PostCreateEnvelope
impl Debug for PostCreateEnvelope
Source§impl<'de> Deserialize<'de> for PostCreateEnvelope
impl<'de> Deserialize<'de> for PostCreateEnvelope
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PostCreateEnvelope
impl RefUnwindSafe for PostCreateEnvelope
impl Send for PostCreateEnvelope
impl Sync for PostCreateEnvelope
impl Unpin for PostCreateEnvelope
impl UnsafeUnpin for PostCreateEnvelope
impl UnwindSafe for PostCreateEnvelope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more