diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2022-10-21 17:15:01 +0200 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2022-10-21 17:15:01 +0200 |
commit | e332e9d4a468b3a97c4d8b91394070a5ac98c916 (patch) | |
tree | 3dca50ef631361605365baa4d22e22c025431e5b /src/client.rs |
Initial commit
Diffstat (limited to 'src/client.rs')
-rw-r--r-- | src/client.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/client.rs b/src/client.rs new file mode 100644 index 0000000..f0a06f3 --- /dev/null +++ b/src/client.rs @@ -0,0 +1,27 @@ +use crate::{Error, Result}; + +use reqwest::Url; + +/// The INWX environment to use. The Sandbox is good for testing +/// or debugging purposes. +pub enum Endpoint { + Production, + Sandbox, +} + +impl From<Endpoint> 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<Url> for Endpoint { + type Error = Error; + fn try_into(self) -> Result<Url> { + let url = Url::parse(self.into())?; + Ok(url) + } +} |