Struct doapi::request::RequestBuilder
[−]
[src]
pub struct RequestBuilder<'t, T> { pub auth: &'t str, pub method: Method, pub url: String, pub resp_t: PhantomData<*const T>, pub body: Option<String>, }
Fields
auth | |
method | |
url | |
resp_t | |
body |
Methods
impl<'t> RequestBuilder<'t, Account>
fn action(self, id: &str) -> RequestBuilder<'t, Action>
Returns type of RequestBuilder
which allows you make requests for information related to
a single action
Parameters:
id
: The action ID you'd like to retrieve from DigitalOcean
Example
// ... domgr set up same as before match domgr.account().action("1234").retrieve() { Ok(action) => println!("Action: {}", action), Err(e) => println!("Error: {}", e) }
fn actions(self) -> RequestBuilder<'t, Actions>
A type of RequestBuilder
that lets you make requests for multiple actions or the concept
of "Actions" as a whole
Example
// ... domgr set up same as before match domgr.account().actions().retrieve() { Ok(action_vec) => println!("Action: {:?}", action_vec), Err(e) => println!("Error: {}", e) }
impl<'t> RequestBuilder<'t, DnsRecords>
fn create(self, record: &DnsRecord) -> RequestBuilder<'t, DnsRecord>
Returns a RequestBuilder
for creating a DNS record.
Parameters:
record
: The instance of DnsRecord
you'd like to create
Example
// ... domgr set up same as before // ... assumes "record" is an instance of doapi::request::DnsRecord match domgr.domain("super.com") .dns_records() .create(&record) .retrieve() { Ok(dns_rec) => println!("Record: {}", dns_rec), Err(e) => println!("Error: {}", e) }
impl<'t> RequestBuilder<'t, DnsRecord>
fn update(self, record: &DnsRecord) -> RequestBuilder<'t, DnsRecord>
Returns a RequestBuilder
for updating an existing DNS record.
Parameters:
record
: The new instance of DnsRecord
you'd like to update to
Example
// ... domgr set up same as before // ... assumes "record" is an instance of doapi::request::DnsRecord match domgr.domain("super.com") .dns_record("1234") .update(&record) .retrieve() { Ok(dns_rec) => println!("Record: {}", dns_rec), Err(e) => println!("Error: {}", e) }
fn delete(self) -> RequestBuilder<'t, HeaderOnly>
Returns a RequestBuilder
for deleting an existing DNS record.
Example
// ... domgr set up same as before match domgr.domain("super.com") .dns_record("1234") .delete() .retrieve() { Ok(_) => println!("Success"), Err(_) => println!("Error") }
impl<'t> RequestBuilder<'t, Domains>
fn create(self, name: &str, ip: &str) -> RequestBuilder<'t, Domain>
Returns a RequestBuilder
that can be used to create a new domain.
Example
// ... domgr set up same as before match domgr.domains() .create("super.com", "10.10.10.1") .retrieve() { Ok(domain) => println!("Domain: {}", domain), Err(e) => println!("Error: {}", e) }
impl<'t> RequestBuilder<'t, Domain>
fn delete(self) -> RequestBuilder<'t, HeaderOnly>
Returns a RequestBuilder
that can be used delete an existing domain.
Example
// ... domgr set up same as before match domgr.domain("super.com") .delete() .retrieve() { Ok(_) => println!("Success"), Err(_) => println!("Error") }
fn dns_records(self) -> RequestBuilder<'t, DnsRecords>
Returns a type of RequestBuilder
which allows you make requests related to multiple DNS
records or the concept of "DNS Records" as a whole
Example
// ... domgr set up same as before match domgr.domains() .create("super.com", "10.10.10.1") .retrieve() { Ok(domain) => println!("Domain: {}", domain), Err(e) => println!("Error: {}", e) }
fn dns_record(self, id: &str) -> RequestBuilder<'t, DnsRecord>
Returns type of RequestBuilder
which allows you make requests related to a single DNS
record
Example
// ... domgr set up same as before match domgr.domain("super.com") .retrieve() { Ok(domain) => println!("Domain: {}", domain), Err(e) => println!("Error: {}", e) }