# oriko-services

Voudo Oriko services - Gmail API client.

## Installation

Add to your `Cargo.toml`:

```toml
[dependencies]
oriko-services = { path = "../packages/oriko-services" }
# Or from crates.io (when published)
# oriko-services = "0.1.0"
```

## Usage

### Basic Setup

```rust
use oriko_services::{GmailClient, GmailClientBuilder, TokenProvider};
use async_trait::async_trait;

// Implement TokenProvider
struct MyTokenProvider;

#[async_trait]
impl TokenProvider for MyTokenProvider {
    async fn get_access_token(&self) -> Result<String, String> {
        // Your token retrieval logic
        Ok("your_access_token".to_string())
    }
}

// Create client
let client = GmailClient::builder()
    .token_provider(Box::new(MyTokenProvider))
    .build()?;
```

### Fetch Messages

```rust
// Fetch messages
let messages = client.fetch_messages(Some(10)).await?;

// Fetch specific message
let message = client.fetch_message(&message_id).await?;

// Parse email
let parsed = client.parse_email(&message)?;
```

## API

### GmailClient

- `GmailClient::builder()` - Create builder
- `fetch_messages(max_results)` - Fetch message list
- `fetch_message(message_id)` - Fetch full message
- `parse_email(message)` - Parse email into structured format

### GmailClientBuilder

- `http_client(client)` - Set custom HTTP client
- `token_provider(provider)` - Set token provider (required)
- `build()` - Build client

### TokenProvider Trait

```rust
#[async_trait]
pub trait TokenProvider: Send + Sync {
    async fn get_access_token(&self) -> Result<String, String>;
}
```

Implement this trait to provide access tokens. The client will call this method for each API request.

