1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! API endpoint structures.
//!
//! The types in this module are meant to aid in constructing the appropriate calls using type-safe
//! Rust idioms.
//!
//! All endpoints use the builder pattern and have their members as private so that there are no
//! API implications of adding new members for additional query parameters in future Marketstack
//! releases.
//!
//! # Example
//!
//! ```rust,no_run
//! use serde::{Deserialize, Serialize};
//! use marketstack::Marketstack;
//! use marketstack::api::{self, Query};
//! use marketstack::api::eod;
//! use marketstack::{PaginationInfo, EodDataItem};
//!
//! // The return type of an `EodData`. Note that Marketstack may contain more information, but you can
//! // define your structure to only fetch what is needed.
//! #[derive(Serialize, Deserialize, Debug, Clone)]
//! pub struct EodData {
//! pub pagination: PaginationInfo,
//! pub data: Vec<EodDataItem>,
//! }
//!
//! // Create the client.
//! let client = Marketstack::new("api.marketstack.com", "private-token").unwrap();
//!
//! // OR create an insecure client (if on the Free plan).
//! let client = Marketstack::new_insecure("api.marketstack.com", "private-token").unwrap();
//!
//! // Create a simple endpoint. This one gets the "eod" for the AAPL symbol.
//! let endpoint = eod::Eod::builder().symbol("AAPL").build().unwrap();
//! // Call the endpoint. The return type decides how to represent the value.
//! let eod_data: EodData = endpoint.query(&client).unwrap();
//!
//! // Some endpoints support pagination. Since Marketstack does pagination through query
//! // params, we simply specify them in the endpoint builder.
//! // Note that there are limits defined, and therefore, limit(5) is fallible and returns
//! // a Result.
//! let pageable_endpoint = eod::Eod::builder().symbol("AAPL").limit(5).unwrap().build().unwrap();
//! ```
//!
//! # Using Marketstack API
//!
//! The above provides an example as to how to query `eod` data from marketstack. To use the other
//! builders, please see the respective modules within `api` for more information. The modules are
//! organized by the endpoints that are provided by marketstack.
pub use AsyncClient;
pub use Client;
pub use RestClient;
pub use Endpoint;
pub use ApiError;
pub use BodyError;
pub use ignore;
pub use Ignore;
pub use FormParams;
pub use ParamValue;
pub use QueryParams;
pub use AsyncQuery;
pub use Query;
pub use raw;
pub use Raw;
pub use PageLimit;