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 ConfirmShipmentError {
22 Status400(models::orders_v0::ConfirmShipmentErrorResponse),
23 Status401(models::orders_v0::ConfirmShipmentErrorResponse),
24 Status403(models::orders_v0::ConfirmShipmentErrorResponse),
25 Status404(models::orders_v0::ConfirmShipmentErrorResponse),
26 Status429(models::orders_v0::ConfirmShipmentErrorResponse),
27 Status500(models::orders_v0::ConfirmShipmentErrorResponse),
28 Status503(models::orders_v0::ConfirmShipmentErrorResponse),
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetOrderError {
36 Status400(models::orders_v0::GetOrderResponse),
37 Status403(models::orders_v0::GetOrderResponse),
38 Status404(models::orders_v0::GetOrderResponse),
39 Status429(models::orders_v0::GetOrderResponse),
40 Status500(models::orders_v0::GetOrderResponse),
41 Status503(models::orders_v0::GetOrderResponse),
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum GetOrderAddressError {
49 Status400(models::orders_v0::GetOrderAddressResponse),
50 Status403(models::orders_v0::GetOrderAddressResponse),
51 Status404(models::orders_v0::GetOrderAddressResponse),
52 Status429(models::orders_v0::GetOrderAddressResponse),
53 Status500(models::orders_v0::GetOrderAddressResponse),
54 Status503(models::orders_v0::GetOrderAddressResponse),
55 UnknownValue(serde_json::Value),
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum GetOrderBuyerInfoError {
62 Status400(models::orders_v0::GetOrderBuyerInfoResponse),
63 Status403(models::orders_v0::GetOrderBuyerInfoResponse),
64 Status404(models::orders_v0::GetOrderBuyerInfoResponse),
65 Status429(models::orders_v0::GetOrderBuyerInfoResponse),
66 Status500(models::orders_v0::GetOrderBuyerInfoResponse),
67 Status503(models::orders_v0::GetOrderBuyerInfoResponse),
68 UnknownValue(serde_json::Value),
69}
70
71#[derive(Debug, Clone, Serialize, Deserialize)]
73#[serde(untagged)]
74pub enum GetOrderItemsError {
75 Status400(models::orders_v0::GetOrderItemsResponse),
76 Status403(models::orders_v0::GetOrderItemsResponse),
77 Status404(models::orders_v0::GetOrderItemsResponse),
78 Status429(models::orders_v0::GetOrderItemsResponse),
79 Status500(models::orders_v0::GetOrderItemsResponse),
80 Status503(models::orders_v0::GetOrderItemsResponse),
81 UnknownValue(serde_json::Value),
82}
83
84#[derive(Debug, Clone, Serialize, Deserialize)]
86#[serde(untagged)]
87pub enum GetOrderItemsBuyerInfoError {
88 Status400(models::orders_v0::GetOrderItemsBuyerInfoResponse),
89 Status403(models::orders_v0::GetOrderItemsBuyerInfoResponse),
90 Status404(models::orders_v0::GetOrderItemsBuyerInfoResponse),
91 Status429(models::orders_v0::GetOrderItemsBuyerInfoResponse),
92 Status500(models::orders_v0::GetOrderItemsBuyerInfoResponse),
93 Status503(models::orders_v0::GetOrderItemsBuyerInfoResponse),
94 UnknownValue(serde_json::Value),
95}
96
97#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum GetOrderRegulatedInfoError {
101 Status400(models::orders_v0::GetOrderRegulatedInfoResponse),
102 Status403(models::orders_v0::GetOrderRegulatedInfoResponse),
103 Status404(models::orders_v0::GetOrderRegulatedInfoResponse),
104 Status429(models::orders_v0::GetOrderRegulatedInfoResponse),
105 Status500(models::orders_v0::GetOrderRegulatedInfoResponse),
106 Status503(models::orders_v0::GetOrderRegulatedInfoResponse),
107 UnknownValue(serde_json::Value),
108}
109
110#[derive(Debug, Clone, Serialize, Deserialize)]
112#[serde(untagged)]
113pub enum GetOrdersError {
114 Status400(models::orders_v0::GetOrdersResponse),
115 Status403(models::orders_v0::GetOrdersResponse),
116 Status404(models::orders_v0::GetOrdersResponse),
117 Status429(models::orders_v0::GetOrdersResponse),
118 Status500(models::orders_v0::GetOrdersResponse),
119 Status503(models::orders_v0::GetOrdersResponse),
120 UnknownValue(serde_json::Value),
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum UpdateVerificationStatusError {
127 Status400(models::orders_v0::UpdateVerificationStatusErrorResponse),
128 Status403(models::orders_v0::UpdateVerificationStatusErrorResponse),
129 Status404(models::orders_v0::UpdateVerificationStatusErrorResponse),
130 Status413(models::orders_v0::UpdateVerificationStatusErrorResponse),
131 Status415(models::orders_v0::UpdateVerificationStatusErrorResponse),
132 Status429(models::orders_v0::UpdateVerificationStatusErrorResponse),
133 Status500(models::orders_v0::UpdateVerificationStatusErrorResponse),
134 Status503(models::orders_v0::UpdateVerificationStatusErrorResponse),
135 UnknownValue(serde_json::Value),
136}
137
138#[derive(Debug, Clone, Serialize, Deserialize)]
140#[serde(untagged)]
141pub enum UpdateShipmentStatusError {
142 Status400(models::orders_v0::UpdateShipmentStatusErrorResponse),
143 Status403(models::orders_v0::UpdateShipmentStatusErrorResponse),
144 Status404(models::orders_v0::UpdateShipmentStatusErrorResponse),
145 Status413(models::orders_v0::UpdateShipmentStatusErrorResponse),
146 Status415(models::orders_v0::UpdateShipmentStatusErrorResponse),
147 Status429(models::orders_v0::UpdateShipmentStatusErrorResponse),
148 Status500(models::orders_v0::UpdateShipmentStatusErrorResponse),
149 Status503(models::orders_v0::UpdateShipmentStatusErrorResponse),
150 UnknownValue(serde_json::Value),
151}
152
153pub async fn confirm_shipment(configuration: &configuration::Configuration, order_id: &str, payload: models::orders_v0::ConfirmShipmentRequest) -> Result<(), Error<ConfirmShipmentError>> {
155 let p_order_id = order_id;
157 let p_payload = payload;
158
159 let uri_str = format!("{}/orders/v0/orders/{orderId}/shipmentConfirmation", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
160 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
161
162 if let Some(ref user_agent) = configuration.user_agent {
163 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
164 }
165 req_builder = req_builder.json(&p_payload);
166
167 let req = req_builder.build()?;
168 let resp = configuration.client.execute(req).await?;
169
170 let status = resp.status();
171
172 if !status.is_client_error() && !status.is_server_error() {
173 Ok(())
174 } else {
175 let content = resp.text().await?;
176 let entity: Option<ConfirmShipmentError> = serde_json::from_str(&content).ok();
177 Err(Error::ResponseError(ResponseContent { status, content, entity }))
178 }
179}
180
181pub async fn get_order(configuration: &configuration::Configuration, order_id: &str) -> Result<models::orders_v0::GetOrderResponse, Error<GetOrderError>> {
183 let p_order_id = order_id;
185
186 let uri_str = format!("{}/orders/v0/orders/{orderId}", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
187 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
188
189 if let Some(ref user_agent) = configuration.user_agent {
190 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
191 }
192
193 let req = req_builder.build()?;
194 let resp = configuration.client.execute(req).await?;
195
196 let status = resp.status();
197 let content_type = resp
198 .headers()
199 .get("content-type")
200 .and_then(|v| v.to_str().ok())
201 .unwrap_or("application/octet-stream");
202 let content_type = super::ContentType::from(content_type);
203
204 if !status.is_client_error() && !status.is_server_error() {
205 let content = resp.text().await?;
206 match content_type {
207 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
208 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::orders_v0::GetOrderResponse`"))),
209 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::orders_v0::GetOrderResponse`")))),
210 }
211 } else {
212 let content = resp.text().await?;
213 let entity: Option<GetOrderError> = serde_json::from_str(&content).ok();
214 Err(Error::ResponseError(ResponseContent { status, content, entity }))
215 }
216}
217
218pub async fn get_order_address(configuration: &configuration::Configuration, order_id: &str) -> Result<models::orders_v0::GetOrderAddressResponse, Error<GetOrderAddressError>> {
220 let p_order_id = order_id;
222
223 let uri_str = format!("{}/orders/v0/orders/{orderId}/address", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
224 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
225
226 if let Some(ref user_agent) = configuration.user_agent {
227 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
228 }
229
230 let req = req_builder.build()?;
231 let resp = configuration.client.execute(req).await?;
232
233 let status = resp.status();
234 let content_type = resp
235 .headers()
236 .get("content-type")
237 .and_then(|v| v.to_str().ok())
238 .unwrap_or("application/octet-stream");
239 let content_type = super::ContentType::from(content_type);
240
241 if !status.is_client_error() && !status.is_server_error() {
242 let content = resp.text().await?;
243 match content_type {
244 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
245 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::orders_v0::GetOrderAddressResponse`"))),
246 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::orders_v0::GetOrderAddressResponse`")))),
247 }
248 } else {
249 let content = resp.text().await?;
250 let entity: Option<GetOrderAddressError> = serde_json::from_str(&content).ok();
251 Err(Error::ResponseError(ResponseContent { status, content, entity }))
252 }
253}
254
255pub async fn get_order_buyer_info(configuration: &configuration::Configuration, order_id: &str) -> Result<models::orders_v0::GetOrderBuyerInfoResponse, Error<GetOrderBuyerInfoError>> {
257 let p_order_id = order_id;
259
260 let uri_str = format!("{}/orders/v0/orders/{orderId}/buyerInfo", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
261 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
262
263 if let Some(ref user_agent) = configuration.user_agent {
264 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
265 }
266
267 let req = req_builder.build()?;
268 let resp = configuration.client.execute(req).await?;
269
270 let status = resp.status();
271 let content_type = resp
272 .headers()
273 .get("content-type")
274 .and_then(|v| v.to_str().ok())
275 .unwrap_or("application/octet-stream");
276 let content_type = super::ContentType::from(content_type);
277
278 if !status.is_client_error() && !status.is_server_error() {
279 let content = resp.text().await?;
280 match content_type {
281 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
282 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::orders_v0::GetOrderBuyerInfoResponse`"))),
283 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::orders_v0::GetOrderBuyerInfoResponse`")))),
284 }
285 } else {
286 let content = resp.text().await?;
287 let entity: Option<GetOrderBuyerInfoError> = serde_json::from_str(&content).ok();
288 Err(Error::ResponseError(ResponseContent { status, content, entity }))
289 }
290}
291
292pub async fn get_order_items(configuration: &configuration::Configuration, order_id: &str, next_token: Option<&str>) -> Result<models::orders_v0::GetOrderItemsResponse, Error<GetOrderItemsError>> {
294 let p_order_id = order_id;
296 let p_next_token = next_token;
297
298 let uri_str = format!("{}/orders/v0/orders/{orderId}/orderItems", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
299 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
300
301 if let Some(ref param_value) = p_next_token {
302 req_builder = req_builder.query(&[("NextToken", ¶m_value.to_string())]);
303 }
304 if let Some(ref user_agent) = configuration.user_agent {
305 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
306 }
307
308 let req = req_builder.build()?;
309 let resp = configuration.client.execute(req).await?;
310
311 let status = resp.status();
312 let content_type = resp
313 .headers()
314 .get("content-type")
315 .and_then(|v| v.to_str().ok())
316 .unwrap_or("application/octet-stream");
317 let content_type = super::ContentType::from(content_type);
318
319 if !status.is_client_error() && !status.is_server_error() {
320 let content = resp.text().await?;
321 match content_type {
322 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
323 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::orders_v0::GetOrderItemsResponse`"))),
324 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::orders_v0::GetOrderItemsResponse`")))),
325 }
326 } else {
327 let content = resp.text().await?;
328 let entity: Option<GetOrderItemsError> = serde_json::from_str(&content).ok();
329 Err(Error::ResponseError(ResponseContent { status, content, entity }))
330 }
331}
332
333pub async fn get_order_items_buyer_info(configuration: &configuration::Configuration, order_id: &str, next_token: Option<&str>) -> Result<models::orders_v0::GetOrderItemsBuyerInfoResponse, Error<GetOrderItemsBuyerInfoError>> {
335 let p_order_id = order_id;
337 let p_next_token = next_token;
338
339 let uri_str = format!("{}/orders/v0/orders/{orderId}/orderItems/buyerInfo", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
340 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
341
342 if let Some(ref param_value) = p_next_token {
343 req_builder = req_builder.query(&[("NextToken", ¶m_value.to_string())]);
344 }
345 if let Some(ref user_agent) = configuration.user_agent {
346 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
347 }
348
349 let req = req_builder.build()?;
350 let resp = configuration.client.execute(req).await?;
351
352 let status = resp.status();
353 let content_type = resp
354 .headers()
355 .get("content-type")
356 .and_then(|v| v.to_str().ok())
357 .unwrap_or("application/octet-stream");
358 let content_type = super::ContentType::from(content_type);
359
360 if !status.is_client_error() && !status.is_server_error() {
361 let content = resp.text().await?;
362 match content_type {
363 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
364 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::orders_v0::GetOrderItemsBuyerInfoResponse`"))),
365 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::orders_v0::GetOrderItemsBuyerInfoResponse`")))),
366 }
367 } else {
368 let content = resp.text().await?;
369 let entity: Option<GetOrderItemsBuyerInfoError> = serde_json::from_str(&content).ok();
370 Err(Error::ResponseError(ResponseContent { status, content, entity }))
371 }
372}
373
374pub async fn get_order_regulated_info(configuration: &configuration::Configuration, order_id: &str) -> Result<models::orders_v0::GetOrderRegulatedInfoResponse, Error<GetOrderRegulatedInfoError>> {
376 let p_order_id = order_id;
378
379 let uri_str = format!("{}/orders/v0/orders/{orderId}/regulatedInfo", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
380 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
381
382 if let Some(ref user_agent) = configuration.user_agent {
383 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
384 }
385
386 let req = req_builder.build()?;
387 let resp = configuration.client.execute(req).await?;
388
389 let status = resp.status();
390 let content_type = resp
391 .headers()
392 .get("content-type")
393 .and_then(|v| v.to_str().ok())
394 .unwrap_or("application/octet-stream");
395 let content_type = super::ContentType::from(content_type);
396
397 if !status.is_client_error() && !status.is_server_error() {
398 let content = resp.text().await?;
399 match content_type {
400 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
401 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::orders_v0::GetOrderRegulatedInfoResponse`"))),
402 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::orders_v0::GetOrderRegulatedInfoResponse`")))),
403 }
404 } else {
405 let content = resp.text().await?;
406 let entity: Option<GetOrderRegulatedInfoError> = serde_json::from_str(&content).ok();
407 Err(Error::ResponseError(ResponseContent { status, content, entity }))
408 }
409}
410
411pub async fn get_orders(configuration: &configuration::Configuration, marketplace_ids: Vec<String>, created_after: Option<&str>, created_before: Option<&str>, last_updated_after: Option<&str>, last_updated_before: Option<&str>, order_statuses: Option<Vec<String>>, fulfillment_channels: Option<Vec<String>>, payment_methods: Option<Vec<String>>, buyer_email: Option<&str>, seller_order_id: Option<&str>, max_results_per_page: Option<i32>, easy_ship_shipment_statuses: Option<Vec<String>>, electronic_invoice_statuses: Option<Vec<String>>, next_token: Option<&str>, amazon_order_ids: Option<Vec<String>>, actual_fulfillment_supply_source_id: Option<&str>, is_ispu: Option<bool>, store_chain_store_id: Option<&str>, earliest_delivery_date_before: Option<&str>, earliest_delivery_date_after: Option<&str>, latest_delivery_date_before: Option<&str>, latest_delivery_date_after: Option<&str>) -> Result<models::orders_v0::GetOrdersResponse, Error<GetOrdersError>> {
413 let p_marketplace_ids = marketplace_ids;
415 let p_created_after = created_after;
416 let p_created_before = created_before;
417 let p_last_updated_after = last_updated_after;
418 let p_last_updated_before = last_updated_before;
419 let p_order_statuses = order_statuses;
420 let p_fulfillment_channels = fulfillment_channels;
421 let p_payment_methods = payment_methods;
422 let p_buyer_email = buyer_email;
423 let p_seller_order_id = seller_order_id;
424 let p_max_results_per_page = max_results_per_page;
425 let p_easy_ship_shipment_statuses = easy_ship_shipment_statuses;
426 let p_electronic_invoice_statuses = electronic_invoice_statuses;
427 let p_next_token = next_token;
428 let p_amazon_order_ids = amazon_order_ids;
429 let p_actual_fulfillment_supply_source_id = actual_fulfillment_supply_source_id;
430 let p_is_ispu = is_ispu;
431 let p_store_chain_store_id = store_chain_store_id;
432 let p_earliest_delivery_date_before = earliest_delivery_date_before;
433 let p_earliest_delivery_date_after = earliest_delivery_date_after;
434 let p_latest_delivery_date_before = latest_delivery_date_before;
435 let p_latest_delivery_date_after = latest_delivery_date_after;
436
437 let uri_str = format!("{}/orders/v0/orders", configuration.base_path);
438 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
439
440 if let Some(ref param_value) = p_created_after {
441 req_builder = req_builder.query(&[("CreatedAfter", ¶m_value.to_string())]);
442 }
443 if let Some(ref param_value) = p_created_before {
444 req_builder = req_builder.query(&[("CreatedBefore", ¶m_value.to_string())]);
445 }
446 if let Some(ref param_value) = p_last_updated_after {
447 req_builder = req_builder.query(&[("LastUpdatedAfter", ¶m_value.to_string())]);
448 }
449 if let Some(ref param_value) = p_last_updated_before {
450 req_builder = req_builder.query(&[("LastUpdatedBefore", ¶m_value.to_string())]);
451 }
452 if let Some(ref param_value) = p_order_statuses {
453 req_builder = match "csv" {
454 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("OrderStatuses".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
455 _ => req_builder.query(&[("OrderStatuses", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
456 };
457 }
458 req_builder = match "csv" {
459 "multi" => req_builder.query(&p_marketplace_ids.into_iter().map(|p| ("MarketplaceIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
460 _ => req_builder.query(&[("MarketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
461 };
462 if let Some(ref param_value) = p_fulfillment_channels {
463 req_builder = match "csv" {
464 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("FulfillmentChannels".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
465 _ => req_builder.query(&[("FulfillmentChannels", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
466 };
467 }
468 if let Some(ref param_value) = p_payment_methods {
469 req_builder = match "csv" {
470 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("PaymentMethods".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
471 _ => req_builder.query(&[("PaymentMethods", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
472 };
473 }
474 if let Some(ref param_value) = p_buyer_email {
475 req_builder = req_builder.query(&[("BuyerEmail", ¶m_value.to_string())]);
476 }
477 if let Some(ref param_value) = p_seller_order_id {
478 req_builder = req_builder.query(&[("SellerOrderId", ¶m_value.to_string())]);
479 }
480 if let Some(ref param_value) = p_max_results_per_page {
481 req_builder = req_builder.query(&[("MaxResultsPerPage", ¶m_value.to_string())]);
482 }
483 if let Some(ref param_value) = p_easy_ship_shipment_statuses {
484 req_builder = match "csv" {
485 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("EasyShipShipmentStatuses".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
486 _ => req_builder.query(&[("EasyShipShipmentStatuses", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
487 };
488 }
489 if let Some(ref param_value) = p_electronic_invoice_statuses {
490 req_builder = match "csv" {
491 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("ElectronicInvoiceStatuses".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
492 _ => req_builder.query(&[("ElectronicInvoiceStatuses", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
493 };
494 }
495 if let Some(ref param_value) = p_next_token {
496 req_builder = req_builder.query(&[("NextToken", ¶m_value.to_string())]);
497 }
498 if let Some(ref param_value) = p_amazon_order_ids {
499 req_builder = match "csv" {
500 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("AmazonOrderIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
501 _ => req_builder.query(&[("AmazonOrderIds", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
502 };
503 }
504 if let Some(ref param_value) = p_actual_fulfillment_supply_source_id {
505 req_builder = req_builder.query(&[("ActualFulfillmentSupplySourceId", ¶m_value.to_string())]);
506 }
507 if let Some(ref param_value) = p_is_ispu {
508 req_builder = req_builder.query(&[("IsISPU", ¶m_value.to_string())]);
509 }
510 if let Some(ref param_value) = p_store_chain_store_id {
511 req_builder = req_builder.query(&[("StoreChainStoreId", ¶m_value.to_string())]);
512 }
513 if let Some(ref param_value) = p_earliest_delivery_date_before {
514 req_builder = req_builder.query(&[("EarliestDeliveryDateBefore", ¶m_value.to_string())]);
515 }
516 if let Some(ref param_value) = p_earliest_delivery_date_after {
517 req_builder = req_builder.query(&[("EarliestDeliveryDateAfter", ¶m_value.to_string())]);
518 }
519 if let Some(ref param_value) = p_latest_delivery_date_before {
520 req_builder = req_builder.query(&[("LatestDeliveryDateBefore", ¶m_value.to_string())]);
521 }
522 if let Some(ref param_value) = p_latest_delivery_date_after {
523 req_builder = req_builder.query(&[("LatestDeliveryDateAfter", ¶m_value.to_string())]);
524 }
525 if let Some(ref user_agent) = configuration.user_agent {
526 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
527 }
528
529 let req = req_builder.build()?;
530 let resp = configuration.client.execute(req).await?;
531
532 let status = resp.status();
533 let content_type = resp
534 .headers()
535 .get("content-type")
536 .and_then(|v| v.to_str().ok())
537 .unwrap_or("application/octet-stream");
538 let content_type = super::ContentType::from(content_type);
539
540 if !status.is_client_error() && !status.is_server_error() {
541 let content = resp.text().await?;
542 match content_type {
543 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
544 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::orders_v0::GetOrdersResponse`"))),
545 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::orders_v0::GetOrdersResponse`")))),
546 }
547 } else {
548 let content = resp.text().await?;
549 let entity: Option<GetOrdersError> = serde_json::from_str(&content).ok();
550 Err(Error::ResponseError(ResponseContent { status, content, entity }))
551 }
552}
553
554pub async fn update_verification_status(configuration: &configuration::Configuration, order_id: &str, payload: models::orders_v0::UpdateVerificationStatusRequest) -> Result<(), Error<UpdateVerificationStatusError>> {
556 let p_order_id = order_id;
558 let p_payload = payload;
559
560 let uri_str = format!("{}/orders/v0/orders/{orderId}/regulatedInfo", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
561 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
562
563 if let Some(ref user_agent) = configuration.user_agent {
564 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
565 }
566 req_builder = req_builder.json(&p_payload);
567
568 let req = req_builder.build()?;
569 let resp = configuration.client.execute(req).await?;
570
571 let status = resp.status();
572
573 if !status.is_client_error() && !status.is_server_error() {
574 Ok(())
575 } else {
576 let content = resp.text().await?;
577 let entity: Option<UpdateVerificationStatusError> = serde_json::from_str(&content).ok();
578 Err(Error::ResponseError(ResponseContent { status, content, entity }))
579 }
580}
581
582pub async fn update_shipment_status(configuration: &configuration::Configuration, order_id: &str, payload: models::orders_v0::UpdateShipmentStatusRequest) -> Result<(), Error<UpdateShipmentStatusError>> {
584 let p_order_id = order_id;
586 let p_payload = payload;
587
588 let uri_str = format!("{}/orders/v0/orders/{orderId}/shipment", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
589 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
590
591 if let Some(ref user_agent) = configuration.user_agent {
592 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
593 }
594 req_builder = req_builder.json(&p_payload);
595
596 let req = req_builder.build()?;
597 let resp = configuration.client.execute(req).await?;
598
599 let status = resp.status();
600
601 if !status.is_client_error() && !status.is_server_error() {
602 Ok(())
603 } else {
604 let content = resp.text().await?;
605 let entity: Option<UpdateShipmentStatusError> = serde_json::from_str(&content).ok();
606 Err(Error::ResponseError(ResponseContent { status, content, entity }))
607 }
608}