@@ -51,25 +51,21 @@ fn main() -> Result<(), anyhow::Error> {
51
51
name : name. to_string ( ) ,
52
52
} ) ;
53
53
54
- let client = reqwest:: blocking:: Client :: new ( ) ;
54
+ let client = reqwest:: blocking:: Client :: builder ( )
55
+ . user_agent ( "graphql-rust/0.9.0" )
56
+ . build ( ) ?;
55
57
56
58
let res = client
57
59
. post ( "https://api.github.com/graphql" )
58
60
. bearer_auth ( config. github_api_token )
59
61
. json ( & q)
60
62
. send ( ) ?;
61
63
64
+ res. error_for_status_ref ( ) ?;
65
+
62
66
let response_body: Response < repo_view:: ResponseData > = res. json ( ) ?;
63
67
info ! ( "{:?}" , response_body) ;
64
68
65
- if let Some ( errors) = response_body. errors {
66
- println ! ( "there are errors:" ) ;
67
-
68
- for error in & errors {
69
- println ! ( "{:?}" , error) ;
70
- }
71
- }
72
-
73
69
let response_data: repo_view:: ResponseData = response_body. data . expect ( "missing response data" ) ;
74
70
75
71
let stars: Option < i64 > = response_data
@@ -80,8 +76,8 @@ fn main() -> Result<(), anyhow::Error> {
80
76
println ! ( "{}/{} - 🌟 {}" , owner, name, stars. unwrap_or( 0 ) , ) ;
81
77
82
78
let mut table = prettytable:: Table :: new ( ) ;
83
-
84
- table. add_row ( row ! ( b => "issue" , "comments" ) ) ;
79
+ table . set_format ( * prettytable :: format :: consts :: FORMAT_NO_LINESEP_WITH_TITLE ) ;
80
+ table. set_titles ( row ! ( b => "issue" , "comments" ) ) ;
85
81
86
82
for issue in & response_data
87
83
. repository
0 commit comments