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)
}

impl<'t> RequestBuilder<'t, Droplet>

fn disable_backups(self) -> RequestBuilder<'t, Action>

fn reboot(self) -> RequestBuilder<'t, Action>

fn power_cycle(self) -> RequestBuilder<'t, Action>

fn shutdown(self) -> RequestBuilder<'t, Action>

fn power_off(self) -> RequestBuilder<'t, Action>

fn power_on(self) -> RequestBuilder<'t, Action>

fn restore(self, img: &str) -> RequestBuilder<'t, Action>

fn reset_password(self) -> RequestBuilder<'t, Action>

fn resize(self, size: &str, disk: bool) -> RequestBuilder<'t, Action>

fn rebuild(self, img: &str) -> RequestBuilder<'t, Action>

fn rename(self, name: &str) -> RequestBuilder<'t, Action>

fn change_kernel(self, kernel: &str) -> RequestBuilder<'t, Action>

fn enable_ipv6(self) -> RequestBuilder<'t, Action>

fn enable_private_networking(self) -> RequestBuilder<'t, Action>

fn snapshot(self, name: &str) -> RequestBuilder<'t, Action>

fn upgrade(self) -> RequestBuilder<'t, Action>

fn action(self, id: &str) -> RequestBuilder<'t, Action>

fn kernels(self) -> RequestBuilder<'t, Kernels>

fn snapshots(self) -> RequestBuilder<'t, Snapshots>

fn backups(self) -> RequestBuilder<'t, Backups>

fn actions(self) -> RequestBuilder<'t, Actions>

fn delete(self) -> RequestBuilder<'t, HeaderOnly>

fn show(&self) -> RequestBuilder<'t, Droplet>

fn neighbors(self) -> RequestBuilder<'t, Droplets>

impl<'t> RequestBuilder<'t, Droplets>

fn create(self, droplet: &Droplet) -> RequestBuilder<'t, Droplet>

fn neighbors(self) -> RequestBuilder<'t, Neighbors>

fn upgrades(self) -> RequestBuilder<'t, ResponseStringArray>

impl<'t> RequestBuilder<'t, Image>

fn transfer(self, region: &str) -> RequestBuilder<'t, Action>

fn convert(self) -> RequestBuilder<'t, Action>

fn actions(self) -> RequestBuilder<'t, Actions>

fn action(self, id: &str) -> RequestBuilder<'t, Action>

fn update(self, name: &str) -> RequestBuilder<'t, Image>

fn delete(self) -> RequestBuilder<'t, HeaderOnly>

impl<'t> RequestBuilder<'t, Images>

fn applications(self) -> RequestBuilder<'t, Images>

fn distributions(self) -> RequestBuilder<'t, Images>

fn private(self) -> RequestBuilder<'t, Images>

fn available(self) -> RequestBuilder<'t, Images>

impl<'t> RequestBuilder<'t, SshKeys>

fn create(self, name: &str, pub_key: &str) -> RequestBuilder<'t, SshKey>

impl<'t> RequestBuilder<'t, SshKey>

fn update(self, name: &str) -> RequestBuilder<'t, SshKey>

fn destroy(self) -> RequestBuilder<'t, HeaderOnly>

impl<'t, T> RequestBuilder<'t, T>

