//! For API calls if enabled use super::*; use std::{ iter, convert::Infallible, }; use futures::{ stream::{ self, BoxStream, StreamExt, }, }; pub mod error; use error::ApiError; mod single; #[inline] fn aggregate(mut body: impl Buf) -> Result { std::str::from_utf8(&body.to_bytes()).map(ToOwned::to_owned) } pub async fn single(host: IpAddr, num: Option, body: impl Buf) -> Result { single::single_stream(host, num, body).await .map(|rx| Response::new(Body::wrap_stream(rx.map(move |x| { info!("{} <- {:?}", host, x); x })))) .map_err(warp::reject::custom) }