gitea_sdk/api/user/
list_repos.rs

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