canic_core/api/ic/
http.rs1use crate::{
2 dto::{
3 error::Error,
4 http::{HttpRequestArgs, HttpRequestResult},
5 },
6 workflow::http::HttpWorkflow,
7};
8
9pub struct HttpApi;
17
18impl HttpApi {
19 pub async fn get(url: &str, headers: &[(&str, &str)]) -> Result<HttpRequestResult, Error> {
22 HttpWorkflow::get(url, headers).await.map_err(Error::from)
23 }
24
25 pub async fn get_with_label(
28 url: &str,
29 headers: &[(&str, &str)],
30 label: &str,
31 ) -> Result<HttpRequestResult, Error> {
32 HttpWorkflow::get_with_label(url, headers, label)
33 .await
34 .map_err(Error::from)
35 }
36
37 pub async fn get_raw(args: HttpRequestArgs) -> Result<HttpRequestResult, Error> {
39 HttpWorkflow::get_raw(args).await.map_err(Error::from)
40 }
41}