pub struct Fetcher<'a, H: HttpClient, C: RetrySettings> { /* private fields */ }Expand description
Wraps an HttpClient with a rate-limit throttle and retry/backoff loop.
C supplies the knobs via RetrySettings — typically a vendor SyncConfig.
Implementations§
Source§impl<'a, H: HttpClient, C: RetrySettings> Fetcher<'a, H, C>
impl<'a, H: HttpClient, C: RetrySettings> Fetcher<'a, H, C>
pub fn new(http: &'a H, cfg: &'a C) -> Self
Sourcepub fn get(&self, url: &str) -> Result<Vec<u8>, String>
pub fn get(&self, url: &str) -> Result<Vec<u8>, String>
GET with throttle + bounded exponential backoff. On success returns the body; on terminal failure a message with the token redacted.
Sourcepub fn get_rows(&self, url: &str) -> Result<Vec<Value>, String>
pub fn get_rows(&self, url: &str) -> Result<Vec<Value>, String>
GET and parse a JSON array of row objects (list / EOD endpoints).
Vendor list endpoints return an array on success and an error object
on failure; surface that object’s message (checking the common key shapes
across vendors — message / error / Error Message) instead of
silently yielding no rows.
Auto Trait Implementations§
impl<'a, H, C> !Freeze for Fetcher<'a, H, C>
impl<'a, H, C> !RefUnwindSafe for Fetcher<'a, H, C>
impl<'a, H, C> !Sync for Fetcher<'a, H, C>
impl<'a, H, C> Send for Fetcher<'a, H, C>
impl<'a, H, C> Unpin for Fetcher<'a, H, C>
impl<'a, H, C> UnsafeUnpin for Fetcher<'a, H, C>
impl<'a, H, C> UnwindSafe for Fetcher<'a, H, C>where
H: RefUnwindSafe,
C: RefUnwindSafe,
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