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