1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! # dna-rs
//!
//! Async Rust client for the [Domain Name API](https://www.domainnameapi.com/) REST gateway.
//!
//! ## Quick start
//!
//! ```rust,no_run
//! use dna_rs::DnaClient;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), dna_rs::DnaError> {
//! let client = DnaClient::new("YOUR-RESELLER-UUID", "YOUR-API-TOKEN")?;
//! let balance = client.get_current_balance("USD").await?;
//! println!("Balance: {} {}", balance.balance, balance.currency_name);
//! Ok(())
//! }
//! ```
//!
//! ## Module layout
//!
//! | Path | Contents |
//! |---|---|
//! | [`models`] | All request / response types, grouped by domain |
//! | `ops/` (private) | `impl DnaClient` blocks, one file per API domain |
//! | [`error`] | [`DnaError`] and [`DnaResult`] |
//! | `http` (private) | Low-level reqwest transport |
//!
//!
//! ## Environments
//!
//! | Constructor | Endpoint |
//! |---|---|
//! | [`DnaClient::new`] | Production |
//! | [`DnaClient::new_ote`] | OTE / sandbox |
//! | [`DnaClient::with_url`] | Custom URL |
//!
//! ## Error Handling
//!
//! All methods return [`DnaResult<T>`] which is [`Result<T, DnaError>`].
//!
//! ```rust,no_run
//! use dna_rs::{DnaClient, DnaError};
//!
//! # async fn example() -> Result<(), DnaError> {
//! # let client = DnaClient::new("id", "token")?;
//! match client.get_reseller_details().await {
//! Ok(d) => println!("{}", d.name),
//! Err(DnaError::Api { code, message, .. }) => eprintln!("[{code}] {message}"),
//! Err(e) => eprintln!("{e}"),
//! }
//! # Ok(())
//! # }
//! ```
pub use DnaClient;
pub use ;
/// Production API base URL.
pub const URL_PROD: &str = "https://api.domainresellerapi.com/api/v1";
/// OTE (test/sandbox) API base URL.
pub const URL_OTE: &str = "https://ote.domainresellerapi.com/api/v1";