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
impl Client
sourcepub fn certificates(&self) -> Certificates<'_>
pub fn certificates(&self) -> Certificates<'_>
Returns the certificates
service attached to this client
sourcepub fn vanity_name_servers(&self) -> VanityNameServers<'_>
pub fn vanity_name_servers(&self) -> VanityNameServers<'_>
Returns the vanity_name_servers
service attached to this endpoint
sourcepub fn set_base_url(&mut self, url: &str)
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.
sourcepub fn versioned_url(&self) -> String
pub fn versioned_url(&self) -> String
Returns the current url (including the API_VERSION
as part of the path).
sourcepub fn get<E: Endpoint>(
&self,
path: &str,
options: Option<RequestOptions>
) -> Result<DNSimpleResponse<E::Output>, DNSimpleError>
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
sourcepub fn post<E: Endpoint>(
&self,
path: &str,
data: Value
) -> Result<DNSimpleResponse<<E as Endpoint>::Output>, DNSimpleError>
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
sourcepub fn empty_post(
&self,
path: &str
) -> Result<DNSimpleEmptyResponse, DNSimpleError>
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
sourcepub fn put<E: Endpoint>(
&self,
path: &str,
data: Value
) -> Result<DNSimpleResponse<<E as Endpoint>::Output>, DNSimpleError>
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
sourcepub fn empty_put(
&self,
path: &str
) -> Result<DNSimpleEmptyResponse, DNSimpleError>
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
sourcepub fn patch<E: Endpoint>(
&self,
path: &str,
data: Value
) -> Result<DNSimpleResponse<<E as Endpoint>::Output>, DNSimpleError>
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
sourcepub fn delete(&self, path: &str) -> Result<DNSimpleEmptyResponse, DNSimpleError>
pub fn delete(&self, path: &str) -> Result<DNSimpleEmptyResponse, DNSimpleError>
sourcepub fn delete_with_response<E: Endpoint>(
&self,
path: &str
) -> Result<DNSimpleResponse<E::Output>, DNSimpleError>
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