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
139pub async fn confirm_shipment(configuration: &configuration::Configuration, order_id: &str, payload: models::orders_v0::ConfirmShipmentRequest) -> Result<(), Error<ConfirmShipmentError>> {
141 let p_order_id = order_id;
143 let p_payload = payload;
144
145 let uri_str = format!("{}/orders/v0/orders/{orderId}/shipmentConfirmation", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
146 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
147
148 if let Some(ref user_agent) = configuration.user_agent {
149 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
150 }
151 req_builder = req_builder.json(&p_payload);
152
153 let req = req_builder.build()?;
154 let resp = configuration.client.execute(req).await?;
155
156 let status = resp.status();
157
158 if !status.is_client_error() && !status.is_server_error() {
159 Ok(())
160 } else {
161 let content = resp.text().await?;
162 let entity: Option<ConfirmShipmentError> = serde_json::from_str(&content).ok();
163 Err(Error::ResponseError(ResponseContent { status, content, entity }))
164 }
165}
166
167pub async fn get_order(configuration: &configuration::Configuration, order_id: &str) -> Result<models::orders_v0::GetOrderResponse, Error<GetOrderError>> {
169 let p_order_id = order_id;
171
172 let uri_str = format!("{}/orders/v0/orders/{orderId}", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
173 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
174
175 if let Some(ref user_agent) = configuration.user_agent {
176 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
177 }
178
179 let req = req_builder.build()?;
180 let resp = configuration.client.execute(req).await?;
181
182 let status = resp.status();
183 let content_type = resp
184 .headers()
185 .get("content-type")
186 .and_then(|v| v.to_str().ok())
187 .unwrap_or("application/octet-stream");
188 let content_type = super::ContentType::from(content_type);
189
190 if !status.is_client_error() && !status.is_server_error() {
191 let content = resp.text().await?;
192 match content_type {
193 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
194 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`"))),
195 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`")))),
196 }
197 } else {
198 let content = resp.text().await?;
199 let entity: Option<GetOrderError> = serde_json::from_str(&content).ok();
200 Err(Error::ResponseError(ResponseContent { status, content, entity }))
201 }
202}
203
204pub async fn get_order_address(configuration: &configuration::Configuration, order_id: &str) -> Result<models::orders_v0::GetOrderAddressResponse, Error<GetOrderAddressError>> {
206 let p_order_id = order_id;
208
209 let uri_str = format!("{}/orders/v0/orders/{orderId}/address", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
210 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
211
212 if let Some(ref user_agent) = configuration.user_agent {
213 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
214 }
215
216 let req = req_builder.build()?;
217 let resp = configuration.client.execute(req).await?;
218
219 let status = resp.status();
220 let content_type = resp
221 .headers()
222 .get("content-type")
223 .and_then(|v| v.to_str().ok())
224 .unwrap_or("application/octet-stream");
225 let content_type = super::ContentType::from(content_type);
226
227 if !status.is_client_error() && !status.is_server_error() {
228 let content = resp.text().await?;
229 match content_type {
230 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
231 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`"))),
232 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`")))),
233 }
234 } else {
235 let content = resp.text().await?;
236 let entity: Option<GetOrderAddressError> = serde_json::from_str(&content).ok();
237 Err(Error::ResponseError(ResponseContent { status, content, entity }))
238 }
239}
240
241pub async fn get_order_buyer_info(configuration: &configuration::Configuration, order_id: &str) -> Result<models::orders_v0::GetOrderBuyerInfoResponse, Error<GetOrderBuyerInfoError>> {
243 let p_order_id = order_id;
245
246 let uri_str = format!("{}/orders/v0/orders/{orderId}/buyerInfo", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
247 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
248
249 if let Some(ref user_agent) = configuration.user_agent {
250 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
251 }
252
253 let req = req_builder.build()?;
254 let resp = configuration.client.execute(req).await?;
255
256 let status = resp.status();
257 let content_type = resp
258 .headers()
259 .get("content-type")
260 .and_then(|v| v.to_str().ok())
261 .unwrap_or("application/octet-stream");
262 let content_type = super::ContentType::from(content_type);
263
264 if !status.is_client_error() && !status.is_server_error() {
265 let content = resp.text().await?;
266 match content_type {
267 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
268 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`"))),
269 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`")))),
270 }
271 } else {
272 let content = resp.text().await?;
273 let entity: Option<GetOrderBuyerInfoError> = serde_json::from_str(&content).ok();
274 Err(Error::ResponseError(ResponseContent { status, content, entity }))
275 }
276}
277
278pub async fn get_order_items(configuration: &configuration::Configuration, order_id: &str, next_token: Option<&str>) -> Result<models::orders_v0::GetOrderItemsResponse, Error<GetOrderItemsError>> {
280 let p_order_id = order_id;
282 let p_next_token = next_token;
283
284 let uri_str = format!("{}/orders/v0/orders/{orderId}/orderItems", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
285 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
286
287 if let Some(ref param_value) = p_next_token {
288 req_builder = req_builder.query(&[("NextToken", ¶m_value.to_string())]);
289 }
290 if let Some(ref user_agent) = configuration.user_agent {
291 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
292 }
293
294 let req = req_builder.build()?;
295 let resp = configuration.client.execute(req).await?;
296
297 let status = resp.status();
298 let content_type = resp
299 .headers()
300 .get("content-type")
301 .and_then(|v| v.to_str().ok())
302 .unwrap_or("application/octet-stream");
303 let content_type = super::ContentType::from(content_type);
304
305 if !status.is_client_error() && !status.is_server_error() {
306 let content = resp.text().await?;
307 match content_type {
308 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
309 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`"))),
310 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`")))),
311 }
312 } else {
313 let content = resp.text().await?;
314 let entity: Option<GetOrderItemsError> = serde_json::from_str(&content).ok();
315 Err(Error::ResponseError(ResponseContent { status, content, entity }))
316 }
317}
318
319pub async fn get_order_items_buyer_info(configuration: &configuration::Configuration, order_id: &str, next_token: Option<&str>) -> Result<models::orders_v0::GetOrderItemsBuyerInfoResponse, Error<GetOrderItemsBuyerInfoError>> {
321 let p_order_id = order_id;
323 let p_next_token = next_token;
324
325 let uri_str = format!("{}/orders/v0/orders/{orderId}/orderItems/buyerInfo", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
326 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
327
328 if let Some(ref param_value) = p_next_token {
329 req_builder = req_builder.query(&[("NextToken", ¶m_value.to_string())]);
330 }
331 if let Some(ref user_agent) = configuration.user_agent {
332 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
333 }
334
335 let req = req_builder.build()?;
336 let resp = configuration.client.execute(req).await?;
337
338 let status = resp.status();
339 let content_type = resp
340 .headers()
341 .get("content-type")
342 .and_then(|v| v.to_str().ok())
343 .unwrap_or("application/octet-stream");
344 let content_type = super::ContentType::from(content_type);
345
346 if !status.is_client_error() && !status.is_server_error() {
347 let content = resp.text().await?;
348 match content_type {
349 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
350 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`"))),
351 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`")))),
352 }
353 } else {
354 let content = resp.text().await?;
355 let entity: Option<GetOrderItemsBuyerInfoError> = serde_json::from_str(&content).ok();
356 Err(Error::ResponseError(ResponseContent { status, content, entity }))
357 }
358}
359
360pub async fn get_order_regulated_info(configuration: &configuration::Configuration, order_id: &str) -> Result<models::orders_v0::GetOrderRegulatedInfoResponse, Error<GetOrderRegulatedInfoError>> {
362 let p_order_id = order_id;
364
365 let uri_str = format!("{}/orders/v0/orders/{orderId}/regulatedInfo", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
366 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
367
368 if let Some(ref user_agent) = configuration.user_agent {
369 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
370 }
371
372 let req = req_builder.build()?;
373 let resp = configuration.client.execute(req).await?;
374
375 let status = resp.status();
376 let content_type = resp
377 .headers()
378 .get("content-type")
379 .and_then(|v| v.to_str().ok())
380 .unwrap_or("application/octet-stream");
381 let content_type = super::ContentType::from(content_type);
382
383 if !status.is_client_error() && !status.is_server_error() {
384 let content = resp.text().await?;
385 match content_type {
386 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
387 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`"))),
388 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`")))),
389 }
390 } else {
391 let content = resp.text().await?;
392 let entity: Option<GetOrderRegulatedInfoError> = serde_json::from_str(&content).ok();
393 Err(Error::ResponseError(ResponseContent { status, content, entity }))
394 }
395}
396
397pub 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>> {
399 let p_marketplace_ids = marketplace_ids;
401 let p_created_after = created_after;
402 let p_created_before = created_before;
403 let p_last_updated_after = last_updated_after;
404 let p_last_updated_before = last_updated_before;
405 let p_order_statuses = order_statuses;
406 let p_fulfillment_channels = fulfillment_channels;
407 let p_payment_methods = payment_methods;
408 let p_buyer_email = buyer_email;
409 let p_seller_order_id = seller_order_id;
410 let p_max_results_per_page = max_results_per_page;
411 let p_easy_ship_shipment_statuses = easy_ship_shipment_statuses;
412 let p_electronic_invoice_statuses = electronic_invoice_statuses;
413 let p_next_token = next_token;
414 let p_amazon_order_ids = amazon_order_ids;
415 let p_actual_fulfillment_supply_source_id = actual_fulfillment_supply_source_id;
416 let p_is_ispu = is_ispu;
417 let p_store_chain_store_id = store_chain_store_id;
418 let p_earliest_delivery_date_before = earliest_delivery_date_before;
419 let p_earliest_delivery_date_after = earliest_delivery_date_after;
420 let p_latest_delivery_date_before = latest_delivery_date_before;
421 let p_latest_delivery_date_after = latest_delivery_date_after;
422
423 let uri_str = format!("{}/orders/v0/orders", configuration.base_path);
424 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
425
426 if let Some(ref param_value) = p_created_after {
427 req_builder = req_builder.query(&[("CreatedAfter", ¶m_value.to_string())]);
428 }
429 if let Some(ref param_value) = p_created_before {
430 req_builder = req_builder.query(&[("CreatedBefore", ¶m_value.to_string())]);
431 }
432 if let Some(ref param_value) = p_last_updated_after {
433 req_builder = req_builder.query(&[("LastUpdatedAfter", ¶m_value.to_string())]);
434 }
435 if let Some(ref param_value) = p_last_updated_before {
436 req_builder = req_builder.query(&[("LastUpdatedBefore", ¶m_value.to_string())]);
437 }
438 if let Some(ref param_value) = p_order_statuses {
439 req_builder = match "csv" {
440 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("OrderStatuses".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
441 _ => req_builder.query(&[("OrderStatuses", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
442 };
443 }
444 req_builder = match "csv" {
445 "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)>>()),
446 _ => req_builder.query(&[("MarketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
447 };
448 if let Some(ref param_value) = p_fulfillment_channels {
449 req_builder = match "csv" {
450 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("FulfillmentChannels".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
451 _ => req_builder.query(&[("FulfillmentChannels", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
452 };
453 }
454 if let Some(ref param_value) = p_payment_methods {
455 req_builder = match "csv" {
456 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("PaymentMethods".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
457 _ => req_builder.query(&[("PaymentMethods", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
458 };
459 }
460 if let Some(ref param_value) = p_buyer_email {
461 req_builder = req_builder.query(&[("BuyerEmail", ¶m_value.to_string())]);
462 }
463 if let Some(ref param_value) = p_seller_order_id {
464 req_builder = req_builder.query(&[("SellerOrderId", ¶m_value.to_string())]);
465 }
466 if let Some(ref param_value) = p_max_results_per_page {
467 req_builder = req_builder.query(&[("MaxResultsPerPage", ¶m_value.to_string())]);
468 }
469 if let Some(ref param_value) = p_easy_ship_shipment_statuses {
470 req_builder = match "csv" {
471 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("EasyShipShipmentStatuses".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
472 _ => req_builder.query(&[("EasyShipShipmentStatuses", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
473 };
474 }
475 if let Some(ref param_value) = p_electronic_invoice_statuses {
476 req_builder = match "csv" {
477 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("ElectronicInvoiceStatuses".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
478 _ => req_builder.query(&[("ElectronicInvoiceStatuses", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
479 };
480 }
481 if let Some(ref param_value) = p_next_token {
482 req_builder = req_builder.query(&[("NextToken", ¶m_value.to_string())]);
483 }
484 if let Some(ref param_value) = p_amazon_order_ids {
485 req_builder = match "csv" {
486 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("AmazonOrderIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
487 _ => req_builder.query(&[("AmazonOrderIds", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
488 };
489 }
490 if let Some(ref param_value) = p_actual_fulfillment_supply_source_id {
491 req_builder = req_builder.query(&[("ActualFulfillmentSupplySourceId", ¶m_value.to_string())]);
492 }
493 if let Some(ref param_value) = p_is_ispu {
494 req_builder = req_builder.query(&[("IsISPU", ¶m_value.to_string())]);
495 }
496 if let Some(ref param_value) = p_store_chain_store_id {
497 req_builder = req_builder.query(&[("StoreChainStoreId", ¶m_value.to_string())]);
498 }
499 if let Some(ref param_value) = p_earliest_delivery_date_before {
500 req_builder = req_builder.query(&[("EarliestDeliveryDateBefore", ¶m_value.to_string())]);
501 }
502 if let Some(ref param_value) = p_earliest_delivery_date_after {
503 req_builder = req_builder.query(&[("EarliestDeliveryDateAfter", ¶m_value.to_string())]);
504 }
505 if let Some(ref param_value) = p_latest_delivery_date_before {
506 req_builder = req_builder.query(&[("LatestDeliveryDateBefore", ¶m_value.to_string())]);
507 }
508 if let Some(ref param_value) = p_latest_delivery_date_after {
509 req_builder = req_builder.query(&[("LatestDeliveryDateAfter", ¶m_value.to_string())]);
510 }
511 if let Some(ref user_agent) = configuration.user_agent {
512 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
513 }
514
515 let req = req_builder.build()?;
516 let resp = configuration.client.execute(req).await?;
517
518 let status = resp.status();
519 let content_type = resp
520 .headers()
521 .get("content-type")
522 .and_then(|v| v.to_str().ok())
523 .unwrap_or("application/octet-stream");
524 let content_type = super::ContentType::from(content_type);
525
526 if !status.is_client_error() && !status.is_server_error() {
527 let content = resp.text().await?;
528 match content_type {
529 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
530 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`"))),
531 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`")))),
532 }
533 } else {
534 let content = resp.text().await?;
535 let entity: Option<GetOrdersError> = serde_json::from_str(&content).ok();
536 Err(Error::ResponseError(ResponseContent { status, content, entity }))
537 }
538}
539
540pub async fn update_verification_status(configuration: &configuration::Configuration, order_id: &str, payload: models::orders_v0::UpdateVerificationStatusRequest) -> Result<(), Error<UpdateVerificationStatusError>> {
542 let p_order_id = order_id;
544 let p_payload = payload;
545
546 let uri_str = format!("{}/orders/v0/orders/{orderId}/regulatedInfo", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
547 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
548
549 if let Some(ref user_agent) = configuration.user_agent {
550 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
551 }
552 req_builder = req_builder.json(&p_payload);
553
554 let req = req_builder.build()?;
555 let resp = configuration.client.execute(req).await?;
556
557 let status = resp.status();
558
559 if !status.is_client_error() && !status.is_server_error() {
560 Ok(())
561 } else {
562 let content = resp.text().await?;
563 let entity: Option<UpdateVerificationStatusError> = serde_json::from_str(&content).ok();
564 Err(Error::ResponseError(ResponseContent { status, content, entity }))
565 }
566}
567