9 releases

0.2.6 May 13, 2022
0.2.5 May 11, 2022
0.2.1 Apr 28, 2022
0.1.1 Apr 27, 2022

#679 in Authentication

28 downloads per month

Apache-2.0

11MB
226K SLoC

GitHub v3 REST API

GitHub API client for Rust, supporting hyper and reqwest (async and blocking).

This code is automatically generated from the OpenAPI spec for the GitHub API.

Features

The code requires at least one feature to be enabled, to select the HTTP request library:

  • hyper-client (enabled by default)
  • reqwest-async
  • reqwest-blocking

Contributions

Since this code is automatically generated, Pull Requests will not be accepted directly.

If you find a problem, check if GitHub's OpenAPI repo contains the same problem and report there.

If the problem does not exist in the OpenAPI description and appears to be a problem with the code generation, please open an issue in this repo.


lib.rs:

Clients for GitHub API.

Generated from https://github.com/github/rest-api-description/commits/main/descriptions/api.github.com/api.github.com.json SHA 6985b0b dated 27 April 2022

HTTP library support

The underlying web library can be selected as a feature.

For hyper, the feature hyper-client is enabled by default.

For async reqwest use

[dependencies]
jinxapi-github = { version = "0.1", default-features = false, features = ["reqwest-async"] }

For blocking reqwest use

[dependencies]
jinxapi-github = { version = "0.1", default-features = false, features = ["reqwest-blocking"] }

Using the API

Broadly, the steps to use the API are:

  • Create a v1_1_4::config::Configuration object, including authentication credentials.
  • Create a client for the underlying HTTP library (hyper or reqwest).
  • Create a Caller (v1_1_4::hyper::Caller, v1_1_4::reqwest::Caller, v1_1_4::reqwest::blocking::Caller), providing the Configuration, Client, and an appropriate function for sleeping (e.g. std::thread::sleep or tokio::time::sleep).
  • For requests with a body, create the body type.
  • Call a method on the Caller, passing in operation parameters and, if required, a body.
  • Handle the response returned from the method.

See the test and example code for examples of these steps.

Dependencies

~9–22MB
~409K SLoC