pub struct RequestOptions {
pub api_key: Option<String>,
pub token: Option<String>,
pub max_retries: Option<u32>,
pub timeout_seconds: Option<u64>,
pub additional_headers: HashMap<String, String>,
pub additional_query_params: HashMap<String, String>,
pub additional_body_params: Map<String, Value>,
}Expand description
Options for customizing individual requests
Fields§
§api_key: Option<String>API key for authentication (overrides client-level API key)
token: Option<String>Bearer token for authentication (overrides client-level token)
max_retries: Option<u32>Maximum number of retry attempts for failed requests
timeout_seconds: Option<u64>Request timeout in seconds (overrides client-level timeout)
additional_headers: HashMap<String, String>Additional headers to include in the request
additional_query_params: HashMap<String, String>Additional query parameters to include in the request
additional_body_params: Map<String, Value>Additional properties to merge into the JSON request body.
Keys are sent verbatim (use the API’s wire-format names). See
RequestOptions::additional_body_param for the merge rules.
Implementations§
Source§impl RequestOptions
impl RequestOptions
pub fn new() -> Self
pub fn api_key(self, key: impl Into<String>) -> Self
pub fn token(self, token: impl Into<String>) -> Self
pub fn max_retries(self, retries: u32) -> Self
pub fn timeout_seconds(self, timeout: u64) -> Self
pub fn additional_header( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn additional_query_param( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Sourcepub fn additional_body_param(
self,
key: impl Into<String>,
value: impl Into<Value>,
) -> Self
pub fn additional_body_param( self, key: impl Into<String>, value: impl Into<Value>, ) -> Self
Adds a property to the request body, e.g. an undocumented or beta field.
The property is merged into the body after it has been serialized:
- the key is used as-is (no casing transform), and a value set here overrides a generated field with the same key;
- if the endpoint sends no body (or a
nullbody), a JSON object containing only the additional properties is sent; - it applies to JSON and
application/x-www-form-urlencodedbodies. Multipart (file upload) and raw bytes bodies are not supported and are sent unchanged, as is a body that serializes to a non-object JSON value (e.g. an array).
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