pub struct Client<P: MakeRequest> { /* private fields */ }
Expand description
A client for interfacing with the Porkbun API servers
Implementations§
Source§impl Client<DefaultTransport>
impl Client<DefaultTransport>
Sourcepub fn new(api_key: ApiKey) -> Self
Available on crate feature default-client
only.
pub fn new(api_key: ApiKey) -> Self
default-client
only.creates a new client using the supplied api key and the default transport implementation.
if you wish to change the transport layer, or you’re not using tokio, use new_with_transport
Source§impl<T> Client<T>
impl<T> Client<T>
Sourcepub fn new_with_transport(api_key: ApiKey, transport: T) -> Self
pub fn new_with_transport(api_key: ApiKey, transport: T) -> Self
creates a new client using the supplied api key and transport.
if you don’t care about the implementation details of the transport, consider using new
which uses a default implementation.
Sourcepub async fn ping(&self) -> Result<IpAddr, Error<T::Error>>
pub async fn ping(&self) -> Result<IpAddr, Error<T::Error>>
pings the api servers returning your ip address.
Sourcepub async fn domain_pricing(
&self,
) -> Result<HashMap<String, Pricing>, Error<T::Error>>
pub async fn domain_pricing( &self, ) -> Result<HashMap<String, Pricing>, Error<T::Error>>
Get a mapping of available TLDs to their pricing structure. This method does not require authentication, and it will work with any ApiKey.
This method includes all TLDs, including special ones like handshake domains. If you only want ICANN TLDs, and you probably do, use icann_domain_pricing instead.
Sourcepub async fn icann_domain_pricing(
&self,
) -> Result<impl Iterator<Item = (String, Pricing)>, Error<T::Error>>
pub async fn icann_domain_pricing( &self, ) -> Result<impl Iterator<Item = (String, Pricing)>, Error<T::Error>>
Get a mapping of available TLDs to their pricing structure, filtered to only include ICANN TLDs. This method does not require authentication, and it will work with any ApiKey.
Sourcepub async fn domains(&self) -> Result<Vec<DomainInfo>, Error<T::Error>>
pub async fn domains(&self) -> Result<Vec<DomainInfo>, Error<T::Error>>
get all the domains associated with this account
Sourcepub async fn get_all(
&self,
domain: &str,
) -> Result<Vec<DnsEntry>, Error<T::Error>>
pub async fn get_all( &self, domain: &str, ) -> Result<Vec<DnsEntry>, Error<T::Error>>
Gets all the DNS records for a given domain
Sourcepub async fn get_single(
&self,
domain: &str,
id: &str,
) -> Result<Option<DnsEntry>, Error<T::Error>>
pub async fn get_single( &self, domain: &str, id: &str, ) -> Result<Option<DnsEntry>, Error<T::Error>>
Gets a single DNS record for a given domain, by its unique ID.
Sourcepub async fn create(
&self,
domain: &str,
cmd: CreateOrEditDnsRecord<'_>,
) -> Result<String, Error<T::Error>>
pub async fn create( &self, domain: &str, cmd: CreateOrEditDnsRecord<'_>, ) -> Result<String, Error<T::Error>>
Create a new DNS record for the given domain. Will fail if there already exists a record with the same name and type.
Sourcepub async fn edit(
&self,
domain: &str,
id: &str,
cmd: CreateOrEditDnsRecord<'_>,
) -> Result<(), Error<T::Error>>
pub async fn edit( &self, domain: &str, id: &str, cmd: CreateOrEditDnsRecord<'_>, ) -> Result<(), Error<T::Error>>
Edits an existing DNS record for a given domain, by its unique ID. IDs can be discovered by first calling get_all.
Sourcepub async fn delete(
&self,
domain: &str,
id: &str,
) -> Result<(), Error<T::Error>>
pub async fn delete( &self, domain: &str, id: &str, ) -> Result<(), Error<T::Error>>
Deletes an existing DNS record for a given domain, by its unique ID. IDs can be discovered by first calling get_all.
Sourcepub async fn nameservers(
&self,
domain: &str,
) -> Result<Vec<String>, Error<T::Error>>
pub async fn nameservers( &self, domain: &str, ) -> Result<Vec<String>, Error<T::Error>>
Gets the configured nameservers for a particular domain
Sourcepub async fn update_nameservers(
&self,
domain: &str,
name_servers: Vec<String>,
) -> Result<(), Error<T::Error>>
pub async fn update_nameservers( &self, domain: &str, name_servers: Vec<String>, ) -> Result<(), Error<T::Error>>
Updates the nameservers for a particular domain
Sourcepub async fn get_url_forwards(
&self,
domain: &str,
) -> Result<Vec<ForwardWithID>, Error<T::Error>>
pub async fn get_url_forwards( &self, domain: &str, ) -> Result<Vec<ForwardWithID>, Error<T::Error>>
Get all the url forwards for a given domain
Sourcepub async fn add_url_forward(
&self,
domain: &str,
cmd: Forward,
) -> Result<(), Error<T::Error>>
pub async fn add_url_forward( &self, domain: &str, cmd: Forward, ) -> Result<(), Error<T::Error>>
Add a new url forward to the given domain