Crate hubcaps[−][src]
Hubcaps provides a set of building blocks for interacting with the Github API
Examples
Typical use will require instantiation of a Github client. Which requires
a user agent string, set of hubcaps::Credentials
and a tokio_core Handle
.
extern crate hubcaps; extern crate hyper; extern crate tokio_core; use tokio_core::reactor::Core; use hubcaps::{Credentials, Github}; fn main() { let mut core = Core::new().expect("reactor fail"); let github = Github::new( String::from("user-agent-name"), Credentials::Token( String::from("personal-access-token") ), &core.handle() ); }
Github enterprise users will want to create a client with the Github#host method
Access to various services are provided via methods on instances of the Github
type.
The convention for executing operations typically looks like
github.repo(.., ..).service().operation(OperationOptions)
where operation may be create
,
delete
, etc.
Services and their types are packaged under their own module namespace.
A service interface will provide access to operations and operations may access options types
that define the various parameter options available for the operation. Most operation option
types expose builder()
methods for a builder oriented style of constructing options.
Entity listings
Many of Github's APIs return a collection of entities with a common interface for supporting pagination
Hubcaps supports two types of interfaces for working with listings. list(...)
interfaces return the first
( often enough ) list of entities. Alternatively for listings that require > 30 items you may wish to
use the iter(..)
variant which returns a futures::Stream
over all entities in a paginated set.
Errors
Operations typically result in a hubcaps::Future
with an error type pinned to
hubcaps::Error.
Rate Limiting
A special note should be taken when accounting for Github's API Rate Limiting A special case hubcaps::ErrorKind::RateLimit will be returned from api operations when the rate limit associated with credentials has been exhausted. This type will include a reset Duration to wait before making future requests.
This crate uses the log
crate's debug log interface to log x-rate-limit
headers received from Github.
If you are attempting to test your access patterns against
Github's rate limits, enable debug looking and look for "x-rate-limit"
log patterns sourced from this crate
Re-exports
pub use errors::Error; |
pub use errors::ErrorKind; |
pub use errors::Result; |
Modules
activity |
Activity interface |
branches |
Repo branches interface |
comments |
Comments interface |
deployments |
Deployments interface |
errors |
Client errors |
gists |
Gists interface |
git |
Git interface |
hooks |
Hooks interface |
issues |
Issues interface |
keys |
Deploy keys interface |
labels |
Labels interface |
notifications |
Notifications interface |
organizations |
Organizations interface |
pull_commits |
Pull Commits interface |
pulls |
Pull requests interface |
rate_limit |
Rate Limit interface |
releases |
Releases interface |
repositories |
Repository interface |
review_comments |
Review comments interface |
search |
Search interface |
stars |
Stars interface |
statuses |
Statuses interface |
teams |
Teams interface |
traffic |
Traffic interface |
users |
Users interface |
Structs
Github |
Entry point interface for interacting with Github API |
Enums
Credentials |
Various forms of authentication credentials supported by Github |
MediaType |
Github defined Media types See this doc for more for more information |
SortDirection |
enum representation of Github list sorting options |
Type Definitions
Future |
A type alias for |
Stream |
A type alias for |