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 CancelFulfillmentOrderError {
22 Status400(models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse),
23 Status401(models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse),
24 Status403(models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse),
25 Status404(models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse),
26 Status429(models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse),
27 Status500(models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse),
28 Status503(models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse),
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum CreateFulfillmentOrderError {
36 Status400(models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse),
37 Status401(models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse),
38 Status403(models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse),
39 Status404(models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse),
40 Status429(models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse),
41 Status500(models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse),
42 Status503(models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse),
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum CreateFulfillmentReturnError {
50 Status400(models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse),
51 Status401(models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse),
52 Status403(models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse),
53 Status404(models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse),
54 Status429(models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse),
55 Status500(models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse),
56 Status503(models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse),
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum DeliveryOffersError {
64 Status400(models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse),
65 Status401(models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse),
66 Status403(models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse),
67 Status404(models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse),
68 Status429(models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse),
69 Status500(models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse),
70 Status503(models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse),
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetFeatureInventoryError {
78 Status400(models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse),
79 Status401(models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse),
80 Status403(models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse),
81 Status404(models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse),
82 Status429(models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse),
83 Status500(models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse),
84 Status503(models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse),
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetFeatureSkuError {
92 Status400(models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse),
93 Status401(models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse),
94 Status403(models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse),
95 Status404(models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse),
96 Status429(models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse),
97 Status500(models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse),
98 Status503(models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse),
99 UnknownValue(serde_json::Value),
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104#[serde(untagged)]
105pub enum GetFeaturesError {
106 Status400(models::fulfillment_outbound_2020_07_01::GetFeaturesResponse),
107 Status401(models::fulfillment_outbound_2020_07_01::GetFeaturesResponse),
108 Status403(models::fulfillment_outbound_2020_07_01::GetFeaturesResponse),
109 Status404(models::fulfillment_outbound_2020_07_01::GetFeaturesResponse),
110 Status429(models::fulfillment_outbound_2020_07_01::GetFeaturesResponse),
111 Status500(models::fulfillment_outbound_2020_07_01::GetFeaturesResponse),
112 Status503(models::fulfillment_outbound_2020_07_01::GetFeaturesResponse),
113 UnknownValue(serde_json::Value),
114}
115
116#[derive(Debug, Clone, Serialize, Deserialize)]
118#[serde(untagged)]
119pub enum GetFulfillmentOrderError {
120 Status400(models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse),
121 Status401(models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse),
122 Status403(models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse),
123 Status404(models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse),
124 Status429(models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse),
125 Status500(models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse),
126 Status503(models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse),
127 UnknownValue(serde_json::Value),
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum GetFulfillmentPreviewError {
134 Status400(models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse),
135 Status401(models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse),
136 Status403(models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse),
137 Status404(models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse),
138 Status429(models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse),
139 Status500(models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse),
140 Status503(models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse),
141 UnknownValue(serde_json::Value),
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum GetPackageTrackingDetailsError {
148 Status400(models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse),
149 Status401(models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse),
150 Status403(models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse),
151 Status404(models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse),
152 Status429(models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse),
153 Status500(models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse),
154 Status503(models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse),
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum ListAllFulfillmentOrdersError {
162 Status400(models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse),
163 Status401(models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse),
164 Status403(models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse),
165 Status404(models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse),
166 Status429(models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse),
167 Status500(models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse),
168 Status503(models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse),
169 UnknownValue(serde_json::Value),
170}
171
172#[derive(Debug, Clone, Serialize, Deserialize)]
174#[serde(untagged)]
175pub enum ListReturnReasonCodesError {
176 Status400(models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse),
177 Status401(models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse),
178 Status403(models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse),
179 Status404(models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse),
180 Status429(models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse),
181 Status500(models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse),
182 Status503(models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse),
183 UnknownValue(serde_json::Value),
184}
185
186#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum SubmitFulfillmentOrderStatusUpdateError {
190 Status400(models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse),
191 Status401(models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse),
192 Status403(models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse),
193 Status404(models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse),
194 Status429(models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse),
195 Status500(models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse),
196 Status503(models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse),
197 UnknownValue(serde_json::Value),
198}
199
200#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum UpdateFulfillmentOrderError {
204 Status400(models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse),
205 Status401(models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse),
206 Status403(models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse),
207 Status404(models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse),
208 Status429(models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse),
209 Status500(models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse),
210 Status503(models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse),
211 UnknownValue(serde_json::Value),
212}
213
214
215pub async fn cancel_fulfillment_order(configuration: &configuration::Configuration, seller_fulfillment_order_id: &str) -> Result<models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse, Error<CancelFulfillmentOrderError>> {
217 let p_seller_fulfillment_order_id = seller_fulfillment_order_id;
219
220 let uri_str = format!("{}/fba/outbound/2020-07-01/fulfillmentOrders/{sellerFulfillmentOrderId}/cancel", configuration.base_path, sellerFulfillmentOrderId=crate::apis::urlencode(p_seller_fulfillment_order_id));
221 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
222
223 if let Some(ref user_agent) = configuration.user_agent {
224 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
225 }
226
227 let req = req_builder.build()?;
228 let resp = configuration.client.execute(req).await?;
229
230 let status = resp.status();
231 let content_type = resp
232 .headers()
233 .get("content-type")
234 .and_then(|v| v.to_str().ok())
235 .unwrap_or("application/octet-stream");
236 let content_type = super::ContentType::from(content_type);
237
238 if !status.is_client_error() && !status.is_server_error() {
239 let content = resp.text().await?;
240 match content_type {
241 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
242 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse`"))),
243 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::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse`")))),
244 }
245 } else {
246 let content = resp.text().await?;
247 let entity: Option<CancelFulfillmentOrderError> = serde_json::from_str(&content).ok();
248 Err(Error::ResponseError(ResponseContent { status, content, entity }))
249 }
250}
251
252pub async fn create_fulfillment_order(configuration: &configuration::Configuration, body: models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderRequest) -> Result<models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse, Error<CreateFulfillmentOrderError>> {
254 let p_body = body;
256
257 let uri_str = format!("{}/fba/outbound/2020-07-01/fulfillmentOrders", configuration.base_path);
258 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
259
260 if let Some(ref user_agent) = configuration.user_agent {
261 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
262 }
263 req_builder = req_builder.json(&p_body);
264
265 let req = req_builder.build()?;
266 let resp = configuration.client.execute(req).await?;
267
268 let status = resp.status();
269 let content_type = resp
270 .headers()
271 .get("content-type")
272 .and_then(|v| v.to_str().ok())
273 .unwrap_or("application/octet-stream");
274 let content_type = super::ContentType::from(content_type);
275
276 if !status.is_client_error() && !status.is_server_error() {
277 let content = resp.text().await?;
278 match content_type {
279 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
280 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse`"))),
281 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::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse`")))),
282 }
283 } else {
284 let content = resp.text().await?;
285 let entity: Option<CreateFulfillmentOrderError> = serde_json::from_str(&content).ok();
286 Err(Error::ResponseError(ResponseContent { status, content, entity }))
287 }
288}
289
290pub async fn create_fulfillment_return(configuration: &configuration::Configuration, seller_fulfillment_order_id: &str, body: models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnRequest) -> Result<models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse, Error<CreateFulfillmentReturnError>> {
292 let p_seller_fulfillment_order_id = seller_fulfillment_order_id;
294 let p_body = body;
295
296 let uri_str = format!("{}/fba/outbound/2020-07-01/fulfillmentOrders/{sellerFulfillmentOrderId}/return", configuration.base_path, sellerFulfillmentOrderId=crate::apis::urlencode(p_seller_fulfillment_order_id));
297 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
298
299 if let Some(ref user_agent) = configuration.user_agent {
300 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
301 }
302 req_builder = req_builder.json(&p_body);
303
304 let req = req_builder.build()?;
305 let resp = configuration.client.execute(req).await?;
306
307 let status = resp.status();
308 let content_type = resp
309 .headers()
310 .get("content-type")
311 .and_then(|v| v.to_str().ok())
312 .unwrap_or("application/octet-stream");
313 let content_type = super::ContentType::from(content_type);
314
315 if !status.is_client_error() && !status.is_server_error() {
316 let content = resp.text().await?;
317 match content_type {
318 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
319 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse`"))),
320 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::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse`")))),
321 }
322 } else {
323 let content = resp.text().await?;
324 let entity: Option<CreateFulfillmentReturnError> = serde_json::from_str(&content).ok();
325 Err(Error::ResponseError(ResponseContent { status, content, entity }))
326 }
327}
328
329pub async fn delivery_offers(configuration: &configuration::Configuration, body: models::fulfillment_outbound_2020_07_01::GetDeliveryOffersRequest) -> Result<models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse, Error<DeliveryOffersError>> {
331 let p_body = body;
333
334 let uri_str = format!("{}/fba/outbound/2020-07-01/deliveryOffers", configuration.base_path);
335 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
336
337 if let Some(ref user_agent) = configuration.user_agent {
338 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
339 }
340 req_builder = req_builder.json(&p_body);
341
342 let req = req_builder.build()?;
343 let resp = configuration.client.execute(req).await?;
344
345 let status = resp.status();
346 let content_type = resp
347 .headers()
348 .get("content-type")
349 .and_then(|v| v.to_str().ok())
350 .unwrap_or("application/octet-stream");
351 let content_type = super::ContentType::from(content_type);
352
353 if !status.is_client_error() && !status.is_server_error() {
354 let content = resp.text().await?;
355 match content_type {
356 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
357 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse`"))),
358 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::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse`")))),
359 }
360 } else {
361 let content = resp.text().await?;
362 let entity: Option<DeliveryOffersError> = serde_json::from_str(&content).ok();
363 Err(Error::ResponseError(ResponseContent { status, content, entity }))
364 }
365}
366
367pub async fn get_feature_inventory(configuration: &configuration::Configuration, marketplace_id: &str, feature_name: &str, next_token: Option<&str>, query_start_date: Option<String>) -> Result<models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse, Error<GetFeatureInventoryError>> {
369 let p_marketplace_id = marketplace_id;
371 let p_feature_name = feature_name;
372 let p_next_token = next_token;
373 let p_query_start_date = query_start_date;
374
375 let uri_str = format!("{}/fba/outbound/2020-07-01/features/inventory/{featureName}", configuration.base_path, featureName=crate::apis::urlencode(p_feature_name));
376 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
377
378 req_builder = req_builder.query(&[("marketplaceId", &p_marketplace_id.to_string())]);
379 if let Some(ref param_value) = p_next_token {
380 req_builder = req_builder.query(&[("nextToken", ¶m_value.to_string())]);
381 }
382 if let Some(ref param_value) = p_query_start_date {
383 req_builder = req_builder.query(&[("queryStartDate", ¶m_value.to_string())]);
384 }
385 if let Some(ref user_agent) = configuration.user_agent {
386 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
387 }
388
389 let req = req_builder.build()?;
390 let resp = configuration.client.execute(req).await?;
391
392 let status = resp.status();
393 let content_type = resp
394 .headers()
395 .get("content-type")
396 .and_then(|v| v.to_str().ok())
397 .unwrap_or("application/octet-stream");
398 let content_type = super::ContentType::from(content_type);
399
400 if !status.is_client_error() && !status.is_server_error() {
401 let content = resp.text().await?;
402 match content_type {
403 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
404 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse`"))),
405 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::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse`")))),
406 }
407 } else {
408 let content = resp.text().await?;
409 let entity: Option<GetFeatureInventoryError> = serde_json::from_str(&content).ok();
410 Err(Error::ResponseError(ResponseContent { status, content, entity }))
411 }
412}
413
414pub async fn get_feature_sku(configuration: &configuration::Configuration, marketplace_id: &str, feature_name: &str, seller_sku: &str) -> Result<models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse, Error<GetFeatureSkuError>> {
416 let p_marketplace_id = marketplace_id;
418 let p_feature_name = feature_name;
419 let p_seller_sku = seller_sku;
420
421 let uri_str = format!("{}/fba/outbound/2020-07-01/features/inventory/{featureName}/{sellerSku}", configuration.base_path, featureName=crate::apis::urlencode(p_feature_name), sellerSku=crate::apis::urlencode(p_seller_sku));
422 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
423
424 req_builder = req_builder.query(&[("marketplaceId", &p_marketplace_id.to_string())]);
425 if let Some(ref user_agent) = configuration.user_agent {
426 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
427 }
428
429 let req = req_builder.build()?;
430 let resp = configuration.client.execute(req).await?;
431
432 let status = resp.status();
433 let content_type = resp
434 .headers()
435 .get("content-type")
436 .and_then(|v| v.to_str().ok())
437 .unwrap_or("application/octet-stream");
438 let content_type = super::ContentType::from(content_type);
439
440 if !status.is_client_error() && !status.is_server_error() {
441 let content = resp.text().await?;
442 match content_type {
443 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
444 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse`"))),
445 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::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse`")))),
446 }
447 } else {
448 let content = resp.text().await?;
449 let entity: Option<GetFeatureSkuError> = serde_json::from_str(&content).ok();
450 Err(Error::ResponseError(ResponseContent { status, content, entity }))
451 }
452}
453
454pub async fn get_features(configuration: &configuration::Configuration, marketplace_id: &str) -> Result<models::fulfillment_outbound_2020_07_01::GetFeaturesResponse, Error<GetFeaturesError>> {
456 let p_marketplace_id = marketplace_id;
458
459 let uri_str = format!("{}/fba/outbound/2020-07-01/features", configuration.base_path);
460 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
461
462 req_builder = req_builder.query(&[("marketplaceId", &p_marketplace_id.to_string())]);
463 if let Some(ref user_agent) = configuration.user_agent {
464 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
465 }
466
467 let req = req_builder.build()?;
468 let resp = configuration.client.execute(req).await?;
469
470 let status = resp.status();
471 let content_type = resp
472 .headers()
473 .get("content-type")
474 .and_then(|v| v.to_str().ok())
475 .unwrap_or("application/octet-stream");
476 let content_type = super::ContentType::from(content_type);
477
478 if !status.is_client_error() && !status.is_server_error() {
479 let content = resp.text().await?;
480 match content_type {
481 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
482 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::GetFeaturesResponse`"))),
483 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::fulfillment_outbound_2020_07_01::GetFeaturesResponse`")))),
484 }
485 } else {
486 let content = resp.text().await?;
487 let entity: Option<GetFeaturesError> = serde_json::from_str(&content).ok();
488 Err(Error::ResponseError(ResponseContent { status, content, entity }))
489 }
490}
491
492pub async fn get_fulfillment_order(configuration: &configuration::Configuration, seller_fulfillment_order_id: &str) -> Result<models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse, Error<GetFulfillmentOrderError>> {
494 let p_seller_fulfillment_order_id = seller_fulfillment_order_id;
496
497 let uri_str = format!("{}/fba/outbound/2020-07-01/fulfillmentOrders/{sellerFulfillmentOrderId}", configuration.base_path, sellerFulfillmentOrderId=crate::apis::urlencode(p_seller_fulfillment_order_id));
498 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
499
500 if let Some(ref user_agent) = configuration.user_agent {
501 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
502 }
503
504 let req = req_builder.build()?;
505 let resp = configuration.client.execute(req).await?;
506
507 let status = resp.status();
508 let content_type = resp
509 .headers()
510 .get("content-type")
511 .and_then(|v| v.to_str().ok())
512 .unwrap_or("application/octet-stream");
513 let content_type = super::ContentType::from(content_type);
514
515 if !status.is_client_error() && !status.is_server_error() {
516 let content = resp.text().await?;
517 match content_type {
518 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
519 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse`"))),
520 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::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse`")))),
521 }
522 } else {
523 let content = resp.text().await?;
524 let entity: Option<GetFulfillmentOrderError> = serde_json::from_str(&content).ok();
525 Err(Error::ResponseError(ResponseContent { status, content, entity }))
526 }
527}
528
529pub async fn get_fulfillment_preview(configuration: &configuration::Configuration, body: models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewRequest) -> Result<models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse, Error<GetFulfillmentPreviewError>> {
531 let p_body = body;
533
534 let uri_str = format!("{}/fba/outbound/2020-07-01/fulfillmentOrders/preview", configuration.base_path);
535 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
536
537 if let Some(ref user_agent) = configuration.user_agent {
538 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
539 }
540 req_builder = req_builder.json(&p_body);
541
542 let req = req_builder.build()?;
543 let resp = configuration.client.execute(req).await?;
544
545 let status = resp.status();
546 let content_type = resp
547 .headers()
548 .get("content-type")
549 .and_then(|v| v.to_str().ok())
550 .unwrap_or("application/octet-stream");
551 let content_type = super::ContentType::from(content_type);
552
553 if !status.is_client_error() && !status.is_server_error() {
554 let content = resp.text().await?;
555 match content_type {
556 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
557 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse`"))),
558 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::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse`")))),
559 }
560 } else {
561 let content = resp.text().await?;
562 let entity: Option<GetFulfillmentPreviewError> = serde_json::from_str(&content).ok();
563 Err(Error::ResponseError(ResponseContent { status, content, entity }))
564 }
565}
566
567pub async fn get_package_tracking_details(configuration: &configuration::Configuration, package_number: i32) -> Result<models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse, Error<GetPackageTrackingDetailsError>> {
569 let p_package_number = package_number;
571
572 let uri_str = format!("{}/fba/outbound/2020-07-01/tracking", configuration.base_path);
573 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
574
575 req_builder = req_builder.query(&[("packageNumber", &p_package_number.to_string())]);
576 if let Some(ref user_agent) = configuration.user_agent {
577 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
578 }
579
580 let req = req_builder.build()?;
581 let resp = configuration.client.execute(req).await?;
582
583 let status = resp.status();
584 let content_type = resp
585 .headers()
586 .get("content-type")
587 .and_then(|v| v.to_str().ok())
588 .unwrap_or("application/octet-stream");
589 let content_type = super::ContentType::from(content_type);
590
591 if !status.is_client_error() && !status.is_server_error() {
592 let content = resp.text().await?;
593 match content_type {
594 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
595 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse`"))),
596 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::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse`")))),
597 }
598 } else {
599 let content = resp.text().await?;
600 let entity: Option<GetPackageTrackingDetailsError> = serde_json::from_str(&content).ok();
601 Err(Error::ResponseError(ResponseContent { status, content, entity }))
602 }
603}
604
605pub async fn list_all_fulfillment_orders(configuration: &configuration::Configuration, query_start_date: Option<String>, next_token: Option<&str>) -> Result<models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse, Error<ListAllFulfillmentOrdersError>> {
607 let p_query_start_date = query_start_date;
609 let p_next_token = next_token;
610
611 let uri_str = format!("{}/fba/outbound/2020-07-01/fulfillmentOrders", configuration.base_path);
612 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
613
614 if let Some(ref param_value) = p_query_start_date {
615 req_builder = req_builder.query(&[("queryStartDate", ¶m_value.to_string())]);
616 }
617 if let Some(ref param_value) = p_next_token {
618 req_builder = req_builder.query(&[("nextToken", ¶m_value.to_string())]);
619 }
620 if let Some(ref user_agent) = configuration.user_agent {
621 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
622 }
623
624 let req = req_builder.build()?;
625 let resp = configuration.client.execute(req).await?;
626
627 let status = resp.status();
628 let content_type = resp
629 .headers()
630 .get("content-type")
631 .and_then(|v| v.to_str().ok())
632 .unwrap_or("application/octet-stream");
633 let content_type = super::ContentType::from(content_type);
634
635 if !status.is_client_error() && !status.is_server_error() {
636 let content = resp.text().await?;
637 match content_type {
638 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
639 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse`"))),
640 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::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse`")))),
641 }
642 } else {
643 let content = resp.text().await?;
644 let entity: Option<ListAllFulfillmentOrdersError> = serde_json::from_str(&content).ok();
645 Err(Error::ResponseError(ResponseContent { status, content, entity }))
646 }
647}
648
649pub async fn list_return_reason_codes(configuration: &configuration::Configuration, seller_sku: &str, marketplace_id: Option<&str>, seller_fulfillment_order_id: Option<&str>, language: Option<&str>) -> Result<models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse, Error<ListReturnReasonCodesError>> {
651 let p_seller_sku = seller_sku;
653 let p_marketplace_id = marketplace_id;
654 let p_seller_fulfillment_order_id = seller_fulfillment_order_id;
655 let p_language = language;
656
657 let uri_str = format!("{}/fba/outbound/2020-07-01/returnReasonCodes", configuration.base_path);
658 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
659
660 req_builder = req_builder.query(&[("sellerSku", &p_seller_sku.to_string())]);
661 if let Some(ref param_value) = p_marketplace_id {
662 req_builder = req_builder.query(&[("marketplaceId", ¶m_value.to_string())]);
663 }
664 if let Some(ref param_value) = p_seller_fulfillment_order_id {
665 req_builder = req_builder.query(&[("sellerFulfillmentOrderId", ¶m_value.to_string())]);
666 }
667 if let Some(ref param_value) = p_language {
668 req_builder = req_builder.query(&[("language", ¶m_value.to_string())]);
669 }
670 if let Some(ref user_agent) = configuration.user_agent {
671 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
672 }
673
674 let req = req_builder.build()?;
675 let resp = configuration.client.execute(req).await?;
676
677 let status = resp.status();
678 let content_type = resp
679 .headers()
680 .get("content-type")
681 .and_then(|v| v.to_str().ok())
682 .unwrap_or("application/octet-stream");
683 let content_type = super::ContentType::from(content_type);
684
685 if !status.is_client_error() && !status.is_server_error() {
686 let content = resp.text().await?;
687 match content_type {
688 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
689 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse`"))),
690 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::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse`")))),
691 }
692 } else {
693 let content = resp.text().await?;
694 let entity: Option<ListReturnReasonCodesError> = serde_json::from_str(&content).ok();
695 Err(Error::ResponseError(ResponseContent { status, content, entity }))
696 }
697}
698
699pub async fn submit_fulfillment_order_status_update(configuration: &configuration::Configuration, seller_fulfillment_order_id: &str, body: models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateRequest) -> Result<models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse, Error<SubmitFulfillmentOrderStatusUpdateError>> {
701 let p_seller_fulfillment_order_id = seller_fulfillment_order_id;
703 let p_body = body;
704
705 let uri_str = format!("{}/fba/outbound/2020-07-01/fulfillmentOrders/{sellerFulfillmentOrderId}/status", configuration.base_path, sellerFulfillmentOrderId=crate::apis::urlencode(p_seller_fulfillment_order_id));
706 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
707
708 if let Some(ref user_agent) = configuration.user_agent {
709 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
710 }
711 req_builder = req_builder.json(&p_body);
712
713 let req = req_builder.build()?;
714 let resp = configuration.client.execute(req).await?;
715
716 let status = resp.status();
717 let content_type = resp
718 .headers()
719 .get("content-type")
720 .and_then(|v| v.to_str().ok())
721 .unwrap_or("application/octet-stream");
722 let content_type = super::ContentType::from(content_type);
723
724 if !status.is_client_error() && !status.is_server_error() {
725 let content = resp.text().await?;
726 match content_type {
727 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
728 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse`"))),
729 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::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse`")))),
730 }
731 } else {
732 let content = resp.text().await?;
733 let entity: Option<SubmitFulfillmentOrderStatusUpdateError> = serde_json::from_str(&content).ok();
734 Err(Error::ResponseError(ResponseContent { status, content, entity }))
735 }
736}
737
738pub async fn update_fulfillment_order(configuration: &configuration::Configuration, seller_fulfillment_order_id: &str, body: models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderRequest) -> Result<models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse, Error<UpdateFulfillmentOrderError>> {
740 let p_seller_fulfillment_order_id = seller_fulfillment_order_id;
742 let p_body = body;
743
744 let uri_str = format!("{}/fba/outbound/2020-07-01/fulfillmentOrders/{sellerFulfillmentOrderId}", configuration.base_path, sellerFulfillmentOrderId=crate::apis::urlencode(p_seller_fulfillment_order_id));
745 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
746
747 if let Some(ref user_agent) = configuration.user_agent {
748 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
749 }
750 req_builder = req_builder.json(&p_body);
751
752 let req = req_builder.build()?;
753 let resp = configuration.client.execute(req).await?;
754
755 let status = resp.status();
756 let content_type = resp
757 .headers()
758 .get("content-type")
759 .and_then(|v| v.to_str().ok())
760 .unwrap_or("application/octet-stream");
761 let content_type = super::ContentType::from(content_type);
762
763 if !status.is_client_error() && !status.is_server_error() {
764 let content = resp.text().await?;
765 match content_type {
766 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
767 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse`"))),
768 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::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse`")))),
769 }
770 } else {
771 let content = resp.text().await?;
772 let entity: Option<UpdateFulfillmentOrderError> = serde_json::from_str(&content).ok();
773 Err(Error::ResponseError(ResponseContent { status, content, entity }))
774 }
775}
776