-
-
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.
Merge pull request #110 from softprops/label_iter
iter stream for repo labels
- Loading branch information
Showing
5 changed files
with
69 additions
and
14 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
extern crate env_logger; | ||
#[macro_use(quick_main)] | ||
extern crate error_chain; | ||
extern crate futures; | ||
extern crate hubcaps; | ||
extern crate hyper; | ||
extern crate tokio_core; | ||
|
||
use std::env; | ||
|
||
use futures::Stream; | ||
use tokio_core::reactor::Core; | ||
|
||
use hubcaps::{Credentials, Github, Result}; | ||
|
||
quick_main!(run); | ||
|
||
fn run() -> Result<()> { | ||
drop(env_logger::init()); | ||
match env::var("GITHUB_TOKEN").ok() { | ||
Some(token) => { | ||
let mut core = Core::new()?; | ||
let github = Github::new( | ||
concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")), | ||
Some(Credentials::Token(token)), | ||
&core.handle(), | ||
); | ||
core.run( | ||
github | ||
.repo("rust-lang", "cargo") | ||
.labels() | ||
.iter() | ||
.for_each(move |label| Ok(println!("{}", label.name))), | ||
)?; | ||
Ok(()) | ||
} | ||
_ => Err("example missing GITHUB_TOKEN".into()), | ||
} | ||
} |
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