Skip to main content

roark_rs/models/
error_response.rs

1/*
2 * Roark Analytics API
3 *
4 * # Roark Analytics API - Voice AI Analytics Platform  The Roark Analytics API provides comprehensive monitoring, evaluation, and analytics capabilities for voice AI agents. This API allows developers to seamlessly integrate with the Roark platform to track call quality, analyze agent performance, and extract insights from voice interactions.  ## Key Features  - **Real-time Call Analysis**: Upload and analyze voice call recordings with AI-powered insights - **Sentiment Analysis**: Extract emotional tone, key phrases, and sentiment scores across 64+ emotions - **Agent Performance Evaluation**: Create custom evaluation jobs with configurable metrics and scoring - **Platform Integrations**: Native support for VAPI and Retell AI with webhook-based data ingestion - **Custom Analytics**: Build custom analytics pipelines with flexible data models and properties  ## Authentication  All API endpoints require Bearer token authentication. Include your API token in the Authorization header:  ``` Authorization: Bearer YOUR_API_TOKEN ```  ## Rate Limiting  The API implements rate limiting to ensure service stability. Rate limit headers are included in responses.  ## Error Handling  The API uses standard HTTP status codes and returns structured error responses with detailed error information including error types, codes, and human-readable messages.  ## Rust Code Generation  This OpenAPI specification has been optimized for Rust code generation with: - Snake_case field naming conventions - Proper nullable field handling with Option<T> - Comprehensive documentation for generated code - Type-safe enum definitions - Structured error handling
5 *
6 * The version of the OpenAPI document: 1.0.0
7 * Contact: support@roark.ai
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// ErrorResponse : Standardized error response with detailed error information
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ErrorResponse {
17    #[serde(rename = "error_type")]
18    pub error_type: models::ErrorType,
19    /// Machine-readable error code identifier for programmatic handling
20    #[serde(rename = "error_code")]
21    pub error_code: String,
22    /// Human-readable error message providing context about the error
23    #[serde(rename = "message")]
24    pub message: String,
25    /// The specific parameter that caused the error (if applicable)
26    #[serde(rename = "parameter", skip_serializing_if = "Option::is_none")]
27    pub parameter: Option<String>,
28    /// Additional contextual information about the error
29    #[serde(rename = "details", skip_serializing_if = "Option::is_none")]
30    pub details: Option<std::collections::HashMap<String, serde_json::Value>>,
31    /// Unique request identifier for debugging and support purposes
32    #[serde(rename = "request_id", skip_serializing_if = "Option::is_none")]
33    pub request_id: Option<String>,
34}
35
36impl ErrorResponse {
37    /// Standardized error response with detailed error information
38    pub fn new(error_type: models::ErrorType, error_code: String, message: String) -> ErrorResponse {
39        ErrorResponse {
40            error_type,
41            error_code,
42            message,
43            parameter: None,
44            details: None,
45            request_id: None,
46        }
47    }
48}
49