[][src]Trait oauth1_request::OAuth1Authorize

pub trait OAuth1Authorize {
    fn authorize_with<SM>(
        &self,
        signer: Signer<SM>,
        consumer_key: &str,
        options: Option<&Options>
    ) -> Request
    where
        SM: SignatureMethod
; 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
, { ... }
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
, { ... } }

Types that can be made into a Request using given credentials.

#[derive(OAuth1Authorize)]

oauth1-request-derive crate provides a custom derive macro for OAuth1Authorizetrait.

The derive macro 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)]

Skip the field if the value is None or use the unwrapped value otherwise. The value's type must be Option<T>.

  • #[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

Signs self using signer.

Users of the trait should use authorize or authorize_form instead.

Loading content...

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

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

Signs self using the given credentials and returns a Request with an x-www-form-urlencoded string.

Loading content...

Implementations on Foreign Types

impl<'a, A: OAuth1Authorize + ?Sized> OAuth1Authorize for &'a A[src]

impl<'a, A: OAuth1Authorize + ?Sized> OAuth1Authorize for &'a mut A[src]

impl OAuth1Authorize for ()[src]

Authorizes a request with no query pairs.

impl<K: Borrow<str>, V: Borrow<str>> OAuth1Authorize for BTreeSet<(K, V)>[src]

impl<A: OAuth1Authorize> OAuth1Authorize for Option<A>[src]

Loading content...

Implementors

Loading content...