pub struct RequestOptions { /* private fields */ }Expand description
Per-call options that override the client’s settings for one call.
A per-call retry policy fully replaces the client’s policy for that call.
let options = RequestOptions::new()
.timeout(Duration::from_secs(30))
.retry_policy(RetryPolicy::none())
.header("X-Agent-Client", "my-app")
.extra_body("foo", serde_json::json!(1));
let request = SystemOneRequest::new("text").question("a", Noul::new("q"));
let response = client
.system_one_with(request, options)
.await?;Implementations§
Source§impl RequestOptions
impl RequestOptions
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Overrides the per-attempt timeout for this call. Must be > 0.
Sourcepub fn retry_policy(self, policy: RetryPolicy) -> Self
pub fn retry_policy(self, policy: RetryPolicy) -> Self
Replaces the retry policy for this call.
Sourcepub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn header(self, name: impl Into<String>, value: impl Into<String>) -> Self
Adds a header for this call. SDK-owned headers always win.
Sourcepub fn extra_body(self, name: impl Into<String>, value: Value) -> Self
pub fn extra_body(self, name: impl Into<String>, value: Value) -> Self
Merges an extra field into the JSON request body for this call.
Existing fields with the same name are replaced. The extra fields are included in what is sent, but not parsed by this client.
Trait Implementations§
Source§impl Clone for RequestOptions
impl Clone for RequestOptions
Source§impl Debug for RequestOptions
impl Debug for RequestOptions
Auto Trait Implementations§
impl Freeze for RequestOptions
impl RefUnwindSafe for RequestOptions
impl Send for RequestOptions
impl Sync for RequestOptions
impl Unpin for RequestOptions
impl UnsafeUnpin for RequestOptions
impl UnwindSafe for RequestOptions
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