[][src]Struct egg_mode::raw::auth::RequestBuilder

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

Builder struct to assemble and sign an API request.

For more information about how to use this type and about building requests manually, see the module docs.

Implementations

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

pub fn new(method: Method, base_uri: &'a str) -> Self[src]

Creates a new RequestBuilder with the given HTTP method and base URL.

pub fn with_query_params(self, params: &ParamList) -> Self[src]

Adds the given parameters as a query string. Parameters given this way will be included in the OAuth signature.

Note that functions that take a ParamList accumulate parameters as part of the OAuth signature. If you call both with_query_params and with_body_params, both sets of parameters will be used as part of the OAuth signature.

On the other hand, the query string is not cumulative. If you call with_query_params multiple times, only the last set of parameters will actually be considered part of the query string.

pub fn with_body_params(self, params: &ParamList) -> Self[src]

Adds the given params as a request body, formatted as application/x-www-form-urlencoded. Parameters given this way will be included in the OAuth signature.

Note that functions that take a ParamList accumulate parameters as part of the OAuth signature. If you call both with_query_params and with_body_params, both sets of parameters will be used as part of the OAuth signature.

Note that the functions that specify a request body each overwrite the body. For example, if you specify with_body_params and also with_body_json, only the one you call last will be sent with the request.

pub fn with_body_json(self, body: impl Serialize) -> Self[src]

Includes the given data as the request body, formatted as JSON. Data given this way will not be included in the OAuth signature.

Note that the functions that specify a request body each overwrite the body. For example, if you specify with_body_params and also with_body_json, only the one you call last will be sent with the request.

pub fn with_body(self, body: impl Into<Body>, content: &'static str) -> Self[src]

Includes the given data as the request body, with the given content type. Data given this way will not be included in the OAuth signature.

Note that the functions that specify a request body each overwrite the body. For example, if you specify with_body_params and also with_body, only the one you call last will be sent with the request.

pub fn oauth_callback(self, callback: impl Into<String>) -> Self[src]

Includes the given OAuth Callback into the OAuth parameters.

Note that oauth_callback and oauth_verifier are mutually exclusive. If you specify both on the same request, only the last one will be sent.

pub fn oauth_verifier(self, verifier: impl Into<String>) -> Self[src]

Includes the given OAuth Verifier into the OAuth parameters.

Note that oauth_callback and oauth_verifier are mutually exclusive. If you specify both on the same request, only the last one will be sent.

pub fn request_keys(
    self,
    consumer_key: &KeyPair,
    token: Option<&KeyPair>
) -> Request<Body>
[src]

Formats this RequestBuilder into a complete Request, signing it with the given keys.

While the token parameter is an Option here, it should only be None when generating a request token; all other calls must have two sets of keys (or be authenticated in a different way, i.e. a Bearer token).

pub fn request_token(self, token: &Token) -> Request<Body>[src]

Formats this RequestBuilder into a complete Request, signing it with the given token.

If the given Token is an Access token, the request will be signed using OAuth 1.0a, using the given URI, HTTP method, and parameters to create a signature.

If the given Token is a Bearer token, the request will be authenticated using OAuth 2.0, specifying the given Bearer token as authorization.

pub fn request_consumer_bearer(self, consumer_key: &KeyPair) -> Request<Body>[src]

Formats this RequestBuilder into a complete Request, with an Authorization header formatted using HTTP Basic authentication using the given consumer key, as expected by the POST oauth2/token endpoint.

This Authorization should only be used when requesting a Bearer token; other requests need to be signed with multiple keys (as with request_keys or giving an Access token to request_token) or with a proper Bearer token given to request_token.

This authorization can also be used to access Enterprise API endpoints that require Basic authentication, using a KeyPair with the email address and password that would ordinarily be used to access the Enterprise API Console.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for RequestBuilder<'a>

impl<'a> Send for RequestBuilder<'a>

impl<'a> Sync for RequestBuilder<'a>

impl<'a> Unpin for RequestBuilder<'a>

impl<'a> !UnwindSafe for RequestBuilder<'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, 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, 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>,