vapi_client/models/
log.rs

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