pub async fn new_with_url<'auth>(
        auth: impl Into<HttpAuthentication<'auth>>,
        api_root: &str,
    ) -> Result<Self> {
        let auth = auth.into();
        let mut default_headers = HeaderMap::new().auth(&auth);
        default_headers.insert(reqwest::header::ACCEPT, HeaderValue::from_static("*/*"));
        let client = reqwest::Client::builder()
            .default_headers(default_headers)
            .build()
            .unwrap();
        let revolt_config = Self::get_revolt_config(&client, api_root).await?;
        let auth_type = match auth {
            HttpAuthentication::BotToken { .. } => AuthType::Bot,
            HttpAuthentication::UserSession { .. } => AuthType::UserSession,
        };
        Ok(Self {
            client,
            api_root: api_root.to_string(),
            revolt_config,
            auth_type,
        })
    }
/// Creates a new client from the authentication and url.
///
/// Use this if using a self hosted instance of revolt, otherwise use [`Self::new`].
Creates a new client from the authentication and url.
Use this if using a self hosted instance of revolt, otherwise use [`Self::new`].
Creates a new client from the authentication and url . Use this if using a self hosted instance of revolt otherwise use [ ` Self :: new ` ] .
pub async fn new_with_url<'auth>(
        auth: impl Into<HttpAuthentication<'auth>>,
        api_root: &str,
    ) -> Result<Self> {
        let auth = auth.into();
        let mut default_headers = HeaderMap::new().auth(&auth);
        default_headers.insert(reqwest::header::ACCEPT, HeaderValue::from_static("*/*"));
        let client = reqwest::Client::builder()
            .default_headers(default_headers)
            .build()
            .unwrap();
        let revolt_config = Self::get_revolt_config(&client, api_root).await?;
        let auth_type = match auth {
            HttpAuthentication::BotToken { .. } => AuthType::Bot,
            HttpAuthentication::UserSession { .. } => AuthType::UserSession,
        };
        Ok(Self {
            client,
            api_root: api_root.to_string(),
            revolt_config,
            auth_type,
        })
    }
pub async fn new_with_url < ' auth > ( auth : impl Into < HttpAuthentication < ' auth > > , api_root : & str , ) -> Result < Self > { let auth = auth . into ( ) ; let mut default_headers = HeaderMap :: new ( ) . auth ( & auth ) ; default_headers . insert ( reqwest :: header :: ACCEPT , HeaderValue :: from_static ( " " ) ) ; let client = reqwest :: Client :: builder ( ) . default_headers ( default_headers ) . build ( ) . unwrap ( ) ; let revolt_config = Self :: get_revolt_config ( & client , api_root ) . await ? ; let auth_type = match auth { HttpAuthentication :: BotToken { .. } => AuthType :: Bot , HttpAuthentication :: UserSession { .. } => AuthType :: UserSession , } ; Ok ( Self { client , api_root : api_root . to_string ( ) , revolt_config , auth_type , } ) }
Creates a new client from the authentication and url.
Creates a new client from the authentication and url .
auth
impl Into<HttpAuthentication<'auth>>
api_root
&str
auth
impl Into<HttpAuthentication<'auth>>
api_root
&str