Skip to main content

openai_types/webhooks/
_gen.rs

1// AUTO-GENERATED by py2rust — do not edit.
2// Re-generate: python3 scripts/py2rust.py sync <python_dir> <rust_dir>
3// Domain: webhooks
4
5use serde::{Deserialize, Serialize};
6
7/// Event data payload.
8#[derive(Debug, Clone, Serialize, Deserialize)]
9#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
10pub struct Data {
11    /// The unique ID of the batch API request.
12    pub id: String,
13}
14
15/// Sent when a batch API request has been cancelled.
16#[derive(Debug, Clone, Serialize, Deserialize)]
17#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
18pub struct BatchCancelledWebhookEvent {
19    /// The unique ID of the event.
20    pub id: String,
21    /// The Unix timestamp (in seconds) of when the batch API request was cancelled.
22    pub created_at: i64,
23    /// Event data payload.
24    pub data: Data,
25    /// The type of the event. Always `batch.cancelled`.
26    #[serde(rename = "type")]
27    pub type_: String,
28    /// The object of the event. Always `event`.
29    #[serde(skip_serializing_if = "Option::is_none", default)]
30    pub object: Option<String>,
31}
32
33/// Sent when a batch API request has been completed.
34#[derive(Debug, Clone, Serialize, Deserialize)]
35#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
36pub struct BatchCompletedWebhookEvent {
37    /// The unique ID of the event.
38    pub id: String,
39    /// The Unix timestamp (in seconds) of when the batch API request was completed.
40    pub created_at: i64,
41    /// Event data payload.
42    pub data: Data,
43    /// The type of the event. Always `batch.completed`.
44    #[serde(rename = "type")]
45    pub type_: String,
46    /// The object of the event. Always `event`.
47    #[serde(skip_serializing_if = "Option::is_none", default)]
48    pub object: Option<String>,
49}
50
51/// Sent when a batch API request has expired.
52#[derive(Debug, Clone, Serialize, Deserialize)]
53#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
54pub struct BatchExpiredWebhookEvent {
55    /// The unique ID of the event.
56    pub id: String,
57    /// The Unix timestamp (in seconds) of when the batch API request expired.
58    pub created_at: i64,
59    /// Event data payload.
60    pub data: Data,
61    /// The type of the event. Always `batch.expired`.
62    #[serde(rename = "type")]
63    pub type_: String,
64    /// The object of the event. Always `event`.
65    #[serde(skip_serializing_if = "Option::is_none", default)]
66    pub object: Option<String>,
67}
68
69/// Sent when a batch API request has failed.
70#[derive(Debug, Clone, Serialize, Deserialize)]
71#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
72pub struct BatchFailedWebhookEvent {
73    /// The unique ID of the event.
74    pub id: String,
75    /// The Unix timestamp (in seconds) of when the batch API request failed.
76    pub created_at: i64,
77    /// Event data payload.
78    pub data: Data,
79    /// The type of the event. Always `batch.failed`.
80    #[serde(rename = "type")]
81    pub type_: String,
82    /// The object of the event. Always `event`.
83    #[serde(skip_serializing_if = "Option::is_none", default)]
84    pub object: Option<String>,
85}
86
87/// Sent when an eval run has been canceled.
88#[derive(Debug, Clone, Serialize, Deserialize)]
89#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
90pub struct EvalRunCanceledWebhookEvent {
91    /// The unique ID of the event.
92    pub id: String,
93    /// The Unix timestamp (in seconds) of when the eval run was canceled.
94    pub created_at: i64,
95    /// Event data payload.
96    pub data: Data,
97    /// The type of the event. Always `eval.run.canceled`.
98    #[serde(rename = "type")]
99    pub type_: String,
100    /// The object of the event. Always `event`.
101    #[serde(skip_serializing_if = "Option::is_none", default)]
102    pub object: Option<String>,
103}
104
105/// Sent when an eval run has failed.
106#[derive(Debug, Clone, Serialize, Deserialize)]
107#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
108pub struct EvalRunFailedWebhookEvent {
109    /// The unique ID of the event.
110    pub id: String,
111    /// The Unix timestamp (in seconds) of when the eval run failed.
112    pub created_at: i64,
113    /// Event data payload.
114    pub data: Data,
115    /// The type of the event. Always `eval.run.failed`.
116    #[serde(rename = "type")]
117    pub type_: String,
118    /// The object of the event. Always `event`.
119    #[serde(skip_serializing_if = "Option::is_none", default)]
120    pub object: Option<String>,
121}
122
123/// Sent when an eval run has succeeded.
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
126pub struct EvalRunSucceededWebhookEvent {
127    /// The unique ID of the event.
128    pub id: String,
129    /// The Unix timestamp (in seconds) of when the eval run succeeded.
130    pub created_at: i64,
131    /// Event data payload.
132    pub data: Data,
133    /// The type of the event. Always `eval.run.succeeded`.
134    #[serde(rename = "type")]
135    pub type_: String,
136    /// The object of the event. Always `event`.
137    #[serde(skip_serializing_if = "Option::is_none", default)]
138    pub object: Option<String>,
139}
140
141/// Sent when a fine-tuning job has been cancelled.
142#[derive(Debug, Clone, Serialize, Deserialize)]
143#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
144pub struct FineTuningJobCancelledWebhookEvent {
145    /// The unique ID of the event.
146    pub id: String,
147    /// The Unix timestamp (in seconds) of when the fine-tuning job was cancelled.
148    pub created_at: i64,
149    /// Event data payload.
150    pub data: Data,
151    /// The type of the event. Always `fine_tuning.job.cancelled`.
152    #[serde(rename = "type")]
153    pub type_: String,
154    /// The object of the event. Always `event`.
155    #[serde(skip_serializing_if = "Option::is_none", default)]
156    pub object: Option<String>,
157}
158
159/// Sent when a fine-tuning job has failed.
160#[derive(Debug, Clone, Serialize, Deserialize)]
161#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
162pub struct FineTuningJobFailedWebhookEvent {
163    /// The unique ID of the event.
164    pub id: String,
165    /// The Unix timestamp (in seconds) of when the fine-tuning job failed.
166    pub created_at: i64,
167    /// Event data payload.
168    pub data: Data,
169    /// The type of the event. Always `fine_tuning.job.failed`.
170    #[serde(rename = "type")]
171    pub type_: String,
172    /// The object of the event. Always `event`.
173    #[serde(skip_serializing_if = "Option::is_none", default)]
174    pub object: Option<String>,
175}
176
177/// Sent when a fine-tuning job has succeeded.
178#[derive(Debug, Clone, Serialize, Deserialize)]
179#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
180pub struct FineTuningJobSucceededWebhookEvent {
181    /// The unique ID of the event.
182    pub id: String,
183    /// The Unix timestamp (in seconds) of when the fine-tuning job succeeded.
184    pub created_at: i64,
185    /// Event data payload.
186    pub data: Data,
187    /// The type of the event. Always `fine_tuning.job.succeeded`.
188    #[serde(rename = "type")]
189    pub type_: String,
190    /// The object of the event. Always `event`.
191    #[serde(skip_serializing_if = "Option::is_none", default)]
192    pub object: Option<String>,
193}
194
195/// A header from the SIP Invite.
196#[derive(Debug, Clone, Serialize, Deserialize)]
197#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
198pub struct DataSipHeader {
199    /// Name of the SIP Header.
200    pub name: String,
201    /// Value of the SIP Header.
202    pub value: String,
203}
204
205/// Sent when Realtime API Receives a incoming SIP call.
206#[derive(Debug, Clone, Serialize, Deserialize)]
207#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
208pub struct RealtimeCallIncomingWebhookEvent {
209    /// The unique ID of the event.
210    pub id: String,
211    /// The Unix timestamp (in seconds) of when the model response was completed.
212    pub created_at: i64,
213    /// Event data payload.
214    pub data: Data,
215    /// The type of the event. Always `realtime.call.incoming`.
216    #[serde(rename = "type")]
217    pub type_: String,
218    /// The object of the event. Always `event`.
219    #[serde(skip_serializing_if = "Option::is_none", default)]
220    pub object: Option<String>,
221}
222
223/// Sent when a background response has been cancelled.
224#[derive(Debug, Clone, Serialize, Deserialize)]
225#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
226pub struct ResponseCancelledWebhookEvent {
227    /// The unique ID of the event.
228    pub id: String,
229    /// The Unix timestamp (in seconds) of when the model response was cancelled.
230    pub created_at: i64,
231    /// Event data payload.
232    pub data: Data,
233    /// The type of the event. Always `response.cancelled`.
234    #[serde(rename = "type")]
235    pub type_: String,
236    /// The object of the event. Always `event`.
237    #[serde(skip_serializing_if = "Option::is_none", default)]
238    pub object: Option<String>,
239}
240
241/// Sent when a background response has been completed.
242#[derive(Debug, Clone, Serialize, Deserialize)]
243#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
244pub struct ResponseCompletedWebhookEvent {
245    /// The unique ID of the event.
246    pub id: String,
247    /// The Unix timestamp (in seconds) of when the model response was completed.
248    pub created_at: i64,
249    /// Event data payload.
250    pub data: Data,
251    /// The type of the event. Always `response.completed`.
252    #[serde(rename = "type")]
253    pub type_: String,
254    /// The object of the event. Always `event`.
255    #[serde(skip_serializing_if = "Option::is_none", default)]
256    pub object: Option<String>,
257}
258
259/// Sent when a background response has failed.
260#[derive(Debug, Clone, Serialize, Deserialize)]
261#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
262pub struct ResponseFailedWebhookEvent {
263    /// The unique ID of the event.
264    pub id: String,
265    /// The Unix timestamp (in seconds) of when the model response failed.
266    pub created_at: i64,
267    /// Event data payload.
268    pub data: Data,
269    /// The type of the event. Always `response.failed`.
270    #[serde(rename = "type")]
271    pub type_: String,
272    /// The object of the event. Always `event`.
273    #[serde(skip_serializing_if = "Option::is_none", default)]
274    pub object: Option<String>,
275}
276
277/// Sent when a background response has been interrupted.
278#[derive(Debug, Clone, Serialize, Deserialize)]
279#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
280pub struct ResponseIncompleteWebhookEvent {
281    /// The unique ID of the event.
282    pub id: String,
283    /// The Unix timestamp (in seconds) of when the model response was interrupted.
284    pub created_at: i64,
285    /// Event data payload.
286    pub data: Data,
287    /// The type of the event. Always `response.incomplete`.
288    #[serde(rename = "type")]
289    pub type_: String,
290    /// The object of the event. Always `event`.
291    #[serde(skip_serializing_if = "Option::is_none", default)]
292    pub object: Option<String>,
293}
294
295pub type UnwrapWebhookEvent = serde_json::Value;