pub struct Article { /* private fields */ }Implementations§
Source§impl Article
impl Article
pub fn new(api_key: String) -> Self
Sourcepub async fn post_article(&self, data: &ArticlePost) -> Result<String, Error>
pub async fn post_article(&self, data: &ArticlePost) -> Result<String, Error>
Sourcepub async fn update_article(
&self,
id: &str,
data: &ArticlePost,
) -> Result<String, Error>
pub async fn update_article( &self, id: &str, data: &ArticlePost, ) -> Result<String, Error>
Sourcepub async fn list(
&self,
type_: ArticleListType,
page: u32,
size: u32,
tag: Option<&str>,
) -> Result<ArticleList, Error>
pub async fn list( &self, type_: ArticleListType, page: u32, size: u32, tag: Option<&str>, ) -> Result<ArticleList, Error>
Sourcepub async fn list_by_user(
&self,
user: &str,
page: u32,
size: u32,
) -> Result<ArticleList, Error>
pub async fn list_by_user( &self, user: &str, page: u32, size: u32, ) -> Result<ArticleList, Error>
查询文章列表
user指定用户page页码size每页数量
返回文章列表
Sourcepub async fn vote(&self, id: &str, like: bool) -> Result<bool, Error>
pub async fn vote(&self, id: &str, like: bool) -> Result<bool, Error>
点赞/取消点赞文章
id文章idlike点赞类型,true 为点赞,false 为点踩
返回文章点赞状态,true 为点赞,false 为点踩
Sourcepub async fn watch(&self, following_id: &str) -> Result<ResponseResult, Error>
pub async fn watch(&self, following_id: &str) -> Result<ResponseResult, Error>
关注/取消关注文章
followingId文章id
返回执行结果
Sourcepub async fn add_listener(
&self,
id: &str,
type_: ArticleType,
callback: ArticleListener,
) -> Result<WebSocketClient, Error>
pub async fn add_listener( &self, id: &str, type_: ArticleType, callback: ArticleListener, ) -> Result<WebSocketClient, Error>
添加文章监听器
id文章idtype_文章类型callback监听回调
返回 WebSocketClient
Auto Trait Implementations§
impl Freeze for Article
impl RefUnwindSafe for Article
impl Send for Article
impl Sync for Article
impl Unpin for Article
impl UnsafeUnpin 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