use async_trait::async_trait;
use iggy_common::{IdentityInfo, IggyError};
use reqwest::{Response, Url};
use serde::Serialize;
#[async_trait]
pub trait HttpTransport {
fn get_url(&self, path: &str) -> Result<Url, IggyError>;
async fn get(&self, path: &str) -> Result<Response, IggyError>;
async fn get_with_query<T: Serialize + Sync + ?Sized>(
&self,
path: &str,
query: &T,
) -> Result<Response, IggyError>;
async fn post<T: Serialize + Sync + ?Sized>(
&self,
path: &str,
payload: &T,
) -> Result<Response, IggyError>;
async fn put<T: Serialize + Sync + ?Sized>(
&self,
path: &str,
payload: &T,
) -> Result<Response, IggyError>;
async fn delete(&self, path: &str) -> Result<Response, IggyError>;
async fn delete_with_query<T: Serialize + Sync + ?Sized>(
&self,
path: &str,
query: &T,
) -> Result<Response, IggyError>;
async fn is_authenticated(&self) -> bool;
async fn _refresh_access_token(&self) -> Result<(), IggyError>;
async fn set_access_token(&self, token: Option<String>);
async fn set_token_from_identity(&self, identity: &IdentityInfo) -> Result<(), IggyError>;
}