fn with_auth(auth: &'t str) -> RequestBuilder<'t, T>

fn new<S>(auth: &'t str, url: S) -> RequestBuilder<'t, T> where S: Into<String>

Trait Implementations

impl<'t> DoRequest<Account> for RequestBuilder<'t, Account>

fn request(&self) -> Result<Request<Fresh>>

fn retrieve_json(&self) -> Result<String>

fn retrieve_raw_response(&self) -> Result<Response>

fn retrieve_header(&self) -> Result<HeaderOnly, String>

fn retrieve_obj(&self, obj: String) -> Result<T, String>

fn retrieve(&self) -> Result<T, String>

impl<'t> DoRequest<Action> for RequestBuilder<'t, Action>

fn request(&self) -> Result<Request<Fresh>>

fn retrieve_json(&self) -> Result<String>

fn retrieve_raw_response(&self) -> Result<Response>

fn retrieve_header(&self) -> Result<HeaderOnly, String>

fn retrieve_obj(&self, obj: String) -> Result<T, String>

fn retrieve(&self) -> Result<T, String>

impl<'t> DoRequest<DnsRecord> for RequestBuilder<'t, DnsRecord>

fn request(&self) -> Result<Request<Fresh>>

fn retrieve_json(&self) -> Result<String>

fn retrieve_raw_response(&self) -> Result<Response>

fn retrieve_header(&self) -> Result<HeaderOnly, String>

fn retrieve_obj(&self, obj: String) -> Result<T, String>

fn retrieve(&self) -> Result<T, String>

impl<'t> DoRequest<Domain> for RequestBuilder<'t, Domain>

fn request(&self) -> Result<Request<Fresh>>

fn retrieve_json(&self) -> Result<String>

fn retrieve_raw_response(&self) -> Result<Response>

fn retrieve_header(&self) -> Result<HeaderOnly, String>

fn retrieve_obj(&self, obj: String) -> Result<T, String>

fn retrieve(&self) -> Result<T, String>

impl<'t> DoRequest<Droplet> for RequestBuilder<'t, Droplet>

fn request(&self) -> Result<Request<Fresh>>

fn retrieve_json(&self) -> Result<String>

fn retrieve_raw_response(&self) -> Result<Response>

fn retrieve_header(&self) -> Result<HeaderOnly, String>

fn retrieve_obj(&self, obj: String) -> Result<T, String>

fn retrieve(&self) -> Result<T, String>

impl<'t> DoRequest<Image> for RequestBuilder<'t, Image>

fn request(&self) -> Result<Request<Fresh>>

fn retrieve_json(&self) -> Result<String>

fn retrieve_raw_response(&self) -> Result<Response>

fn retrieve_header(&self) -> Result<HeaderOnly, String>

fn retrieve_obj(&self, obj: String) -> Result<T, String>

fn retrieve(&self) -> Result<T, String>

impl<'t> DoRequest<SshKey> for RequestBuilder<'t, SshKey>

fn request(&self) -> Result<Request<Fresh>>

fn retrieve_json(&self) -> Result<String>

fn retrieve_raw_response(&self) -> Result<Response>

fn retrieve_header(&self) -> Result<HeaderOnly, String>

fn retrieve_obj(&self, obj: String) -> Result<T, String>

fn retrieve(&self) -> Result<T, String>

impl<'t, T> Display for RequestBuilder<'t, T>

fn fmt(&self, f: &mut Formatter) -> Result

impl<'t, T> BaseRequest for RequestBuilder<'t, T>

fn auth(&self) -> &str

fn url(&self) -> &str

fn method(&self) -> Method

fn body(&self) -> Option<String>

impl<'t, I> PagedRequest for RequestBuilder<'t, Vec<I>> where I: Deserialize + NamedResponse + NotArray

type Item = I

fn retrieve_single_page(&self, url: String) -> Result<RawPagedResponse<I>, String>

impl<'t, I> DoRequest<Vec<I>> for RequestBuilder<'t, Vec<I>> where I: Deserialize + NamedResponse + NotArray

fn retrieve(&self) -> Result<Vec<I>, String>

fn request(&self) -> Result<Request<Fresh>>

fn retrieve_json(&self) -> Result<String>

fn retrieve_raw_response(&self) -> Result<Response>

fn retrieve_header(&self) -> Result<HeaderOnly, String>

fn retrieve_obj(&self, obj: String) -> Result<T, String>

impl<'t> DoRequest<HeaderOnly> for RequestBuilder<'t, HeaderOnly>

fn retrieve(&self) -> Result<HeaderOnly, String>

fn request(&self) -> Result<Request<Fresh>>

fn retrieve_json(&self) -> Result<String>

fn retrieve_raw_response(&self) -> Result<Response>

fn retrieve_header(&self) -> Result<HeaderOnly, String>

fn retrieve_obj(&self, obj: String) -> Result<T, String>

impl<'t> DoRequest<ResponseStringArray> for RequestBuilder<'t, ResponseStringArray>

fn retrieve_obj(&self, obj: String) -> Result<ResponseStringArray, String>

fn request(&self) -> Result<Request<Fresh>>

fn retrieve_json(&self) -> Result<String>

fn retrieve_raw_response(&self) -> Result<Response>

fn retrieve_header(&self) -> Result<HeaderOnly, String>

fn retrieve(&self) -> Result<T, String>

impl<'t> DoRequest<Neighbors> for RequestBuilder<'t, Neighbors>

fn request(&self) -> Result<Request<Fresh>>

fn retrieve_json(&self) -> Result<String>

fn retrieve_raw_response(&self) -> Result<Response>

fn retrieve_header(&self) -> Result<HeaderOnly, String>

fn retrieve_obj(&self, obj: String) -> Result<T, String>

fn retrieve(&self) -> Result<T, String>