use anyhow::Result;
use crate::{client::SpapiClient, models};
impl SpapiClient {
pub async fn cancel_shipment(
&self,
shipment_id: &str,
) -> Result<models::merchant_fulfillment_v0::CancelShipmentResponse> {
let configuration = self.create_configuration().await?;
let guard = self
.limiter()
.wait("merchant_fulfillment_v0/cancel_shipment", 1.0, 1)
.await?;
let res =
crate::apis::merchant_fulfillment_v0::cancel_shipment(&configuration, shipment_id)
.await?;
guard.mark_response().await;
Ok(res)
}
pub async fn create_shipment(
&self,
body: models::merchant_fulfillment_v0::CreateShipmentRequest,
) -> Result<models::merchant_fulfillment_v0::CreateShipmentResponse> {
let configuration = self.create_configuration().await?;
let guard = self
.limiter()
.wait("merchant_fulfillment_v0/create_shipment", 2.0, 2)
.await?;
let res =
crate::apis::merchant_fulfillment_v0::create_shipment(&configuration, body).await?;
guard.mark_response().await;
Ok(res)
}
pub async fn get_additional_seller_inputs(
&self,
body: models::merchant_fulfillment_v0::GetAdditionalSellerInputsRequest,
) -> Result<models::merchant_fulfillment_v0::GetAdditionalSellerInputsResponse> {
let configuration = self.create_configuration().await?;
let guard = self
.limiter()
.wait(
"merchant_fulfillment_v0/get_additional_seller_inputs",
1.0,
1,
)
.await?;
let res = crate::apis::merchant_fulfillment_v0::get_additional_seller_inputs(
&configuration,
body,
)
.await?;
guard.mark_response().await;
Ok(res)
}
pub async fn get_eligible_shipment_services(
&self,
body: models::merchant_fulfillment_v0::GetEligibleShipmentServicesRequest,
) -> Result<models::merchant_fulfillment_v0::GetEligibleShipmentServicesResponse> {
let configuration = self.create_configuration().await?;
let guard = self
.limiter()
.wait(
"merchant_fulfillment_v0/get_eligible_shipment_services",
6.0,
12,
)
.await?;
let res = crate::apis::merchant_fulfillment_v0::get_eligible_shipment_services(
&configuration,
body,
)
.await?;
guard.mark_response().await;
Ok(res)
}
pub async fn get_mfn_shipment(
&self,
shipment_id: &str,
) -> Result<models::merchant_fulfillment_v0::GetShipmentResponse> {
let configuration = self.create_configuration().await?;
let guard = self
.limiter()
.wait("merchant_fulfillment_v0/get_shipment", 1.0, 1)
.await?;
let res = crate::apis::merchant_fulfillment_v0::get_shipment(&configuration, shipment_id)
.await?;
guard.mark_response().await;
Ok(res)
}
}