Struct reqwest_oauth1::Secrets
source · pub struct Secrets<'a> { /* private fields */ }
Expand description
Represents OAuth secrets including consumer_key, consumer_secret, token, and token_secret. The token and token_secret are optional.
Basic usage
use reqwest_oauth1::OAuthClientProvider;
let consumer_key = "[CONSUMER_KEY]";
let consumer_secret = "[CONSUMER_SECRET]";
// if you don't have the token and token secret:
let secrets = reqwest_oauth1::Secrets::new(consumer_key, consumer_secret);
// when you have the access token and secret:
let access_token = "[ACCESS_TOKEN]";
let token_secret = "[TOKEN_SECRET]";
let secrets_with_token = secrets.token(access_token, token_secret);
// use the secret
let req = reqwest::Client::new()
.oauth1(secrets_with_token)
.post("http://example.com/");
Implementations§
source§impl<'a> Secrets<'a>
impl<'a> Secrets<'a>
pub fn new<TKey, TSecret>(consumer_key: TKey, consumer_secret: TSecret) -> Selfwhere TKey: Into<Cow<'a, str>>, TSecret: Into<Cow<'a, str>>,
pub fn new_with_token<TKey, TSecret, TToken, TTokenSecret>( consumer_key: TKey, consumer_secret: TSecret, token: TToken, token_secret: TTokenSecret ) -> Selfwhere TKey: Into<Cow<'a, str>>, TSecret: Into<Cow<'a, str>>, TToken: Into<Cow<'a, str>>, TTokenSecret: Into<Cow<'a, str>>,
pub fn token<TKey, TSecret>( self, token: TKey, token_secret: TSecret ) -> Secrets<'a>where TKey: Into<Cow<'a, str>>, TSecret: Into<Cow<'a, str>>,
Trait Implementations§
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Secrets<'a>
impl<'a> Send for Secrets<'a>
impl<'a> Sync for Secrets<'a>
impl<'a> Unpin for Secrets<'a>
impl<'a> UnwindSafe for Secrets<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more