Struct dnsimple::dnsimple::Client

source ·
pub struct Client {
    pub _agent: Agent,
    /* private fields */
}
Expand description

Represents the Rust client for the DNSimple API V2

The client is your entrypoint to the DNSimple API. Using it you will be able to call all the endpoints of the DNSimple API and their respective functions.

Examples

use dnsimple::dnsimple::{Client, new_client};

let client = new_client(true, String::from("AUTH_TOKEN"));
let identity = client.identity().whoami().unwrap().data.unwrap();

let account = identity.account.unwrap();

Fields§

§_agent: Agent

Implementations§

source§

impl Client

source

pub fn accounts(&self) -> Accounts<'_>

Returns the accounts service attached to this client

source

pub fn contacts(&self) -> Contacts<'_>

Returns the contacts service attached to this client

source

pub fn certificates(&self) -> Certificates<'_>

Returns the certificates service attached to this client

source

pub fn domains(&self) -> Domains<'_>

Returns the domains service attached to this client

source

pub fn identity(&self) -> Identity<'_>

Returns the identity service attached to this client

source

pub fn oauth(&self) -> OAuth<'_>

Returns the oauth service attached to this client

source

pub fn registrar(&self) -> Registrar<'_>

Returns the registrar service attached to this client

source

pub fn services(&self) -> Services<'_>

Returns the services service attached to this client

source

pub fn templates(&self) -> Templates<'_>

Returns the templates service attached to this client

source

pub fn tlds(&self) -> Tlds<'_>

Returns the tlds service attached to this endpoint

source

pub fn vanity_name_servers(&self) -> VanityNameServers<'_>

Returns the vanity_name_servers service attached to this endpoint

source

pub fn webhooks(&self) -> Webhooks<'_>

Returns the webhooks service attached to this endpoint

source

pub fn zones(&self) -> Zones<'_>

Returns the zones service attached to this endpoint

source

pub fn set_base_url(&mut self, url: &str)

Convenience function to change the base url in runtime (used internally for testing).

Note that if you want to do this you will have to declare your client mutable.

use dnsimple::dnsimple::{Client, new_client};
let mut client = new_client(true, String::from("ACCESS_TOKEN"));
client.set_base_url("https://example.com");
Arguments

url: The url we want to change the base url to.

source

pub fn versioned_url(&self) -> String

Returns the current url (including the API_VERSION as part of the path).

source

pub fn get<E: Endpoint>( &self, path: &str, options: Option<RequestOptions> ) -> Result<DNSimpleResponse<E::Output>, DNSimpleError>

Sends a GET request to the DNSimple API

Arguments

path: the path to the endpoint options: optionally a RequestOptions with things like pagination, filtering and sorting

source

pub fn post<E: Endpoint>( &self, path: &str, data: Value ) -> Result<DNSimpleResponse<<E as Endpoint>::Output>, DNSimpleError>

Sends a POST request to the DNSimple API

Arguments

path: the path to the endpoint data: the json payload to be sent to the server

source

pub fn empty_post( &self, path: &str ) -> Result<DNSimpleEmptyResponse, DNSimpleError>

Sends a POST request to the DNSimple API without any payload

Arguments

path: the path to the endpoint

source

pub fn put<E: Endpoint>( &self, path: &str, data: Value ) -> Result<DNSimpleResponse<<E as Endpoint>::Output>, DNSimpleError>

Sends a PUT request to the DNSimple API

Arguments

path: the path to the endpoint data: the json payload to be sent to the server

source

pub fn empty_put( &self, path: &str ) -> Result<DNSimpleEmptyResponse, DNSimpleError>

Sends a PUT request to the DNSimple API without any payload

Arguments

path: the path to the endpoint

source

pub fn patch<E: Endpoint>( &self, path: &str, data: Value ) -> Result<DNSimpleResponse<<E as Endpoint>::Output>, DNSimpleError>

Sends a PATCH request to the DNSimple API

Arguments

path: the path to the endpoint data: the json payload to be sent to the server

source

pub fn delete(&self, path: &str) -> Result<DNSimpleEmptyResponse, DNSimpleError>

Sends a DELETE request to the DNSimple API

Arguments

path: the path to the endpoint

source

pub fn delete_with_response<E: Endpoint>( &self, path: &str ) -> Result<DNSimpleResponse<E::Output>, DNSimpleError>

Sends a DELETE request to the DNSimple API returning a response containing a DNSimpleResponse

Arguments

path: the path to the endpoint

source

pub fn build_post_request(&self, path: &&str) -> Request

source

pub fn build_put_request(&self, path: &&str) -> Request

source

pub fn build_patch_request(&self, path: &&str) -> Request

Auto Trait Implementations§

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.