Create a new organization. # Arguments `client` — Authenticated storage client. Must target the server apex (not an org subdomain): this endpoint spans orgs and is served on the bare host. See `atomic_cli::commands::client::build_apex_client`. `name` — Human-readable display name for the organization. `email` — Optional contact email. # Errors Returns [`TeamsError::AlreadyExists`](crate::error
(
client: &StorageClient,
name: &str,
email: Option<&str>,
)
| 25 | /// Returns [`TeamsError::AlreadyExists`](crate::error::TeamsError::AlreadyExists) |
| 26 | /// if an organization with the derived slug already exists. |
| 27 | pub async fn create_org( |
| 28 | client: &StorageClient, |
| 29 | name: &str, |
| 30 | email: Option<&str>, |
| 31 | ) -> TeamsResult<OrgInfo> { |
| 32 | debug!("Creating organization: name={name}"); |
| 33 | let slug = slugify(name); |
| 34 | let body = CreateOrgRequest { |
| 35 | slug: &slug, |
| 36 | name, |
| 37 | email, |
| 38 | }; |
| 39 | let info: OrgInfo = client |
| 40 | .post("/orgs", &body) |
| 41 | .await |
| 42 | .map_err(|e| map_remote_error(e, format!("org {name}")))?; |
| 43 | debug!("Created organization: slug={}, id={}", info.slug, info.id); |
| 44 | Ok(info) |
| 45 | } |
| 46 | |
| 47 | /// Fetch an organization by slug. |
| 48 | /// |
no test coverage detected