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
sourceimpl<'a> Secrets<'a>
impl<'a> Secrets<'a>
pub fn new<TKey, TSecret>(consumer_key: TKey, consumer_secret: TSecret) -> Self where
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
) -> Self where
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more