diff --git a/examples/graphql_issues.rs b/examples/graphql_issues.rs new file mode 100644 index 00000000..e6a2876c --- /dev/null +++ b/examples/graphql_issues.rs @@ -0,0 +1,28 @@ +#[tokio::main] +async fn main() -> Result<(), Box> { + let octocrab = octocrab::Octocrab::builder() + .personal_token(std::env::var("GITHUB_TOKEN").unwrap()) + .build()?; + + let query = r#" { + repository(owner:"XAMPPRocky", name:"octocrab") { + issues(last: 2, states: OPEN) { + nodes { + title + url + } + } + } + } "#; + + let response: octocrab::Result = octocrab + .graphql(&serde_json::json!({ "query": query })) + .await; + + match response { + Ok(value) => println!("{value:#?}"), + Err(error) => println!("{error:#?}"), + } + + Ok(()) +}