14 个版本 (1 个稳定版)
1.0.0 | 2024 年 7 月 3 日 |
---|---|
0.3.0 | 2024 年 6 月 23 日 |
0.2.0 | 2024 年 5 月 21 日 |
0.1.12 | 2024 年 4 月 10 日 |
0.1.11 | 2024 年 2 月 23 日 |
#1052 in Web 编程
13KB
141 行
boosty-rs
安装说明
$ cargo add boosty-rs
示例
从博客获取所有帖子
use std::error::Error;
use boosty_rs::request;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let response = request::fetch_posts("boosty".to_string(), None).await?;
println!("{:?}", response);
Ok(())
}
从博客获取单个帖子
use std::error::Error;
use boosty_rs::request;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let response = request::fetch_post("boosty".to_string(), "a4dc61c8-4ff9-495b-946b-3982efef68fe".to_string(), None).await?;
println!("{:?}", response);
Ok(())
}
使用授权从博客获取所有帖子
use std::error::Error;
use boosty_rs::request;
use boosty_rs::auth::Auth;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let response = request::fetch_posts("boosty".to_string(), Auth::new("access_token".to_string())).await?;
println!("{:?}", response);
Ok(())
}
依赖项
~8–21MB
~325K SLoC