43 releases

0.6.2 Sep 7, 2020
0.6.1 Jun 26, 2020
0.5.0 Oct 29, 2018
0.4.9 Jun 29, 2018
0.2.0 Mar 20, 2016

#757 in Web programming

Download history 213/week @ 2024-07-29 44/week @ 2024-08-05 71/week @ 2024-08-12 34/week @ 2024-08-19 69/week @ 2024-08-26 43/week @ 2024-09-02 44/week @ 2024-09-09 44/week @ 2024-09-16 206/week @ 2024-09-23 55/week @ 2024-09-30 1/week @ 2024-10-07 49/week @ 2024-10-14 31/week @ 2024-10-21 49/week @ 2024-10-28 49/week @ 2024-11-04 8/week @ 2024-11-11

141 downloads per month
Used in 13 crates

MIT license

250KB
7K SLoC

hubcaps

a Rust interface for GitHub


installation

Add the following to your Cargo.toml file

[dependencies]
hubcaps = "0.6"

usage

Basic usage requires a user agent string and optionally a flavor of hubcaps::Credentials for making requests as a particular GitHub user.

For user authenticated requests you'll typically want to use hubcaps::Credentials::Token with a personal access token.

use hubcaps::{Credentials, Github};

fn main() {
  let github = Github::new(
    "my-cool-user-agent/0.1.0",
    Credentials::Token("personal-access-token".to_string()),
  );
}

GitHub instances define methods for accessing api services that map closely to their url structure.

As a convention, api methods that expect arguments are represented as functions that accept a struct representing those arguments with an optional builder interface for convenience of construction.

See examples directory for some getting started examples

repositories

Typically the reference point of most GitHub services is a repository

let repo = github.repo("user", "repo");

With a repo instance on hand, you can access a number of sub services, like labels, deployments, pulls, issues, releases, and many more. Each of this are named functions exported from the repo interface.

See examples directory for examples

branches

Branches is a service for listing repository branches

let branches = repo.branches();

labels

Labels is a service for tagging resources like issues and pulls with names which you can later group and filter on.

use hubcaps::labels::LabelOptions;

let labels = repo.labels();

// create new labels
labels.create(
    &LabelOptions::new(
      "rustic", "ccc"
    )
  )

deployments

Deployments is a service for orchestrating deployments of applications sourced from GitHub repositories

let deployments = repo.deployments();

See examples directory for examples

pulls

Pulls is a service for issuing code change requests against a repository

let pulls = repo.pulls();

See examples directory for examples

issues

Issues is a service for tracking bugs for a repository

let issues = repo.issues();

See examples directory for examples

releases

Releases is a service for tracking changes for a stable releases of a versioned library or application

let releases = repo.releases();

gists

Gists is a service for micro repositories

let gists = github.gists();

See examples directory for examples

hooks

Hooks is a service for managing repository hooks

let hooks = repo.hooks();

See examples directory for examples

Search provides a raw string query search for indexed data. Currently only search for issues is supported

let search_issues = github.search().issues();

teams

Teams is a service for listing repository and organization teams

let teams = repo.teams();

See examples directory for examples

Doug Tangren (softprops) 2015-2020

Dependencies

~15–31MB
~580K SLoC