MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / create_org

Function create_org

atomic-teams/src/org.rs:27–45  ·  view source on GitHub ↗

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>,
)

Source from the content-addressed store, hash-verified

25/// Returns [`TeamsError::AlreadyExists`](crate::error::TeamsError::AlreadyExists)
26/// if an organization with the derived slug already exists.
27pub 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///

Callers 1

executeMethod · 0.85

Calls 3

slugifyFunction · 0.85
map_remote_errorFunction · 0.85
postMethod · 0.80

Tested by

no test coverage detected