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 ConfirmCustomizationDetailsError {
22 Status400(models::messaging::CreateConfirmCustomizationDetailsResponse),
23 Status403(models::messaging::CreateConfirmCustomizationDetailsResponse),
24 Status404(models::messaging::CreateConfirmCustomizationDetailsResponse),
25 Status413(models::messaging::CreateConfirmCustomizationDetailsResponse),
26 Status415(models::messaging::CreateConfirmCustomizationDetailsResponse),
27 Status429(models::messaging::CreateConfirmCustomizationDetailsResponse),
28 Status500(models::messaging::CreateConfirmCustomizationDetailsResponse),
29 Status503(models::messaging::CreateConfirmCustomizationDetailsResponse),
30 UnknownValue(serde_json::Value),
31}
32
33#[derive(Debug, Clone, Serialize, Deserialize)]
35#[serde(untagged)]
36pub enum CreateAmazonMotorsError {
37 Status400(models::messaging::CreateAmazonMotorsResponse),
38 Status403(models::messaging::CreateAmazonMotorsResponse),
39 Status404(models::messaging::CreateAmazonMotorsResponse),
40 Status413(models::messaging::CreateAmazonMotorsResponse),
41 Status415(models::messaging::CreateAmazonMotorsResponse),
42 Status429(models::messaging::CreateAmazonMotorsResponse),
43 Status500(models::messaging::CreateAmazonMotorsResponse),
44 Status503(models::messaging::CreateAmazonMotorsResponse),
45 UnknownValue(serde_json::Value),
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum CreateConfirmDeliveryDetailsError {
52 Status400(models::messaging::CreateConfirmDeliveryDetailsResponse),
53 Status403(models::messaging::CreateConfirmDeliveryDetailsResponse),
54 Status404(models::messaging::CreateConfirmDeliveryDetailsResponse),
55 Status413(models::messaging::CreateConfirmDeliveryDetailsResponse),
56 Status415(models::messaging::CreateConfirmDeliveryDetailsResponse),
57 Status429(models::messaging::CreateConfirmDeliveryDetailsResponse),
58 Status500(models::messaging::CreateConfirmDeliveryDetailsResponse),
59 Status503(models::messaging::CreateConfirmDeliveryDetailsResponse),
60 UnknownValue(serde_json::Value),
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize)]
65#[serde(untagged)]
66pub enum CreateConfirmOrderDetailsError {
67 Status400(models::messaging::CreateConfirmOrderDetailsResponse),
68 Status403(models::messaging::CreateConfirmOrderDetailsResponse),
69 Status404(models::messaging::CreateConfirmOrderDetailsResponse),
70 Status413(models::messaging::CreateConfirmOrderDetailsResponse),
71 Status415(models::messaging::CreateConfirmOrderDetailsResponse),
72 Status429(models::messaging::CreateConfirmOrderDetailsResponse),
73 Status500(models::messaging::CreateConfirmOrderDetailsResponse),
74 Status503(models::messaging::CreateConfirmOrderDetailsResponse),
75 UnknownValue(serde_json::Value),
76}
77
78#[derive(Debug, Clone, Serialize, Deserialize)]
80#[serde(untagged)]
81pub enum CreateConfirmServiceDetailsError {
82 Status400(models::messaging::CreateConfirmServiceDetailsResponse),
83 Status403(models::messaging::CreateConfirmServiceDetailsResponse),
84 Status404(models::messaging::CreateConfirmServiceDetailsResponse),
85 Status413(models::messaging::CreateConfirmServiceDetailsResponse),
86 Status415(models::messaging::CreateConfirmServiceDetailsResponse),
87 Status429(models::messaging::CreateConfirmServiceDetailsResponse),
88 Status500(models::messaging::CreateConfirmServiceDetailsResponse),
89 Status503(models::messaging::CreateConfirmServiceDetailsResponse),
90 UnknownValue(serde_json::Value),
91}
92
93#[derive(Debug, Clone, Serialize, Deserialize)]
95#[serde(untagged)]
96pub enum CreateDigitalAccessKeyError {
97 Status400(models::messaging::CreateDigitalAccessKeyResponse),
98 Status403(models::messaging::CreateDigitalAccessKeyResponse),
99 Status404(models::messaging::CreateDigitalAccessKeyResponse),
100 Status413(models::messaging::CreateDigitalAccessKeyResponse),
101 Status415(models::messaging::CreateDigitalAccessKeyResponse),
102 Status429(models::messaging::CreateDigitalAccessKeyResponse),
103 Status500(models::messaging::CreateDigitalAccessKeyResponse),
104 Status503(models::messaging::CreateDigitalAccessKeyResponse),
105 UnknownValue(serde_json::Value),
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum CreateLegalDisclosureError {
112 Status400(models::messaging::CreateLegalDisclosureResponse),
113 Status403(models::messaging::CreateLegalDisclosureResponse),
114 Status404(models::messaging::CreateLegalDisclosureResponse),
115 Status413(models::messaging::CreateLegalDisclosureResponse),
116 Status415(models::messaging::CreateLegalDisclosureResponse),
117 Status429(models::messaging::CreateLegalDisclosureResponse),
118 Status500(models::messaging::CreateLegalDisclosureResponse),
119 Status503(models::messaging::CreateLegalDisclosureResponse),
120 UnknownValue(serde_json::Value),
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum CreateNegativeFeedbackRemovalError {
127 Status400(models::messaging::CreateNegativeFeedbackRemovalResponse),
128 Status403(models::messaging::CreateNegativeFeedbackRemovalResponse),
129 Status404(models::messaging::CreateNegativeFeedbackRemovalResponse),
130 Status413(models::messaging::CreateNegativeFeedbackRemovalResponse),
131 Status415(models::messaging::CreateNegativeFeedbackRemovalResponse),
132 Status429(models::messaging::CreateNegativeFeedbackRemovalResponse),
133 Status500(models::messaging::CreateNegativeFeedbackRemovalResponse),
134 Status503(models::messaging::CreateNegativeFeedbackRemovalResponse),
135 UnknownValue(serde_json::Value),
136}
137
138#[derive(Debug, Clone, Serialize, Deserialize)]
140#[serde(untagged)]
141pub enum CreateUnexpectedProblemError {
142 Status400(models::messaging::CreateUnexpectedProblemResponse),
143 Status403(models::messaging::CreateUnexpectedProblemResponse),
144 Status404(models::messaging::CreateUnexpectedProblemResponse),
145 Status413(models::messaging::CreateUnexpectedProblemResponse),
146 Status415(models::messaging::CreateUnexpectedProblemResponse),
147 Status429(models::messaging::CreateUnexpectedProblemResponse),
148 Status500(models::messaging::CreateUnexpectedProblemResponse),
149 Status503(models::messaging::CreateUnexpectedProblemResponse),
150 UnknownValue(serde_json::Value),
151}
152
153#[derive(Debug, Clone, Serialize, Deserialize)]
155#[serde(untagged)]
156pub enum CreateWarrantyError {
157 Status400(models::messaging::CreateWarrantyResponse),
158 Status403(models::messaging::CreateWarrantyResponse),
159 Status404(models::messaging::CreateWarrantyResponse),
160 Status413(models::messaging::CreateWarrantyResponse),
161 Status415(models::messaging::CreateWarrantyResponse),
162 Status429(models::messaging::CreateWarrantyResponse),
163 Status500(models::messaging::CreateWarrantyResponse),
164 Status503(models::messaging::CreateWarrantyResponse),
165 UnknownValue(serde_json::Value),
166}
167
168#[derive(Debug, Clone, Serialize, Deserialize)]
170#[serde(untagged)]
171pub enum GetAttributesError {
172 Status400(models::messaging::GetAttributesResponse),
173 Status403(models::messaging::GetAttributesResponse),
174 Status404(models::messaging::GetAttributesResponse),
175 Status413(models::messaging::GetAttributesResponse),
176 Status415(models::messaging::GetAttributesResponse),
177 Status429(models::messaging::GetAttributesResponse),
178 Status500(models::messaging::GetAttributesResponse),
179 Status503(models::messaging::GetAttributesResponse),
180 UnknownValue(serde_json::Value),
181}
182
183#[derive(Debug, Clone, Serialize, Deserialize)]
185#[serde(untagged)]
186pub enum GetMessagingActionsForOrderError {
187 Status400(models::messaging::GetMessagingActionsForOrderResponse),
188 Status403(models::messaging::GetMessagingActionsForOrderResponse),
189 Status404(models::messaging::GetMessagingActionsForOrderResponse),
190 Status413(models::messaging::GetMessagingActionsForOrderResponse),
191 Status415(models::messaging::GetMessagingActionsForOrderResponse),
192 Status429(models::messaging::GetMessagingActionsForOrderResponse),
193 Status500(models::messaging::GetMessagingActionsForOrderResponse),
194 Status503(models::messaging::GetMessagingActionsForOrderResponse),
195 UnknownValue(serde_json::Value),
196}
197
198#[derive(Debug, Clone, Serialize, Deserialize)]
200#[serde(untagged)]
201pub enum SendInvoiceError {
202 Status400(models::messaging::InvoiceResponse),
203 Status403(models::messaging::InvoiceResponse),
204 Status404(models::messaging::InvoiceResponse),
205 Status413(models::messaging::InvoiceResponse),
206 Status415(models::messaging::InvoiceResponse),
207 Status429(models::messaging::InvoiceResponse),
208 Status500(models::messaging::InvoiceResponse),
209 Status503(models::messaging::InvoiceResponse),
210 UnknownValue(serde_json::Value),
211}
212
213
214pub async fn confirm_customization_details(configuration: &configuration::Configuration, amazon_order_id: &str, marketplace_ids: Vec<String>, body: models::messaging::CreateConfirmCustomizationDetailsRequest) -> Result<models::messaging::CreateConfirmCustomizationDetailsResponse, Error<ConfirmCustomizationDetailsError>> {
216 let p_amazon_order_id = amazon_order_id;
218 let p_marketplace_ids = marketplace_ids;
219 let p_body = body;
220
221 let uri_str = format!("{}/messaging/v1/orders/{amazonOrderId}/messages/confirmCustomizationDetails", configuration.base_path, amazonOrderId=crate::apis::urlencode(p_amazon_order_id));
222 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
223
224 req_builder = match "csv" {
225 "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)>>()),
226 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
227 };
228 if let Some(ref user_agent) = configuration.user_agent {
229 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
230 }
231 req_builder = req_builder.json(&p_body);
232
233 let req = req_builder.build()?;
234 let resp = configuration.client.execute(req).await?;
235
236 let status = resp.status();
237 let content_type = resp
238 .headers()
239 .get("content-type")
240 .and_then(|v| v.to_str().ok())
241 .unwrap_or("application/octet-stream");
242 let content_type = super::ContentType::from(content_type);
243
244 if !status.is_client_error() && !status.is_server_error() {
245 let content = resp.text().await?;
246 match content_type {
247 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
248 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::messaging::CreateConfirmCustomizationDetailsResponse`"))),
249 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::messaging::CreateConfirmCustomizationDetailsResponse`")))),
250 }
251 } else {
252 let content = resp.text().await?;
253 let entity: Option<ConfirmCustomizationDetailsError> = serde_json::from_str(&content).ok();
254 Err(Error::ResponseError(ResponseContent { status, content, entity }))
255 }
256}
257
258pub async fn create_amazon_motors(configuration: &configuration::Configuration, amazon_order_id: &str, marketplace_ids: Vec<String>, body: models::messaging::CreateAmazonMotorsRequest) -> Result<models::messaging::CreateAmazonMotorsResponse, Error<CreateAmazonMotorsError>> {
260 let p_amazon_order_id = amazon_order_id;
262 let p_marketplace_ids = marketplace_ids;
263 let p_body = body;
264
265 let uri_str = format!("{}/messaging/v1/orders/{amazonOrderId}/messages/amazonMotors", configuration.base_path, amazonOrderId=crate::apis::urlencode(p_amazon_order_id));
266 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
267
268 req_builder = match "csv" {
269 "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)>>()),
270 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
271 };
272 if let Some(ref user_agent) = configuration.user_agent {
273 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
274 }
275 req_builder = req_builder.json(&p_body);
276
277 let req = req_builder.build()?;
278 let resp = configuration.client.execute(req).await?;
279
280 let status = resp.status();
281 let content_type = resp
282 .headers()
283 .get("content-type")
284 .and_then(|v| v.to_str().ok())
285 .unwrap_or("application/octet-stream");
286 let content_type = super::ContentType::from(content_type);
287
288 if !status.is_client_error() && !status.is_server_error() {
289 let content = resp.text().await?;
290 match content_type {
291 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
292 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::messaging::CreateAmazonMotorsResponse`"))),
293 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::messaging::CreateAmazonMotorsResponse`")))),
294 }
295 } else {
296 let content = resp.text().await?;
297 let entity: Option<CreateAmazonMotorsError> = serde_json::from_str(&content).ok();
298 Err(Error::ResponseError(ResponseContent { status, content, entity }))
299 }
300}
301
302pub async fn create_confirm_delivery_details(configuration: &configuration::Configuration, amazon_order_id: &str, marketplace_ids: Vec<String>, body: models::messaging::CreateConfirmDeliveryDetailsRequest) -> Result<models::messaging::CreateConfirmDeliveryDetailsResponse, Error<CreateConfirmDeliveryDetailsError>> {
304 let p_amazon_order_id = amazon_order_id;
306 let p_marketplace_ids = marketplace_ids;
307 let p_body = body;
308
309 let uri_str = format!("{}/messaging/v1/orders/{amazonOrderId}/messages/confirmDeliveryDetails", configuration.base_path, amazonOrderId=crate::apis::urlencode(p_amazon_order_id));
310 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
311
312 req_builder = match "csv" {
313 "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)>>()),
314 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
315 };
316 if let Some(ref user_agent) = configuration.user_agent {
317 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
318 }
319 req_builder = req_builder.json(&p_body);
320
321 let req = req_builder.build()?;
322 let resp = configuration.client.execute(req).await?;
323
324 let status = resp.status();
325 let content_type = resp
326 .headers()
327 .get("content-type")
328 .and_then(|v| v.to_str().ok())
329 .unwrap_or("application/octet-stream");
330 let content_type = super::ContentType::from(content_type);
331
332 if !status.is_client_error() && !status.is_server_error() {
333 let content = resp.text().await?;
334 match content_type {
335 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
336 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::messaging::CreateConfirmDeliveryDetailsResponse`"))),
337 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::messaging::CreateConfirmDeliveryDetailsResponse`")))),
338 }
339 } else {
340 let content = resp.text().await?;
341 let entity: Option<CreateConfirmDeliveryDetailsError> = serde_json::from_str(&content).ok();
342 Err(Error::ResponseError(ResponseContent { status, content, entity }))
343 }
344}
345
346pub async fn create_confirm_order_details(configuration: &configuration::Configuration, amazon_order_id: &str, marketplace_ids: Vec<String>, body: models::messaging::CreateConfirmOrderDetailsRequest) -> Result<models::messaging::CreateConfirmOrderDetailsResponse, Error<CreateConfirmOrderDetailsError>> {
348 let p_amazon_order_id = amazon_order_id;
350 let p_marketplace_ids = marketplace_ids;
351 let p_body = body;
352
353 let uri_str = format!("{}/messaging/v1/orders/{amazonOrderId}/messages/confirmOrderDetails", configuration.base_path, amazonOrderId=crate::apis::urlencode(p_amazon_order_id));
354 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
355
356 req_builder = match "csv" {
357 "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)>>()),
358 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
359 };
360 if let Some(ref user_agent) = configuration.user_agent {
361 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
362 }
363 req_builder = req_builder.json(&p_body);
364
365 let req = req_builder.build()?;
366 let resp = configuration.client.execute(req).await?;
367
368 let status = resp.status();
369 let content_type = resp
370 .headers()
371 .get("content-type")
372 .and_then(|v| v.to_str().ok())
373 .unwrap_or("application/octet-stream");
374 let content_type = super::ContentType::from(content_type);
375
376 if !status.is_client_error() && !status.is_server_error() {
377 let content = resp.text().await?;
378 match content_type {
379 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
380 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::messaging::CreateConfirmOrderDetailsResponse`"))),
381 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::messaging::CreateConfirmOrderDetailsResponse`")))),
382 }
383 } else {
384 let content = resp.text().await?;
385 let entity: Option<CreateConfirmOrderDetailsError> = serde_json::from_str(&content).ok();
386 Err(Error::ResponseError(ResponseContent { status, content, entity }))
387 }
388}
389
390pub async fn create_confirm_service_details(configuration: &configuration::Configuration, amazon_order_id: &str, marketplace_ids: Vec<String>, body: models::messaging::CreateConfirmServiceDetailsRequest) -> Result<models::messaging::CreateConfirmServiceDetailsResponse, Error<CreateConfirmServiceDetailsError>> {
392 let p_amazon_order_id = amazon_order_id;
394 let p_marketplace_ids = marketplace_ids;
395 let p_body = body;
396
397 let uri_str = format!("{}/messaging/v1/orders/{amazonOrderId}/messages/confirmServiceDetails", configuration.base_path, amazonOrderId=crate::apis::urlencode(p_amazon_order_id));
398 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
399
400 req_builder = match "csv" {
401 "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)>>()),
402 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
403 };
404 if let Some(ref user_agent) = configuration.user_agent {
405 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
406 }
407 req_builder = req_builder.json(&p_body);
408
409 let req = req_builder.build()?;
410 let resp = configuration.client.execute(req).await?;
411
412 let status = resp.status();
413 let content_type = resp
414 .headers()
415 .get("content-type")
416 .and_then(|v| v.to_str().ok())
417 .unwrap_or("application/octet-stream");
418 let content_type = super::ContentType::from(content_type);
419
420 if !status.is_client_error() && !status.is_server_error() {
421 let content = resp.text().await?;
422 match content_type {
423 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
424 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::messaging::CreateConfirmServiceDetailsResponse`"))),
425 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::messaging::CreateConfirmServiceDetailsResponse`")))),
426 }
427 } else {
428 let content = resp.text().await?;
429 let entity: Option<CreateConfirmServiceDetailsError> = serde_json::from_str(&content).ok();
430 Err(Error::ResponseError(ResponseContent { status, content, entity }))
431 }
432}
433
434pub async fn create_digital_access_key(configuration: &configuration::Configuration, amazon_order_id: &str, marketplace_ids: Vec<String>, body: models::messaging::CreateDigitalAccessKeyRequest) -> Result<models::messaging::CreateDigitalAccessKeyResponse, Error<CreateDigitalAccessKeyError>> {
436 let p_amazon_order_id = amazon_order_id;
438 let p_marketplace_ids = marketplace_ids;
439 let p_body = body;
440
441 let uri_str = format!("{}/messaging/v1/orders/{amazonOrderId}/messages/digitalAccessKey", configuration.base_path, amazonOrderId=crate::apis::urlencode(p_amazon_order_id));
442 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
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 user_agent) = configuration.user_agent {
449 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
450 }
451 req_builder = req_builder.json(&p_body);
452
453 let req = req_builder.build()?;
454 let resp = configuration.client.execute(req).await?;
455
456 let status = resp.status();
457 let content_type = resp
458 .headers()
459 .get("content-type")
460 .and_then(|v| v.to_str().ok())
461 .unwrap_or("application/octet-stream");
462 let content_type = super::ContentType::from(content_type);
463
464 if !status.is_client_error() && !status.is_server_error() {
465 let content = resp.text().await?;
466 match content_type {
467 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
468 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::messaging::CreateDigitalAccessKeyResponse`"))),
469 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::messaging::CreateDigitalAccessKeyResponse`")))),
470 }
471 } else {
472 let content = resp.text().await?;
473 let entity: Option<CreateDigitalAccessKeyError> = serde_json::from_str(&content).ok();
474 Err(Error::ResponseError(ResponseContent { status, content, entity }))
475 }
476}
477
478pub async fn create_legal_disclosure(configuration: &configuration::Configuration, amazon_order_id: &str, marketplace_ids: Vec<String>, body: models::messaging::CreateLegalDisclosureRequest) -> Result<models::messaging::CreateLegalDisclosureResponse, Error<CreateLegalDisclosureError>> {
480 let p_amazon_order_id = amazon_order_id;
482 let p_marketplace_ids = marketplace_ids;
483 let p_body = body;
484
485 let uri_str = format!("{}/messaging/v1/orders/{amazonOrderId}/messages/legalDisclosure", configuration.base_path, amazonOrderId=crate::apis::urlencode(p_amazon_order_id));
486 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
487
488 req_builder = match "csv" {
489 "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)>>()),
490 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
491 };
492 if let Some(ref user_agent) = configuration.user_agent {
493 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
494 }
495 req_builder = req_builder.json(&p_body);
496
497 let req = req_builder.build()?;
498 let resp = configuration.client.execute(req).await?;
499
500 let status = resp.status();
501 let content_type = resp
502 .headers()
503 .get("content-type")
504 .and_then(|v| v.to_str().ok())
505 .unwrap_or("application/octet-stream");
506 let content_type = super::ContentType::from(content_type);
507
508 if !status.is_client_error() && !status.is_server_error() {
509 let content = resp.text().await?;
510 match content_type {
511 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
512 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::messaging::CreateLegalDisclosureResponse`"))),
513 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::messaging::CreateLegalDisclosureResponse`")))),
514 }
515 } else {
516 let content = resp.text().await?;
517 let entity: Option<CreateLegalDisclosureError> = serde_json::from_str(&content).ok();
518 Err(Error::ResponseError(ResponseContent { status, content, entity }))
519 }
520}
521
522pub async fn create_negative_feedback_removal(configuration: &configuration::Configuration, amazon_order_id: &str, marketplace_ids: Vec<String>) -> Result<models::messaging::CreateNegativeFeedbackRemovalResponse, Error<CreateNegativeFeedbackRemovalError>> {
524 let p_amazon_order_id = amazon_order_id;
526 let p_marketplace_ids = marketplace_ids;
527
528 let uri_str = format!("{}/messaging/v1/orders/{amazonOrderId}/messages/negativeFeedbackRemoval", configuration.base_path, amazonOrderId=crate::apis::urlencode(p_amazon_order_id));
529 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
530
531 req_builder = match "csv" {
532 "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)>>()),
533 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
534 };
535 if let Some(ref user_agent) = configuration.user_agent {
536 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
537 }
538
539 let req = req_builder.build()?;
540 let resp = configuration.client.execute(req).await?;
541
542 let status = resp.status();
543 let content_type = resp
544 .headers()
545 .get("content-type")
546 .and_then(|v| v.to_str().ok())
547 .unwrap_or("application/octet-stream");
548 let content_type = super::ContentType::from(content_type);
549
550 if !status.is_client_error() && !status.is_server_error() {
551 let content = resp.text().await?;
552 match content_type {
553 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
554 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::messaging::CreateNegativeFeedbackRemovalResponse`"))),
555 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::messaging::CreateNegativeFeedbackRemovalResponse`")))),
556 }
557 } else {
558 let content = resp.text().await?;
559 let entity: Option<CreateNegativeFeedbackRemovalError> = serde_json::from_str(&content).ok();
560 Err(Error::ResponseError(ResponseContent { status, content, entity }))
561 }
562}
563
564pub async fn create_unexpected_problem(configuration: &configuration::Configuration, amazon_order_id: &str, marketplace_ids: Vec<String>, body: models::messaging::CreateUnexpectedProblemRequest) -> Result<models::messaging::CreateUnexpectedProblemResponse, Error<CreateUnexpectedProblemError>> {
566 let p_amazon_order_id = amazon_order_id;
568 let p_marketplace_ids = marketplace_ids;
569 let p_body = body;
570
571 let uri_str = format!("{}/messaging/v1/orders/{amazonOrderId}/messages/unexpectedProblem", configuration.base_path, amazonOrderId=crate::apis::urlencode(p_amazon_order_id));
572 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
573
574 req_builder = match "csv" {
575 "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)>>()),
576 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
577 };
578 if let Some(ref user_agent) = configuration.user_agent {
579 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
580 }
581 req_builder = req_builder.json(&p_body);
582
583 let req = req_builder.build()?;
584 let resp = configuration.client.execute(req).await?;
585
586 let status = resp.status();
587 let content_type = resp
588 .headers()
589 .get("content-type")
590 .and_then(|v| v.to_str().ok())
591 .unwrap_or("application/octet-stream");
592 let content_type = super::ContentType::from(content_type);
593
594 if !status.is_client_error() && !status.is_server_error() {
595 let content = resp.text().await?;
596 match content_type {
597 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
598 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::messaging::CreateUnexpectedProblemResponse`"))),
599 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::messaging::CreateUnexpectedProblemResponse`")))),
600 }
601 } else {
602 let content = resp.text().await?;
603 let entity: Option<CreateUnexpectedProblemError> = serde_json::from_str(&content).ok();
604 Err(Error::ResponseError(ResponseContent { status, content, entity }))
605 }
606}
607
608pub async fn create_warranty(configuration: &configuration::Configuration, amazon_order_id: &str, marketplace_ids: Vec<String>, body: models::messaging::CreateWarrantyRequest) -> Result<models::messaging::CreateWarrantyResponse, Error<CreateWarrantyError>> {
610 let p_amazon_order_id = amazon_order_id;
612 let p_marketplace_ids = marketplace_ids;
613 let p_body = body;
614
615 let uri_str = format!("{}/messaging/v1/orders/{amazonOrderId}/messages/warranty", configuration.base_path, amazonOrderId=crate::apis::urlencode(p_amazon_order_id));
616 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
617
618 req_builder = match "csv" {
619 "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)>>()),
620 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
621 };
622 if let Some(ref user_agent) = configuration.user_agent {
623 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
624 }
625 req_builder = req_builder.json(&p_body);
626
627 let req = req_builder.build()?;
628 let resp = configuration.client.execute(req).await?;
629
630 let status = resp.status();
631 let content_type = resp
632 .headers()
633 .get("content-type")
634 .and_then(|v| v.to_str().ok())
635 .unwrap_or("application/octet-stream");
636 let content_type = super::ContentType::from(content_type);
637
638 if !status.is_client_error() && !status.is_server_error() {
639 let content = resp.text().await?;
640 match content_type {
641 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
642 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::messaging::CreateWarrantyResponse`"))),
643 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::messaging::CreateWarrantyResponse`")))),
644 }
645 } else {
646 let content = resp.text().await?;
647 let entity: Option<CreateWarrantyError> = serde_json::from_str(&content).ok();
648 Err(Error::ResponseError(ResponseContent { status, content, entity }))
649 }
650}
651
652pub async fn get_attributes(configuration: &configuration::Configuration, amazon_order_id: &str, marketplace_ids: Vec<String>) -> Result<models::messaging::GetAttributesResponse, Error<GetAttributesError>> {
654 let p_amazon_order_id = amazon_order_id;
656 let p_marketplace_ids = marketplace_ids;
657
658 let uri_str = format!("{}/messaging/v1/orders/{amazonOrderId}/attributes", configuration.base_path, amazonOrderId=crate::apis::urlencode(p_amazon_order_id));
659 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
660
661 req_builder = match "csv" {
662 "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)>>()),
663 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
664 };
665 if let Some(ref user_agent) = configuration.user_agent {
666 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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::messaging::GetAttributesResponse`"))),
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::messaging::GetAttributesResponse`")))),
686 }
687 } else {
688 let content = resp.text().await?;
689 let entity: Option<GetAttributesError> = serde_json::from_str(&content).ok();
690 Err(Error::ResponseError(ResponseContent { status, content, entity }))
691 }
692}
693
694pub async fn get_messaging_actions_for_order(configuration: &configuration::Configuration, amazon_order_id: &str, marketplace_ids: Vec<String>) -> Result<models::messaging::GetMessagingActionsForOrderResponse, Error<GetMessagingActionsForOrderError>> {
696 let p_amazon_order_id = amazon_order_id;
698 let p_marketplace_ids = marketplace_ids;
699
700 let uri_str = format!("{}/messaging/v1/orders/{amazonOrderId}", configuration.base_path, amazonOrderId=crate::apis::urlencode(p_amazon_order_id));
701 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
702
703 req_builder = match "csv" {
704 "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)>>()),
705 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
706 };
707 if let Some(ref user_agent) = configuration.user_agent {
708 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
709 }
710
711 let req = req_builder.build()?;
712 let resp = configuration.client.execute(req).await?;
713
714 let status = resp.status();
715 let content_type = resp
716 .headers()
717 .get("content-type")
718 .and_then(|v| v.to_str().ok())
719 .unwrap_or("application/octet-stream");
720 let content_type = super::ContentType::from(content_type);
721
722 if !status.is_client_error() && !status.is_server_error() {
723 let content = resp.text().await?;
724 match content_type {
725 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
726 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::messaging::GetMessagingActionsForOrderResponse`"))),
727 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::messaging::GetMessagingActionsForOrderResponse`")))),
728 }
729 } else {
730 let content = resp.text().await?;
731 let entity: Option<GetMessagingActionsForOrderError> = serde_json::from_str(&content).ok();
732 Err(Error::ResponseError(ResponseContent { status, content, entity }))
733 }
734}
735
736pub async fn send_invoice(configuration: &configuration::Configuration, amazon_order_id: &str, marketplace_ids: Vec<String>, body: models::messaging::InvoiceRequest) -> Result<models::messaging::InvoiceResponse, Error<SendInvoiceError>> {
738 let p_amazon_order_id = amazon_order_id;
740 let p_marketplace_ids = marketplace_ids;
741 let p_body = body;
742
743 let uri_str = format!("{}/messaging/v1/orders/{amazonOrderId}/messages/invoice", configuration.base_path, amazonOrderId=crate::apis::urlencode(p_amazon_order_id));
744 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
745
746 req_builder = match "csv" {
747 "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)>>()),
748 _ => req_builder.query(&[("marketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
749 };
750 if let Some(ref user_agent) = configuration.user_agent {
751 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
752 }
753 req_builder = req_builder.json(&p_body);
754
755 let req = req_builder.build()?;
756 let resp = configuration.client.execute(req).await?;
757
758 let status = resp.status();
759 let content_type = resp
760 .headers()
761 .get("content-type")
762 .and_then(|v| v.to_str().ok())
763 .unwrap_or("application/octet-stream");
764 let content_type = super::ContentType::from(content_type);
765
766 if !status.is_client_error() && !status.is_server_error() {
767 let content = resp.text().await?;
768 match content_type {
769 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
770 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::messaging::InvoiceResponse`"))),
771 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::messaging::InvoiceResponse`")))),
772 }
773 } else {
774 let content = resp.text().await?;
775 let entity: Option<SendInvoiceError> = serde_json::from_str(&content).ok();
776 Err(Error::ResponseError(ResponseContent { status, content, entity }))
777 }
778}
779