Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
fix: fixes image API
Browse files Browse the repository at this point in the history
  • Loading branch information
kbknapp committed Jun 5, 2015
1 parent db3e723 commit 4e032f2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/request/builder/images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ use request::RequestBuilder;
use request::DoRequest;

impl<'t> RequestBuilder<'t, response::Image> {
pub fn transfer(self, region: &str) -> RequestBuilder<'t, response::Action> {
pub fn transfer(mut self, region: &str) -> RequestBuilder<'t, response::Action> {
// POST: "https://api.digitalocean.com/v2/images/$ID/actions"
// body:
// "type" : "transfer"
// "region" : "nyc2"
self.url.push_str("/actions");
RequestBuilder {
method: Method::Post,
auth: self.auth,
Expand All @@ -20,10 +21,11 @@ impl<'t> RequestBuilder<'t, response::Image> {
body: Some(format!("{{\"type\":\"transfer\",\"region\":{:?}}}", region))
}
}
pub fn convert(self) -> RequestBuilder<'t, response::Action> {
// POST: "https://api.digitalocean.com/v2/images/7938291/actions"
pub fn convert(mut self) -> RequestBuilder<'t, response::Action> {
// POST: "https://api.digitalocean.com/v2/images/$ID/actions"
// body:
// "type" : "convert"
self.url.push_str("/actions");
RequestBuilder {
method: Method::Post,
auth: self.auth,
Expand All @@ -33,7 +35,7 @@ impl<'t> RequestBuilder<'t, response::Image> {
}
}
pub fn actions(mut self) -> RequestBuilder<'t, response::Actions> {
// GET: https://api.digitalocean.com/v2/images/$SLUG
// GET: "https://api.digitalocean.com/v2/images/$ID/actions"
self.url.push_str("/actions");
RequestBuilder {
url: self.url,
Expand Down

0 comments on commit 4e032f2

Please sign in to comment.