use crate::{
dto::{
error::Error,
http::{HttpRequestArgs, HttpRequestResult},
},
workflow::http::HttpWorkflow,
};
pub struct HttpApi;
impl HttpApi {
pub async fn get(url: &str, headers: &[(&str, &str)]) -> Result<HttpRequestResult, Error> {
HttpWorkflow::get(url, headers).await.map_err(Error::from)
}
pub async fn get_with_label(
url: &str,
headers: &[(&str, &str)],
label: &str,
) -> Result<HttpRequestResult, Error> {
HttpWorkflow::get_with_label(url, headers, label)
.await
.map_err(Error::from)
}
pub async fn get_raw(args: HttpRequestArgs) -> Result<HttpRequestResult, Error> {
HttpWorkflow::get_raw(args).await.map_err(Error::from)
}
}