pub struct DnaClient { /* private fields */ }Expand description
Async REST client for the Domain Name API.
Create one instance per reseller session and reuse it across calls.
§Examples
use dna_rs::DnaClient;
// Production
let client = DnaClient::new("RESELLER-UUID", "API-TOKEN")?;
// OTE / test environment
let ote = DnaClient::new_ote("RESELLER-UUID", "API-TOKEN")?;Implementations§
Source§impl DnaClient
impl DnaClient
Source§impl DnaClient
impl DnaClient
Sourcepub async fn get_reseller_details(&self) -> DnaResult<ResellerDetails>
pub async fn get_reseller_details(&self) -> DnaResult<ResellerDetails>
Fetch reseller profile including all currency balances.
Sourcepub async fn get_current_balance(
&self,
currency_id: &str,
) -> DnaResult<CurrentBalance>
pub async fn get_current_balance( &self, currency_id: &str, ) -> DnaResult<CurrentBalance>
Fetch the balance for a single currency ("USD", "TRY", "EUR", "GBP").
Source§impl DnaClient
impl DnaClient
Sourcepub async fn check_availability(
&self,
domains: &[&str],
extensions: &[&str],
period: u32,
command: &str,
) -> DnaResult<Vec<AvailabilityResult>>
pub async fn check_availability( &self, domains: &[&str], extensions: &[&str], period: u32, command: &str, ) -> DnaResult<Vec<AvailabilityResult>>
Check availability of all domain × extension combinations.
command is forwarded verbatim (e.g. "create", "transfer").
Source§impl DnaClient
impl DnaClient
Sourcepub async fn get_contacts(
&self,
domain_name: &str,
) -> DnaResult<HashMap<String, ContactInfo>>
pub async fn get_contacts( &self, domain_name: &str, ) -> DnaResult<HashMap<String, ContactInfo>>
Fetch all contacts for a domain.
Returns a map of "Administrative" | "Billing" | "Technical" | "Registrant"
to ContactInfo.
Sourcepub async fn save_contacts(
&self,
domain_name: &str,
contacts: HashMap<&str, ContactInput>,
) -> DnaResult<HashMap<String, ContactInfo>>
pub async fn save_contacts( &self, domain_name: &str, contacts: HashMap<&str, ContactInput>, ) -> DnaResult<HashMap<String, ContactInfo>>
Update all contacts for a domain.
contacts maps a type label ("Registrant", "Administrative", etc.)
to the new contact data.
Source§impl DnaClient
impl DnaClient
Sourcepub async fn get_list(
&self,
extra: Option<&[(&str, &str)]>,
) -> DnaResult<DomainList>
pub async fn get_list( &self, extra: Option<&[(&str, &str)]>, ) -> DnaResult<DomainList>
List all domains in the account.
Pass extra key/value pairs to override pagination defaults
(MaxResultCount = 200, SkipCount = 0).
Sourcepub async fn get_details(&self, domain_name: &str) -> DnaResult<DomainInfo>
pub async fn get_details(&self, domain_name: &str) -> DnaResult<DomainInfo>
Fetch full details for a single domain.
Sourcepub async fn sync_from_registry(
&self,
domain_name: &str,
) -> DnaResult<DomainInfo>
pub async fn sync_from_registry( &self, domain_name: &str, ) -> DnaResult<DomainInfo>
Synchronise domain data from the registry (delegates to [get_details]).
Sourcepub async fn renew(
&self,
domain_name: &str,
period: u32,
) -> DnaResult<RenewResult>
pub async fn renew( &self, domain_name: &str, period: u32, ) -> DnaResult<RenewResult>
Renew a domain for period additional years.
Sourcepub async fn register_with_contact_info(
&self,
domain_name: &str,
period: u32,
contacts: HashMap<&str, ContactInput>,
name_servers: Option<Vec<String>>,
epp_lock: bool,
privacy_lock: bool,
additional_attributes: Option<Value>,
) -> DnaResult<DomainInfo>
pub async fn register_with_contact_info( &self, domain_name: &str, period: u32, contacts: HashMap<&str, ContactInput>, name_servers: Option<Vec<String>>, epp_lock: bool, privacy_lock: bool, additional_attributes: Option<Value>, ) -> DnaResult<DomainInfo>
Register a new domain with full contact information.
Sourcepub async fn enable_theft_protection_lock(
&self,
domain_name: &str,
) -> DnaResult<()>
pub async fn enable_theft_protection_lock( &self, domain_name: &str, ) -> DnaResult<()>
Enable the registrar transfer lock.
Sourcepub async fn disable_theft_protection_lock(
&self,
domain_name: &str,
) -> DnaResult<()>
pub async fn disable_theft_protection_lock( &self, domain_name: &str, ) -> DnaResult<()>
Disable the registrar transfer lock.
Sourcepub async fn modify_privacy_protection_status(
&self,
domain_name: &str,
status: bool,
_reason: Option<&str>,
) -> DnaResult<bool>
pub async fn modify_privacy_protection_status( &self, domain_name: &str, status: bool, _reason: Option<&str>, ) -> DnaResult<bool>
Enable or disable WHOIS privacy protection.
_reason is accepted for API-compatibility but not forwarded (the REST
gateway does not expose a reason field).
Sourcepub fn validate_contact(&self, c: ContactInput) -> ContactInput
pub fn validate_contact(&self, c: ContactInput) -> ContactInput
Validate and normalise a ContactInput, filling in Turkish defaults
for any blank mandatory fields (mirrors validateContact in the PHP library).
Source§impl DnaClient
impl DnaClient
Sourcepub async fn modify_name_server(
&self,
domain_name: &str,
name_servers: Vec<String>,
) -> DnaResult<Vec<String>>
pub async fn modify_name_server( &self, domain_name: &str, name_servers: Vec<String>, ) -> DnaResult<Vec<String>>
Replace all name-servers for a domain.
Sourcepub async fn add_child_name_server(
&self,
domain_name: &str,
host_name: &str,
ip_address: &str,
) -> DnaResult<()>
pub async fn add_child_name_server( &self, domain_name: &str, host_name: &str, ip_address: &str, ) -> DnaResult<()>
Add a glue (child) name-server to a domain.
Source§impl DnaClient
impl DnaClient
Sourcepub async fn get_tld_list(
&self,
result_count: u32,
skip_count: u32,
) -> DnaResult<TldListResponse>
pub async fn get_tld_list( &self, result_count: u32, skip_count: u32, ) -> DnaResult<TldListResponse>
Fetch TLD list and pricing matrix.
Source§impl DnaClient
impl DnaClient
Sourcepub async fn transfer(
&self,
domain_name: &str,
epp_code: &str,
period: u32,
contacts: Option<HashMap<&str, ContactInput>>,
) -> DnaResult<DomainInfo>
pub async fn transfer( &self, domain_name: &str, epp_code: &str, period: u32, contacts: Option<HashMap<&str, ContactInput>>, ) -> DnaResult<DomainInfo>
Initiate a domain transfer into the account.
Sourcepub async fn check_transfer(
&self,
domain_name: &str,
auth_code: &str,
) -> DnaResult<TransferCheckResult>
pub async fn check_transfer( &self, domain_name: &str, auth_code: &str, ) -> DnaResult<TransferCheckResult>
Check whether a domain can be transferred with the given auth code.
Sourcepub async fn cancel_transfer(&self, domain_name: &str) -> DnaResult<String>
pub async fn cancel_transfer(&self, domain_name: &str) -> DnaResult<String>
Cancel a pending incoming transfer.
Sourcepub async fn approve_transfer(&self, domain_name: &str) -> DnaResult<String>
pub async fn approve_transfer(&self, domain_name: &str) -> DnaResult<String>
Approve a pending outgoing transfer.
Sourcepub async fn reject_transfer(&self, domain_name: &str) -> DnaResult<String>
pub async fn reject_transfer(&self, domain_name: &str) -> DnaResult<String>
Reject a pending outgoing transfer.