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 CancelInboundError {
22 Status400(models::awd_2024_05_09::ErrorList),
23 Status403(models::awd_2024_05_09::ErrorList),
24 Status404(models::awd_2024_05_09::ErrorList),
25 Status409(models::awd_2024_05_09::ErrorList),
26 Status413(models::awd_2024_05_09::ErrorList),
27 Status415(models::awd_2024_05_09::ErrorList),
28 Status429(models::awd_2024_05_09::ErrorList),
29 Status500(models::awd_2024_05_09::ErrorList),
30 Status503(models::awd_2024_05_09::ErrorList),
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum CheckInboundEligibilityError {
38 Status400(models::awd_2024_05_09::ErrorList),
39 Status403(models::awd_2024_05_09::ErrorList),
40 Status404(models::awd_2024_05_09::ErrorList),
41 Status413(models::awd_2024_05_09::ErrorList),
42 Status415(models::awd_2024_05_09::ErrorList),
43 Status429(models::awd_2024_05_09::ErrorList),
44 Status500(models::awd_2024_05_09::ErrorList),
45 Status503(models::awd_2024_05_09::ErrorList),
46 UnknownValue(serde_json::Value),
47}
48
49#[derive(Debug, Clone, Serialize, Deserialize)]
51#[serde(untagged)]
52pub enum ConfirmInboundError {
53 Status400(models::awd_2024_05_09::ErrorList),
54 Status403(models::awd_2024_05_09::ErrorList),
55 Status404(models::awd_2024_05_09::ErrorList),
56 Status409(models::awd_2024_05_09::ErrorList),
57 Status413(models::awd_2024_05_09::ErrorList),
58 Status415(models::awd_2024_05_09::ErrorList),
59 Status429(models::awd_2024_05_09::ErrorList),
60 Status500(models::awd_2024_05_09::ErrorList),
61 Status503(models::awd_2024_05_09::ErrorList),
62 UnknownValue(serde_json::Value),
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
67#[serde(untagged)]
68pub enum CreateInboundError {
69 Status400(models::awd_2024_05_09::ErrorList),
70 Status403(models::awd_2024_05_09::ErrorList),
71 Status404(models::awd_2024_05_09::ErrorList),
72 Status413(models::awd_2024_05_09::ErrorList),
73 Status415(models::awd_2024_05_09::ErrorList),
74 Status429(models::awd_2024_05_09::ErrorList),
75 Status500(models::awd_2024_05_09::ErrorList),
76 Status503(models::awd_2024_05_09::ErrorList),
77 UnknownValue(serde_json::Value),
78}
79
80#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum GetInboundError {
84 Status400(models::awd_2024_05_09::ErrorList),
85 Status403(models::awd_2024_05_09::ErrorList),
86 Status404(models::awd_2024_05_09::ErrorList),
87 Status413(models::awd_2024_05_09::ErrorList),
88 Status415(models::awd_2024_05_09::ErrorList),
89 Status429(models::awd_2024_05_09::ErrorList),
90 Status500(models::awd_2024_05_09::ErrorList),
91 Status503(models::awd_2024_05_09::ErrorList),
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetInboundShipmentError {
99 Status400(models::awd_2024_05_09::ErrorList),
100 Status403(models::awd_2024_05_09::ErrorList),
101 Status404(models::awd_2024_05_09::ErrorList),
102 Status413(models::awd_2024_05_09::ErrorList),
103 Status415(models::awd_2024_05_09::ErrorList),
104 Status429(models::awd_2024_05_09::ErrorList),
105 Status500(models::awd_2024_05_09::ErrorList),
106 Status503(models::awd_2024_05_09::ErrorList),
107 UnknownValue(serde_json::Value),
108}
109
110#[derive(Debug, Clone, Serialize, Deserialize)]
112#[serde(untagged)]
113pub enum GetInboundShipmentLabelsError {
114 Status400(models::awd_2024_05_09::ErrorList),
115 Status403(models::awd_2024_05_09::ErrorList),
116 Status404(models::awd_2024_05_09::ErrorList),
117 Status413(models::awd_2024_05_09::ErrorList),
118 Status415(models::awd_2024_05_09::ErrorList),
119 Status429(models::awd_2024_05_09::ErrorList),
120 Status500(models::awd_2024_05_09::ErrorList),
121 Status503(models::awd_2024_05_09::ErrorList),
122 UnknownValue(serde_json::Value),
123}
124
125#[derive(Debug, Clone, Serialize, Deserialize)]
127#[serde(untagged)]
128pub enum ListInboundShipmentsError {
129 Status400(models::awd_2024_05_09::ErrorList),
130 Status403(models::awd_2024_05_09::ErrorList),
131 Status404(models::awd_2024_05_09::ErrorList),
132 Status413(models::awd_2024_05_09::ErrorList),
133 Status415(models::awd_2024_05_09::ErrorList),
134 Status429(models::awd_2024_05_09::ErrorList),
135 Status500(models::awd_2024_05_09::ErrorList),
136 Status503(models::awd_2024_05_09::ErrorList),
137 UnknownValue(serde_json::Value),
138}
139
140#[derive(Debug, Clone, Serialize, Deserialize)]
142#[serde(untagged)]
143pub enum ListInventoryError {
144 Status400(models::awd_2024_05_09::ErrorList),
145 Status403(models::awd_2024_05_09::ErrorList),
146 Status404(models::awd_2024_05_09::ErrorList),
147 Status413(models::awd_2024_05_09::ErrorList),
148 Status415(models::awd_2024_05_09::ErrorList),
149 Status429(models::awd_2024_05_09::ErrorList),
150 Status500(models::awd_2024_05_09::ErrorList),
151 Status503(models::awd_2024_05_09::ErrorList),
152 UnknownValue(serde_json::Value),
153}
154
155#[derive(Debug, Clone, Serialize, Deserialize)]
157#[serde(untagged)]
158pub enum UpdateInboundError {
159 Status400(models::awd_2024_05_09::ErrorList),
160 Status403(models::awd_2024_05_09::ErrorList),
161 Status404(models::awd_2024_05_09::ErrorList),
162 Status409(models::awd_2024_05_09::ErrorList),
163 Status413(models::awd_2024_05_09::ErrorList),
164 Status415(models::awd_2024_05_09::ErrorList),
165 Status429(models::awd_2024_05_09::ErrorList),
166 Status500(models::awd_2024_05_09::ErrorList),
167 Status503(models::awd_2024_05_09::ErrorList),
168 UnknownValue(serde_json::Value),
169}
170
171#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum UpdateInboundShipmentTransportDetailsError {
175 Status400(models::awd_2024_05_09::ErrorList),
176 Status403(models::awd_2024_05_09::ErrorList),
177 Status404(models::awd_2024_05_09::ErrorList),
178 Status413(models::awd_2024_05_09::ErrorList),
179 Status415(models::awd_2024_05_09::ErrorList),
180 Status429(models::awd_2024_05_09::ErrorList),
181 Status500(models::awd_2024_05_09::ErrorList),
182 Status503(models::awd_2024_05_09::ErrorList),
183 UnknownValue(serde_json::Value),
184}
185
186
187pub async fn cancel_inbound(configuration: &configuration::Configuration, order_id: &str) -> Result<(), Error<CancelInboundError>> {
189 let p_order_id = order_id;
191
192 let uri_str = format!("{}/awd/2024-05-09/inboundOrders/{orderId}/cancellation", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
193 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
194
195 if let Some(ref user_agent) = configuration.user_agent {
196 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
197 }
198
199 let req = req_builder.build()?;
200 let resp = configuration.client.execute(req).await?;
201
202 let status = resp.status();
203
204 if !status.is_client_error() && !status.is_server_error() {
205 Ok(())
206 } else {
207 let content = resp.text().await?;
208 let entity: Option<CancelInboundError> = serde_json::from_str(&content).ok();
209 Err(Error::ResponseError(ResponseContent { status, content, entity }))
210 }
211}
212
213pub async fn check_inbound_eligibility(configuration: &configuration::Configuration, body: models::awd_2024_05_09::InboundPackages) -> Result<models::awd_2024_05_09::InboundEligibility, Error<CheckInboundEligibilityError>> {
215 let p_body = body;
217
218 let uri_str = format!("{}/awd/2024-05-09/inboundEligibility", configuration.base_path);
219 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
220
221 if let Some(ref user_agent) = configuration.user_agent {
222 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
223 }
224 req_builder = req_builder.json(&p_body);
225
226 let req = req_builder.build()?;
227 let resp = configuration.client.execute(req).await?;
228
229 let status = resp.status();
230 let content_type = resp
231 .headers()
232 .get("content-type")
233 .and_then(|v| v.to_str().ok())
234 .unwrap_or("application/octet-stream");
235 let content_type = super::ContentType::from(content_type);
236
237 if !status.is_client_error() && !status.is_server_error() {
238 let content = resp.text().await?;
239 match content_type {
240 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
241 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::awd_2024_05_09::InboundEligibility`"))),
242 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::awd_2024_05_09::InboundEligibility`")))),
243 }
244 } else {
245 let content = resp.text().await?;
246 let entity: Option<CheckInboundEligibilityError> = serde_json::from_str(&content).ok();
247 Err(Error::ResponseError(ResponseContent { status, content, entity }))
248 }
249}
250
251pub async fn confirm_inbound(configuration: &configuration::Configuration, order_id: &str) -> Result<(), Error<ConfirmInboundError>> {
253 let p_order_id = order_id;
255
256 let uri_str = format!("{}/awd/2024-05-09/inboundOrders/{orderId}/confirmation", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
257 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
258
259 if let Some(ref user_agent) = configuration.user_agent {
260 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
261 }
262
263 let req = req_builder.build()?;
264 let resp = configuration.client.execute(req).await?;
265
266 let status = resp.status();
267
268 if !status.is_client_error() && !status.is_server_error() {
269 Ok(())
270 } else {
271 let content = resp.text().await?;
272 let entity: Option<ConfirmInboundError> = serde_json::from_str(&content).ok();
273 Err(Error::ResponseError(ResponseContent { status, content, entity }))
274 }
275}
276
277pub async fn create_inbound(configuration: &configuration::Configuration, body: models::awd_2024_05_09::InboundOrderCreationData) -> Result<models::awd_2024_05_09::InboundOrderReference, Error<CreateInboundError>> {
279 let p_body = body;
281
282 let uri_str = format!("{}/awd/2024-05-09/inboundOrders", configuration.base_path);
283 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
284
285 if let Some(ref user_agent) = configuration.user_agent {
286 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
287 }
288 req_builder = req_builder.json(&p_body);
289
290 let req = req_builder.build()?;
291 let resp = configuration.client.execute(req).await?;
292
293 let status = resp.status();
294 let content_type = resp
295 .headers()
296 .get("content-type")
297 .and_then(|v| v.to_str().ok())
298 .unwrap_or("application/octet-stream");
299 let content_type = super::ContentType::from(content_type);
300
301 if !status.is_client_error() && !status.is_server_error() {
302 let content = resp.text().await?;
303 match content_type {
304 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
305 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::awd_2024_05_09::InboundOrderReference`"))),
306 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::awd_2024_05_09::InboundOrderReference`")))),
307 }
308 } else {
309 let content = resp.text().await?;
310 let entity: Option<CreateInboundError> = serde_json::from_str(&content).ok();
311 Err(Error::ResponseError(ResponseContent { status, content, entity }))
312 }
313}
314
315pub async fn get_inbound(configuration: &configuration::Configuration, order_id: &str) -> Result<models::awd_2024_05_09::InboundOrder, Error<GetInboundError>> {
317 let p_order_id = order_id;
319
320 let uri_str = format!("{}/awd/2024-05-09/inboundOrders/{orderId}", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
321 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
322
323 if let Some(ref user_agent) = configuration.user_agent {
324 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
325 }
326
327 let req = req_builder.build()?;
328 let resp = configuration.client.execute(req).await?;
329
330 let status = resp.status();
331 let content_type = resp
332 .headers()
333 .get("content-type")
334 .and_then(|v| v.to_str().ok())
335 .unwrap_or("application/octet-stream");
336 let content_type = super::ContentType::from(content_type);
337
338 if !status.is_client_error() && !status.is_server_error() {
339 let content = resp.text().await?;
340 match content_type {
341 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
342 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::awd_2024_05_09::InboundOrder`"))),
343 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::awd_2024_05_09::InboundOrder`")))),
344 }
345 } else {
346 let content = resp.text().await?;
347 let entity: Option<GetInboundError> = serde_json::from_str(&content).ok();
348 Err(Error::ResponseError(ResponseContent { status, content, entity }))
349 }
350}
351
352pub async fn get_inbound_shipment(configuration: &configuration::Configuration, shipment_id: &str, sku_quantities: Option<&str>) -> Result<models::awd_2024_05_09::InboundShipment, Error<GetInboundShipmentError>> {
354 let p_shipment_id = shipment_id;
356 let p_sku_quantities = sku_quantities;
357
358 let uri_str = format!("{}/awd/2024-05-09/inboundShipments/{shipmentId}", configuration.base_path, shipmentId=crate::apis::urlencode(p_shipment_id));
359 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
360
361 if let Some(ref param_value) = p_sku_quantities {
362 req_builder = req_builder.query(&[("skuQuantities", ¶m_value.to_string())]);
363 }
364 if let Some(ref user_agent) = configuration.user_agent {
365 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
366 }
367
368 let req = req_builder.build()?;
369 let resp = configuration.client.execute(req).await?;
370
371 let status = resp.status();
372 let content_type = resp
373 .headers()
374 .get("content-type")
375 .and_then(|v| v.to_str().ok())
376 .unwrap_or("application/octet-stream");
377 let content_type = super::ContentType::from(content_type);
378
379 if !status.is_client_error() && !status.is_server_error() {
380 let content = resp.text().await?;
381 match content_type {
382 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
383 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::awd_2024_05_09::InboundShipment`"))),
384 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::awd_2024_05_09::InboundShipment`")))),
385 }
386 } else {
387 let content = resp.text().await?;
388 let entity: Option<GetInboundShipmentError> = serde_json::from_str(&content).ok();
389 Err(Error::ResponseError(ResponseContent { status, content, entity }))
390 }
391}
392
393pub async fn get_inbound_shipment_labels(configuration: &configuration::Configuration, shipment_id: &str, page_type: Option<&str>, format_type: Option<&str>) -> Result<models::awd_2024_05_09::ShipmentLabels, Error<GetInboundShipmentLabelsError>> {
395 let p_shipment_id = shipment_id;
397 let p_page_type = page_type;
398 let p_format_type = format_type;
399
400 let uri_str = format!("{}/awd/2024-05-09/inboundShipments/{shipmentId}/labels", configuration.base_path, shipmentId=crate::apis::urlencode(p_shipment_id));
401 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
402
403 if let Some(ref param_value) = p_page_type {
404 req_builder = req_builder.query(&[("pageType", ¶m_value.to_string())]);
405 }
406 if let Some(ref param_value) = p_format_type {
407 req_builder = req_builder.query(&[("formatType", ¶m_value.to_string())]);
408 }
409 if let Some(ref user_agent) = configuration.user_agent {
410 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
411 }
412
413 let req = req_builder.build()?;
414 let resp = configuration.client.execute(req).await?;
415
416 let status = resp.status();
417 let content_type = resp
418 .headers()
419 .get("content-type")
420 .and_then(|v| v.to_str().ok())
421 .unwrap_or("application/octet-stream");
422 let content_type = super::ContentType::from(content_type);
423
424 if !status.is_client_error() && !status.is_server_error() {
425 let content = resp.text().await?;
426 match content_type {
427 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
428 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::awd_2024_05_09::ShipmentLabels`"))),
429 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::awd_2024_05_09::ShipmentLabels`")))),
430 }
431 } else {
432 let content = resp.text().await?;
433 let entity: Option<GetInboundShipmentLabelsError> = serde_json::from_str(&content).ok();
434 Err(Error::ResponseError(ResponseContent { status, content, entity }))
435 }
436}
437
438pub async fn list_inbound_shipments(configuration: &configuration::Configuration, sort_by: Option<&str>, sort_order: Option<&str>, shipment_status: Option<&str>, updated_after: Option<String>, updated_before: Option<String>, max_results: Option<i32>, next_token: Option<&str>) -> Result<models::awd_2024_05_09::ShipmentListing, Error<ListInboundShipmentsError>> {
440 let p_sort_by = sort_by;
442 let p_sort_order = sort_order;
443 let p_shipment_status = shipment_status;
444 let p_updated_after = updated_after;
445 let p_updated_before = updated_before;
446 let p_max_results = max_results;
447 let p_next_token = next_token;
448
449 let uri_str = format!("{}/awd/2024-05-09/inboundShipments", configuration.base_path);
450 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
451
452 if let Some(ref param_value) = p_sort_by {
453 req_builder = req_builder.query(&[("sortBy", ¶m_value.to_string())]);
454 }
455 if let Some(ref param_value) = p_sort_order {
456 req_builder = req_builder.query(&[("sortOrder", ¶m_value.to_string())]);
457 }
458 if let Some(ref param_value) = p_shipment_status {
459 req_builder = req_builder.query(&[("shipmentStatus", ¶m_value.to_string())]);
460 }
461 if let Some(ref param_value) = p_updated_after {
462 req_builder = req_builder.query(&[("updatedAfter", ¶m_value.to_string())]);
463 }
464 if let Some(ref param_value) = p_updated_before {
465 req_builder = req_builder.query(&[("updatedBefore", ¶m_value.to_string())]);
466 }
467 if let Some(ref param_value) = p_max_results {
468 req_builder = req_builder.query(&[("maxResults", ¶m_value.to_string())]);
469 }
470 if let Some(ref param_value) = p_next_token {
471 req_builder = req_builder.query(&[("nextToken", ¶m_value.to_string())]);
472 }
473 if let Some(ref user_agent) = configuration.user_agent {
474 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
475 }
476
477 let req = req_builder.build()?;
478 let resp = configuration.client.execute(req).await?;
479
480 let status = resp.status();
481 let content_type = resp
482 .headers()
483 .get("content-type")
484 .and_then(|v| v.to_str().ok())
485 .unwrap_or("application/octet-stream");
486 let content_type = super::ContentType::from(content_type);
487
488 if !status.is_client_error() && !status.is_server_error() {
489 let content = resp.text().await?;
490 match content_type {
491 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
492 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::awd_2024_05_09::ShipmentListing`"))),
493 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::awd_2024_05_09::ShipmentListing`")))),
494 }
495 } else {
496 let content = resp.text().await?;
497 let entity: Option<ListInboundShipmentsError> = serde_json::from_str(&content).ok();
498 Err(Error::ResponseError(ResponseContent { status, content, entity }))
499 }
500}
501
502pub async fn list_inventory(configuration: &configuration::Configuration, sku: Option<&str>, sort_order: Option<&str>, details: Option<&str>, next_token: Option<&str>, max_results: Option<i32>) -> Result<models::awd_2024_05_09::InventoryListing, Error<ListInventoryError>> {
504 let p_sku = sku;
506 let p_sort_order = sort_order;
507 let p_details = details;
508 let p_next_token = next_token;
509 let p_max_results = max_results;
510
511 let uri_str = format!("{}/awd/2024-05-09/inventory", configuration.base_path);
512 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
513
514 if let Some(ref param_value) = p_sku {
515 req_builder = req_builder.query(&[("sku", ¶m_value.to_string())]);
516 }
517 if let Some(ref param_value) = p_sort_order {
518 req_builder = req_builder.query(&[("sortOrder", ¶m_value.to_string())]);
519 }
520 if let Some(ref param_value) = p_details {
521 req_builder = req_builder.query(&[("details", ¶m_value.to_string())]);
522 }
523 if let Some(ref param_value) = p_next_token {
524 req_builder = req_builder.query(&[("nextToken", ¶m_value.to_string())]);
525 }
526 if let Some(ref param_value) = p_max_results {
527 req_builder = req_builder.query(&[("maxResults", ¶m_value.to_string())]);
528 }
529 if let Some(ref user_agent) = configuration.user_agent {
530 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
531 }
532
533 let req = req_builder.build()?;
534 let resp = configuration.client.execute(req).await?;
535
536 let status = resp.status();
537 let content_type = resp
538 .headers()
539 .get("content-type")
540 .and_then(|v| v.to_str().ok())
541 .unwrap_or("application/octet-stream");
542 let content_type = super::ContentType::from(content_type);
543
544 if !status.is_client_error() && !status.is_server_error() {
545 let content = resp.text().await?;
546 match content_type {
547 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
548 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::awd_2024_05_09::InventoryListing`"))),
549 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::awd_2024_05_09::InventoryListing`")))),
550 }
551 } else {
552 let content = resp.text().await?;
553 let entity: Option<ListInventoryError> = serde_json::from_str(&content).ok();
554 Err(Error::ResponseError(ResponseContent { status, content, entity }))
555 }
556}
557
558pub async fn update_inbound(configuration: &configuration::Configuration, order_id: &str, body: models::awd_2024_05_09::InboundOrder) -> Result<(), Error<UpdateInboundError>> {
560 let p_order_id = order_id;
562 let p_body = body;
563
564 let uri_str = format!("{}/awd/2024-05-09/inboundOrders/{orderId}", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
565 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
566
567 if let Some(ref user_agent) = configuration.user_agent {
568 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
569 }
570 req_builder = req_builder.json(&p_body);
571
572 let req = req_builder.build()?;
573 let resp = configuration.client.execute(req).await?;
574
575 let status = resp.status();
576
577 if !status.is_client_error() && !status.is_server_error() {
578 Ok(())
579 } else {
580 let content = resp.text().await?;
581 let entity: Option<UpdateInboundError> = serde_json::from_str(&content).ok();
582 Err(Error::ResponseError(ResponseContent { status, content, entity }))
583 }
584}
585
586pub async fn update_inbound_shipment_transport_details(configuration: &configuration::Configuration, shipment_id: &str, body: models::awd_2024_05_09::TransportationDetails) -> Result<(), Error<UpdateInboundShipmentTransportDetailsError>> {
588 let p_shipment_id = shipment_id;
590 let p_body = body;
591
592 let uri_str = format!("{}/awd/2024-05-09/inboundShipments/{shipmentId}/transport", configuration.base_path, shipmentId=crate::apis::urlencode(p_shipment_id));
593 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
594
595 if let Some(ref user_agent) = configuration.user_agent {
596 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
597 }
598 req_builder = req_builder.json(&p_body);
599
600 let req = req_builder.build()?;
601 let resp = configuration.client.execute(req).await?;
602
603 let status = resp.status();
604
605 if !status.is_client_error() && !status.is_server_error() {
606 Ok(())
607 } else {
608 let content = resp.text().await?;
609 let entity: Option<UpdateInboundShipmentTransportDetailsError> = serde_json::from_str(&content).ok();
610 Err(Error::ResponseError(ResponseContent { status, content, entity }))
611 }
612}
613