pub struct RequestOptions { /* private fields */ }Expand description
Settings for one call, applied with with_options on any resource handle.
use std::time::Duration;
use wellfriend::{RequestOptions, Wellfriend};
let wf = Wellfriend::new();
let options = RequestOptions::new()
.idempotency_key("invoice-2026-0042-compress")
.timeout(Duration::from_secs(120))
.max_retries(5);
wf.tools().with_options(options).compress_pdf("invoice.pdf", None).await?.save("invoice.min.pdf").await?;Implementations§
Source§impl RequestOptions
impl RequestOptions
Sourcepub fn idempotency_key(self, key: impl Into<String>) -> Self
pub fn idempotency_key(self, key: impl Into<String>) -> Self
The idempotency key for the call’s main write, instead of a generated one. Sending the
same call again with the same key returns the first result instead of repeating the work.
Keys are 8 to 200 characters of letters, digits, ., _, : and -.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
The timeout for connecting and receiving response headers, and for each read of the body. It never limits a whole streamed upload or download.
Sourcepub fn max_retries(self, max_retries: u32) -> Self
pub fn max_retries(self, max_retries: u32) -> Self
How many times a failed request is retried.
Sourcepub fn wait_timeout(self, wait_timeout: Duration) -> Self
pub fn wait_timeout(self, wait_timeout: Duration) -> Self
How long tool calls and pipelines wait for their result.
Sourcepub fn header(self, name: HeaderName, value: HeaderValue) -> Self
pub fn header(self, name: HeaderName, value: HeaderValue) -> Self
An extra header sent with every request of the call.
Trait Implementations§
Source§impl Clone for RequestOptions
impl Clone for RequestOptions
Source§impl Debug for RequestOptions
impl Debug for RequestOptions
Auto Trait Implementations§
impl Forget for RequestOptions
impl Freeze for RequestOptions
impl Move 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