1use super::ConversationItem;
6use super::wire::present_nullable;
7use crate::Rest;
8use serde::{Deserialize, Serialize};
9
10#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
12#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
13#[derive(gproxy_protocol_macros::DeclaredFields)]
14#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
15pub struct ConversationCreatedEvent {
16 pub conversation: ConversationCreatedEventConversation,
17 pub event_id: String,
18 #[serde(rename = "type")]
19 pub type_: ConversationCreatedEventType,
20 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
21 pub rest: Rest,
22}
23
24#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
26#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
27#[derive(gproxy_protocol_macros::DeclaredFields)]
28#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
29pub struct ConversationItemCreatedEvent {
30 pub event_id: String,
31 pub item: ConversationItem,
32 #[serde(rename = "type")]
33 pub type_: ConversationItemCreatedEventType,
34 #[serde(
35 default,
36 deserialize_with = "present_nullable",
37 skip_serializing_if = "Option::is_none"
38 )]
39 pub previous_item_id: Option<Option<String>>,
40 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
41 pub rest: Rest,
42}
43
44#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
46#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
47#[derive(gproxy_protocol_macros::DeclaredFields)]
48#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
49pub struct ConversationItemDeletedEvent {
50 pub event_id: String,
51 pub item_id: String,
52 #[serde(rename = "type")]
53 pub type_: ConversationItemDeletedEventType,
54 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
55 pub rest: Rest,
56}
57
58#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
60#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
61#[derive(gproxy_protocol_macros::DeclaredFields)]
62#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
63pub struct ConversationItemTruncatedEvent {
64 pub audio_end_ms: i64,
65 pub content_index: i64,
66 pub event_id: String,
67 pub item_id: String,
68 #[serde(rename = "type")]
69 pub type_: ConversationItemTruncatedEventType,
70 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
71 pub rest: Rest,
72}
73
74#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
76#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
77#[derive(gproxy_protocol_macros::DeclaredFields)]
78#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
79pub struct ConversationItemAdded {
80 pub event_id: String,
81 pub item: ConversationItem,
82 #[serde(rename = "type")]
83 pub type_: ConversationItemAddedType,
84 #[serde(
85 default,
86 deserialize_with = "present_nullable",
87 skip_serializing_if = "Option::is_none"
88 )]
89 pub previous_item_id: Option<Option<String>>,
90 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
91 pub rest: Rest,
92}
93
94#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
96#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
97#[derive(gproxy_protocol_macros::DeclaredFields)]
98#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
99pub struct ConversationItemDone {
100 pub event_id: String,
101 pub item: ConversationItem,
102 #[serde(rename = "type")]
103 pub type_: ConversationItemDoneType,
104 #[serde(
105 default,
106 deserialize_with = "present_nullable",
107 skip_serializing_if = "Option::is_none"
108 )]
109 pub previous_item_id: Option<Option<String>>,
110 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
111 pub rest: Rest,
112}
113
114#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
116#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
117#[derive(gproxy_protocol_macros::DeclaredFields)]
118#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
119pub struct ConversationCreatedEventConversation {
120 #[serde(
121 default,
122 deserialize_with = "present_nullable",
123 skip_serializing_if = "Option::is_none"
124 )]
125 pub id: Option<Option<String>>,
126 #[serde(
127 default,
128 deserialize_with = "present_nullable",
129 skip_serializing_if = "Option::is_none"
130 )]
131 pub object: Option<Option<ConversationCreatedEventConversationObject>>,
132 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
133 pub rest: Rest,
134}
135
136#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
137#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
138#[derive(gproxy_protocol_macros::DeclaredFields)]
139#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
140pub enum ConversationCreatedEventType {
141 #[serde(rename = "conversation.created")]
142 ConversationCreated,
143}
144
145#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
146#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
147#[derive(gproxy_protocol_macros::DeclaredFields)]
148#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
149pub enum ConversationItemCreatedEventType {
150 #[serde(rename = "conversation.item.created")]
151 ConversationItemCreated,
152}
153
154#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
155#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
156#[derive(gproxy_protocol_macros::DeclaredFields)]
157#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
158pub enum ConversationItemDeletedEventType {
159 #[serde(rename = "conversation.item.deleted")]
160 ConversationItemDeleted,
161}
162
163#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
164#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
165#[derive(gproxy_protocol_macros::DeclaredFields)]
166#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
167pub enum ConversationItemTruncatedEventType {
168 #[serde(rename = "conversation.item.truncated")]
169 ConversationItemTruncated,
170}
171
172#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
173#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
174#[derive(gproxy_protocol_macros::DeclaredFields)]
175#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
176pub enum ConversationItemAddedType {
177 #[serde(rename = "conversation.item.added")]
178 ConversationItemAdded,
179}
180
181#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
182#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
183#[derive(gproxy_protocol_macros::DeclaredFields)]
184#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
185pub enum ConversationItemDoneType {
186 #[serde(rename = "conversation.item.done")]
187 ConversationItemDone,
188}
189
190#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
191#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
192#[derive(gproxy_protocol_macros::DeclaredFields)]
193#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
194pub enum ConversationCreatedEventConversationObject {
195 #[serde(rename = "realtime.conversation")]
196 RealtimeConversation,
197}