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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
//! # SumUp Rust SDK
//!
//! Official Rust SDK for the SumUp REST API.
//!
//! ## Quick Start
//!
//! ```no_run
//! use sumup::Client;
//!
//! #[tokio::main]
//! async fn main() {
//! // Create a client (reads SUMUP_API_KEY from environment)
//! let client = Client::default();
//!
//! // Call an API endpoint
//! let checkouts = client
//! .checkouts()
//! .list(Default::default())
//! .await
//! .expect("list checkouts request failed");
//! println!("found {} checkouts", checkouts.len());
//! }
//! ```
//!
//! ## Configuration
//!
//! ### Authentication
//!
//! Set your API key via environment variable or explicitly:
//!
//! ```no_run
//! # use sumup::{Authorization, Client};
//! // From environment variable SUMUP_API_KEY
//! let client = Client::default();
//!
//! // Explicit token
//! let client = Client::default()
//! .with_authorization(Authorization::api_key("your_api_key"));
//! ```
//!
//! ### Custom Configuration
//!
//! ```no_run
//! # use sumup::{Authorization, Client};
//! use std::time::Duration;
//!
//! let client = Client::default()
//! .with_authorization(Authorization::api_key("your_api_key"))
//! .with_timeout(Duration::from_secs(30));
//! ```
//!
//! To customize reqwest directly, build a configured `reqwest::Client` and pass
//! it to [`Client::with_client`]. Start from [`Client::http_client_builder`] to
//! keep the SDK's default headers:
//!
//! ```no_run
//! # use sumup::Client;
//! # fn build_client() -> Result<Client, reqwest::Error> {
//! let http_client = Client::http_client_builder()
//! .pool_max_idle_per_host(8)
//! .build()?;
//!
//! let client = Client::default().with_client(http_client);
//! # Ok(client)
//! # }
//! ```
//!
//! ## Making API Calls
//!
//! The SDK organizes endpoints by tags:
//!
//! ```no_run
//! # use sumup::{Client, Currency, checkouts};
//! # async fn example(client: Client) {
//! // Create a checkout
//! let checkout = client.checkouts().create(checkouts::CreateRequest::builder()
//! .checkout_reference("unique-ref")
//! .amount(10.0)
//! .currency(Currency::EUR)
//! .merchant_code("MCODE")
//! .build())
//! .await
//! .expect("create checkout");
//! println!("created checkout {}", checkout.id.unwrap_or_default());
//!
//! // Transactions with query parameters
//! use sumup::resources::transactions::ListParams;
//! let transactions = client
//! .transactions()
//! .list(
//! "MERCHANT_CODE",
//! ListParams::builder().limit(10).build(),
//! )
//! .await
//! .expect("list transactions");
//! let count = transactions.items.as_ref().map_or(0, |items| items.len());
//! println!("fetched {} historical transactions", count);
//! # }
//! ```
//!
//! ## Request Builders
//!
//! Build requests and query parameters with `builder()`. Omit optional fields to
//! leave them absent, or pass values directly without `Some(...)`. For nullable
//! fields, use [`Nullable::Null`] to send an explicit `null`, or [`Nullable::Value`]
//! to send a value.
//!
//! ```
//! use sumup::readers::CreateRequest;
//!
//! let request = CreateRequest::builder()
//! .name("Front desk")
//! .pairing_code("12345678")
//! .build();
//! assert!(request.metadata.is_none());
//! ```
//!
//! Required fields must be set before calling `build()`. Omitting one is a
//! compile-time error:
//!
//! ```compile_fail
//! use sumup::readers::CreateRequest;
//!
//! let request = CreateRequest::builder().name("Front desk").build();
//! // Missing required pairing_code.
//! ```
//!
//! ## DateTime Support
//!
//! The SDK supports both [`chrono`](https://docs.rs/chrono) (default) and
//! [`jiff`](https://docs.rs/jiff) for datetime types:
//!
//! ```toml
//! # Use chrono (default)
//! [dependencies]
//! sumup = "0.5"
//!
//! # Use jiff instead
//! [dependencies]
//! sumup = { version = "0.5", default-features = false, features = ["jiff", "reqwest-default-tls"] }
//!
//! # Use rustls instead of reqwest's default TLS backend
//! [dependencies]
//! sumup = { version = "0.5", default-features = false, features = ["chrono", "reqwest-rustls-tls"] }
//! ```
//!
//! ## Error Handling
//!
//! Failed calls return a [`SdkError`]. Use `problem()` to read typed Problem details
//! when the API provides them:
//!
//! ```no_run
//! # use sumup::Client;
//! # async fn example() {
//! let client = Client::default();
//! if let Err(error) = client.checkouts().get("your-checkout-id").await {
//! if let Some(problem) = error.problem() {
//! eprintln!("{}: {}", problem.r#type, problem.detail.as_deref().unwrap_or("Request failed"));
//! }
//! eprintln!("{error}");
//! }
//! # }
//! ```
//!
//! Use [`SdkError::status`], [`SdkError::headers`], and [`SdkError::raw_body`]
//! to inspect the HTTP response. [`SdkError::body`] provides other typed error details.
//!
//! ## Features
//!
//! - **chrono** (default): Use chrono for datetime types
//! - **jiff**: Use jiff for datetime types (mutually exclusive with chrono)
//! - **reqwest-default-tls** (default): Use reqwest's default TLS backend
//! - **reqwest-rustls-tls**: Use reqwest's rustls TLS backend
//!
//! ## Resources
//!
//! - [API Documentation](https://developer.sumup.com/docs/)
//! - [GitHub Repository](https://github.com/sumup/sumup-rs)
// Generated endpoint methods intentionally retain typed API response bodies in
// their error variants, which can exceed Clippy's heuristic size threshold.
pub use crate*;
pub use Authorization;
pub use Client;
pub use ;
pub use Nullable;
pub use Secret;
pub use VERSION;