Skip to main content

agentcat_api/models/
publish_event_request.rs

1/*
2 * AgentCat API
3 *
4 * API for AgentCat application
5 *
6 * The version of the OpenAPI document: v1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct PublishEventRequest {
16    /// ID of the event, typically auto-generated by the AgentCat Agent
17    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
18    pub id: Option<String>,
19    /// ID of the project this event belongs to
20    #[serde(rename = "project_id")]
21    pub project_id: String,
22    /// ID of the session this event belongs to. Null for stateless mode (server assigns session).
23    #[serde(rename = "session_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub session_id: Option<Option<String>>,
25    /// Optional actor ID
26    #[serde(rename = "actor_id", skip_serializing_if = "Option::is_none")]
27    pub actor_id: Option<String>,
28    /// Optional custom event ID (must be unique)
29    #[serde(rename = "event_id", skip_serializing_if = "Option::is_none")]
30    pub event_id: Option<String>,
31    /// Type of event (e.g., mcp:tools/call, agentcat:identify)
32    #[serde(rename = "event_type", skip_serializing_if = "Option::is_none")]
33    pub event_type: Option<EventType>,
34    /// Whether this event represents an error
35    #[serde(rename = "is_error", skip_serializing_if = "Option::is_none")]
36    pub is_error: Option<bool>,
37    /// Error details if is_error is true
38    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
39    pub error: Option<serde_json::Value>,
40    /// Name of the resource accessed (for resource events)
41    #[serde(rename = "resource_name", skip_serializing_if = "Option::is_none")]
42    pub resource_name: Option<String>,
43    /// Duration of the operation in milliseconds
44    #[serde(rename = "duration", skip_serializing_if = "Option::is_none")]
45    pub duration: Option<i32>,
46    /// Token count of the request side as measured by the SDK. When absent, the server estimates it from the stored parameters.
47    #[serde(rename = "input_tokens", skip_serializing_if = "Option::is_none")]
48    pub input_tokens: Option<i32>,
49    /// 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.
50    #[serde(rename = "output_tokens", skip_serializing_if = "Option::is_none")]
51    pub output_tokens: Option<i32>,
52    /// Agent-provided timestamp of when the event occurred
53    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
54    pub timestamp: Option<chrono::DateTime<chrono::FixedOffset>>,
55    /// Captured explanation of why the actor made this request
56    #[serde(rename = "user_intent", skip_serializing_if = "Option::is_none")]
57    pub user_intent: Option<String>,
58    /// Parameters sent with the request
59    #[serde(rename = "parameters", skip_serializing_if = "Option::is_none")]
60    pub parameters: Option<serde_json::Value>,
61    /// Response data from the operation
62    #[serde(rename = "response", skip_serializing_if = "Option::is_none")]
63    pub response: Option<serde_json::Value>,
64    /// Actor ID for agentcat:identify events
65    #[serde(rename = "identify_actor_given_id", skip_serializing_if = "Option::is_none")]
66    pub identify_actor_given_id: Option<String>,
67    /// Actor name for agentcat:identify events
68    #[serde(rename = "identify_actor_name", skip_serializing_if = "Option::is_none")]
69    pub identify_actor_name: Option<String>,
70    /// Additional data for agentcat:identify events
71    #[serde(rename = "identify_data", skip_serializing_if = "Option::is_none")]
72    pub identify_data: Option<serde_json::Value>,
73    /// 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.
74    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
75    pub tags: Option<std::collections::HashMap<String, String>>,
76    /// Custom structured data. Keys are strings, values can be string, number, boolean, array, object, or null (null values are filtered out).
77    #[serde(rename = "properties", skip_serializing_if = "Option::is_none")]
78    pub properties: Option<serde_json::Value>,
79    /// IP address of the client
80    #[serde(rename = "ip_address", skip_serializing_if = "Option::is_none")]
81    pub ip_address: Option<String>,
82    /// Programming language of the SDK used
83    #[serde(rename = "sdk_language", skip_serializing_if = "Option::is_none")]
84    pub sdk_language: Option<String>,
85    /// Version of AgentCat being used
86    #[serde(rename = "agentcat_version", skip_serializing_if = "Option::is_none")]
87    pub agentcat_version: Option<String>,
88    /// Name of the MCP server
89    #[serde(rename = "server_name", skip_serializing_if = "Option::is_none")]
90    pub server_name: Option<String>,
91    /// Version of the MCP server
92    #[serde(rename = "server_version", skip_serializing_if = "Option::is_none")]
93    pub server_version: Option<String>,
94    /// Name of the MCP client
95    #[serde(rename = "client_name", skip_serializing_if = "Option::is_none")]
96    pub client_name: Option<String>,
97    /// Version of the MCP client
98    #[serde(rename = "client_version", skip_serializing_if = "Option::is_none")]
99    pub client_version: Option<String>,
100}
101
102impl PublishEventRequest {
103    pub fn new(project_id: String) -> PublishEventRequest {
104        PublishEventRequest {
105            id: None,
106            project_id,
107            session_id: None,
108            actor_id: None,
109            event_id: None,
110            event_type: None,
111            is_error: None,
112            error: None,
113            resource_name: None,
114            duration: None,
115            input_tokens: None,
116            output_tokens: None,
117            timestamp: None,
118            user_intent: None,
119            parameters: None,
120            response: None,
121            identify_actor_given_id: None,
122            identify_actor_name: None,
123            identify_data: None,
124            tags: None,
125            properties: None,
126            ip_address: None,
127            sdk_language: None,
128            agentcat_version: None,
129            server_name: None,
130            server_version: None,
131            client_name: None,
132            client_version: None,
133        }
134    }
135}
136/// Type of event (e.g., mcp:tools/call, agentcat:identify)
137#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
138pub enum EventType {
139    #[serde(rename = "mcp:ping")]
140    McpColonPing,
141    #[serde(rename = "mcp:initialize")]
142    McpColonInitialize,
143    #[serde(rename = "mcp:completion/complete")]
144    McpColonCompletionSlashComplete,
145    #[serde(rename = "mcp:logging/setLevel")]
146    McpColonLoggingSlashSetLevel,
147    #[serde(rename = "mcp:prompts/get")]
148    McpColonPromptsSlashGet,
149    #[serde(rename = "mcp:prompts/list")]
150    McpColonPromptsSlashList,
151    #[serde(rename = "mcp:resources/list")]
152    McpColonResourcesSlashList,
153    #[serde(rename = "mcp:resources/templates/list")]
154    McpColonResourcesSlashTemplatesSlashList,
155    #[serde(rename = "mcp:resources/read")]
156    McpColonResourcesSlashRead,
157    #[serde(rename = "mcp:resources/subscribe")]
158    McpColonResourcesSlashSubscribe,
159    #[serde(rename = "mcp:resources/unsubscribe")]
160    McpColonResourcesSlashUnsubscribe,
161    #[serde(rename = "mcp:tools/call")]
162    McpColonToolsSlashCall,
163    #[serde(rename = "mcp:tools/list")]
164    McpColonToolsSlashList,
165    #[serde(rename = "mcp:tasks/get")]
166    McpColonTasksSlashGet,
167    #[serde(rename = "mcp:tasks/result")]
168    McpColonTasksSlashResult,
169    #[serde(rename = "mcp:tasks/list")]
170    McpColonTasksSlashList,
171    #[serde(rename = "mcp:tasks/cancel")]
172    McpColonTasksSlashCancel,
173    #[serde(rename = "agentcat:identify")]
174    AgentcatColonIdentify,
175    #[serde(rename = "agentcat:custom")]
176    AgentcatColonCustom,
177}
178
179impl Default for EventType {
180    fn default() -> EventType {
181        Self::McpColonPing
182    }
183}
184