pub struct EndpointRequestBuilder<'a, E, S>where
E: Endpoint,{ /* private fields */ }Expand description
Fluent builder for a typed Endpoint.
When E::Params is not [()], the builder starts in NeedsParams and requires
.params() before .send_json().
Implementations§
Source§impl<'a, E> EndpointRequestBuilder<'a, E, NeedsParams>where
E: Endpoint,
impl<'a, E> EndpointRequestBuilder<'a, E, NeedsParams>where
E: Endpoint,
Source§impl<'a, E> EndpointRequestBuilder<'a, E, Ready>where
E: Endpoint,
impl<'a, E> EndpointRequestBuilder<'a, E, Ready>where
E: Endpoint,
Sourcepub fn query(
self,
query: <E as Endpoint>::Query,
) -> EndpointRequestBuilder<'a, E, Ready>
pub fn query( self, query: <E as Endpoint>::Query, ) -> EndpointRequestBuilder<'a, E, Ready>
Applies typed query parameters for E::Query.
Sourcepub fn header(
self,
key: impl AsRef<str>,
value: impl AsRef<str>,
) -> Result<EndpointRequestBuilder<'a, E, Ready>, Error>
pub fn header( self, key: impl AsRef<str>, value: impl AsRef<str>, ) -> Result<EndpointRequestBuilder<'a, E, Ready>, Error>
Adds a request header.
Sourcepub fn bearer_token(
self,
token: impl Into<String>,
) -> EndpointRequestBuilder<'a, E, Ready>
pub fn bearer_token( self, token: impl Into<String>, ) -> EndpointRequestBuilder<'a, E, Ready>
Sets bearer authentication.
Sourcepub fn cancellation_token(
self,
token: CancellationToken,
) -> EndpointRequestBuilder<'a, E, Ready>
pub fn cancellation_token( self, token: CancellationToken, ) -> EndpointRequestBuilder<'a, E, Ready>
Attaches a cancellation token.
Sourcepub fn throw_on_error(self, throw: bool) -> EndpointRequestBuilder<'a, E, Ready>
pub fn throw_on_error(self, throw: bool) -> EndpointRequestBuilder<'a, E, Ready>
When true, send returns Err on non-2xx.
Sourcepub async fn send_json(self) -> Result<<E as Endpoint>::Response, Error>
pub async fn send_json(self) -> Result<<E as Endpoint>::Response, Error>
Executes and deserializes E::Response (feature json).
Sourcepub fn into_inner(self) -> RequestBuilder<'a>
pub fn into_inner(self) -> RequestBuilder<'a>
Returns the underlying RequestBuilder for advanced options.
Auto Trait Implementations§
impl<'a, E, S> !Freeze for EndpointRequestBuilder<'a, E, S>
impl<'a, E, S> !RefUnwindSafe for EndpointRequestBuilder<'a, E, S>
impl<'a, E, S> Send for EndpointRequestBuilder<'a, E, S>
impl<'a, E, S> Sync for EndpointRequestBuilder<'a, E, S>
impl<'a, E, S> Unpin for EndpointRequestBuilder<'a, E, S>
impl<'a, E, S> UnsafeUnpin for EndpointRequestBuilder<'a, E, S>
impl<'a, E, S> !UnwindSafe for EndpointRequestBuilder<'a, E, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more