diff --git a/Cargo.toml b/Cargo.toml index 775c5ab..50898de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "elefren" -version = "0.17.0" +version = "0.18.0" description = "A wrapper around the Mastodon API." authors = ["Aaron Power ", "Paul Woolcock "] license = "MIT/Apache-2.0" @@ -28,7 +28,7 @@ version = "0.4" features = ["serde"] [features] -default-features = [] +default = [] json = [] all = ["toml", "json"] diff --git a/src/registration.rs b/src/registration.rs index 4836338..ddd59f3 100644 --- a/src/registration.rs +++ b/src/registration.rs @@ -282,7 +282,7 @@ impl Registered { /// Create an access token from the client id, client secret, and code /// provided by the authorisation url. - pub fn complete(self, code: &str) -> Result> { + pub fn complete(&self, code: &str) -> Result> { let url = format!( "{}/oauth/token?client_id={}&client_secret={}&code={}&grant_type=authorization_code&redirect_uri={}", self.base, @@ -295,15 +295,15 @@ impl Registered { let token: AccessToken = self.send(self.client.post(&url))?.json()?; let data = Data { - base: self.base.into(), - client_id: self.client_id.into(), - client_secret: self.client_secret.into(), - redirect: self.redirect.into(), + base: self.base.clone().into(), + client_id: self.client_id.clone().into(), + client_secret: self.client_secret.clone().into(), + redirect: self.redirect.clone().into(), token: token.access_token.into(), }; - let mut builder = MastodonBuilder::new(self.http_sender); - builder.client(self.client).data(data); + let mut builder = MastodonBuilder::new(self.http_sender.clone()); + builder.client(self.client.clone()).data(data); Ok(builder.build()?) } }