Struct Client

Source
pub struct Client<P: MakeRequest> { /* private fields */ }
Expand description

A client for interfacing with the Porkbun API servers

Implementations§

Source§

impl Client<DefaultTransport>

Source

pub fn new(api_key: ApiKey) -> Self

Available on crate feature 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>
where T: MakeRequest, <T::Body as Body>::Error: Into<T::Error>,

Source

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.

Source

pub async fn ping(&self) -> Result<IpAddr, Error<T::Error>>

pings the api servers returning your ip address.

Source

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.

Source

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.

Source

pub async fn domains(&self) -> Result<Vec<DomainInfo>, Error<T::Error>>

get all the domains associated with this account

Source

pub async fn get_all( &self, domain: &str, ) -> Result<Vec<DnsEntry>, Error<T::Error>>

Gets all the DNS records for a given domain

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub async fn nameservers( &self, domain: &str, ) -> Result<Vec<String>, Error<T::Error>>

Gets the configured nameservers for a particular domain

Source

pub async fn update_nameservers( &self, domain: &str, name_servers: Vec<String>, ) -> Result<(), Error<T::Error>>

Updates the nameservers for a particular domain

Source

pub async fn get_url_forwards( &self, domain: &str, ) -> Result<Vec<ForwardWithID>, Error<T::Error>>

Get all the url forwards for a given domain

Source

pub async fn add_url_forward( &self, domain: &str, cmd: Forward, ) -> Result<(), Error<T::Error>>

Add a new url forward to the given domain

Source

pub async fn delete_url_forward( &self, domain: &str, id: &str, ) -> Result<(), Error<T::Error>>

Delete a url forward with the given id from the given domain

Source

pub async fn get_ssl_bundle( &mut self, domain: &str, ) -> Result<SslBundle, Error<T::Error>>

Get the SSL certificate bundle for a given domain

Auto Trait Implementations§

§

impl<P> Freeze for Client<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for Client<P>
where P: RefUnwindSafe,

§

impl<P> Send for Client<P>
where P: Send,

§

impl<P> Sync for Client<P>
where P: Sync,

§

impl<P> Unpin for Client<P>
where P: Unpin,

§

impl<P> UnwindSafe for Client<P>
where P: UnwindSafe,

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, 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