use crate::{Error, Result}; use std::sync::Arc; use reqwest::Url; /// The INWX environment to use. The Sandbox is good for testing /// or debugging purposes. pub enum Endpoint { Production, Sandbox, } impl From for &str { fn from(endpoint: Endpoint) -> &'static str { match endpoint { Endpoint::Production => "https://api.domrobot.com/xmlrpc/", Endpoint::Sandbox => "https://api.ote.domrobot.com/xmlrpc/", } } } impl TryInto for Endpoint { type Error = Error; fn try_into(self) -> Result { let url = Url::parse(self.into())?; Ok(url) } } /// A synchronous client to make API calls with. /// You do **not** need to wrap it in an `Arc` or `Rc` /// because it already uses an `Arc` internally. /// [`Rc`]: std::rc::Rc pub struct Client { inner: Arc, } impl Client {} // The underlying data of a `Client`. struct ClientRef { http: reqwest::Client, }