-
-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fields missing? #499
Comments
I've also noticed with octocrab::models::workflows::Run is missing top level keys, such as Not sure if this is by design, but it seems the structs defined in Octocrab is not a one-to-one mapping of what the GitHub api returns. |
There's this section in the docs that talks about how to extend octocrab types |
I guess I'll review actual schemas some day |
So I took Extracted URLS with tags use std::{fs::File,
io::BufWriter};
use std::io::Write;
use serde_yaml::Value;
fn main() -> std::io::Result<()> {
fn find_methods(gk: Option<&Value>) -> Option<&Value> {
let methods: Vec<_> = "get|post|put|patch|delete".split('|').collect();
for method in methods {
let try_method = gk.and_then(|gk| gk.get(method));
if try_method.is_some() { return try_method; }
}
None
}
//
let delim = '\t';
let f = File::open("api.github.com.2022-11-28.yaml").unwrap();
let out_file = File::create("api.github.com.2022-11-28.tsv").unwrap();
let mut writer = BufWriter::new(out_file);
let data: Value = serde_yaml::from_reader(f).unwrap();
let q = data.get("paths").unwrap();
writer.write_all(format!("TAG{delim}URL\n").as_ref())?;
println!("TAG{delim}URL");
match q {
Value::Sequence(sq) => println!("Sequence of {}", sq.len()),
Value::Mapping(m) => {
for key in m.keys() {
let gk = m.get(key);
let gk = find_methods(gk);
let gk = gk
.and_then(|gk| gk.get("tags"))
.and_then(|gs| gs.as_sequence());
if let Some(gk_contents) = gk {
if let Some(tag) = gk_contents.first() {
print!("{}{delim}", tag.as_str().unwrap());
writer.write_all(format!("{}{delim}", tag.as_str().unwrap()).as_ref())?;
} else {
print!("-{delim}");
writer.write_all(b"-{delim}\n")?
}
}
println!("{}", key.as_str().unwrap());
writer.write_all(format!("{}\n", key.as_str().unwrap()).as_ref())?
}
}
Value::String(st) => println!("String {}", st),
_ => println!("---")
}
let _ = writer.flush();
Ok(())
} and here is the result. |
Thank you for your issue! PRs adding missing fields are welcome and encouraged 🙂 |
we might use https://github.com/dmgorsky/github_api_check_for_octocrab for that |
Inspecting the code, noticed that
pub struct ListCollaboratorsBuilder
might lackaffiliation
,permission
and
pub struct Collaborator
might lackrole_name
according to
https://docs.github.com/en/rest/collaborators/collaborators?apiVersion=2022-11-28#list-repository-collaborators
The text was updated successfully, but these errors were encountered: