use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct RealtimeServerEventResponseCreated {
#[serde(rename = "event_id")]
pub event_id: String,
#[serde(rename = "type", deserialize_with = "Option::deserialize")]
pub r#type: Option<serde_json::Value>,
#[serde(rename = "response")]
pub response: Box<models::RealtimeResponse>,
}
impl RealtimeServerEventResponseCreated {
pub fn new(
event_id: String,
r#type: Option<serde_json::Value>,
response: models::RealtimeResponse,
) -> RealtimeServerEventResponseCreated {
RealtimeServerEventResponseCreated {
event_id,
r#type,
response: Box::new(response),
}
}
}
impl std::fmt::Display for RealtimeServerEventResponseCreated {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match serde_json::to_string(self) {
Ok(s) => write!(f, "{}", s),
Err(_) => Err(std::fmt::Error),
}
}
}