Struct dnsimple::dnsimple::Client [−][src]
pub struct Client {
pub _agent: Agent,
// some fields omitted
}
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
Returns the certificates
service attached to this client
Returns the vanity_name_servers
service attached to this endpoint
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.
Returns the current url (including the API_VERSION
as part of the path).
pub fn get<E: Endpoint>(
&self,
path: &str,
options: Option<RequestOptions>
) -> Result<DNSimpleResponse<E::Output>, String>
pub fn get<E: Endpoint>(
&self,
path: &str,
options: Option<RequestOptions>
) -> Result<DNSimpleResponse<E::Output>, String>
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
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
Sends a POST request to the DNSimple API without any payload
Arguments
path
: the path to the endpoint
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
Sends a PUT request to the DNSimple API without any payload
Arguments
path
: the path to the endpoint
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
pub fn delete_with_response<E: Endpoint>(
&self,
path: &str
) -> Result<DNSimpleResponse<E::Output>, String>
pub fn delete_with_response<E: Endpoint>(
&self,
path: &str
) -> Result<DNSimpleResponse<E::Output>, String>
Sends a DELETE request to the DNSimple API returning a response containing a DNSimpleResponse
Arguments
path
: the path to the endpoint