Skip to main content

mesa_dev/client/
org.rs

1use crate::low_level::apis::{configuration::Configuration, org_api, Error};
2use crate::models;
3
4use super::{ApiKeysClient, ReposClient};
5
6/// Client scoped to an organization (`/{org}`).
7#[derive(Clone, Debug)]
8pub struct OrgClient<'a> {
9    pub(super) config: &'a Configuration,
10    pub(super) org: &'a str,
11}
12
13impl OrgClient<'_> {
14    /// Get organization metadata and repository counts.
15    ///
16    /// # Errors
17    ///
18    /// Returns an error if the API request fails.
19    pub async fn get(&self) -> Result<models::GetByOrg200Response, Error<org_api::GetByOrgError>> {
20        org_api::get_by_org(self.config, self.org).await
21    }
22
23    /// Access repository listing and creation.
24    #[must_use]
25    pub fn repos(&self) -> ReposClient<'_> {
26        ReposClient { org: self }
27    }
28
29    /// Access API key management.
30    #[must_use]
31    pub fn api_keys(&self) -> ApiKeysClient<'_> {
32        ApiKeysClient { org: self }
33    }
34}