-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement organization repository list support
- Loading branch information
1 parent
93bdac6
commit 8424459
Showing
5 changed files
with
135 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
extern crate env_logger; | ||
extern crate hyper; | ||
extern crate hubcaps; | ||
|
||
use hyper::Client; | ||
use hubcaps::{Credentials, Github, OrganizationRepoListOptions}; | ||
use hubcaps::repositories::OrgRepoType; | ||
use std::env; | ||
|
||
fn main() { | ||
env_logger::init().unwrap(); | ||
match env::var("GITHUB_TOKEN").ok() { | ||
Some(token) => { | ||
let client = Client::new(); | ||
let github = Github::new(format!("hubcaps/{}", env!("CARGO_PKG_VERSION")), | ||
&client, | ||
Credentials::Token(token)); | ||
|
||
let options = OrganizationRepoListOptions::builder().repo_type(OrgRepoType::Forks).build(); | ||
|
||
println!("Forks in the rust-lang organization:"); | ||
|
||
for repo in github.org_repos("rust-lang").list(&options).unwrap() { | ||
println!("{}", repo.name) | ||
} | ||
} | ||
_ => println!("example missing GITHUB_TOKEN"), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters