pub struct Article {
pub title: String,
pub author: String,
pub content: String,
pub content_source_url: Option<String>,
pub digest: String,
pub show_cover_pic: u8,
pub thumb_media_id: Option<String>,
pub need_open_comment: u8,
pub only_fans_can_comment: u8,
}
Expand description
Represents a WeChat article for draft creation.
Fields§
§title: String
Article title
Article author
content: String
Article content (HTML)
content_source_url: Option<String>
Content source URL (optional)
digest: String
Digest (summary) of the article
show_cover_pic: u8
Show cover picture in content (0: no, 1: yes)
thumb_media_id: Option<String>
Thumb media ID for cover image
need_open_comment: u8
Need open comment (0: no, 1: yes)
only_fans_can_comment: u8
Only fans can comment (0: no, 1: yes)
Implementations§
Source§impl Article
impl Article
Sourcepub fn new(title: String, author: String, content: String) -> Self
pub fn new(title: String, author: String, content: String) -> Self
Creates a new article with required fields.
Sourcepub fn with_digest(self, digest: String) -> Self
pub fn with_digest(self, digest: String) -> Self
Sets the article digest (summary).
Sourcepub fn with_cover_image(self, thumb_media_id: String) -> Self
pub fn with_cover_image(self, thumb_media_id: String) -> Self
Sets the cover image media ID.
Sourcepub fn with_show_cover(self, show: bool) -> Self
pub fn with_show_cover(self, show: bool) -> Self
Sets whether to show cover image in content.
Sourcepub fn with_comments(self, enable_comments: bool, fans_only: bool) -> Self
pub fn with_comments(self, enable_comments: bool, fans_only: bool) -> Self
Sets comment settings.
Sourcepub fn with_source_url(self, url: String) -> Self
pub fn with_source_url(self, url: String) -> Self
Sets the content source URL.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Article
impl<'de> Deserialize<'de> for Article
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 Article
impl RefUnwindSafe for Article
impl Send for Article
impl Sync for Article
impl Unpin for Article
impl UnwindSafe for Article
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