#github-api #api-bindings #pure

yanked github-rs

Pure Rust bindings to the Github API

0.7.0 Apr 25, 2019
0.6.1 Dec 28, 2017
0.6.0 Sep 24, 2017
0.5.0 Jun 23, 2017
0.1.0 Aug 18, 2016

#63 in #github-api

Download history 41/week @ 2024-03-14 18/week @ 2024-03-21 62/week @ 2024-03-28 58/week @ 2024-04-04 16/week @ 2024-04-11 29/week @ 2024-04-18 43/week @ 2024-04-25 12/week @ 2024-05-02 20/week @ 2024-05-09 27/week @ 2024-05-16 26/week @ 2024-05-23 27/week @ 2024-05-30 30/week @ 2024-06-06 15/week @ 2024-06-13 21/week @ 2024-06-20 12/week @ 2024-06-27

82 downloads per month
Used in 5 crates

MIT license

63KB
2K SLoC

github-rs

Service Status
TravisCI Build Status
DependencyCI DependencyStatus
AppveyorCI Build status
CodeCov codecov
crates.io crates.io

Pure Rust bindings to the Github V3 API. If you want bindings to the V4 library see the github-graphql-rs library.

Incomplete Bindings

Please look at the endpoints docs to see which endpoints are currently covered in the API. This is for the Github V3 API.

Dependencies and Support

github-rs is intended to work on all tier 1 supported Rust systems:

  • Windows
  • Linux
  • MacOSX

github-rs supports rustls and rust-native-tls for TLS connectivity. rustls is used by default, but one can toggle support with Cargo features:

[dependencies.github-rs]
version = "0.6"
default-features = false
features = ["rust-native-tls"]

Since rustls depends on ring for cryptography, hardware support is limited to what ring supports, currently ARM and x86 (both 32- and 64-bit). If you're compiling for other architectures then you may use the rust-native-tls feature for maximum portability.

Minimum Compiler Version

Due to the use of certain features github-rs requires rustc version 1.18 or higher.

Project Aims

  • Have a robust API where everything is error handled properly to avoid panics of any kind. A library is the base of an application and should be a solid foundation to be built upon
  • Cover all Github stable endpoints. Anything that's deprecated and beta should be obtained only through configuration for those features. As deprecated endpoints are removed from Github so too should they be removed from this library.
  • Having stability as part of the API. As such effort will be taken to make sure this code compiles on stable Rust, rather than nightly.
  • Ease of use. The complexity should be hidden from those not hacking on the code itself.
  • Documentation of everything so not only is it easy to hack on but finding out how to use the library should be easy to find.

Getting Started

Add the following to your Cargo.toml

[dependencies]
github-rs = "0.6"
serde_json = "1.0"

Then in your lib.rs or main.rs file add:

use github_rs::client::{Executor, Github};
use serde_json::Value;

Now you can start making queries. Here's a small example to get your user information:

use github_rs::client::{Executor, Github};
use serde_json::Value;

fn main() {
    let client = Github::new("API TOKEN").unwrap();
    let me = client.get()
                   .user()
                   .execute::<Value>();
    match me {
        Ok((headers, status, json)) => {
            println!("{:#?}", headers);
            println!("{}", status);
            if let Some(json) = json{
                println!("{}", json);
            }
        },
        Err(e) => println!("{}", e)
    }
}

Hacking on the Library

Contributing

See CONTRIBUTING.md for more information.

License

Licensed under either of

at your option.

Licensing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~12–25MB
~374K SLoC