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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
//! # Eskom-se-Push API
//!
//! The library is an unofficial lib and is not maintained by the API developers.
//!
//! This library is an API binding to the [EskomSePush](https://sepush.co.za) API.
//!
//! It does have a few small helper functions to assist.
//!
//! To get up and running, you can either pass in the API key or use environment variables.
//!
//! ## API key as a variable
//!
//! ```rust
//! use eskom_se_push_api::EskomAPI;
//!
//! fn main() {
//! let api = EskomAPI::new("XXXXXXXXXXXXXXXXXXXXXXXXX");
//! let resp = api.check_allowance();
//! match resp {
//! Ok(allowance) => {
//! println!(
//! "You have made {} API calls today",
//! allowance.allowance.count
//! );
//! }
//! Err(e) => {
//! eprintln!("Error: {}", e);
//! }
//! }
//! }
//! ```
//!
//! ## API key as an env variable
//!
//! The default env variable is `ESKOMSEPUSH_API_KEY`
//! ```rust
//! use eskom_se_push_api::EskomAPI;
//!
//! fn main() {
//! let api = EskomAPI::new_with_env(None);
//! let resp = api.check_allowance();
//! match resp {
//! Ok(allowance) => {
//! println!(
//! "You have made {} API calls today",
//! allowance.allowance.count
//! );
//! }
//! Err(e) => {
//! eprintln!("Error: {}", e);
//! }
//! }
//! }
//! ```
//!
//! //!
//! ## API key as an custom env variable
//!
//! Able to use custom env keys such as `MY_CUSTOM_KEY`
//! ```rust
//! use eskom_se_push_api::EskomAPI;
//!
//! fn main() {
//! let api = EskomAPI::new_with_env(Some("MY_CUSTOM_KEY"));
//! let resp = api.check_allowance();
//! match resp {
//! Ok(allowance) => {
//! println!(
//! "You have made {} API calls today",
//! allowance.allowance.count
//! );
//! }
//! Err(e) => {
//! eprintln!("Error: {}", e);
//! }
//! }
//! }
//! ```
//!
//! ## Features
//!
//! There are currently 4 features but some are used in combinations to enable certain functionality
//!
//! * `reqwest` and `async`: Adds an async reqwest client and response handler
//!
//! * `reqwest` and `sync`: Adds a blocking reqwest client and response handler
//!
//! * `ureq`: Adds a ureq client and response handler
//!
//! None of the features are added by default
pub use Endpoint;
pub use EndpointAsync;
extern crate thiserror;