XAMPPRocky / octocrab

A modern, extensible GitHub API Client for Rust.
Other
1.06k stars 258 forks source link

Delete git reference #572

Closed tniessen closed 6 months ago

tniessen commented 7 months ago

I'm trying to migrate from octokit to octocrab and I am using this workaround to delete a git reference:

async fn delete_reference(
    octocrab: &octocrab::Octocrab,
    owner: &str,
    repo: &str,
    reference: &octocrab::params::repos::Reference,
) -> octocrab::Result<()> {
    let route = format!("/repos/{owner}/{repo}/git/refs/{ref}", ref = reference.ref_url());
    let response = octocrab._delete(route, None::<&()>).await?;
    octocrab::map_github_error(response).await?;
    Ok(())
}

However, it would be great if octocrab had a built-in function to do this, similar to octokit. (Perhaps it already exists and I simply haven't found it yet!)