pub trait HttpRunner {
type Response;
// Required methods
fn run<T: Serialize>(
&self,
cmd: &mut Request<'_, T>,
) -> Result<Self::Response>;
fn api_max_pages<T: Serialize>(&self, cmd: &Request<'_, T>) -> u32;
// Provided methods
fn throttle(&self, milliseconds: Milliseconds) { ... }
fn throttle_range(&self, min: Milliseconds, max: Milliseconds) { ... }
}
Expand description
A trait for the HTTP protocol. Implementors need to conform with the HTTP
constraints and requirements. Implementors accept a Request
that wraps
headers, payloads and HTTP methods. Clients can potentially do HTTP calls
against a remote server or mock the responses for testing purposes.
Required Associated Types§
Required Methods§
fn run<T: Serialize>(&self, cmd: &mut Request<'_, T>) -> Result<Self::Response>
sourcefn api_max_pages<T: Serialize>(&self, cmd: &Request<'_, T>) -> u32
fn api_max_pages<T: Serialize>(&self, cmd: &Request<'_, T>) -> u32
Return the number of API MAX PAGES allowed for the given Request.
Provided Methods§
sourcefn throttle(&self, milliseconds: Milliseconds)
fn throttle(&self, milliseconds: Milliseconds)
Milliseconds to wait before executing the next request
sourcefn throttle_range(&self, min: Milliseconds, max: Milliseconds)
fn throttle_range(&self, min: Milliseconds, max: Milliseconds)
Random wait time between the given range before submitting the next HTTP request. The wait time is in milliseconds. The range is inclusive.
Object Safety§
This trait is not object safe.