vapi_client/models/
log.rs

1/*
2 * Vapi API
3 *
4 * API for building voice assistants
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12use utoipa::ToSchema;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, ToSchema)]
18pub struct Log {
19    /// This is the timestamp at which the log was written.
20    #[serde(rename = "time")]
21    pub time: String,
22    /// This is the unique identifier for the org that this log belongs to.
23    #[serde(rename = "orgId")]
24    pub org_id: String,
25    /// This is the type of the log.
26    #[serde(rename = "type")]
27    pub r#type: Type,
28    /// This is the type of the webhook, given the log is from a webhook.
29    #[serde(rename = "webhookType", skip_serializing_if = "Option::is_none")]
30    pub webhook_type: Option<String>,
31    /// This is the specific resource, relevant only to API logs.
32    #[serde(rename = "resource", skip_serializing_if = "Option::is_none")]
33    pub resource: Option<Resource>,
34    /// 'This is how long the request took.
35    #[serde(
36        rename = "requestDurationSeconds",
37        skip_serializing_if = "Option::is_none"
38    )]
39    pub request_duration_seconds: Option<f64>,
40    /// This is the timestamp at which the request began.
41    #[serde(rename = "requestStartedAt", skip_serializing_if = "Option::is_none")]
42    pub request_started_at: Option<String>,
43    /// This is the timestamp at which the request finished.
44    #[serde(rename = "requestFinishedAt", skip_serializing_if = "Option::is_none")]
45    pub request_finished_at: Option<String>,
46    /// This is the body of the request.
47    #[serde(rename = "requestBody", skip_serializing_if = "Option::is_none")]
48    pub request_body: Option<serde_json::Value>,
49    /// This is the request method.
50    #[serde(rename = "requestHttpMethod", skip_serializing_if = "Option::is_none")]
51    pub request_http_method: Option<RequestHttpMethod>,
52    /// This is the request URL.
53    #[serde(rename = "requestUrl", skip_serializing_if = "Option::is_none")]
54    pub request_url: Option<String>,
55    /// This is the request path.
56    #[serde(rename = "requestPath", skip_serializing_if = "Option::is_none")]
57    pub request_path: Option<String>,
58    /// This is the request query.
59    #[serde(rename = "requestQuery", skip_serializing_if = "Option::is_none")]
60    pub request_query: Option<String>,
61    /// This the HTTP status code of the response.
62    #[serde(rename = "responseHttpCode", skip_serializing_if = "Option::is_none")]
63    pub response_http_code: Option<f64>,
64    /// This is the request IP address.
65    #[serde(rename = "requestIpAddress", skip_serializing_if = "Option::is_none")]
66    pub request_ip_address: Option<String>,
67    /// This is the origin of the request
68    #[serde(rename = "requestOrigin", skip_serializing_if = "Option::is_none")]
69    pub request_origin: Option<String>,
70    /// This is the body of the response.
71    #[serde(rename = "responseBody", skip_serializing_if = "Option::is_none")]
72    pub response_body: Option<serde_json::Value>,
73    /// These are the headers of the request.
74    #[serde(rename = "requestHeaders", skip_serializing_if = "Option::is_none")]
75    pub request_headers: Option<serde_json::Value>,
76    /// This is the error, if one occurred.
77    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
78    pub error: Option<models::Error>,
79    /// This is the ID of the assistant.
80    #[serde(rename = "assistantId", skip_serializing_if = "Option::is_none")]
81    pub assistant_id: Option<String>,
82    /// This is the ID of the phone number.
83    #[serde(rename = "phoneNumberId", skip_serializing_if = "Option::is_none")]
84    pub phone_number_id: Option<String>,
85    /// This is the ID of the customer.
86    #[serde(rename = "customerId", skip_serializing_if = "Option::is_none")]
87    pub customer_id: Option<String>,
88    /// This is the ID of the squad.
89    #[serde(rename = "squadId", skip_serializing_if = "Option::is_none")]
90    pub squad_id: Option<String>,
91    /// This is the ID of the call.
92    #[serde(rename = "callId", skip_serializing_if = "Option::is_none")]
93    pub call_id: Option<String>,
94}
95
96impl Log {
97    pub fn new(time: String, org_id: String, r#type: Type) -> Log {
98        Log {
99            time,
100            org_id,
101            r#type,
102            webhook_type: None,
103            resource: None,
104            request_duration_seconds: None,
105            request_started_at: None,
106            request_finished_at: None,
107            request_body: None,
108            request_http_method: None,
109            request_url: None,
110            request_path: None,
111            request_query: None,
112            response_http_code: None,
113            request_ip_address: None,
114            request_origin: None,
115            response_body: None,
116            request_headers: None,
117            error: None,
118            assistant_id: None,
119            phone_number_id: None,
120            customer_id: None,
121            squad_id: None,
122            call_id: None,
123        }
124    }
125}
126/// This is the type of the log.
127#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
128pub enum Type {
129    #[serde(rename = "API")]
130    Api,
131    #[serde(rename = "Webhook")]
132    Webhook,
133    #[serde(rename = "Call")]
134    Call,
135    #[serde(rename = "Provider")]
136    Provider,
137}
138
139impl Default for Type {
140    fn default() -> Type {
141        Self::Api
142    }
143}
144/// This is the specific resource, relevant only to API logs.
145#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
146pub enum Resource {
147    #[serde(rename = "org")]
148    Org,
149    #[serde(rename = "assistant")]
150    Assistant,
151    #[serde(rename = "analytics")]
152    Analytics,
153    #[serde(rename = "credential")]
154    Credential,
155    #[serde(rename = "phone-number")]
156    PhoneNumber,
157    #[serde(rename = "block")]
158    Block,
159    #[serde(rename = "voice-library")]
160    VoiceLibrary,
161    #[serde(rename = "provider")]
162    Provider,
163    #[serde(rename = "tool")]
164    Tool,
165    #[serde(rename = "token")]
166    Token,
167    #[serde(rename = "template")]
168    Template,
169    #[serde(rename = "squad")]
170    Squad,
171    #[serde(rename = "call")]
172    Call,
173    #[serde(rename = "file")]
174    File,
175    #[serde(rename = "metric")]
176    Metric,
177    #[serde(rename = "log")]
178    Log,
179}
180
181impl Default for Resource {
182    fn default() -> Resource {
183        Self::Org
184    }
185}
186/// This is the request method.
187#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
188pub enum RequestHttpMethod {
189    #[serde(rename = "POST")]
190    Post,
191    #[serde(rename = "GET")]
192    Get,
193    #[serde(rename = "PUT")]
194    Put,
195    #[serde(rename = "PATCH")]
196    Patch,
197    #[serde(rename = "DELETE")]
198    Delete,
199}
200
201impl Default for RequestHttpMethod {
202    fn default() -> RequestHttpMethod {
203        Self::Post
204    }
205}