use crate::error::LettaResult;
use futures::Stream;
use std::pin::Pin;
pub type StreamingResponse<T> = Pin<Box<dyn Stream<Item = LettaResult<T>> + Send>>;
#[derive(Debug, Clone)]
pub struct SseEvent {
pub event_type: Option<String>,
pub data: String,
pub id: Option<String>,
}
pub async fn parse_sse_stream(
_response: reqwest::Response,
) -> LettaResult<StreamingResponse<SseEvent>> {
todo!("SSE parsing implementation")
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_sse_event_creation() {
let event = SseEvent {
event_type: Some("message".to_string()),
data: "test data".to_string(),
id: Some("123".to_string()),
};
assert_eq!(event.event_type.as_deref(), Some("message"));
assert_eq!(event.data, "test data");
assert_eq!(event.id.as_deref(), Some("123"));
}
}