Skip to main content

objectiveai_sdk/functions/executions/
http.rs

1//! HTTP functions for function executions.
2
3use crate::{HttpClient, HttpError};
4use futures::Stream;
5
6/// Creates a function execution (non-streaming).
7pub async fn create_function_execution_unary(
8    client: &HttpClient,
9    mut params: super::request::FunctionExecutionCreateParams,
10) -> Result<super::response::unary::FunctionExecution, HttpError> {
11    params.stream = None;
12    client
13        .send_unary(reqwest::Method::POST, "functions/executions", Some(params))
14        .await
15}
16
17/// Creates a streaming function execution.
18pub async fn create_function_execution_streaming(
19    client: &HttpClient,
20    mut params: super::request::FunctionExecutionCreateParams,
21) -> Result<
22    impl Stream<
23        Item = Result<
24            super::response::streaming::FunctionExecutionChunk,
25            HttpError,
26        >,
27    >
28    + Send
29    + 'static
30    + use<>,
31    HttpError,
32> {
33    params.stream = Some(true);
34    client
35        .send_streaming(reqwest::Method::POST, "functions/executions", Some(params))
36        .await
37}