1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum GetCoachDeckLayoutError {
22 Status400(models::Problem),
23 Status401(models::Problem),
24 Status403(models::Problem),
25 Status404(models::Problem),
26 Status406(models::Problem),
27 Status415(models::Problem),
28 Status500(models::Problem),
29 Status501(models::Problem),
30 Status503(models::Problem),
31 DefaultResponse(models::Problem),
32 UnknownValue(serde_json::Value),
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize)]
37#[serde(untagged)]
38pub enum GetCoachDeckLayoutsError {
39 Status400(models::Problem),
40 Status401(models::Problem),
41 Status403(models::Problem),
42 Status404(models::Problem),
43 Status406(models::Problem),
44 Status415(models::Problem),
45 Status500(models::Problem),
46 Status501(models::Problem),
47 Status503(models::Problem),
48 DefaultResponse(models::Problem),
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum GetCoachLayoutsError {
56 Status400(models::Problem),
57 Status401(models::Problem),
58 Status403(models::Problem),
59 Status404(models::Problem),
60 Status406(models::Problem),
61 Status415(models::Problem),
62 Status500(models::Problem),
63 Status501(models::Problem),
64 Status503(models::Problem),
65 DefaultResponse(models::Problem),
66 UnknownValue(serde_json::Value),
67}
68
69#[derive(Debug, Clone, Serialize, Deserialize)]
71#[serde(untagged)]
72pub enum GetCoachLayoutsLayoutIdError {
73 Status400(models::Problem),
74 Status401(models::Problem),
75 Status403(models::Problem),
76 Status404(models::Problem),
77 Status406(models::Problem),
78 Status415(models::Problem),
79 Status500(models::Problem),
80 Status501(models::Problem),
81 Status503(models::Problem),
82 DefaultResponse(models::Problem),
83 UnknownValue(serde_json::Value),
84}
85
86#[derive(Debug, Clone, Serialize, Deserialize)]
88#[serde(untagged)]
89pub enum GetPassengerCategoriesError {
90 Status400(models::Problem),
91 Status401(models::Problem),
92 Status403(models::Problem),
93 Status500(models::Problem),
94 Status501(models::Problem),
95 UnknownValue(serde_json::Value),
96}
97
98#[derive(Debug, Clone, Serialize, Deserialize)]
100#[serde(untagged)]
101pub enum GetPlacesError {
102 Status400(models::Problem),
103 Status401(models::Problem),
104 Status403(models::Problem),
105 Status404(models::Problem),
106 Status406(models::Problem),
107 Status415(models::Problem),
108 Status500(models::Problem),
109 Status501(models::Problem),
110 Status503(models::Problem),
111 DefaultResponse(models::Problem),
112 UnknownValue(serde_json::Value),
113}
114
115#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum GetProductTagsError {
119 Status400(models::Problem),
120 Status401(models::Problem),
121 Status403(models::Problem),
122 Status404(models::Problem),
123 Status406(models::Problem),
124 Status415(models::Problem),
125 Status500(models::Problem),
126 Status501(models::Problem),
127 Status503(models::Problem),
128 DefaultResponse(models::Problem),
129 UnknownValue(serde_json::Value),
130}
131
132#[derive(Debug, Clone, Serialize, Deserialize)]
134#[serde(untagged)]
135pub enum GetProductsError {
136 Status400(models::Problem),
137 Status401(models::Problem),
138 Status403(models::Problem),
139 Status404(models::Problem),
140 Status406(models::Problem),
141 Status415(models::Problem),
142 Status500(models::Problem),
143 Status501(models::Problem),
144 Status503(models::Problem),
145 DefaultResponse(models::Problem),
146 UnknownValue(serde_json::Value),
147}
148
149#[derive(Debug, Clone, Serialize, Deserialize)]
151#[serde(untagged)]
152pub enum GetProductsIdError {
153 Status400(models::Problem),
154 Status401(models::Problem),
155 Status403(models::Problem),
156 Status404(models::Problem),
157 Status406(models::Problem),
158 Status415(models::Problem),
159 Status500(models::Problem),
160 Status501(models::Problem),
161 Status503(models::Problem),
162 DefaultResponse(models::Problem),
163 UnknownValue(serde_json::Value),
164}
165
166#[derive(Debug, Clone, Serialize, Deserialize)]
168#[serde(untagged)]
169pub enum GetReductionCardsError {
170 Status400(models::Problem),
171 Status401(models::Problem),
172 Status403(models::Problem),
173 Status404(models::Problem),
174 Status406(models::Problem),
175 Status415(models::Problem),
176 Status500(models::Problem),
177 Status501(models::Problem),
178 Status503(models::Problem),
179 DefaultResponse(models::Problem),
180 UnknownValue(serde_json::Value),
181}
182
183#[derive(Debug, Clone, Serialize, Deserialize)]
185#[serde(untagged)]
186pub enum GetZonesError {
187 Status400(models::Problem),
188 Status401(models::Problem),
189 Status403(models::Problem),
190 Status404(models::Problem),
191 Status406(models::Problem),
192 Status415(models::Problem),
193 Status500(models::Problem),
194 Status501(models::Problem),
195 Status503(models::Problem),
196 DefaultResponse(models::Problem),
197 UnknownValue(serde_json::Value),
198}
199
200
201pub async fn get_coach_deck_layout(configuration: &configuration::Configuration, layout_id: &str, requestor: Option<&str>, traceparent: Option<&str>, tracestate: Option<&str>, x_accept_namespace: Option<&str>) -> Result<models::CoachDeckLayoutResponse, Error<GetCoachDeckLayoutError>> {
203 let p_path_layout_id = layout_id;
205 let p_header_requestor = requestor;
206 let p_header_traceparent = traceparent;
207 let p_header_tracestate = tracestate;
208 let p_header_x_accept_namespace = x_accept_namespace;
209
210 let uri_str = format!("{}/coach-deck-layouts/{layoutId}", configuration.base_path, layoutId=crate::apis::urlencode(p_path_layout_id));
211 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
212
213 if let Some(ref user_agent) = configuration.user_agent {
214 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
215 }
216 if let Some(param_value) = p_header_requestor {
217 req_builder = req_builder.header("Requestor", param_value.to_string());
218 }
219 if let Some(param_value) = p_header_traceparent {
220 req_builder = req_builder.header("traceparent", param_value.to_string());
221 }
222 if let Some(param_value) = p_header_tracestate {
223 req_builder = req_builder.header("tracestate", param_value.to_string());
224 }
225 if let Some(param_value) = p_header_x_accept_namespace {
226 req_builder = req_builder.header("x-accept-namespace", param_value.to_string());
227 }
228 if let Some(ref token) = configuration.oauth_access_token {
229 req_builder = req_builder.bearer_auth(token.to_owned());
230 };
231
232 let req = req_builder.build()?;
233 let resp = configuration.client.execute(req).await?;
234
235 let status = resp.status();
236 let content_type = resp
237 .headers()
238 .get("content-type")
239 .and_then(|v| v.to_str().ok())
240 .unwrap_or("application/octet-stream");
241 let content_type = super::ContentType::from(content_type);
242
243 if !status.is_client_error() && !status.is_server_error() {
244 let content = resp.text().await?;
245 match content_type {
246 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
247 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CoachDeckLayoutResponse`"))),
248 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CoachDeckLayoutResponse`")))),
249 }
250 } else {
251 let content = resp.text().await?;
252 let entity: Option<GetCoachDeckLayoutError> = serde_json::from_str(&content).ok();
253 Err(Error::ResponseError(ResponseContent { status, content, entity }))
254 }
255}
256
257pub async fn get_coach_deck_layouts(configuration: &configuration::Configuration, requestor: Option<&str>, traceparent: Option<&str>, tracestate: Option<&str>, if_none_match: Option<&str>, x_accept_namespace: Option<&str>) -> Result<models::CoachDeckLayoutCollectionResponse, Error<GetCoachDeckLayoutsError>> {
259 let p_header_requestor = requestor;
261 let p_header_traceparent = traceparent;
262 let p_header_tracestate = tracestate;
263 let p_header_if_none_match = if_none_match;
264 let p_header_x_accept_namespace = x_accept_namespace;
265
266 let uri_str = format!("{}/coach-deck-layouts", configuration.base_path);
267 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
268
269 if let Some(ref user_agent) = configuration.user_agent {
270 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
271 }
272 if let Some(param_value) = p_header_requestor {
273 req_builder = req_builder.header("Requestor", param_value.to_string());
274 }
275 if let Some(param_value) = p_header_traceparent {
276 req_builder = req_builder.header("traceparent", param_value.to_string());
277 }
278 if let Some(param_value) = p_header_tracestate {
279 req_builder = req_builder.header("tracestate", param_value.to_string());
280 }
281 if let Some(param_value) = p_header_if_none_match {
282 req_builder = req_builder.header("If-None-Match", param_value.to_string());
283 }
284 if let Some(param_value) = p_header_x_accept_namespace {
285 req_builder = req_builder.header("x-accept-namespace", param_value.to_string());
286 }
287 if let Some(ref token) = configuration.oauth_access_token {
288 req_builder = req_builder.bearer_auth(token.to_owned());
289 };
290
291 let req = req_builder.build()?;
292 let resp = configuration.client.execute(req).await?;
293
294 let status = resp.status();
295 let content_type = resp
296 .headers()
297 .get("content-type")
298 .and_then(|v| v.to_str().ok())
299 .unwrap_or("application/octet-stream");
300 let content_type = super::ContentType::from(content_type);
301
302 if !status.is_client_error() && !status.is_server_error() {
303 let content = resp.text().await?;
304 match content_type {
305 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
306 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CoachDeckLayoutCollectionResponse`"))),
307 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CoachDeckLayoutCollectionResponse`")))),
308 }
309 } else {
310 let content = resp.text().await?;
311 let entity: Option<GetCoachDeckLayoutsError> = serde_json::from_str(&content).ok();
312 Err(Error::ResponseError(ResponseContent { status, content, entity }))
313 }
314}
315
316#[deprecated]
318pub async fn get_coach_layouts(configuration: &configuration::Configuration, requestor: Option<&str>, accept_language: Option<&str>, traceparent: Option<&str>, tracestate: Option<&str>, x_accept_namespace: Option<&str>, page: Option<&str>) -> Result<models::CoachLayoutCollectionResponse, Error<GetCoachLayoutsError>> {
319 let p_header_requestor = requestor;
321 let p_header_accept_language = accept_language;
322 let p_header_traceparent = traceparent;
323 let p_header_tracestate = tracestate;
324 let p_header_x_accept_namespace = x_accept_namespace;
325 let p_query_page = page;
326
327 let uri_str = format!("{}/coach-layouts", configuration.base_path);
328 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
329
330 if let Some(ref param_value) = p_query_page {
331 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
332 }
333 if let Some(ref user_agent) = configuration.user_agent {
334 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
335 }
336 if let Some(param_value) = p_header_requestor {
337 req_builder = req_builder.header("Requestor", param_value.to_string());
338 }
339 if let Some(param_value) = p_header_accept_language {
340 req_builder = req_builder.header("Accept-Language", param_value.to_string());
341 }
342 if let Some(param_value) = p_header_traceparent {
343 req_builder = req_builder.header("traceparent", param_value.to_string());
344 }
345 if let Some(param_value) = p_header_tracestate {
346 req_builder = req_builder.header("tracestate", param_value.to_string());
347 }
348 if let Some(param_value) = p_header_x_accept_namespace {
349 req_builder = req_builder.header("x-accept-namespace", param_value.to_string());
350 }
351 if let Some(ref token) = configuration.oauth_access_token {
352 req_builder = req_builder.bearer_auth(token.to_owned());
353 };
354
355 let req = req_builder.build()?;
356 let resp = configuration.client.execute(req).await?;
357
358 let status = resp.status();
359 let content_type = resp
360 .headers()
361 .get("content-type")
362 .and_then(|v| v.to_str().ok())
363 .unwrap_or("application/octet-stream");
364 let content_type = super::ContentType::from(content_type);
365
366 if !status.is_client_error() && !status.is_server_error() {
367 let content = resp.text().await?;
368 match content_type {
369 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
370 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CoachLayoutCollectionResponse`"))),
371 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CoachLayoutCollectionResponse`")))),
372 }
373 } else {
374 let content = resp.text().await?;
375 let entity: Option<GetCoachLayoutsError> = serde_json::from_str(&content).ok();
376 Err(Error::ResponseError(ResponseContent { status, content, entity }))
377 }
378}
379
380#[deprecated]
382pub async fn get_coach_layouts_layout_id(configuration: &configuration::Configuration, layout_id: &str, requestor: Option<&str>, accept_language: Option<&str>, traceparent: Option<&str>, tracestate: Option<&str>, x_accept_namespace: Option<&str>) -> Result<models::CoachLayoutResponse, Error<GetCoachLayoutsLayoutIdError>> {
383 let p_path_layout_id = layout_id;
385 let p_header_requestor = requestor;
386 let p_header_accept_language = accept_language;
387 let p_header_traceparent = traceparent;
388 let p_header_tracestate = tracestate;
389 let p_header_x_accept_namespace = x_accept_namespace;
390
391 let uri_str = format!("{}/coach-layouts/{layoutId}", configuration.base_path, layoutId=crate::apis::urlencode(p_path_layout_id));
392 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
393
394 if let Some(ref user_agent) = configuration.user_agent {
395 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
396 }
397 if let Some(param_value) = p_header_requestor {
398 req_builder = req_builder.header("Requestor", param_value.to_string());
399 }
400 if let Some(param_value) = p_header_accept_language {
401 req_builder = req_builder.header("Accept-Language", param_value.to_string());
402 }
403 if let Some(param_value) = p_header_traceparent {
404 req_builder = req_builder.header("traceparent", param_value.to_string());
405 }
406 if let Some(param_value) = p_header_tracestate {
407 req_builder = req_builder.header("tracestate", param_value.to_string());
408 }
409 if let Some(param_value) = p_header_x_accept_namespace {
410 req_builder = req_builder.header("x-accept-namespace", param_value.to_string());
411 }
412 if let Some(ref token) = configuration.oauth_access_token {
413 req_builder = req_builder.bearer_auth(token.to_owned());
414 };
415
416 let req = req_builder.build()?;
417 let resp = configuration.client.execute(req).await?;
418
419 let status = resp.status();
420 let content_type = resp
421 .headers()
422 .get("content-type")
423 .and_then(|v| v.to_str().ok())
424 .unwrap_or("application/octet-stream");
425 let content_type = super::ContentType::from(content_type);
426
427 if !status.is_client_error() && !status.is_server_error() {
428 let content = resp.text().await?;
429 match content_type {
430 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
431 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CoachLayoutResponse`"))),
432 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CoachLayoutResponse`")))),
433 }
434 } else {
435 let content = resp.text().await?;
436 let entity: Option<GetCoachLayoutsLayoutIdError> = serde_json::from_str(&content).ok();
437 Err(Error::ResponseError(ResponseContent { status, content, entity }))
438 }
439}
440
441pub async fn get_passenger_categories(configuration: &configuration::Configuration, requestor: Option<&str>, accept_language: Option<&str>, traceparent: Option<&str>, tracestate: Option<&str>) -> Result<Vec<models::PassengerCategory>, Error<GetPassengerCategoriesError>> {
443 let p_header_requestor = requestor;
445 let p_header_accept_language = accept_language;
446 let p_header_traceparent = traceparent;
447 let p_header_tracestate = tracestate;
448
449 let uri_str = format!("{}/passenger-categories", configuration.base_path);
450 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
451
452 if let Some(ref user_agent) = configuration.user_agent {
453 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
454 }
455 if let Some(param_value) = p_header_requestor {
456 req_builder = req_builder.header("Requestor", param_value.to_string());
457 }
458 if let Some(param_value) = p_header_accept_language {
459 req_builder = req_builder.header("Accept-Language", param_value.to_string());
460 }
461 if let Some(param_value) = p_header_traceparent {
462 req_builder = req_builder.header("traceparent", param_value.to_string());
463 }
464 if let Some(param_value) = p_header_tracestate {
465 req_builder = req_builder.header("tracestate", param_value.to_string());
466 }
467 if let Some(ref token) = configuration.oauth_access_token {
468 req_builder = req_builder.bearer_auth(token.to_owned());
469 };
470
471 let req = req_builder.build()?;
472 let resp = configuration.client.execute(req).await?;
473
474 let status = resp.status();
475 let content_type = resp
476 .headers()
477 .get("content-type")
478 .and_then(|v| v.to_str().ok())
479 .unwrap_or("application/octet-stream");
480 let content_type = super::ContentType::from(content_type);
481
482 if !status.is_client_error() && !status.is_server_error() {
483 let content = resp.text().await?;
484 match content_type {
485 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
486 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::PassengerCategory>`"))),
487 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::PassengerCategory>`")))),
488 }
489 } else {
490 let content = resp.text().await?;
491 let entity: Option<GetPassengerCategoriesError> = serde_json::from_str(&content).ok();
492 Err(Error::ResponseError(ResponseContent { status, content, entity }))
493 }
494}
495
496pub async fn get_places(configuration: &configuration::Configuration, requestor: Option<&str>, accept_language: Option<&str>, traceparent: Option<&str>, tracestate: Option<&str>, if_none_match: Option<&str>, x_accept_namespace: Option<&str>, page: Option<&str>) -> Result<models::PlaceResponse, Error<GetPlacesError>> {
497 let p_header_requestor = requestor;
499 let p_header_accept_language = accept_language;
500 let p_header_traceparent = traceparent;
501 let p_header_tracestate = tracestate;
502 let p_header_if_none_match = if_none_match;
503 let p_header_x_accept_namespace = x_accept_namespace;
504 let p_query_page = page;
505
506 let uri_str = format!("{}/places", configuration.base_path);
507 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
508
509 if let Some(ref param_value) = p_query_page {
510 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
511 }
512 if let Some(ref user_agent) = configuration.user_agent {
513 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
514 }
515 if let Some(param_value) = p_header_requestor {
516 req_builder = req_builder.header("Requestor", param_value.to_string());
517 }
518 if let Some(param_value) = p_header_accept_language {
519 req_builder = req_builder.header("Accept-Language", param_value.to_string());
520 }
521 if let Some(param_value) = p_header_traceparent {
522 req_builder = req_builder.header("traceparent", param_value.to_string());
523 }
524 if let Some(param_value) = p_header_tracestate {
525 req_builder = req_builder.header("tracestate", param_value.to_string());
526 }
527 if let Some(param_value) = p_header_if_none_match {
528 req_builder = req_builder.header("If-None-Match", param_value.to_string());
529 }
530 if let Some(param_value) = p_header_x_accept_namespace {
531 req_builder = req_builder.header("x-accept-namespace", param_value.to_string());
532 }
533 if let Some(ref token) = configuration.oauth_access_token {
534 req_builder = req_builder.bearer_auth(token.to_owned());
535 };
536
537 let req = req_builder.build()?;
538 let resp = configuration.client.execute(req).await?;
539
540 let status = resp.status();
541 let content_type = resp
542 .headers()
543 .get("content-type")
544 .and_then(|v| v.to_str().ok())
545 .unwrap_or("application/octet-stream");
546 let content_type = super::ContentType::from(content_type);
547
548 if !status.is_client_error() && !status.is_server_error() {
549 let content = resp.text().await?;
550 match content_type {
551 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
552 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PlaceResponse`"))),
553 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PlaceResponse`")))),
554 }
555 } else {
556 let content = resp.text().await?;
557 let entity: Option<GetPlacesError> = serde_json::from_str(&content).ok();
558 Err(Error::ResponseError(ResponseContent { status, content, entity }))
559 }
560}
561
562pub async fn get_product_tags(configuration: &configuration::Configuration, requestor: Option<&str>, accept_language: Option<&str>, traceparent: Option<&str>, tracestate: Option<&str>, x_accept_namespace: Option<&str>) -> Result<models::ProductTagsResponse, Error<GetProductTagsError>> {
563 let p_header_requestor = requestor;
565 let p_header_accept_language = accept_language;
566 let p_header_traceparent = traceparent;
567 let p_header_tracestate = tracestate;
568 let p_header_x_accept_namespace = x_accept_namespace;
569
570 let uri_str = format!("{}/product-tags", configuration.base_path);
571 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
572
573 if let Some(ref user_agent) = configuration.user_agent {
574 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
575 }
576 if let Some(param_value) = p_header_requestor {
577 req_builder = req_builder.header("Requestor", param_value.to_string());
578 }
579 if let Some(param_value) = p_header_accept_language {
580 req_builder = req_builder.header("Accept-Language", param_value.to_string());
581 }
582 if let Some(param_value) = p_header_traceparent {
583 req_builder = req_builder.header("traceparent", param_value.to_string());
584 }
585 if let Some(param_value) = p_header_tracestate {
586 req_builder = req_builder.header("tracestate", param_value.to_string());
587 }
588 if let Some(param_value) = p_header_x_accept_namespace {
589 req_builder = req_builder.header("x-accept-namespace", param_value.to_string());
590 }
591 if let Some(ref token) = configuration.oauth_access_token {
592 req_builder = req_builder.bearer_auth(token.to_owned());
593 };
594
595 let req = req_builder.build()?;
596 let resp = configuration.client.execute(req).await?;
597
598 let status = resp.status();
599 let content_type = resp
600 .headers()
601 .get("content-type")
602 .and_then(|v| v.to_str().ok())
603 .unwrap_or("application/octet-stream");
604 let content_type = super::ContentType::from(content_type);
605
606 if !status.is_client_error() && !status.is_server_error() {
607 let content = resp.text().await?;
608 match content_type {
609 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
610 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ProductTagsResponse`"))),
611 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ProductTagsResponse`")))),
612 }
613 } else {
614 let content = resp.text().await?;
615 let entity: Option<GetProductTagsError> = serde_json::from_str(&content).ok();
616 Err(Error::ResponseError(ResponseContent { status, content, entity }))
617 }
618}
619
620pub async fn get_products(configuration: &configuration::Configuration, requestor: Option<&str>, accept_language: Option<&str>, traceparent: Option<&str>, tracestate: Option<&str>, x_accept_namespace: Option<&str>, page: Option<&str>, product_code: Option<&str>, issuing_date: Option<String>, travel_date: Option<String>) -> Result<models::ProductCollectionResponse, Error<GetProductsError>> {
621 let p_header_requestor = requestor;
623 let p_header_accept_language = accept_language;
624 let p_header_traceparent = traceparent;
625 let p_header_tracestate = tracestate;
626 let p_header_x_accept_namespace = x_accept_namespace;
627 let p_query_page = page;
628 let p_query_product_code = product_code;
629 let p_query_issuing_date = issuing_date;
630 let p_query_travel_date = travel_date;
631
632 let uri_str = format!("{}/products", configuration.base_path);
633 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
634
635 if let Some(ref param_value) = p_query_page {
636 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
637 }
638 if let Some(ref param_value) = p_query_product_code {
639 req_builder = req_builder.query(&[("productCode", ¶m_value.to_string())]);
640 }
641 if let Some(ref param_value) = p_query_issuing_date {
642 req_builder = req_builder.query(&[("issuingDate", ¶m_value.to_string())]);
643 }
644 if let Some(ref param_value) = p_query_travel_date {
645 req_builder = req_builder.query(&[("travelDate", ¶m_value.to_string())]);
646 }
647 if let Some(ref user_agent) = configuration.user_agent {
648 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
649 }
650 if let Some(param_value) = p_header_requestor {
651 req_builder = req_builder.header("Requestor", param_value.to_string());
652 }
653 if let Some(param_value) = p_header_accept_language {
654 req_builder = req_builder.header("Accept-Language", param_value.to_string());
655 }
656 if let Some(param_value) = p_header_traceparent {
657 req_builder = req_builder.header("traceparent", param_value.to_string());
658 }
659 if let Some(param_value) = p_header_tracestate {
660 req_builder = req_builder.header("tracestate", param_value.to_string());
661 }
662 if let Some(param_value) = p_header_x_accept_namespace {
663 req_builder = req_builder.header("x-accept-namespace", param_value.to_string());
664 }
665 if let Some(ref token) = configuration.oauth_access_token {
666 req_builder = req_builder.bearer_auth(token.to_owned());
667 };
668
669 let req = req_builder.build()?;
670 let resp = configuration.client.execute(req).await?;
671
672 let status = resp.status();
673 let content_type = resp
674 .headers()
675 .get("content-type")
676 .and_then(|v| v.to_str().ok())
677 .unwrap_or("application/octet-stream");
678 let content_type = super::ContentType::from(content_type);
679
680 if !status.is_client_error() && !status.is_server_error() {
681 let content = resp.text().await?;
682 match content_type {
683 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
684 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ProductCollectionResponse`"))),
685 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ProductCollectionResponse`")))),
686 }
687 } else {
688 let content = resp.text().await?;
689 let entity: Option<GetProductsError> = serde_json::from_str(&content).ok();
690 Err(Error::ResponseError(ResponseContent { status, content, entity }))
691 }
692}
693
694pub async fn get_products_id(configuration: &configuration::Configuration, product_id: &str, requestor: Option<&str>, accept_language: Option<&str>, traceparent: Option<&str>, tracestate: Option<&str>, x_accept_namespace: Option<&str>) -> Result<models::ProductResponse, Error<GetProductsIdError>> {
695 let p_path_product_id = product_id;
697 let p_header_requestor = requestor;
698 let p_header_accept_language = accept_language;
699 let p_header_traceparent = traceparent;
700 let p_header_tracestate = tracestate;
701 let p_header_x_accept_namespace = x_accept_namespace;
702
703 let uri_str = format!("{}/products/{productId}", configuration.base_path, productId=crate::apis::urlencode(p_path_product_id));
704 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
705
706 if let Some(ref user_agent) = configuration.user_agent {
707 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
708 }
709 if let Some(param_value) = p_header_requestor {
710 req_builder = req_builder.header("Requestor", param_value.to_string());
711 }
712 if let Some(param_value) = p_header_accept_language {
713 req_builder = req_builder.header("Accept-Language", param_value.to_string());
714 }
715 if let Some(param_value) = p_header_traceparent {
716 req_builder = req_builder.header("traceparent", param_value.to_string());
717 }
718 if let Some(param_value) = p_header_tracestate {
719 req_builder = req_builder.header("tracestate", param_value.to_string());
720 }
721 if let Some(param_value) = p_header_x_accept_namespace {
722 req_builder = req_builder.header("x-accept-namespace", param_value.to_string());
723 }
724 if let Some(ref token) = configuration.oauth_access_token {
725 req_builder = req_builder.bearer_auth(token.to_owned());
726 };
727
728 let req = req_builder.build()?;
729 let resp = configuration.client.execute(req).await?;
730
731 let status = resp.status();
732 let content_type = resp
733 .headers()
734 .get("content-type")
735 .and_then(|v| v.to_str().ok())
736 .unwrap_or("application/octet-stream");
737 let content_type = super::ContentType::from(content_type);
738
739 if !status.is_client_error() && !status.is_server_error() {
740 let content = resp.text().await?;
741 match content_type {
742 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
743 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ProductResponse`"))),
744 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ProductResponse`")))),
745 }
746 } else {
747 let content = resp.text().await?;
748 let entity: Option<GetProductsIdError> = serde_json::from_str(&content).ok();
749 Err(Error::ResponseError(ResponseContent { status, content, entity }))
750 }
751}
752
753pub async fn get_reduction_cards(configuration: &configuration::Configuration, requestor: Option<&str>, accept_language: Option<&str>, traceparent: Option<&str>, tracestate: Option<&str>, x_accept_namespace: Option<&str>, page: Option<&str>) -> Result<models::ReductionCardCollectionResponse, Error<GetReductionCardsError>> {
755 let p_header_requestor = requestor;
757 let p_header_accept_language = accept_language;
758 let p_header_traceparent = traceparent;
759 let p_header_tracestate = tracestate;
760 let p_header_x_accept_namespace = x_accept_namespace;
761 let p_query_page = page;
762
763 let uri_str = format!("{}/reduction-cards", configuration.base_path);
764 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
765
766 if let Some(ref param_value) = p_query_page {
767 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
768 }
769 if let Some(ref user_agent) = configuration.user_agent {
770 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
771 }
772 if let Some(param_value) = p_header_requestor {
773 req_builder = req_builder.header("Requestor", param_value.to_string());
774 }
775 if let Some(param_value) = p_header_accept_language {
776 req_builder = req_builder.header("Accept-Language", param_value.to_string());
777 }
778 if let Some(param_value) = p_header_traceparent {
779 req_builder = req_builder.header("traceparent", param_value.to_string());
780 }
781 if let Some(param_value) = p_header_tracestate {
782 req_builder = req_builder.header("tracestate", param_value.to_string());
783 }
784 if let Some(param_value) = p_header_x_accept_namespace {
785 req_builder = req_builder.header("x-accept-namespace", param_value.to_string());
786 }
787 if let Some(ref token) = configuration.oauth_access_token {
788 req_builder = req_builder.bearer_auth(token.to_owned());
789 };
790
791 let req = req_builder.build()?;
792 let resp = configuration.client.execute(req).await?;
793
794 let status = resp.status();
795 let content_type = resp
796 .headers()
797 .get("content-type")
798 .and_then(|v| v.to_str().ok())
799 .unwrap_or("application/octet-stream");
800 let content_type = super::ContentType::from(content_type);
801
802 if !status.is_client_error() && !status.is_server_error() {
803 let content = resp.text().await?;
804 match content_type {
805 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
806 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReductionCardCollectionResponse`"))),
807 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ReductionCardCollectionResponse`")))),
808 }
809 } else {
810 let content = resp.text().await?;
811 let entity: Option<GetReductionCardsError> = serde_json::from_str(&content).ok();
812 Err(Error::ResponseError(ResponseContent { status, content, entity }))
813 }
814}
815
816pub async fn get_zones(configuration: &configuration::Configuration, requestor: Option<&str>, accept_language: Option<&str>, traceparent: Option<&str>, tracestate: Option<&str>, x_accept_namespace: Option<&str>, page: Option<&str>) -> Result<models::ZoneCollectionResponse, Error<GetZonesError>> {
817 let p_header_requestor = requestor;
819 let p_header_accept_language = accept_language;
820 let p_header_traceparent = traceparent;
821 let p_header_tracestate = tracestate;
822 let p_header_x_accept_namespace = x_accept_namespace;
823 let p_query_page = page;
824
825 let uri_str = format!("{}/zones", configuration.base_path);
826 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
827
828 if let Some(ref param_value) = p_query_page {
829 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
830 }
831 if let Some(ref user_agent) = configuration.user_agent {
832 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
833 }
834 if let Some(param_value) = p_header_requestor {
835 req_builder = req_builder.header("Requestor", param_value.to_string());
836 }
837 if let Some(param_value) = p_header_accept_language {
838 req_builder = req_builder.header("Accept-Language", param_value.to_string());
839 }
840 if let Some(param_value) = p_header_traceparent {
841 req_builder = req_builder.header("traceparent", param_value.to_string());
842 }
843 if let Some(param_value) = p_header_tracestate {
844 req_builder = req_builder.header("tracestate", param_value.to_string());
845 }
846 if let Some(param_value) = p_header_x_accept_namespace {
847 req_builder = req_builder.header("x-accept-namespace", param_value.to_string());
848 }
849 if let Some(ref token) = configuration.oauth_access_token {
850 req_builder = req_builder.bearer_auth(token.to_owned());
851 };
852
853 let req = req_builder.build()?;
854 let resp = configuration.client.execute(req).await?;
855
856 let status = resp.status();
857 let content_type = resp
858 .headers()
859 .get("content-type")
860 .and_then(|v| v.to_str().ok())
861 .unwrap_or("application/octet-stream");
862 let content_type = super::ContentType::from(content_type);
863
864 if !status.is_client_error() && !status.is_server_error() {
865 let content = resp.text().await?;
866 match content_type {
867 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
868 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ZoneCollectionResponse`"))),
869 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ZoneCollectionResponse`")))),
870 }
871 } else {
872 let content = resp.text().await?;
873 let entity: Option<GetZonesError> = serde_json::from_str(&content).ok();
874 Err(Error::ResponseError(ResponseContent { status, content, entity }))
875 }
876}
877