I'm trying to write a rust script that submits an issue with given name, label and body to a specific repository using github access token. I've found github-rs and octocrab, but can't figure out how this exact function works.
UPDATE Here's the code using rust-curl:
use std::io::Read;
use curl::easy::{Easy, List};
fn main() {
let mut data = r#"{
"title": "Found a bug",
"body": "I'm having a problem with this.",
"labels": [
"bug"
]
}"#.as_bytes();
let mut easy = Easy::new();
easy.url("https://api.github.com").unwrap();
let mut list = List::new();
list.append("Authorization: token TOKEN_HERE").unwrap();
easy.http_headers(list).unwrap();
easy.perform().unwrap();
easy.post(true).unwrap();
easy.post_field_size(data.len() as u64).unwrap();
let mut transfer = easy.transfer();
transfer.read_function(|buf| {
Ok(data.read(buf).unwrap_or(0))
}).unwrap();
transfer.perform().unwrap();
}