use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct ResponseShellCallCommandDeltaStreamingEvent {
#[serde(rename = "type")]
pub r#type: Type,
#[serde(rename = "sequence_number")]
pub sequence_number: i32,
#[serde(rename = "output_index")]
pub output_index: i32,
#[serde(rename = "command_index")]
pub command_index: i32,
#[serde(rename = "delta")]
pub delta: String,
#[serde(rename = "obfuscation", skip_serializing_if = "Option::is_none")]
pub obfuscation: Option<String>,
}
impl ResponseShellCallCommandDeltaStreamingEvent {
pub fn new(
r#type: Type,
sequence_number: i32,
output_index: i32,
command_index: i32,
delta: String,
) -> ResponseShellCallCommandDeltaStreamingEvent {
ResponseShellCallCommandDeltaStreamingEvent {
r#type,
sequence_number,
output_index,
command_index,
delta,
obfuscation: None,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "response.shell_call_command.delta")]
ResponseShellCallCommandDelta,
}
impl Default for Type {
fn default() -> Type {
Self::ResponseShellCallCommandDelta
}
}
impl std::fmt::Display for ResponseShellCallCommandDeltaStreamingEvent {
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),
}
}
}