aboutsummaryrefslogtreecommitdiff
path: root/src/client.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.rs')
-rw-r--r--src/client.rs27
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)
+ }
+}