Skip to main content

Overview

The update_organization function updates an existing organization’s details.

Function Signature

pub async fn update_organization(
    organization_id: &str,
    request: UpdateOrganizationRequest
) -> Result<Organization>

Parameters

organization_id
&str
required
The unique identifier of the organization to update
request
UpdateOrganizationRequest
required
The organization fields to update (all optional):
  • name: Organization name
  • description: Organization description
  • logo_url: URL to organization logo
  • website: Organization website URL

Return Value

Returns Result<Organization> containing the updated organization details.

Basic Usage

use wacht::api::organizations::*;

let update = UpdateOrganizationRequest {
    name: Some("Acme Corporation Ltd".to_string()),
    description: Some("Updated description".to_string()),
    website: Some("https://acme.corp".to_string()),
    ..Default::default()
};

let updated_org = update_organization("52057194421551105", update).await?;
println!("Updated organization: {}", updated_org.name);

Error Handling

match update_organization("52057194421551105", request).await {
    Ok(org) => {
        println!("Successfully updated organization: {}", org.name);
        println!("Last updated: {}", org.updated_at);
    }
    Err(Error::Api { status, message, .. }) => {
        match status.as_u16() {
            404 => println!("Organization not found"),
            400 => println!("Invalid request: {}", message),
            403 => println!("Access denied: {}", message),
            _ => println!("API error {}: {}", status, message),
        }
    }
    Err(e) => println!("Request failed: {}", e),
}

Rate Limits

  • Update operations: 100 requests per minute
  • Burst limit: 10 requests per second