Skip to main content

DnaClient

Struct DnaClient 

Source
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

Source

pub fn new(reseller_id: &str, token: &str) -> DnaResult<Self>

Connect to the production endpoint.

Source

pub fn new_ote(reseller_id: &str, token: &str) -> DnaResult<Self>

Connect to the OTE (test/sandbox) endpoint.

Source

pub fn with_url(reseller_id: &str, token: &str, url: &str) -> DnaResult<Self>

Connect to a custom base URL (useful for mocking in tests).

Source§

impl DnaClient

Source

pub async fn get_reseller_details(&self) -> DnaResult<ResellerDetails>

Fetch reseller profile including all currency balances.

Source

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

Source

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

Source

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.

Source

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

Source

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).

Source

pub async fn get_details(&self, domain_name: &str) -> DnaResult<DomainInfo>

Fetch full details for a single domain.

Source

pub async fn sync_from_registry( &self, domain_name: &str, ) -> DnaResult<DomainInfo>

Synchronise domain data from the registry (delegates to [get_details]).

Source

pub async fn renew( &self, domain_name: &str, period: u32, ) -> DnaResult<RenewResult>

Renew a domain for period additional years.

Source

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.

Source

pub async fn enable_theft_protection_lock( &self, domain_name: &str, ) -> DnaResult<()>

Enable the registrar transfer lock.

Source

pub async fn disable_theft_protection_lock( &self, domain_name: &str, ) -> DnaResult<()>

Disable the registrar transfer lock.

Source

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).

Source

pub fn is_tr_tld(&self, domain: &str) -> bool

Returns true if the domain has a .tr TLD.

Source

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

Source

pub async fn modify_name_server( &self, domain_name: &str, name_servers: Vec<String>, ) -> DnaResult<Vec<String>>

Replace all name-servers for a domain.

Source

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

pub async fn delete_child_name_server( &self, domain_name: &str, host_name: &str, ) -> DnaResult<()>

Delete a glue name-server from a domain.

Source

pub async fn modify_child_name_server( &self, domain_name: &str, host_name: &str, ip_address: &str, ) -> DnaResult<()>

Update the IP address of a glue name-server.

Source§

impl DnaClient

Source

pub async fn get_tld_list( &self, result_count: u32, skip_count: u32, ) -> DnaResult<TldListResponse>

Fetch TLD list and pricing matrix.

Source§

impl DnaClient

Source

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.

Source

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.

Source

pub async fn cancel_transfer(&self, domain_name: &str) -> DnaResult<String>

Cancel a pending incoming transfer.

Source

pub async fn approve_transfer(&self, domain_name: &str) -> DnaResult<String>

Approve a pending outgoing transfer.

Source

pub async fn reject_transfer(&self, domain_name: &str) -> DnaResult<String>

Reject a pending outgoing transfer.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more