4 个版本
| 0.1.3 | 2021年2月16日 | 
|---|---|
| 0.1.2 | 2021年2月14日 | 
| 0.1.1 | 2021年2月1日 | 
| 0.1.0 | 2021年1月31日 | 
#32 in #github-api
每月 23 次下载
36KB
885 代码行
ghrs
ghrs 是 GitHub v3 API 的简单客户端。它具有简单的接口和阻塞 I/O,避免了异步 I/O 的复杂性,因此易于使用。ghrs 受 Octocrab 的启发。
目前提供以下模块。
使用方法
fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
    let client = Client::new();
    let mut current_page = client
        .pulls("owner", "repo")
        .list()
        .per_page(100)
        .page(1)
        .send()?;
    // You get pull requests.
    let mut pull_requests = current_page.take_items();
    // If you want to get next pages, see here.
    while let Some(next_page) = current_page.get_next_page() {
        current_page = next_page;
        pull_requests.extend(current_page.take_items());
    }
    Ok(())
}
GitHub 企业版
如果你使用 ghrs 为 GitHub 企业版,请设置 base_url。
// GET `https://github.your_company.com/api/v3/repos/owner/repo/issues`
let client = ghrs::Client::new();
let mut current_page = client
    .base_url("https://github.your_company.com/api/v3")
    .token("your_token")
    .issues("owner", "repo")
    .list()
    .send()?;
贡献
许可证
依赖项
~6MB
~144K SLoC