agentcat-api 0.0.3

Generated Rust client for the AgentCat API, consumed by agentcat-sdk.
Documentation
/*
 * AgentCat API
 *
 * API for AgentCat application
 *
 * The version of the OpenAPI document: v1
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PublishEventRequest {
    /// ID of the event, typically auto-generated by the AgentCat Agent
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// ID of the project this event belongs to
    #[serde(rename = "project_id")]
    pub project_id: String,
    /// ID of the session this event belongs to. Null for stateless mode (server assigns session).
    #[serde(rename = "session_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub session_id: Option<Option<String>>,
    /// Optional actor ID
    #[serde(rename = "actor_id", skip_serializing_if = "Option::is_none")]
    pub actor_id: Option<String>,
    /// Optional custom event ID (must be unique)
    #[serde(rename = "event_id", skip_serializing_if = "Option::is_none")]
    pub event_id: Option<String>,
    /// Type of event (e.g., mcp:tools/call, agentcat:identify)
    #[serde(rename = "event_type", skip_serializing_if = "Option::is_none")]
    pub event_type: Option<EventType>,
    /// Whether this event represents an error
    #[serde(rename = "is_error", skip_serializing_if = "Option::is_none")]
    pub is_error: Option<bool>,
    /// Error details if is_error is true
    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
    pub error: Option<serde_json::Value>,
    /// Name of the resource accessed (for resource events)
    #[serde(rename = "resource_name", skip_serializing_if = "Option::is_none")]
    pub resource_name: Option<String>,
    /// Duration of the operation in milliseconds
    #[serde(rename = "duration", skip_serializing_if = "Option::is_none")]
    pub duration: Option<i32>,
    /// Token count of the request side as measured by the SDK. When absent, the server estimates it from the stored parameters.
    #[serde(rename = "input_tokens", skip_serializing_if = "Option::is_none")]
    pub input_tokens: Option<i32>,
    /// Token count of the response side as measured by the SDK. When absent, the server estimates it from the stored response. Drives the oversized-tool-response rule.
    #[serde(rename = "output_tokens", skip_serializing_if = "Option::is_none")]
    pub output_tokens: Option<i32>,
    /// Agent-provided timestamp of when the event occurred
    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
    pub timestamp: Option<chrono::DateTime<chrono::FixedOffset>>,
    /// Captured explanation of why the actor made this request
    #[serde(rename = "user_intent", skip_serializing_if = "Option::is_none")]
    pub user_intent: Option<String>,
    /// Parameters sent with the request
    #[serde(rename = "parameters", skip_serializing_if = "Option::is_none")]
    pub parameters: Option<serde_json::Value>,
    /// Response data from the operation
    #[serde(rename = "response", skip_serializing_if = "Option::is_none")]
    pub response: Option<serde_json::Value>,
    /// Actor ID for agentcat:identify events
    #[serde(rename = "identify_actor_given_id", skip_serializing_if = "Option::is_none")]
    pub identify_actor_given_id: Option<String>,
    /// Actor name for agentcat:identify events
    #[serde(rename = "identify_actor_name", skip_serializing_if = "Option::is_none")]
    pub identify_actor_name: Option<String>,
    /// Additional data for agentcat:identify events
    #[serde(rename = "identify_data", skip_serializing_if = "Option::is_none")]
    pub identify_data: Option<serde_json::Value>,
    /// Custom string key-value pairs. Keys: max 32 chars, alphanumeric/underscore/period/colon/dash/dollar-sign only. Values: max 200 chars, no newlines. Max 50 entries.
    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
    pub tags: Option<std::collections::HashMap<String, String>>,
    /// Custom structured data. Keys are strings, values can be string, number, boolean, array, object, or null (null values are filtered out).
    #[serde(rename = "properties", skip_serializing_if = "Option::is_none")]
    pub properties: Option<serde_json::Value>,
    /// IP address of the client
    #[serde(rename = "ip_address", skip_serializing_if = "Option::is_none")]
    pub ip_address: Option<String>,
    /// Programming language of the SDK used
    #[serde(rename = "sdk_language", skip_serializing_if = "Option::is_none")]
    pub sdk_language: Option<String>,
    /// Version of AgentCat being used
    #[serde(rename = "agentcat_version", skip_serializing_if = "Option::is_none")]
    pub agentcat_version: Option<String>,
    /// Name of the MCP server
    #[serde(rename = "server_name", skip_serializing_if = "Option::is_none")]
    pub server_name: Option<String>,
    /// Version of the MCP server
    #[serde(rename = "server_version", skip_serializing_if = "Option::is_none")]
    pub server_version: Option<String>,
    /// Name of the MCP client
    #[serde(rename = "client_name", skip_serializing_if = "Option::is_none")]
    pub client_name: Option<String>,
    /// Version of the MCP client
    #[serde(rename = "client_version", skip_serializing_if = "Option::is_none")]
    pub client_version: Option<String>,
}

impl PublishEventRequest {
    pub fn new(project_id: String) -> PublishEventRequest {
        PublishEventRequest {
            id: None,
            project_id,
            session_id: None,
            actor_id: None,
            event_id: None,
            event_type: None,
            is_error: None,
            error: None,
            resource_name: None,
            duration: None,
            input_tokens: None,
            output_tokens: None,
            timestamp: None,
            user_intent: None,
            parameters: None,
            response: None,
            identify_actor_given_id: None,
            identify_actor_name: None,
            identify_data: None,
            tags: None,
            properties: None,
            ip_address: None,
            sdk_language: None,
            agentcat_version: None,
            server_name: None,
            server_version: None,
            client_name: None,
            client_version: None,
        }
    }
}
/// Type of event (e.g., mcp:tools/call, agentcat:identify)
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum EventType {
    #[serde(rename = "mcp:ping")]
    McpColonPing,
    #[serde(rename = "mcp:initialize")]
    McpColonInitialize,
    #[serde(rename = "mcp:completion/complete")]
    McpColonCompletionSlashComplete,
    #[serde(rename = "mcp:logging/setLevel")]
    McpColonLoggingSlashSetLevel,
    #[serde(rename = "mcp:prompts/get")]
    McpColonPromptsSlashGet,
    #[serde(rename = "mcp:prompts/list")]
    McpColonPromptsSlashList,
    #[serde(rename = "mcp:resources/list")]
    McpColonResourcesSlashList,
    #[serde(rename = "mcp:resources/templates/list")]
    McpColonResourcesSlashTemplatesSlashList,
    #[serde(rename = "mcp:resources/read")]
    McpColonResourcesSlashRead,
    #[serde(rename = "mcp:resources/subscribe")]
    McpColonResourcesSlashSubscribe,
    #[serde(rename = "mcp:resources/unsubscribe")]
    McpColonResourcesSlashUnsubscribe,
    #[serde(rename = "mcp:tools/call")]
    McpColonToolsSlashCall,
    #[serde(rename = "mcp:tools/list")]
    McpColonToolsSlashList,
    #[serde(rename = "mcp:tasks/get")]
    McpColonTasksSlashGet,
    #[serde(rename = "mcp:tasks/result")]
    McpColonTasksSlashResult,
    #[serde(rename = "mcp:tasks/list")]
    McpColonTasksSlashList,
    #[serde(rename = "mcp:tasks/cancel")]
    McpColonTasksSlashCancel,
    #[serde(rename = "agentcat:identify")]
    AgentcatColonIdentify,
    #[serde(rename = "agentcat:custom")]
    AgentcatColonCustom,
}

impl Default for EventType {
    fn default() -> EventType {
        Self::McpColonPing
    }
}