[][src]Struct reqwest_oauth1::Secrets

pub struct Secrets<'a> { /* fields omitted */ }

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

impl<'a> Secrets<'a>[src]

pub fn new<TKey, TSecret>(consumer_key: TKey, consumer_secret: TSecret) -> Self where
    TKey: Into<Cow<'a, str>>,
    TSecret: Into<Cow<'a, str>>, 
[src]

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>>, 
[src]

pub fn token<TKey, TSecret>(
    self,
    token: TKey,
    token_secret: TSecret
) -> Secrets<'a> where
    TKey: Into<Cow<'a, str>>,
    TSecret: Into<Cow<'a, str>>, 
[src]

Trait Implementations

impl<'a> Clone for Secrets<'a>[src]

impl<'a> Debug for Secrets<'a>[src]

impl<'_> SecretsProvider for Secrets<'_>[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,