gitea_sdk/api/orgs/
list_repos.rs

1use build_it::Builder;
2use serde::Serialize;
3
4use crate::{error::Result, model::repos::Repository, Client};
5
6#[derive(Debug, Clone, Builder, Serialize)]
7#[build_it(into)]
8pub struct ListReposBuilder {
9    #[serde(skip)]
10    #[build_it(skip)]
11    org: String,
12    /// Page number of results to return (1-based).
13    page: Option<i64>,
14    /// Page size of results.
15    limit: Option<i64>,
16}
17
18impl ListReposBuilder {
19    pub fn new(org: impl ToString) -> Self {
20        Self {
21            org: org.to_string(),
22            page: None,
23            limit: None,
24        }
25    }
26    /// Sends the request to list an organization's repositories.
27    pub async fn send(&self, client: &Client) -> Result<Vec<Repository>> {
28        let req = client
29            .get(format!("/orgs/{}/repos", self.org))
30            .query(self)
31            .build()?;
32        let res = client.make_request(req).await?;
33        client.parse_response(res).await
34    }
35}