gitea_sdk/api/user/
orgs.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use build_it::Builder;
use serde::Serialize;

use crate::{model::orgs::Organization, Client};

#[derive(Debug, Default, Builder, Serialize)]
pub struct Orgs {
    page: Option<i64>,
    limit: Option<i64>,
}

impl Orgs {
    pub fn new() -> Self {
        Self::default()
    }
    /// Send the request to get the current user's organizations.
    pub async fn send(&self, client: &Client) -> crate::Result<Vec<Organization>> {
        let req = client.get("user/orgs").query(self).build()?;
        let res = client.make_request(req).await?;
        client.parse_response(res).await
    }
}