amazon_spapi/apis/
shipping_v2.rs

1/*
2 * Amazon Shipping API
3 *
4 * The Amazon Shipping API is designed to support outbound shipping use cases both for orders originating on Amazon-owned marketplaces as well as external channels/marketplaces. With these APIs, you can request shipping rates, create shipments, cancel shipments, and track shipments.
5 *
6 * The version of the OpenAPI document: v2
7 * Contact: swa-api-core@amazon.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18/// struct for typed errors of method [`cancel_shipment`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CancelShipmentError {
22    Status400(models::shipping_v2::ErrorList),
23    Status401(models::shipping_v2::ErrorList),
24    Status403(models::shipping_v2::ErrorList),
25    Status404(models::shipping_v2::ErrorList),
26    Status413(models::shipping_v2::ErrorList),
27    Status415(models::shipping_v2::ErrorList),
28    Status429(models::shipping_v2::ErrorList),
29    Status500(models::shipping_v2::ErrorList),
30    Status503(models::shipping_v2::ErrorList),
31    UnknownValue(serde_json::Value),
32}
33
34/// struct for typed errors of method [`create_claim`]
35#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum CreateClaimError {
38    Status400(models::shipping_v2::ErrorList),
39    Status401(models::shipping_v2::ErrorList),
40    Status403(models::shipping_v2::ErrorList),
41    Status404(models::shipping_v2::ErrorList),
42    Status413(models::shipping_v2::ErrorList),
43    Status415(models::shipping_v2::ErrorList),
44    Status429(models::shipping_v2::ErrorList),
45    Status500(models::shipping_v2::ErrorList),
46    Status503(models::shipping_v2::ErrorList),
47    UnknownValue(serde_json::Value),
48}
49
50/// struct for typed errors of method [`direct_purchase_shipment`]
51#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum DirectPurchaseShipmentError {
54    Status400(models::shipping_v2::ErrorList),
55    Status401(models::shipping_v2::ErrorList),
56    Status403(models::shipping_v2::ErrorList),
57    Status404(models::shipping_v2::ErrorList),
58    Status413(models::shipping_v2::ErrorList),
59    Status415(models::shipping_v2::ErrorList),
60    Status429(models::shipping_v2::ErrorList),
61    Status500(models::shipping_v2::ErrorList),
62    Status503(models::shipping_v2::ErrorList),
63    UnknownValue(serde_json::Value),
64}
65
66/// struct for typed errors of method [`generate_collection_form`]
67#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum GenerateCollectionFormError {
70    Status400(models::shipping_v2::ErrorList),
71    Status401(models::shipping_v2::ErrorList),
72    Status403(models::shipping_v2::ErrorList),
73    Status404(models::shipping_v2::ErrorList),
74    Status413(models::shipping_v2::ErrorList),
75    Status415(models::shipping_v2::ErrorList),
76    Status429(models::shipping_v2::ErrorList),
77    Status500(models::shipping_v2::ErrorList),
78    Status503(models::shipping_v2::ErrorList),
79    UnknownValue(serde_json::Value),
80}
81
82/// struct for typed errors of method [`get_access_points`]
83#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum GetAccessPointsError {
86    Status400(models::shipping_v2::ErrorList),
87    Status401(models::shipping_v2::ErrorList),
88    Status403(models::shipping_v2::ErrorList),
89    Status404(models::shipping_v2::ErrorList),
90    Status413(models::shipping_v2::ErrorList),
91    Status415(models::shipping_v2::ErrorList),
92    Status429(models::shipping_v2::ErrorList),
93    Status500(models::shipping_v2::ErrorList),
94    Status503(models::shipping_v2::ErrorList),
95    UnknownValue(serde_json::Value),
96}
97
98/// struct for typed errors of method [`get_additional_inputs`]
99#[derive(Debug, Clone, Serialize, Deserialize)]
100#[serde(untagged)]
101pub enum GetAdditionalInputsError {
102    Status400(models::shipping_v2::ErrorList),
103    Status401(models::shipping_v2::ErrorList),
104    Status403(models::shipping_v2::ErrorList),
105    Status404(models::shipping_v2::ErrorList),
106    Status413(models::shipping_v2::ErrorList),
107    Status415(models::shipping_v2::ErrorList),
108    Status429(models::shipping_v2::ErrorList),
109    Status500(models::shipping_v2::ErrorList),
110    Status503(models::shipping_v2::ErrorList),
111    UnknownValue(serde_json::Value),
112}
113
114/// struct for typed errors of method [`get_carrier_account_form_inputs`]
115#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum GetCarrierAccountFormInputsError {
118    Status400(models::shipping_v2::ErrorList),
119    Status401(models::shipping_v2::ErrorList),
120    Status403(models::shipping_v2::ErrorList),
121    Status404(models::shipping_v2::ErrorList),
122    Status413(models::shipping_v2::ErrorList),
123    Status415(models::shipping_v2::ErrorList),
124    Status429(models::shipping_v2::ErrorList),
125    Status500(models::shipping_v2::ErrorList),
126    Status503(models::shipping_v2::ErrorList),
127    UnknownValue(serde_json::Value),
128}
129
130/// struct for typed errors of method [`get_carrier_accounts`]
131#[derive(Debug, Clone, Serialize, Deserialize)]
132#[serde(untagged)]
133pub enum GetCarrierAccountsError {
134    Status400(models::shipping_v2::ErrorList),
135    Status401(models::shipping_v2::ErrorList),
136    Status403(models::shipping_v2::ErrorList),
137    Status404(models::shipping_v2::ErrorList),
138    Status413(models::shipping_v2::ErrorList),
139    Status415(models::shipping_v2::ErrorList),
140    Status429(models::shipping_v2::ErrorList),
141    Status500(models::shipping_v2::ErrorList),
142    Status503(models::shipping_v2::ErrorList),
143    UnknownValue(serde_json::Value),
144}
145
146/// struct for typed errors of method [`get_collection_form`]
147#[derive(Debug, Clone, Serialize, Deserialize)]
148#[serde(untagged)]
149pub enum GetCollectionFormError {
150    Status400(models::shipping_v2::ErrorList),
151    Status401(models::shipping_v2::ErrorList),
152    Status403(models::shipping_v2::ErrorList),
153    Status404(models::shipping_v2::ErrorList),
154    Status413(models::shipping_v2::ErrorList),
155    Status415(models::shipping_v2::ErrorList),
156    Status429(models::shipping_v2::ErrorList),
157    Status500(models::shipping_v2::ErrorList),
158    Status503(models::shipping_v2::ErrorList),
159    UnknownValue(serde_json::Value),
160}
161
162/// struct for typed errors of method [`get_collection_form_history`]
163#[derive(Debug, Clone, Serialize, Deserialize)]
164#[serde(untagged)]
165pub enum GetCollectionFormHistoryError {
166    Status400(models::shipping_v2::ErrorList),
167    Status401(models::shipping_v2::ErrorList),
168    Status403(models::shipping_v2::ErrorList),
169    Status404(models::shipping_v2::ErrorList),
170    Status413(models::shipping_v2::ErrorList),
171    Status415(models::shipping_v2::ErrorList),
172    Status429(models::shipping_v2::ErrorList),
173    Status500(models::shipping_v2::ErrorList),
174    Status503(models::shipping_v2::ErrorList),
175    UnknownValue(serde_json::Value),
176}
177
178/// struct for typed errors of method [`get_rates`]
179#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum GetRatesError {
182    Status400(models::shipping_v2::ErrorList),
183    Status401(models::shipping_v2::ErrorList),
184    Status403(models::shipping_v2::ErrorList),
185    Status404(models::shipping_v2::ErrorList),
186    Status413(models::shipping_v2::ErrorList),
187    Status415(models::shipping_v2::ErrorList),
188    Status429(models::shipping_v2::ErrorList),
189    Status500(models::shipping_v2::ErrorList),
190    Status503(models::shipping_v2::ErrorList),
191    UnknownValue(serde_json::Value),
192}
193
194/// struct for typed errors of method [`get_shipment_documents`]
195#[derive(Debug, Clone, Serialize, Deserialize)]
196#[serde(untagged)]
197pub enum GetShipmentDocumentsError {
198    Status400(models::shipping_v2::ErrorList),
199    Status401(models::shipping_v2::ErrorList),
200    Status403(models::shipping_v2::ErrorList),
201    Status404(models::shipping_v2::ErrorList),
202    Status413(models::shipping_v2::ErrorList),
203    Status415(models::shipping_v2::ErrorList),
204    Status429(models::shipping_v2::ErrorList),
205    Status500(models::shipping_v2::ErrorList),
206    Status503(models::shipping_v2::ErrorList),
207    UnknownValue(serde_json::Value),
208}
209
210/// struct for typed errors of method [`get_tracking`]
211#[derive(Debug, Clone, Serialize, Deserialize)]
212#[serde(untagged)]
213pub enum GetTrackingError {
214    Status400(models::shipping_v2::ErrorList),
215    Status401(models::shipping_v2::ErrorList),
216    Status403(models::shipping_v2::ErrorList),
217    Status404(models::shipping_v2::ErrorList),
218    Status413(models::shipping_v2::ErrorList),
219    Status415(models::shipping_v2::ErrorList),
220    Status429(models::shipping_v2::ErrorList),
221    Status500(models::shipping_v2::ErrorList),
222    Status503(models::shipping_v2::ErrorList),
223    UnknownValue(serde_json::Value),
224}
225
226/// struct for typed errors of method [`get_unmanifested_shipments`]
227#[derive(Debug, Clone, Serialize, Deserialize)]
228#[serde(untagged)]
229pub enum GetUnmanifestedShipmentsError {
230    Status400(models::shipping_v2::ErrorList),
231    Status401(models::shipping_v2::ErrorList),
232    Status403(models::shipping_v2::ErrorList),
233    Status404(models::shipping_v2::ErrorList),
234    Status413(models::shipping_v2::ErrorList),
235    Status415(models::shipping_v2::ErrorList),
236    Status429(models::shipping_v2::ErrorList),
237    Status500(models::shipping_v2::ErrorList),
238    Status503(models::shipping_v2::ErrorList),
239    UnknownValue(serde_json::Value),
240}
241
242/// struct for typed errors of method [`link_carrier_account`]
243#[derive(Debug, Clone, Serialize, Deserialize)]
244#[serde(untagged)]
245pub enum LinkCarrierAccountError {
246    Status400(models::shipping_v2::ErrorList),
247    Status401(models::shipping_v2::ErrorList),
248    Status403(models::shipping_v2::ErrorList),
249    Status404(models::shipping_v2::ErrorList),
250    Status413(models::shipping_v2::ErrorList),
251    Status415(models::shipping_v2::ErrorList),
252    Status429(models::shipping_v2::ErrorList),
253    Status500(models::shipping_v2::ErrorList),
254    Status503(models::shipping_v2::ErrorList),
255    UnknownValue(serde_json::Value),
256}
257
258/// struct for typed errors of method [`link_carrier_account_0`]
259#[derive(Debug, Clone, Serialize, Deserialize)]
260#[serde(untagged)]
261pub enum LinkCarrierAccount0Error {
262    Status400(models::shipping_v2::ErrorList),
263    Status401(models::shipping_v2::ErrorList),
264    Status403(models::shipping_v2::ErrorList),
265    Status404(models::shipping_v2::ErrorList),
266    Status413(models::shipping_v2::ErrorList),
267    Status415(models::shipping_v2::ErrorList),
268    Status429(models::shipping_v2::ErrorList),
269    Status500(models::shipping_v2::ErrorList),
270    Status503(models::shipping_v2::ErrorList),
271    UnknownValue(serde_json::Value),
272}
273
274/// struct for typed errors of method [`one_click_shipment`]
275#[derive(Debug, Clone, Serialize, Deserialize)]
276#[serde(untagged)]
277pub enum OneClickShipmentError {
278    Status400(models::shipping_v2::ErrorList),
279    Status401(models::shipping_v2::ErrorList),
280    Status403(models::shipping_v2::ErrorList),
281    Status404(models::shipping_v2::ErrorList),
282    Status413(models::shipping_v2::ErrorList),
283    Status415(models::shipping_v2::ErrorList),
284    Status429(models::shipping_v2::ErrorList),
285    Status500(models::shipping_v2::ErrorList),
286    Status503(models::shipping_v2::ErrorList),
287    UnknownValue(serde_json::Value),
288}
289
290/// struct for typed errors of method [`purchase_shipment`]
291#[derive(Debug, Clone, Serialize, Deserialize)]
292#[serde(untagged)]
293pub enum PurchaseShipmentError {
294    Status400(models::shipping_v2::ErrorList),
295    Status401(models::shipping_v2::ErrorList),
296    Status403(models::shipping_v2::ErrorList),
297    Status404(models::shipping_v2::ErrorList),
298    Status413(models::shipping_v2::ErrorList),
299    Status415(models::shipping_v2::ErrorList),
300    Status429(models::shipping_v2::ErrorList),
301    Status500(models::shipping_v2::ErrorList),
302    Status503(models::shipping_v2::ErrorList),
303    UnknownValue(serde_json::Value),
304}
305
306/// struct for typed errors of method [`submit_ndr_feedback`]
307#[derive(Debug, Clone, Serialize, Deserialize)]
308#[serde(untagged)]
309pub enum SubmitNdrFeedbackError {
310    Status400(models::shipping_v2::ErrorList),
311    Status401(models::shipping_v2::ErrorList),
312    Status403(models::shipping_v2::ErrorList),
313    Status404(models::shipping_v2::ErrorList),
314    Status413(models::shipping_v2::ErrorList),
315    Status415(models::shipping_v2::ErrorList),
316    Status429(models::shipping_v2::ErrorList),
317    Status500(models::shipping_v2::ErrorList),
318    Status503(models::shipping_v2::ErrorList),
319    UnknownValue(serde_json::Value),
320}
321
322/// struct for typed errors of method [`unlink_carrier_account`]
323#[derive(Debug, Clone, Serialize, Deserialize)]
324#[serde(untagged)]
325pub enum UnlinkCarrierAccountError {
326    Status400(models::shipping_v2::ErrorList),
327    Status401(models::shipping_v2::ErrorList),
328    Status403(models::shipping_v2::ErrorList),
329    Status404(models::shipping_v2::ErrorList),
330    Status413(models::shipping_v2::ErrorList),
331    Status415(models::shipping_v2::ErrorList),
332    Status429(models::shipping_v2::ErrorList),
333    Status500(models::shipping_v2::ErrorList),
334    Status503(models::shipping_v2::ErrorList),
335    UnknownValue(serde_json::Value),
336}
337
338
339/// Cancels a purchased shipment. Returns an empty object if the shipment is successfully cancelled.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
340pub async fn cancel_shipment(configuration: &configuration::Configuration, shipment_id: &str, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::CancelShipmentResponse, Error<CancelShipmentError>> {
341    // add a prefix to parameters to efficiently prevent name collisions
342    let p_shipment_id = shipment_id;
343    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
344
345    let uri_str = format!("{}/shipping/v2/shipments/{shipmentId}/cancel", configuration.base_path, shipmentId=crate::apis::urlencode(p_shipment_id));
346    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
347
348    if let Some(ref user_agent) = configuration.user_agent {
349        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
350    }
351    if let Some(param_value) = p_x_amzn_shipping_business_id {
352        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
353    }
354
355    let req = req_builder.build()?;
356    let resp = configuration.client.execute(req).await?;
357
358    let status = resp.status();
359    let content_type = resp
360        .headers()
361        .get("content-type")
362        .and_then(|v| v.to_str().ok())
363        .unwrap_or("application/octet-stream");
364    let content_type = super::ContentType::from(content_type);
365
366    if !status.is_client_error() && !status.is_server_error() {
367        let content = resp.text().await?;
368        match content_type {
369            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
370            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::CancelShipmentResponse`"))),
371            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::shipping_v2::CancelShipmentResponse`")))),
372        }
373    } else {
374        let content = resp.text().await?;
375        let entity: Option<CancelShipmentError> = serde_json::from_str(&content).ok();
376        Err(Error::ResponseError(ResponseContent { status, content, entity }))
377    }
378}
379
380/// This API will be used to create claim for single eligible shipment.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).
381pub async fn create_claim(configuration: &configuration::Configuration, body: models::shipping_v2::CreateClaimRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::CreateClaimResponse, Error<CreateClaimError>> {
382    // add a prefix to parameters to efficiently prevent name collisions
383    let p_body = body;
384    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
385
386    let uri_str = format!("{}/shipping/v2/claims", configuration.base_path);
387    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
388
389    if let Some(ref user_agent) = configuration.user_agent {
390        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
391    }
392    if let Some(param_value) = p_x_amzn_shipping_business_id {
393        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
394    }
395    req_builder = req_builder.json(&p_body);
396
397    let req = req_builder.build()?;
398    let resp = configuration.client.execute(req).await?;
399
400    let status = resp.status();
401    let content_type = resp
402        .headers()
403        .get("content-type")
404        .and_then(|v| v.to_str().ok())
405        .unwrap_or("application/octet-stream");
406    let content_type = super::ContentType::from(content_type);
407
408    if !status.is_client_error() && !status.is_server_error() {
409        let content = resp.text().await?;
410        match content_type {
411            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
412            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::CreateClaimResponse`"))),
413            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::shipping_v2::CreateClaimResponse`")))),
414        }
415    } else {
416        let content = resp.text().await?;
417        let entity: Option<CreateClaimError> = serde_json::from_str(&content).ok();
418        Err(Error::ResponseError(ResponseContent { status, content, entity }))
419    }
420}
421
422/// Purchases the shipping service for a shipment using the best fit service offering. Returns purchase related details and documents.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
423pub async fn direct_purchase_shipment(configuration: &configuration::Configuration, body: models::shipping_v2::DirectPurchaseRequest, x_amzn_idempotency_key: Option<&str>, locale: Option<&str>, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::DirectPurchaseResponse, Error<DirectPurchaseShipmentError>> {
424    // add a prefix to parameters to efficiently prevent name collisions
425    let p_body = body;
426    let p_x_amzn_idempotency_key = x_amzn_idempotency_key;
427    let p_locale = locale;
428    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
429
430    let uri_str = format!("{}/shipping/v2/shipments/directPurchase", configuration.base_path);
431    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
432
433    if let Some(ref user_agent) = configuration.user_agent {
434        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
435    }
436    if let Some(param_value) = p_x_amzn_idempotency_key {
437        req_builder = req_builder.header("x-amzn-IdempotencyKey", param_value.to_string());
438    }
439    if let Some(param_value) = p_locale {
440        req_builder = req_builder.header("locale", param_value.to_string());
441    }
442    if let Some(param_value) = p_x_amzn_shipping_business_id {
443        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
444    }
445    req_builder = req_builder.json(&p_body);
446
447    let req = req_builder.build()?;
448    let resp = configuration.client.execute(req).await?;
449
450    let status = resp.status();
451    let content_type = resp
452        .headers()
453        .get("content-type")
454        .and_then(|v| v.to_str().ok())
455        .unwrap_or("application/octet-stream");
456    let content_type = super::ContentType::from(content_type);
457
458    if !status.is_client_error() && !status.is_server_error() {
459        let content = resp.text().await?;
460        match content_type {
461            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
462            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::DirectPurchaseResponse`"))),
463            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::shipping_v2::DirectPurchaseResponse`")))),
464        }
465    } else {
466        let content = resp.text().await?;
467        let entity: Option<DirectPurchaseShipmentError> = serde_json::from_str(&content).ok();
468        Err(Error::ResponseError(ResponseContent { status, content, entity }))
469    }
470}
471
472/// This API  Call to generate the collection form.   **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
473pub async fn generate_collection_form(configuration: &configuration::Configuration, body: models::shipping_v2::GenerateCollectionFormRequest, x_amzn_idempotency_key: Option<&str>, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GenerateCollectionFormResponse, Error<GenerateCollectionFormError>> {
474    // add a prefix to parameters to efficiently prevent name collisions
475    let p_body = body;
476    let p_x_amzn_idempotency_key = x_amzn_idempotency_key;
477    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
478
479    let uri_str = format!("{}/shipping/v2/collectionForms", configuration.base_path);
480    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
481
482    if let Some(ref user_agent) = configuration.user_agent {
483        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
484    }
485    if let Some(param_value) = p_x_amzn_idempotency_key {
486        req_builder = req_builder.header("x-amzn-IdempotencyKey", param_value.to_string());
487    }
488    if let Some(param_value) = p_x_amzn_shipping_business_id {
489        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
490    }
491    req_builder = req_builder.json(&p_body);
492
493    let req = req_builder.build()?;
494    let resp = configuration.client.execute(req).await?;
495
496    let status = resp.status();
497    let content_type = resp
498        .headers()
499        .get("content-type")
500        .and_then(|v| v.to_str().ok())
501        .unwrap_or("application/octet-stream");
502    let content_type = super::ContentType::from(content_type);
503
504    if !status.is_client_error() && !status.is_server_error() {
505        let content = resp.text().await?;
506        match content_type {
507            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
508            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::GenerateCollectionFormResponse`"))),
509            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::shipping_v2::GenerateCollectionFormResponse`")))),
510        }
511    } else {
512        let content = resp.text().await?;
513        let entity: Option<GenerateCollectionFormError> = serde_json::from_str(&content).ok();
514        Err(Error::ResponseError(ResponseContent { status, content, entity }))
515    }
516}
517
518/// Returns a list of access points in proximity of input postal code.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
519pub async fn get_access_points(configuration: &configuration::Configuration, access_point_types: Vec<String>, country_code: &str, postal_code: &str, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetAccessPointsResponse, Error<GetAccessPointsError>> {
520    // add a prefix to parameters to efficiently prevent name collisions
521    let p_access_point_types = access_point_types;
522    let p_country_code = country_code;
523    let p_postal_code = postal_code;
524    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
525
526    let uri_str = format!("{}/shipping/v2/accessPoints", configuration.base_path);
527    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
528
529    req_builder = match "csv" {
530        "multi" => req_builder.query(&p_access_point_types.into_iter().map(|p| ("accessPointTypes".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
531        _ => req_builder.query(&[("accessPointTypes", &p_access_point_types.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
532    };
533    req_builder = req_builder.query(&[("countryCode", &p_country_code.to_string())]);
534    req_builder = req_builder.query(&[("postalCode", &p_postal_code.to_string())]);
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    if let Some(param_value) = p_x_amzn_shipping_business_id {
539        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
540    }
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::shipping_v2::GetAccessPointsResponse`"))),
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::shipping_v2::GetAccessPointsResponse`")))),
559        }
560    } else {
561        let content = resp.text().await?;
562        let entity: Option<GetAccessPointsError> = serde_json::from_str(&content).ok();
563        Err(Error::ResponseError(ResponseContent { status, content, entity }))
564    }
565}
566
567/// Returns the JSON schema to use for providing additional inputs when needed to purchase a shipping offering. Call the getAdditionalInputs operation when the response to a previous call to the getRates operation indicates that additional inputs are required for the rate (shipping offering) that you want to purchase.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
568pub async fn get_additional_inputs(configuration: &configuration::Configuration, request_token: &str, rate_id: &str, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetAdditionalInputsResponse, Error<GetAdditionalInputsError>> {
569    // add a prefix to parameters to efficiently prevent name collisions
570    let p_request_token = request_token;
571    let p_rate_id = rate_id;
572    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
573
574    let uri_str = format!("{}/shipping/v2/shipments/additionalInputs/schema", configuration.base_path);
575    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
576
577    req_builder = req_builder.query(&[("requestToken", &p_request_token.to_string())]);
578    req_builder = req_builder.query(&[("rateId", &p_rate_id.to_string())]);
579    if let Some(ref user_agent) = configuration.user_agent {
580        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
581    }
582    if let Some(param_value) = p_x_amzn_shipping_business_id {
583        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
584    }
585
586    let req = req_builder.build()?;
587    let resp = configuration.client.execute(req).await?;
588
589    let status = resp.status();
590    let content_type = resp
591        .headers()
592        .get("content-type")
593        .and_then(|v| v.to_str().ok())
594        .unwrap_or("application/octet-stream");
595    let content_type = super::ContentType::from(content_type);
596
597    if !status.is_client_error() && !status.is_server_error() {
598        let content = resp.text().await?;
599        match content_type {
600            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
601            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::GetAdditionalInputsResponse`"))),
602            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::shipping_v2::GetAdditionalInputsResponse`")))),
603        }
604    } else {
605        let content = resp.text().await?;
606        let entity: Option<GetAdditionalInputsError> = serde_json::from_str(&content).ok();
607        Err(Error::ResponseError(ResponseContent { status, content, entity }))
608    }
609}
610
611/// This API will return a list of input schema required to register a shipper account with the carrier.   **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
612pub async fn get_carrier_account_form_inputs(configuration: &configuration::Configuration, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetCarrierAccountFormInputsResponse, Error<GetCarrierAccountFormInputsError>> {
613    // add a prefix to parameters to efficiently prevent name collisions
614    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
615
616    let uri_str = format!("{}/shipping/v2/carrierAccountFormInputs", configuration.base_path);
617    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
618
619    if let Some(ref user_agent) = configuration.user_agent {
620        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
621    }
622    if let Some(param_value) = p_x_amzn_shipping_business_id {
623        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
624    }
625
626    let req = req_builder.build()?;
627    let resp = configuration.client.execute(req).await?;
628
629    let status = resp.status();
630    let content_type = resp
631        .headers()
632        .get("content-type")
633        .and_then(|v| v.to_str().ok())
634        .unwrap_or("application/octet-stream");
635    let content_type = super::ContentType::from(content_type);
636
637    if !status.is_client_error() && !status.is_server_error() {
638        let content = resp.text().await?;
639        match content_type {
640            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
641            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::GetCarrierAccountFormInputsResponse`"))),
642            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::shipping_v2::GetCarrierAccountFormInputsResponse`")))),
643        }
644    } else {
645        let content = resp.text().await?;
646        let entity: Option<GetCarrierAccountFormInputsError> = serde_json::from_str(&content).ok();
647        Err(Error::ResponseError(ResponseContent { status, content, entity }))
648    }
649}
650
651/// This API will return Get all carrier accounts for a merchant.   **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
652pub async fn get_carrier_accounts(configuration: &configuration::Configuration, body: models::shipping_v2::GetCarrierAccountsRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetCarrierAccountsResponse, Error<GetCarrierAccountsError>> {
653    // add a prefix to parameters to efficiently prevent name collisions
654    let p_body = body;
655    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
656
657    let uri_str = format!("{}/shipping/v2/carrierAccounts", configuration.base_path);
658    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
659
660    if let Some(ref user_agent) = configuration.user_agent {
661        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
662    }
663    if let Some(param_value) = p_x_amzn_shipping_business_id {
664        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
665    }
666    req_builder = req_builder.json(&p_body);
667
668    let req = req_builder.build()?;
669    let resp = configuration.client.execute(req).await?;
670
671    let status = resp.status();
672    let content_type = resp
673        .headers()
674        .get("content-type")
675        .and_then(|v| v.to_str().ok())
676        .unwrap_or("application/octet-stream");
677    let content_type = super::ContentType::from(content_type);
678
679    if !status.is_client_error() && !status.is_server_error() {
680        let content = resp.text().await?;
681        match content_type {
682            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
683            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::GetCarrierAccountsResponse`"))),
684            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::shipping_v2::GetCarrierAccountsResponse`")))),
685        }
686    } else {
687        let content = resp.text().await?;
688        let entity: Option<GetCarrierAccountsError> = serde_json::from_str(&content).ok();
689        Err(Error::ResponseError(ResponseContent { status, content, entity }))
690    }
691}
692
693/// This API reprint a collection form.   **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
694pub async fn get_collection_form(configuration: &configuration::Configuration, collection_form_id: &str, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetCollectionFormResponse, Error<GetCollectionFormError>> {
695    // add a prefix to parameters to efficiently prevent name collisions
696    let p_collection_form_id = collection_form_id;
697    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
698
699    let uri_str = format!("{}/shipping/v2/collectionForms/{collectionFormId}", configuration.base_path, collectionFormId=crate::apis::urlencode(p_collection_form_id));
700    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
701
702    if let Some(ref user_agent) = configuration.user_agent {
703        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
704    }
705    if let Some(param_value) = p_x_amzn_shipping_business_id {
706        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
707    }
708
709    let req = req_builder.build()?;
710    let resp = configuration.client.execute(req).await?;
711
712    let status = resp.status();
713    let content_type = resp
714        .headers()
715        .get("content-type")
716        .and_then(|v| v.to_str().ok())
717        .unwrap_or("application/octet-stream");
718    let content_type = super::ContentType::from(content_type);
719
720    if !status.is_client_error() && !status.is_server_error() {
721        let content = resp.text().await?;
722        match content_type {
723            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
724            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::GetCollectionFormResponse`"))),
725            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::shipping_v2::GetCollectionFormResponse`")))),
726        }
727    } else {
728        let content = resp.text().await?;
729        let entity: Option<GetCollectionFormError> = serde_json::from_str(&content).ok();
730        Err(Error::ResponseError(ResponseContent { status, content, entity }))
731    }
732}
733
734/// This API Call to get the history of the previously generated collection forms.   **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
735pub async fn get_collection_form_history(configuration: &configuration::Configuration, body: models::shipping_v2::GetCollectionFormHistoryRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetCollectionFormHistoryResponse, Error<GetCollectionFormHistoryError>> {
736    // add a prefix to parameters to efficiently prevent name collisions
737    let p_body = body;
738    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
739
740    let uri_str = format!("{}/shipping/v2/collectionForms/history", configuration.base_path);
741    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
742
743    if let Some(ref user_agent) = configuration.user_agent {
744        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
745    }
746    if let Some(param_value) = p_x_amzn_shipping_business_id {
747        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
748    }
749    req_builder = req_builder.json(&p_body);
750
751    let req = req_builder.build()?;
752    let resp = configuration.client.execute(req).await?;
753
754    let status = resp.status();
755    let content_type = resp
756        .headers()
757        .get("content-type")
758        .and_then(|v| v.to_str().ok())
759        .unwrap_or("application/octet-stream");
760    let content_type = super::ContentType::from(content_type);
761
762    if !status.is_client_error() && !status.is_server_error() {
763        let content = resp.text().await?;
764        match content_type {
765            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
766            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::GetCollectionFormHistoryResponse`"))),
767            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::shipping_v2::GetCollectionFormHistoryResponse`")))),
768        }
769    } else {
770        let content = resp.text().await?;
771        let entity: Option<GetCollectionFormHistoryError> = serde_json::from_str(&content).ok();
772        Err(Error::ResponseError(ResponseContent { status, content, entity }))
773    }
774}
775
776/// Returns the available shipping service offerings.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
777pub async fn get_rates(configuration: &configuration::Configuration, body: models::shipping_v2::GetRatesRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetRatesResponse, Error<GetRatesError>> {
778    // add a prefix to parameters to efficiently prevent name collisions
779    let p_body = body;
780    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
781
782    let uri_str = format!("{}/shipping/v2/shipments/rates", configuration.base_path);
783    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
784
785    if let Some(ref user_agent) = configuration.user_agent {
786        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
787    }
788    if let Some(param_value) = p_x_amzn_shipping_business_id {
789        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
790    }
791    req_builder = req_builder.json(&p_body);
792
793    let req = req_builder.build()?;
794    let resp = configuration.client.execute(req).await?;
795
796    let status = resp.status();
797    let content_type = resp
798        .headers()
799        .get("content-type")
800        .and_then(|v| v.to_str().ok())
801        .unwrap_or("application/octet-stream");
802    let content_type = super::ContentType::from(content_type);
803
804    if !status.is_client_error() && !status.is_server_error() {
805        let content = resp.text().await?;
806        match content_type {
807            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
808            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::GetRatesResponse`"))),
809            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::shipping_v2::GetRatesResponse`")))),
810        }
811    } else {
812        let content = resp.text().await?;
813        let entity: Option<GetRatesError> = serde_json::from_str(&content).ok();
814        Err(Error::ResponseError(ResponseContent { status, content, entity }))
815    }
816}
817
818/// Returns the shipping documents associated with a package in a shipment.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
819pub async fn get_shipment_documents(configuration: &configuration::Configuration, shipment_id: &str, package_client_reference_id: &str, format: Option<&str>, dpi: Option<f64>, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetShipmentDocumentsResponse, Error<GetShipmentDocumentsError>> {
820    // add a prefix to parameters to efficiently prevent name collisions
821    let p_shipment_id = shipment_id;
822    let p_package_client_reference_id = package_client_reference_id;
823    let p_format = format;
824    let p_dpi = dpi;
825    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
826
827    let uri_str = format!("{}/shipping/v2/shipments/{shipmentId}/documents", configuration.base_path, shipmentId=crate::apis::urlencode(p_shipment_id));
828    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
829
830    req_builder = req_builder.query(&[("packageClientReferenceId", &p_package_client_reference_id.to_string())]);
831    if let Some(ref param_value) = p_format {
832        req_builder = req_builder.query(&[("format", &param_value.to_string())]);
833    }
834    if let Some(ref param_value) = p_dpi {
835        req_builder = req_builder.query(&[("dpi", &param_value.to_string())]);
836    }
837    if let Some(ref user_agent) = configuration.user_agent {
838        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
839    }
840    if let Some(param_value) = p_x_amzn_shipping_business_id {
841        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
842    }
843
844    let req = req_builder.build()?;
845    let resp = configuration.client.execute(req).await?;
846
847    let status = resp.status();
848    let content_type = resp
849        .headers()
850        .get("content-type")
851        .and_then(|v| v.to_str().ok())
852        .unwrap_or("application/octet-stream");
853    let content_type = super::ContentType::from(content_type);
854
855    if !status.is_client_error() && !status.is_server_error() {
856        let content = resp.text().await?;
857        match content_type {
858            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
859            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::GetShipmentDocumentsResponse`"))),
860            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::shipping_v2::GetShipmentDocumentsResponse`")))),
861        }
862    } else {
863        let content = resp.text().await?;
864        let entity: Option<GetShipmentDocumentsError> = serde_json::from_str(&content).ok();
865        Err(Error::ResponseError(ResponseContent { status, content, entity }))
866    }
867}
868
869/// Returns tracking information for a purchased shipment.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
870pub async fn get_tracking(configuration: &configuration::Configuration, tracking_id: &str, carrier_id: &str, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetTrackingResponse, Error<GetTrackingError>> {
871    // add a prefix to parameters to efficiently prevent name collisions
872    let p_tracking_id = tracking_id;
873    let p_carrier_id = carrier_id;
874    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
875
876    let uri_str = format!("{}/shipping/v2/tracking", configuration.base_path);
877    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
878
879    req_builder = req_builder.query(&[("trackingId", &p_tracking_id.to_string())]);
880    req_builder = req_builder.query(&[("carrierId", &p_carrier_id.to_string())]);
881    if let Some(ref user_agent) = configuration.user_agent {
882        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
883    }
884    if let Some(param_value) = p_x_amzn_shipping_business_id {
885        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
886    }
887
888    let req = req_builder.build()?;
889    let resp = configuration.client.execute(req).await?;
890
891    let status = resp.status();
892    let content_type = resp
893        .headers()
894        .get("content-type")
895        .and_then(|v| v.to_str().ok())
896        .unwrap_or("application/octet-stream");
897    let content_type = super::ContentType::from(content_type);
898
899    if !status.is_client_error() && !status.is_server_error() {
900        let content = resp.text().await?;
901        match content_type {
902            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
903            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::GetTrackingResponse`"))),
904            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::shipping_v2::GetTrackingResponse`")))),
905        }
906    } else {
907        let content = resp.text().await?;
908        let entity: Option<GetTrackingError> = serde_json::from_str(&content).ok();
909        Err(Error::ResponseError(ResponseContent { status, content, entity }))
910    }
911}
912
913/// This API Get all unmanifested carriers with shipment locations. Any locations which has unmanifested shipments         with an eligible carrier for manifesting shall be returned.   **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
914pub async fn get_unmanifested_shipments(configuration: &configuration::Configuration, body: models::shipping_v2::GetUnmanifestedShipmentsRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetUnmanifestedShipmentsResponse, Error<GetUnmanifestedShipmentsError>> {
915    // add a prefix to parameters to efficiently prevent name collisions
916    let p_body = body;
917    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
918
919    let uri_str = format!("{}/shipping/v2/unmanifestedShipments", configuration.base_path);
920    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
921
922    if let Some(ref user_agent) = configuration.user_agent {
923        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
924    }
925    if let Some(param_value) = p_x_amzn_shipping_business_id {
926        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
927    }
928    req_builder = req_builder.json(&p_body);
929
930    let req = req_builder.build()?;
931    let resp = configuration.client.execute(req).await?;
932
933    let status = resp.status();
934    let content_type = resp
935        .headers()
936        .get("content-type")
937        .and_then(|v| v.to_str().ok())
938        .unwrap_or("application/octet-stream");
939    let content_type = super::ContentType::from(content_type);
940
941    if !status.is_client_error() && !status.is_server_error() {
942        let content = resp.text().await?;
943        match content_type {
944            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
945            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::GetUnmanifestedShipmentsResponse`"))),
946            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::shipping_v2::GetUnmanifestedShipmentsResponse`")))),
947        }
948    } else {
949        let content = resp.text().await?;
950        let entity: Option<GetUnmanifestedShipmentsError> = serde_json::from_str(&content).ok();
951        Err(Error::ResponseError(ResponseContent { status, content, entity }))
952    }
953}
954
955/// This API associates/links the specified carrier account with the merchant.   **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
956pub async fn link_carrier_account(configuration: &configuration::Configuration, carrier_id: &str, body: models::shipping_v2::LinkCarrierAccountRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::LinkCarrierAccountResponse, Error<LinkCarrierAccountError>> {
957    // add a prefix to parameters to efficiently prevent name collisions
958    let p_carrier_id = carrier_id;
959    let p_body = body;
960    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
961
962    let uri_str = format!("{}/shipping/v2/carrierAccounts/{carrierId}", configuration.base_path, carrierId=crate::apis::urlencode(p_carrier_id));
963    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
964
965    if let Some(ref user_agent) = configuration.user_agent {
966        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
967    }
968    if let Some(param_value) = p_x_amzn_shipping_business_id {
969        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
970    }
971    req_builder = req_builder.json(&p_body);
972
973    let req = req_builder.build()?;
974    let resp = configuration.client.execute(req).await?;
975
976    let status = resp.status();
977    let content_type = resp
978        .headers()
979        .get("content-type")
980        .and_then(|v| v.to_str().ok())
981        .unwrap_or("application/octet-stream");
982    let content_type = super::ContentType::from(content_type);
983
984    if !status.is_client_error() && !status.is_server_error() {
985        let content = resp.text().await?;
986        match content_type {
987            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
988            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::LinkCarrierAccountResponse`"))),
989            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::shipping_v2::LinkCarrierAccountResponse`")))),
990        }
991    } else {
992        let content = resp.text().await?;
993        let entity: Option<LinkCarrierAccountError> = serde_json::from_str(&content).ok();
994        Err(Error::ResponseError(ResponseContent { status, content, entity }))
995    }
996}
997
998/// This API associates/links the specified carrier account with the merchant.   **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 10 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).
999pub async fn link_carrier_account_0(configuration: &configuration::Configuration, carrier_id: &str, body: models::shipping_v2::LinkCarrierAccountRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::LinkCarrierAccountResponse, Error<LinkCarrierAccount0Error>> {
1000    // add a prefix to parameters to efficiently prevent name collisions
1001    let p_carrier_id = carrier_id;
1002    let p_body = body;
1003    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
1004
1005    let uri_str = format!("{}/shipping/v2/carrierAccounts/{carrierId}", configuration.base_path, carrierId=crate::apis::urlencode(p_carrier_id));
1006    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1007
1008    if let Some(ref user_agent) = configuration.user_agent {
1009        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1010    }
1011    if let Some(param_value) = p_x_amzn_shipping_business_id {
1012        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
1013    }
1014    req_builder = req_builder.json(&p_body);
1015
1016    let req = req_builder.build()?;
1017    let resp = configuration.client.execute(req).await?;
1018
1019    let status = resp.status();
1020    let content_type = resp
1021        .headers()
1022        .get("content-type")
1023        .and_then(|v| v.to_str().ok())
1024        .unwrap_or("application/octet-stream");
1025    let content_type = super::ContentType::from(content_type);
1026
1027    if !status.is_client_error() && !status.is_server_error() {
1028        let content = resp.text().await?;
1029        match content_type {
1030            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1031            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::LinkCarrierAccountResponse`"))),
1032            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::shipping_v2::LinkCarrierAccountResponse`")))),
1033        }
1034    } else {
1035        let content = resp.text().await?;
1036        let entity: Option<LinkCarrierAccount0Error> = serde_json::from_str(&content).ok();
1037        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1038    }
1039}
1040
1041/// Purchases a shipping service identifier and returns purchase-related details and documents.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
1042pub async fn one_click_shipment(configuration: &configuration::Configuration, body: models::shipping_v2::OneClickShipmentRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::OneClickShipmentResponse, Error<OneClickShipmentError>> {
1043    // add a prefix to parameters to efficiently prevent name collisions
1044    let p_body = body;
1045    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
1046
1047    let uri_str = format!("{}/shipping/v2/oneClickShipment", configuration.base_path);
1048    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1049
1050    if let Some(ref user_agent) = configuration.user_agent {
1051        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1052    }
1053    if let Some(param_value) = p_x_amzn_shipping_business_id {
1054        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
1055    }
1056    req_builder = req_builder.json(&p_body);
1057
1058    let req = req_builder.build()?;
1059    let resp = configuration.client.execute(req).await?;
1060
1061    let status = resp.status();
1062    let content_type = resp
1063        .headers()
1064        .get("content-type")
1065        .and_then(|v| v.to_str().ok())
1066        .unwrap_or("application/octet-stream");
1067    let content_type = super::ContentType::from(content_type);
1068
1069    if !status.is_client_error() && !status.is_server_error() {
1070        let content = resp.text().await?;
1071        match content_type {
1072            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1073            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::OneClickShipmentResponse`"))),
1074            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::shipping_v2::OneClickShipmentResponse`")))),
1075        }
1076    } else {
1077        let content = resp.text().await?;
1078        let entity: Option<OneClickShipmentError> = serde_json::from_str(&content).ok();
1079        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1080    }
1081}
1082
1083/// Purchases a shipping service and returns purchase related details and documents.  Note: You must complete the purchase within 10 minutes of rate creation by the shipping service provider. If you make the request after the 10 minutes have expired, you will receive an error response with the error code equal to \"TOKEN_EXPIRED\". If you receive this error response, you must get the rates for the shipment again.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
1084pub async fn purchase_shipment(configuration: &configuration::Configuration, body: models::shipping_v2::PurchaseShipmentRequest, x_amzn_idempotency_key: Option<&str>, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::PurchaseShipmentResponse, Error<PurchaseShipmentError>> {
1085    // add a prefix to parameters to efficiently prevent name collisions
1086    let p_body = body;
1087    let p_x_amzn_idempotency_key = x_amzn_idempotency_key;
1088    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
1089
1090    let uri_str = format!("{}/shipping/v2/shipments", configuration.base_path);
1091    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1092
1093    if let Some(ref user_agent) = configuration.user_agent {
1094        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1095    }
1096    if let Some(param_value) = p_x_amzn_idempotency_key {
1097        req_builder = req_builder.header("x-amzn-IdempotencyKey", param_value.to_string());
1098    }
1099    if let Some(param_value) = p_x_amzn_shipping_business_id {
1100        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
1101    }
1102    req_builder = req_builder.json(&p_body);
1103
1104    let req = req_builder.build()?;
1105    let resp = configuration.client.execute(req).await?;
1106
1107    let status = resp.status();
1108    let content_type = resp
1109        .headers()
1110        .get("content-type")
1111        .and_then(|v| v.to_str().ok())
1112        .unwrap_or("application/octet-stream");
1113    let content_type = super::ContentType::from(content_type);
1114
1115    if !status.is_client_error() && !status.is_server_error() {
1116        let content = resp.text().await?;
1117        match content_type {
1118            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1119            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::PurchaseShipmentResponse`"))),
1120            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::shipping_v2::PurchaseShipmentResponse`")))),
1121        }
1122    } else {
1123        let content = resp.text().await?;
1124        let entity: Option<PurchaseShipmentError> = serde_json::from_str(&content).ok();
1125        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1126    }
1127}
1128
1129/// This API submits the NDR (Non-delivery Report) Feedback for any eligible shipment.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).
1130pub async fn submit_ndr_feedback(configuration: &configuration::Configuration, body: models::shipping_v2::SubmitNdrFeedbackRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<(), Error<SubmitNdrFeedbackError>> {
1131    // add a prefix to parameters to efficiently prevent name collisions
1132    let p_body = body;
1133    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
1134
1135    let uri_str = format!("{}/shipping/v2/ndrFeedback", configuration.base_path);
1136    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1137
1138    if let Some(ref user_agent) = configuration.user_agent {
1139        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1140    }
1141    if let Some(param_value) = p_x_amzn_shipping_business_id {
1142        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
1143    }
1144    req_builder = req_builder.json(&p_body);
1145
1146    let req = req_builder.build()?;
1147    let resp = configuration.client.execute(req).await?;
1148
1149    let status = resp.status();
1150
1151    if !status.is_client_error() && !status.is_server_error() {
1152        Ok(())
1153    } else {
1154        let content = resp.text().await?;
1155        let entity: Option<SubmitNdrFeedbackError> = serde_json::from_str(&content).ok();
1156        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1157    }
1158}
1159
1160/// This API Unlink the specified carrier account with the merchant.   **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 |  The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
1161pub async fn unlink_carrier_account(configuration: &configuration::Configuration, carrier_id: &str, body: models::shipping_v2::UnlinkCarrierAccountRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::UnlinkCarrierAccountResponse, Error<UnlinkCarrierAccountError>> {
1162    // add a prefix to parameters to efficiently prevent name collisions
1163    let p_carrier_id = carrier_id;
1164    let p_body = body;
1165    let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
1166
1167    let uri_str = format!("{}/shipping/v2/carrierAccounts/{carrierId}/unlink", configuration.base_path, carrierId=crate::apis::urlencode(p_carrier_id));
1168    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1169
1170    if let Some(ref user_agent) = configuration.user_agent {
1171        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1172    }
1173    if let Some(param_value) = p_x_amzn_shipping_business_id {
1174        req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
1175    }
1176    req_builder = req_builder.json(&p_body);
1177
1178    let req = req_builder.build()?;
1179    let resp = configuration.client.execute(req).await?;
1180
1181    let status = resp.status();
1182    let content_type = resp
1183        .headers()
1184        .get("content-type")
1185        .and_then(|v| v.to_str().ok())
1186        .unwrap_or("application/octet-stream");
1187    let content_type = super::ContentType::from(content_type);
1188
1189    if !status.is_client_error() && !status.is_server_error() {
1190        let content = resp.text().await?;
1191        match content_type {
1192            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1193            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::shipping_v2::UnlinkCarrierAccountResponse`"))),
1194            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::shipping_v2::UnlinkCarrierAccountResponse`")))),
1195        }
1196    } else {
1197        let content = resp.text().await?;
1198        let entity: Option<UnlinkCarrierAccountError> = serde_json::from_str(&content).ok();
1199        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1200    }
1201}
1202