pub struct Author {Show 16 fields
pub id: String,
pub name: String,
pub slug: String,
pub profile_image: Option<String>,
pub cover_image: Option<String>,
pub bio: Option<String>,
pub website: Option<String>,
pub location: Option<String>,
pub facebook: Option<String>,
pub twitter: Option<String>,
pub meta_title: Option<String>,
pub meta_description: Option<String>,
pub url: Option<String>,
pub created_at: Option<String>,
pub updated_at: Option<String>,
pub count: Option<PostCount>,
}Expand description
A Ghost author resource.
§Example
use ghost_io_api::models::author::Author;
use serde_json::json;
let json = json!({
"id": "1",
"name": "Jane Doe",
"slug": "jane-doe",
"profile_image": "https://example.com/avatar.jpg"
});
let author: Author = serde_json::from_value(json).unwrap();
assert_eq!(author.name, "Jane Doe");Fields§
§id: StringGhost object ID.
name: StringDisplay name.
slug: StringURL slug.
profile_image: Option<String>Profile image URL.
cover_image: Option<String>Cover image URL.
bio: Option<String>Author bio.
website: Option<String>Personal website URL.
location: Option<String>Location string.
facebook: Option<String>Facebook profile URL or username.
twitter: Option<String>Twitter handle (without @).
meta_title: Option<String>Meta title override.
meta_description: Option<String>Meta description override.
url: Option<String>Public URL of the author’s archive page.
created_at: Option<String>ISO 8601 creation timestamp.
updated_at: Option<String>ISO 8601 last-updated timestamp.
count: Option<PostCount>Post count (populated when include=count.posts).
Implementations§
Source§impl Author
impl Author
Sourcepub fn has_profile_image(&self) -> bool
pub fn has_profile_image(&self) -> bool
Returns true if the author has a profile image set.
§Example
use ghost_io_api::models::author::Author;
let author = Author {
profile_image: Some("https://example.com/img.jpg".to_string()),
..Default::default()
};
assert!(author.has_profile_image());Sourcepub fn post_count(&self) -> Option<u32>
pub fn post_count(&self) -> Option<u32>
Returns the number of published posts by this author, if available.
Returns None unless include=count.posts was in the request.
§Example
use ghost_io_api::models::author::Author;
use ghost_io_api::models::tag::PostCount;
let author = Author {
count: Some(PostCount { posts: 5 }),
..Default::default()
};
assert_eq!(author.post_count(), Some(5));Trait Implementations§
Source§impl<'de> Deserialize<'de> for Author
impl<'de> Deserialize<'de> for Author
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
impl StructuralPartialEq for Author
Auto Trait Implementations§
impl Freeze for Author
impl RefUnwindSafe for Author
impl Send for Author
impl Sync for Author
impl Unpin for Author
impl UnsafeUnpin for Author
impl UnwindSafe for Author
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