-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathsearch_issues.rs
More file actions
30 lines (29 loc) · 835 Bytes
/
Copy pathsearch_issues.rs
File metadata and controls
30 lines (29 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use futures::prelude::*;
use hubcaps::search::SearchIssuesOptions;
use hubcaps::{Credentials, Github};
use std::env;
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
pretty_env_logger::init();
let token = env::var("GITHUB_TOKEN")?;
let github = Github::new(
concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")),
Credentials::Token(token),
)?;
println!("issue search results");
// https://developer.github.com/v3/search/#parameters-3
github
.search()
.issues()
.iter(
"user:softprops",
&SearchIssuesOptions::builder().per_page(100).build(),
)
.try_for_each(|issue| async move {
println!("{}", issue.title);
Ok(())
})
.await?;
Ok(())
}