Struct reqwest_oauth1::OAuthParameters
source · [−]pub struct OAuthParameters<'a, TSM> where
TSM: SignatureMethod + Clone, { /* private fields */ }
Expand description
Represents OAuth parameters including oauth_nonce, oauth_timestamp, realm, and others.
Basic usage
use reqwest_oauth1::OAuthClientProvider;
let consumer_key = "[CONSUMER_KEY]";
let consumer_secret = "[CONSUMER_SECRET]";
let secrets = reqwest_oauth1::Secrets::new(consumer_key, consumer_secret);
let nonce = "[NONCE]";
let timestamp = 100_000_001u64;
let callback = "http://example.com/ready";
let params = reqwest_oauth1::OAuthParameters::new()
.nonce(nonce)
.timestamp(timestamp)
.callback(callback);
let req = reqwest::Client::new()
.oauth1_with_params(secrets, params)
.post("http://example.com/")
// and so on...
;
Note
You can specify same parameters as get/post queries and they will superseded with the specified one in the OAuthParameters.
use reqwest_oauth1::OAuthClientProvider;
let consumer_key = "[CONSUMER_KEY]";
let consumer_secret = "[CONSUMER_SECRET]";
let secrets = reqwest_oauth1::Secrets::new(consumer_key, consumer_secret);
let params = reqwest_oauth1::OAuthParameters::new()
.nonce("ThisNonceWillBeSuperseded");
let req = reqwest::Client::new()
.oauth1_with_params(secrets, params)
.get("http://example.com/")
.query(&[("nonce", "ThisNonceWillSupersedeTheOldOne")])
// and so on...
;
Implementations
sourceimpl OAuthParameters<'_, HmacSha1>
impl OAuthParameters<'_, HmacSha1>
sourceimpl<'a, TSM> OAuthParameters<'a, TSM> where
TSM: SignatureMethod + Clone,
impl<'a, TSM> OAuthParameters<'a, TSM> where
TSM: SignatureMethod + Clone,
sourcepub fn callback<T>(self, callback: T) -> Self where
T: Into<Cow<'a, str>>,
pub fn callback<T>(self, callback: T) -> Self where
T: Into<Cow<'a, str>>,
set the oauth_callback value
sourcepub fn nonce<T>(self, nonce: T) -> Self where
T: Into<Cow<'a, str>>,
pub fn nonce<T>(self, nonce: T) -> Self where
T: Into<Cow<'a, str>>,
set the oauth_nonce value
sourcepub fn realm<T>(self, realm: T) -> Self where
T: Into<Cow<'a, str>>,
pub fn realm<T>(self, realm: T) -> Self where
T: Into<Cow<'a, str>>,
set the realm value
Note
this parameter will not be included in the signature-base string. cf. https://tools.ietf.org/html/rfc5849#section-3.4.1.3.1
sourcepub fn timestamp<T>(self, timestamp: T) -> Self where
T: Into<u64>,
pub fn timestamp<T>(self, timestamp: T) -> Self where
T: Into<u64>,
set the oauth_timestamp value
sourcepub fn verifier<T>(self, verifier: T) -> Self where
T: Into<Cow<'a, str>>,
pub fn verifier<T>(self, verifier: T) -> Self where
T: Into<Cow<'a, str>>,
set the oauth_verifier value
sourcepub fn version<T>(self, version: T) -> Self where
T: Into<bool>,
pub fn version<T>(self, version: T) -> Self where
T: Into<bool>,
set the oauth_version value (boolean)
Note
When the version has value true
, oauth_version will be set with “1.0”.
Otherwise, oauth_version will not be included in your request.
In oauth1, oauth_version value must be “1.0” or not specified.
pub fn signature_method<T>(self, signature_method: T) -> OAuthParameters<'a, T> where
T: SignatureMethod + Clone,
Trait Implementations
sourceimpl<'a, TSM: Clone> Clone for OAuthParameters<'a, TSM> where
TSM: SignatureMethod + Clone,
impl<'a, TSM: Clone> Clone for OAuthParameters<'a, TSM> where
TSM: SignatureMethod + Clone,
sourcefn clone(&self) -> OAuthParameters<'a, TSM>
fn clone(&self) -> OAuthParameters<'a, TSM>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a, TSM: Debug> Debug for OAuthParameters<'a, TSM> where
TSM: SignatureMethod + Clone,
impl<'a, TSM: Debug> Debug for OAuthParameters<'a, TSM> where
TSM: SignatureMethod + Clone,
Auto Trait Implementations
impl<'a, TSM> RefUnwindSafe for OAuthParameters<'a, TSM> where
TSM: RefUnwindSafe,
impl<'a, TSM> Send for OAuthParameters<'a, TSM> where
TSM: Send,
impl<'a, TSM> Sync for OAuthParameters<'a, TSM> where
TSM: Sync,
impl<'a, TSM> Unpin for OAuthParameters<'a, TSM> where
TSM: Unpin,
impl<'a, TSM> UnwindSafe for OAuthParameters<'a, TSM> where
TSM: UnwindSafe,
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)
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