use core::future::Future;
use bytes::Bytes;
use http::{Request, Response};
use url::Url;
use crate::APIError;
#[cfg(feature = "reqwest")]
import!(reqwest);
#[cfg(target_family = "wasm")]
#[cfg(not(feature = "reqwest"))]
import!(wasm);
pub trait RestClient {
type Error;
fn rest_endpoint(&self, path: &str) -> Result<Url, APIError<Self::Error>>;
}
pub trait Client: RestClient {
fn rest(&self, request: Request<Vec<u8>>) -> Result<Response<Bytes>, APIError<Self::Error>>;
}
pub trait AsyncClient: RestClient {
#[cfg(not(target_arch = "wasm32"))]
fn rest_async(
&self,
request: Request<Vec<u8>>,
) -> impl Future<Output = Result<Response<Bytes>, APIError<Self::Error>>> + Send;
#[cfg(target_arch = "wasm32")]
fn rest_async(
&self,
request: Request<Vec<u8>>,
) -> impl Future<Output = Result<Response<Bytes>, APIError<Self::Error>>>;
}