strike48-connector 0.3.6

Rust SDK for the Strike48 Connector Framework
Documentation
//! Simple Echo Connector - The easiest way to build a connector!
//!
//! This demonstrates the simplified API. Compare this to echo_connector.rs
//! which uses the low-level API.
//!
//! Run with:
//!   STRIKE48_HOST=localhost:50061 TENANT_ID=default cargo run --example simple_echo

use strike48_connector::prelude::*;

/// Echo connector - just 15 lines!
struct EchoConnector;

#[async_trait]
impl SimpleConnector for EchoConnector {
    fn name(&self) -> &str {
        "echo"
    }

    fn version(&self) -> &str {
        "1.0.0"
    }

    async fn handle(&self, request: Value) -> Result<Value> {
        // Just return the request as-is, wrapped in an echo response
        Ok(json!({
            "success": true,
            "echo": request,
            "timestamp": chrono::Utc::now().to_rfc3339()
        }))
    }
}

#[tokio::main]
async fn main() -> Result<()> {
    println!("🚀 Starting Echo Connector...");
    println!("   This connector echoes back any request it receives.");
    println!();

    // That's it! The connector reads config from environment variables
    // and handles signal shutdown automatically.
    EchoConnector.run().await
}