Crate goiam

Source
Expand description

§GoIAM Rust SDK

A lightweight Rust SDK for integrating with Go IAM server. Provides methods for authentication, user management, and resource creation.

§Quick Start

use goiam::{new_service, Resource, Service};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let service = new_service(
        "https://go-iam.example.com".to_string(),
        "your-client-id".to_string(),
        "your-secret".to_string(),
    );
     
    // Verify authentication code
    let token = service.verify("auth-code").await?;
     
    // Get user information
    let user = service.me(&token).await?;
    println!("User: {} ({})", user.name, user.email);
     
    // Create a resource
    let resource = Resource::new("resource-id".to_string(), "Resource Name".to_string());
    service.create_resource(&resource, &token).await?;
     
    Ok(())
}

Re-exports§

pub use error::GoIamError;
pub use error::Result;
pub use service::Service;
pub use service_impl::new_service;
pub use service_impl::ServiceImpl;
pub use types::Resource;
pub use types::User;
pub use types::UserResource;
pub use types::UserRole;

Modules§

error
service
service_impl
types