-
-
Notifications
You must be signed in to change notification settings - Fork 68
/
pulls.rs
61 lines (57 loc) · 1.35 KB
/
pulls.rs
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
use futures::prelude::*;
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),
)?;
let repo = github.repo("softprops", "hubcat");
let pulls = repo.pulls();
pulls
.iter(&Default::default())
.try_for_each(|pull| async move {
println!("{:#?}", pull);
Ok(())
})
.await?;
println!("comments");
for c in github
.repo("softprops", "hubcaps")
.pulls()
.get(28)
.comments()
.list(&Default::default())
.await?
{
println!("{:#?}", c);
}
println!("commits");
github
.repo("softprops", "hubcaps")
.pulls()
.get(28)
.commits()
.iter()
.try_for_each(|c| async move {
println!("{:#?}", c);
Ok(())
})
.await?;
println!("review requests");
println!(
"{:#?}",
github
.repo("softprops", "hubcaps")
.pulls()
.get(190)
.review_requests()
.get()
.await?
);
Ok(())
}