Skip to main content

josh_github_graphql/operations/
get_repo_id.rs

1use anyhow::Context;
2
3use crate::connection::GithubApiConnection;
4use josh_github_codegen_graphql::{get_repo_id, GetRepoId};
5
6impl GithubApiConnection {
7    pub async fn get_repo_id(&self, owner: &str, name: &str) -> anyhow::Result<String> {
8        let variables = get_repo_id::Variables {
9            owner: owner.to_string(),
10            name: name.to_string(),
11        };
12
13        let response = self.make_request::<GetRepoId>(variables).await?;
14        Ok(response.repository.context("Empty repository field")?.id)
15    }
16}