use super::{AppType, Application};
use crate::schedule::AsyncScheduler;
#[cfg(feature = "http-client")]
use crate::{Map, error::Error};
#[derive(Debug, Clone, Copy)]
pub struct Agent;
impl Application for Agent {
type Routes = ();
const APP_TYPE: AppType = AppType::Agent;
#[inline]
fn register(self, _routes: Self::Routes) -> Self {
self
}
#[inline]
fn run_with<T: AsyncScheduler + Send + 'static>(self, _scheduler: T) {}
}
impl Agent {
#[cfg(feature = "http-client")]
#[inline]
pub fn get_http_client() -> Option<&'static reqwest::Client> {
super::http_client::SHARED_HTTP_CLIENT.get()
}
#[cfg(feature = "http-client")]
#[inline]
pub fn request_builder(
url: &str,
options: Option<&Map>,
) -> Result<reqwest_middleware::RequestBuilder, Error> {
super::http_client::request_builder(url, options)
}
}