[−][src]Trait oauth1_request::authorize::Authorize
Types that can be made into a Request using given credentials.
#[derive(Authorize)]
oauth1-request crate provides a derive macro for Authorizetrait.
It generates a code to create a query string using the struct's field names and
Display implementation of the values.
You can customize the trait implementation produced by the derive macro with the following field attributes:
#[oauth1(encoded)]
Do not percent encode the value when appending it to query string.
#[oauth1(fmt = "path")]
Format the value using the given function. The function must be callable as
fn(&T, &mut Formatter<'_>) -> fmt::Result (same as Display::fmt).
#[oauth1(option = "true")](or#[oauth1(option = "false")])
If set to "true", skip the field when the value is None or use the unwrapped value otherwise.
The value's type must be Option<T> in that case.
When the field's type name is Option<_>, the attribute is implicitly set to "true".
Use #[oauth1(option = "false")] if you need to opt out of that behavior.
#[oauth1(rename = "name")]
Use the given string as the key of the query pair. The given string must be URI-safe.
#[oauth1(skip)]
Unconditionally skip the field.
#[oauth1(skip_if = "path")]
Call the given function and skip the field if the function returns true.
The function must be callable as fn(&T) -> bool.
Required methods
fn authorize_with<SM>(
&self,
signer: Signer<SM>,
consumer_key: &str,
options: Option<&Options<'_>>
) -> Request where
SM: SignatureMethod,
&self,
signer: Signer<SM>,
consumer_key: &str,
options: Option<&Options<'_>>
) -> Request where
SM: SignatureMethod,
Signs self using signer.
Users of the trait should use authorize or authorize_form instead.
Provided methods
fn authorize<'a, SM>(
&self,
method: &str,
uri: impl Display,
consumer_key: &str,
consumer_secret: &str,
token_secret: impl Into<Option<&'a str>>,
signature_method: SM,
options: impl Into<Option<&'a Options<'a>>>
) -> Request where
SM: SignatureMethod,
&self,
method: &str,
uri: impl Display,
consumer_key: &str,
consumer_secret: &str,
token_secret: impl Into<Option<&'a str>>,
signature_method: SM,
options: impl Into<Option<&'a Options<'a>>>
) -> Request where
SM: SignatureMethod,
Signs self using the given credentials and returns a Request with a URI with query
string.
fn authorize_form<'a, SM>(
&self,
method: &str,
uri: impl Display,
consumer_key: &str,
consumer_secret: &str,
token_secret: impl Into<Option<&'a str>>,
signature_method: SM,
options: impl Into<Option<&'a Options<'a>>>
) -> Request where
SM: SignatureMethod,
&self,
method: &str,
uri: impl Display,
consumer_key: &str,
consumer_secret: &str,
token_secret: impl Into<Option<&'a str>>,
signature_method: SM,
options: impl Into<Option<&'a Options<'a>>>
) -> Request where
SM: SignatureMethod,
Signs self using the given credentials and returns a Request with
an x-www-form-urlencoded string.
Implementations on Foreign Types
impl<'a, A: Authorize + ?Sized> Authorize for &'a A[src]
fn authorize_with<SM>(
&self,
signer: Signer<SM>,
consumer_key: &str,
options: Option<&Options<'_>>
) -> Request where
SM: SignatureMethod, [src]
&self,
signer: Signer<SM>,
consumer_key: &str,
options: Option<&Options<'_>>
) -> Request where
SM: SignatureMethod,
impl<'a, A: Authorize + ?Sized> Authorize for &'a mut A[src]
fn authorize_with<SM>(
&self,
signer: Signer<SM>,
consumer_key: &str,
options: Option<&Options<'_>>
) -> Request where
SM: SignatureMethod, [src]
&self,
signer: Signer<SM>,
consumer_key: &str,
options: Option<&Options<'_>>
) -> Request where
SM: SignatureMethod,
impl Authorize for ()[src]
Authorizes a request with no query pairs.
fn authorize_with<SM>(
&self,
signer: Signer<SM>,
consumer_key: &str,
options: Option<&Options<'_>>
) -> Request where
SM: SignatureMethod, [src]
&self,
signer: Signer<SM>,
consumer_key: &str,
options: Option<&Options<'_>>
) -> Request where
SM: SignatureMethod,
impl<K: Borrow<str>, V: Borrow<str>> Authorize for BTreeSet<(K, V)>[src]
fn authorize_with<SM>(
&self,
signer: Signer<SM>,
consumer_key: &str,
options: Option<&Options<'_>>
) -> Request where
SM: SignatureMethod, [src]
&self,
signer: Signer<SM>,
consumer_key: &str,
options: Option<&Options<'_>>
) -> Request where
SM: SignatureMethod,
impl<A: Authorize> Authorize for Option<A>[src]
fn authorize_with<SM>(
&self,
signer: Signer<SM>,
consumer_key: &str,
options: Option<&Options<'_>>
) -> Request where
SM: SignatureMethod, [src]
&self,
signer: Signer<SM>,
consumer_key: &str,
options: Option<&Options<'_>>
) -> Request where
SM: SignatureMethod,