Overview

The delete_organization_role function permanently deletes a custom organization role.

Function Signature

pub async fn delete_organization_role(
    organization_id: &str,
    role_id: &str
) -> Result<()>

Parameters

organization_id
&str
required
The unique identifier of the organization
role_id
&str
required
The unique identifier of the role to delete

Return Value

Returns Result<()> indicating success or failure.

Basic Usage

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

delete_organization_role("org_123", "role_456").await?;
println!("Role deleted successfully");

Error Handling

match delete_organization_role("org_123", "role_456").await {
    Ok(()) => {
        println!("Role deleted successfully");
    }
    Err(Error::Api { status, message, .. }) => {
        match status.as_u16() {
            404 => println!("Organization or role not found"),
            403 => println!("Access denied: {}", message),
            409 => println!("Cannot delete role with assigned members: {}", message),
            _ => println!("API error {}: {}", status, message),
        }
    }
    Err(e) => println!("Request failed: {}", e),
}

Important Notes

  • Cannot delete built-in system roles (owner, admin, member)
  • Cannot delete roles that are currently assigned to members
  • This operation is irreversible

Rate Limits

  • Delete operations: 20 requests per minute
  • Burst limit: 5 requests per second