Skip to main content

Crate pomelo_http

Crate pomelo_http 

Source
Expand description

Shared HTTP plumbing for the pomelo-* bring-your-own-key sync crates.

Every vendor adapter (pomelo-fmp, pomelo-eodhd, pomelo-alpha-vantage, pomelo-finnhub) needs the same primitives: a mockable HttpClient, a Fetcher that adds rate-limit throttle + bounded exponential-backoff retry, token redaction for logs, and a WriteMode. Those are identical by copy across the adapters, so they live here once (conventions: citrusquant issue #211).

No vendor logic. JSON field maps, densify formulas, symbol suffix rules, and rating mappers stay in the vendor crate — forcing one of those here would create false parity. (List-endpoint error envelopes are similar enough to share: their key shapes are a common set and the label is cosmetic, so Fetcher::get_rows handles them here rather than per vendor.)

The Fetcher reads its throttle/retry knobs through the RetrySettings trait, which each vendor’s SyncConfig implements, so no vendor SyncConfig type leaks in here.

Structs§

Fetcher
Wraps an HttpClient with a rate-limit throttle and retry/backoff loop.

Enums§

HttpError
A classified HTTP failure so the retry loop knows whether to back off.
WriteMode
How an already-present symbol tree is treated by a sync run.

Traits§

HttpClient
Minimal blocking HTTP GET, abstracted so sync logic is tested with a mock.
RetrySettings
Throttle/retry knobs a Fetcher needs, supplied by each vendor SyncConfig.

Functions§

redact
Redact vendor token query params for stderr logs (covers token, apikey, api_key, api_token).