Skip to main content

objectiveai_sdk/error/
http.rs

1//! HTTP client functions for the error endpoint.
2use crate::{HttpClient, HttpError};
3use futures::Stream;
4
5/// Creates an error response (unary).
6pub async fn create_error_unary(
7    client: &HttpClient,
8    mut params: super::request::ErrorCreateParams,
9) -> Result<super::response::ErrorResponse, HttpError> {
10    params.stream = None;
11    client
12        .send_unary(reqwest::Method::POST, "error", Some(params))
13        .await
14}
15
16/// Creates an error response with streaming (SSE).
17pub async fn create_error_streaming(
18    client: &HttpClient,
19    mut params: super::request::ErrorCreateParams,
20) -> Result<
21    impl Stream<Item = Result<super::response::ErrorResponse, HttpError>> + Send + 'static + use<>,
22    HttpError,
23> {
24    params.stream = Some(true);
25    client
26        .send_streaming(reqwest::Method::POST, "error", Some(params))
27        .await
28}