gitea_sdk/api/repos/
get.rs

1use crate::{error::Result, model::repos::Repository};
2
3#[derive(Debug)]
4pub struct GetRepoBuilder {
5    owner: String,
6    repo: String,
7}
8
9impl GetRepoBuilder {
10    pub fn new(owner: impl ToString, repo: impl ToString) -> Self {
11        Self {
12            owner: owner.to_string(),
13            repo: repo.to_string(),
14        }
15    }
16    /// Send the request to get the repository.
17    /// This will return a [Repository] object if the repository exists and is visible to the
18    /// currently authenticated user.
19    pub async fn send(&self, client: &crate::Client) -> Result<Repository> {
20        let GetRepoBuilder { owner, repo } = self;
21        let req = client.get(format!("repos/{owner}/{repo}")).build()?;
22        let res = client.make_request(req).await?;
23        client.parse_response(res).await
24    }
25}