gitea_sdk/api/user/
orgs.rs

1use build_it::Builder;
2use serde::Serialize;
3
4use crate::{model::orgs::Organization, Client};
5
6#[derive(Debug, Default, Builder, Serialize)]
7pub struct Orgs {
8    page: Option<i64>,
9    limit: Option<i64>,
10}
11
12impl Orgs {
13    pub fn new() -> Self {
14        Self::default()
15    }
16    /// Send the request to get the current user's organizations.
17    pub async fn send(&self, client: &Client) -> crate::Result<Vec<Organization>> {
18        let req = client.get("user/orgs").query(self).build()?;
19        let res = client.make_request(req).await?;
20        client.parse_response(res).await
21    }
22}