use crate::types::AiLibError;
use bytes::Bytes;
use futures::future::BoxFuture;
use futures::Stream;
use std::collections::HashMap;
use std::pin::Pin;
use std::sync::Arc;
pub type BytesStream = Pin<Box<dyn Stream<Item = Result<Bytes, AiLibError>> + Send>>;
pub type StreamFuture<'a> = BoxFuture<'a, Result<BytesStream, AiLibError>>;
pub trait DynHttpTransport: Send + Sync {
fn get_json<'a>(
&'a self,
url: &'a str,
headers: Option<HashMap<String, String>>,
) -> BoxFuture<'a, Result<serde_json::Value, AiLibError>>;
fn post_json<'a>(
&'a self,
url: &'a str,
headers: Option<HashMap<String, String>>,
body: serde_json::Value,
) -> BoxFuture<'a, Result<serde_json::Value, AiLibError>>;
fn post_stream<'a>(
&'a self,
url: &'a str,
headers: Option<HashMap<String, String>>,
body: serde_json::Value,
) -> StreamFuture<'a>;
fn upload_multipart<'a>(
&'a self,
url: &'a str,
headers: Option<HashMap<String, String>>,
field_name: &'a str,
file_name: &'a str,
bytes: Vec<u8>,
) -> BoxFuture<'a, Result<serde_json::Value, AiLibError>>;
}
pub type DynHttpTransportRef = Arc<dyn DynHttpTransport + Send + Sync>;