pub struct RequestBuilder<'a, T, Q, R> { /* private fields */ }Expand description
A request builder
Implementations§
Source§impl<'a, T, Q, R> RequestBuilder<'a, T, Q, R>
impl<'a, T, Q, R> RequestBuilder<'a, T, Q, R>
Sourcepub fn body<T2>(self, body: T2) -> RequestBuilder<'a, T2, Q, R>where
T2: ToPayload,
pub fn body<T2>(self, body: T2) -> RequestBuilder<'a, T2, Q, R>where
T2: ToPayload,
Set the request body
Sourcepub fn dc_restrict(self, region: DcRegion) -> Self
pub fn dc_restrict(self, region: DcRegion) -> Self
Restrict this request to a single data center.
When set, do_send short-circuits with
HttpClientError::DcRegionRestricted if the session’s region differs,
instead of forwarding a request the target data center cannot serve.
Call sites for region-limited endpoints declare their region here —
Ap for AP-only APIs, Us for US-only ones.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Override the default request timeout ([REQUEST_TIMEOUT], 30s) for
this call. Most endpoints respond quickly and should stick with the
default; this exists for the rare domain where a slower backend (e.g.
an LLM-backed one) makes the shared default too tight, without
changing that default for every other endpoint.
Sourcepub fn query_params<Q2>(self, params: Q2) -> RequestBuilder<'a, T, Q2, R>
pub fn query_params<Q2>(self, params: Q2) -> RequestBuilder<'a, T, Q2, R>
Set the query string
Sourcepub fn response<R2>(self) -> RequestBuilder<'a, T, Q, R2>where
R2: FromPayload,
pub fn response<R2>(self) -> RequestBuilder<'a, T, Q, R2>where
R2: FromPayload,
Set the response body type
Source§impl<T, Q, R> RequestBuilder<'_, T, Q, R>
impl<T, Q, R> RequestBuilder<'_, T, Q, R>
Sourcepub async fn send(self) -> HttpClientResult<R>
pub async fn send(self) -> HttpClientResult<R>
Send request and get the response
Source§impl<T, Q> RequestBuilder<'_, T, Q, ()>
impl<T, Q> RequestBuilder<'_, T, Q, ()>
Sourcepub async fn send_events(
self,
) -> HttpClientResult<Pin<Box<dyn Stream<Item = HttpClientResult<SseEvent>> + Send>>>
pub async fn send_events( self, ) -> HttpClientResult<Pin<Box<dyn Stream<Item = HttpClientResult<SseEvent>> + Send>>>
Send the request with Accept: text/event-stream and return a stream of
parsed SSE events, instead of buffering the full response body like
send does. There’s no automatic 429 retry here
— once a stream starts delivering events it can’t be replayed as a
whole; a failure is handed back to the caller to decide whether to
start a new call.