use anyhow::Result;
use crate::{client::SpapiClient, models};
impl SpapiClient {
pub async fn get_bill_of_lading(
&self,
shipment_id: &str,
) -> Result<models::fulfillment_inbound_v0::GetBillOfLadingResponse> {
let configuration = self.create_configuration().await?;
let guard = self
.limiter()
.wait("fulfillment_inbound_v0/get_bill_of_lading", 2.0, 30)
.await?;
let res = crate::apis::fulfillment_inbound_v0::get_bill_of_lading(
&configuration,
shipment_id,
)
.await?;
guard.mark_response().await;
Ok(res)
}
pub async fn get_labels(
&self,
shipment_id: &str,
page_type: &str,
label_type: &str,
number_of_packages: Option<i32>,
package_labels_to_print: Option<Vec<String>>,
number_of_pallets: Option<i32>,
page_size: Option<i32>,
page_start_index: Option<i32>,
) -> Result<models::fulfillment_inbound_v0::GetLabelsResponse> {
let configuration = self.create_configuration().await?;
let guard = self
.limiter()
.wait("fulfillment_inbound_v0/get_labels", 2.0, 30)
.await?;
let res = crate::apis::fulfillment_inbound_v0::get_labels(
&configuration,
shipment_id,
page_type,
label_type,
number_of_packages,
package_labels_to_print,
number_of_pallets,
page_size,
page_start_index,
)
.await?;
guard.mark_response().await;
Ok(res)
}
pub async fn get_prep_instructions(
&self,
ship_to_country_code: &str,
seller_sku_list: Option<Vec<String>>,
asin_list: Option<Vec<String>>,
) -> Result<models::fulfillment_inbound_v0::GetPrepInstructionsResponse> {
let configuration = self.create_configuration().await?;
let guard = self
.limiter()
.wait("fulfillment_inbound_v0/get_prep_instructions", 2.0, 30)
.await?;
let res = crate::apis::fulfillment_inbound_v0::get_prep_instructions(
&configuration,
ship_to_country_code,
seller_sku_list,
asin_list,
)
.await?;
guard.mark_response().await;
Ok(res)
}
pub async fn get_shipment_items(
&self,
query_type: &str,
marketplace_id: &str,
last_updated_after: Option<String>,
last_updated_before: Option<String>,
next_token: Option<&str>,
) -> Result<models::fulfillment_inbound_v0::GetShipmentItemsResponse> {
let configuration = self.create_configuration().await?;
let guard = self
.limiter()
.wait("fulfillment_inbound_v0/get_shipment_items", 2.0, 30)
.await?;
let res = crate::apis::fulfillment_inbound_v0::get_shipment_items(
&configuration,
query_type,
marketplace_id,
last_updated_after,
last_updated_before,
next_token,
)
.await?;
guard.mark_response().await;
Ok(res)
}
pub async fn get_shipment_items_by_shipment_id(
&self,
shipment_id: &str,
marketplace_id: Option<&str>,
) -> Result<models::fulfillment_inbound_v0::GetShipmentItemsResponse> {
let configuration = self.create_configuration().await?;
let guard = self
.limiter()
.wait("fulfillment_inbound_v0/get_shipment_items_by_shipment_id", 2.0, 30)
.await?;
let res = crate::apis::fulfillment_inbound_v0::get_shipment_items_by_shipment_id(
&configuration,
shipment_id,
marketplace_id,
)
.await?;
guard.mark_response().await;
Ok(res)
}
pub async fn get_shipments(
&self,
query_type: &str,
marketplace_id: &str,
shipment_status_list: Option<Vec<String>>,
shipment_id_list: Option<Vec<String>>,
last_updated_after: Option<String>,
last_updated_before: Option<String>,
next_token: Option<&str>,
) -> Result<models::fulfillment_inbound_v0::GetShipmentsResponse> {
let configuration = self.create_configuration().await?;
let guard = self
.limiter()
.wait("fulfillment_inbound_v0/get_shipments", 2.0, 30)
.await?;
let res = crate::apis::fulfillment_inbound_v0::get_shipments(
&configuration,
query_type,
marketplace_id,
shipment_status_list,
shipment_id_list,
last_updated_after,
last_updated_before,
next_token,
)
.await?;
guard.mark_response().await;
Ok(res)
}
}