Skip to main content

financial_api/
client.rs

1mod configuration;
2mod credentials;
3mod reference_date;
4mod response;
5mod transport;
6
7#[cfg(test)]
8mod tests;
9
10use std::time::Duration;
11
12use reqwest::header::HeaderValue;
13
14use crate::NaturalDate;
15
16/// Validated API key stored as a sensitive HTTP header value.
17#[derive(Clone)]
18pub struct ApiKey(HeaderValue);
19
20/// Successful response after the common business envelope has been checked.
21#[derive(Debug, Clone, PartialEq)]
22pub struct Response<T> {
23    request_id: String,
24    data: T,
25}
26
27/// Builder for optional client-wide transport configuration.
28#[derive(Debug)]
29pub struct ClientBuilder {
30    api_key: ApiKey,
31    base_url: String,
32    timeout: Duration,
33    reference_date: Option<NaturalDate>,
34}
35
36/// Reusable async API client.
37#[derive(Debug, Clone)]
38pub struct Client {
39    http: reqwest::Client,
40    base_url: reqwest::Url,
41    reference_date: Option<NaturalDate>,
42}