Class ShipmentService
java.lang.Object
com.easypost.service.ShipmentService
-
Method Summary
Modifier and TypeMethodDescriptionGet a list of all Shipment objects.Buy this Shipment.Buy this Shipment.Buy this Shipment.Buy this Shipment.Create a new Shipment object from a map of parameters.findLowestSmartrate
(List<SmartRate> smartRates, int deliveryDay, SmartrateAccuracy deliveryAccuracy) Find the lowest SmartRate from a list of SmartRates.generateForm
(String id, String formType) Generate a form for this shipment.Generate a form for this shipment.final SmartRate
getLowestSmartRate
(List<SmartRate> smartRates, int deliveryDay, String deliveryAccuracy) Deprecated.getNextPage
(ShipmentCollection collection) Get the next page of an ShipmentCollection.getNextPage
(ShipmentCollection collection, Integer pageSize) Get the next page of an ShipmentCollection.getSmartrates
(String id) Deprecated.Usesmartrates(String, Map)
instead.getSmartrates
(String id, Map<String, Object> params) Deprecated.Usesmartrates(String, Map)
instead.Insure this Shipment.Label this Shipment.lowestSmartRate
(String id, int deliveryDay, SmartrateAccuracy deliveryAccuracy) Get the lowest SmartRate for this Shipment.final SmartRate
lowestSmartRate
(String id, int deliveryDay, String deliveryAccuracy) Deprecated.uselowestSmartRate(String, int, SmartrateAccuracy)
instead.Get new rates for this Shipment.Get new rates for this Shipment.recommendShipDate
(String id, String desiredDeliveryDate) Retrieve a recommended ship date for an existing Shipment via the Precision Shipping API, based on a specific desired delivery date.Refund this Shipment.Refund this Shipment.Retrieve a Shipment from the API.retrieveEstimatedDeliveryDate
(String id, String plannedShipDate) Retrieves the estimated delivery date of each Rate via SmartRate.smartrates
(String id) Get SmartRate for this Shipment.smartrates
(String id, Map<String, Object> params) Get SmartRates for this Shipment.
-
Method Details
-
create
Create a new Shipment object from a map of parameters.- Parameters:
params
- The map of parameters.- Returns:
- Shipment object
- Throws:
EasyPostException
- when the request fails.
-
retrieve
Retrieve a Shipment from the API.- Parameters:
id
- The ID of the Shipment to retrieve.- Returns:
- Shipment object
- Throws:
EasyPostException
- when the request fails.
-
all
Get a list of all Shipment objects.- Parameters:
params
- The options for the query.- Returns:
- ShipmentCollection object
- Throws:
EasyPostException
- when the request fails.
-
getNextPage
Get the next page of an ShipmentCollection.- Parameters:
collection
- ShipmentCollection to get next page of.- Returns:
- ShipmentCollection object.
- Throws:
EndOfPaginationError
- when there are no more pages to retrieve.
-
getNextPage
public ShipmentCollection getNextPage(ShipmentCollection collection, Integer pageSize) throws EndOfPaginationError Get the next page of an ShipmentCollection.- Parameters:
collection
- ShipmentCollection to get next page of.pageSize
- The number of results to return on the next page.- Returns:
- ShipmentCollection object.
- Throws:
EndOfPaginationError
- when there are no more pages to retrieve.
-
newRates
Get new rates for this Shipment.- Parameters:
id
- The ID of shipment.- Returns:
- Shipment object
- Throws:
EasyPostException
- when the request fails.
-
newRates
Get new rates for this Shipment.- Parameters:
id
- The ID of shipment.params
- The options for the query.- Returns:
- Shipment object
- Throws:
EasyPostException
- when the request fails.
-
getSmartrates
@Deprecated @InlineMe(replacement="this.smartrates(id, params)") public final List<SmartRate> getSmartrates(String id, Map<String, Object> params) throws EasyPostExceptionDeprecated.Usesmartrates(String, Map)
instead. Deprecated: v5.5.0 - v7.0.0Get SmartRates for this Shipment.- Parameters:
id
- The ID of shipment.params
- The options for the query.- Returns:
- List of SmartRate objects
- Throws:
EasyPostException
- when the request fails.
-
smartrates
Get SmartRate for this Shipment.- Parameters:
id
- The ID of shipment.- Returns:
- List of SmartRate objects
- Throws:
EasyPostException
- when the request fails.
-
smartrates
Get SmartRates for this Shipment.- Parameters:
id
- The ID of shipment.params
- The options for the query.- Returns:
- List of SmartRate objects
- Throws:
EasyPostException
- when the request fails.
-
buy
Buy this Shipment.- Parameters:
id
- The ID of shipment.params
- The options for the query.- Returns:
- Shipment object
- Throws:
EasyPostException
- when the request fails.
-
buy
Buy this Shipment.- Parameters:
id
- The ID of shipment.rate
- The Rate to use for this Shipment.- Returns:
- Shipment object
- Throws:
EasyPostException
- when the request fails.
-
buy
Buy this Shipment.- Parameters:
id
- The ID of shipment.rate
- The Rate to use for this Shipment.endShipperId
- The id of the end shipper to use for this purchase.- Returns:
- Shipment object
- Throws:
EasyPostException
- when the request fails.
-
buy
public Shipment buy(String id, Map<String, Object> params, String endShipperId) throws EasyPostExceptionBuy this Shipment.- Parameters:
id
- The ID of shipment.params
- The options for the query.endShipperId
- The id of the end shipper to use for this purchase.- Returns:
- Shipment object
- Throws:
EasyPostException
- when the request fails.
-
refund
Refund this Shipment.- Parameters:
id
- The ID of shipment.- Returns:
- Shipment object
- Throws:
EasyPostException
- when the request fails.
-
refund
Refund this Shipment.- Parameters:
id
- The ID of shipment.params
- The options for the query.- Returns:
- Shipment object
- Throws:
EasyPostException
- when the request fails.
-
label
Label this Shipment.- Parameters:
id
- The ID of shipment.params
- The options for the query.- Returns:
- Shipment object
- Throws:
EasyPostException
- when the request fails.
-
insure
Insure this Shipment.- Parameters:
id
- The ID of shipment.params
- The options for the query.- Returns:
- Shipment object
- Throws:
EasyPostException
- when the request fails.
-
lowestSmartRate
@Deprecated @InlineMe(replacement="this.lowestSmartRate(id, deliveryDay, SmartrateAccuracy.getByKeyName(deliveryAccuracy))", imports="com.easypost.model.SmartrateAccuracy") public final SmartRate lowestSmartRate(String id, int deliveryDay, String deliveryAccuracy) throws EasyPostException Deprecated.uselowestSmartRate(String, int, SmartrateAccuracy)
instead. Deprecated: v5.5.0 - v7.0.0Get the lowest SmartRate for this Shipment.- Parameters:
id
- The ID of shipment.deliveryDay
- Delivery days restriction to use when filtering.deliveryAccuracy
- Delivery days accuracy restriction to use when filtering.- Returns:
- lowest SmartRate object
- Throws:
EasyPostException
- when the request fails.
-
lowestSmartRate
public SmartRate lowestSmartRate(String id, int deliveryDay, SmartrateAccuracy deliveryAccuracy) throws EasyPostException Get the lowest SmartRate for this Shipment.- Parameters:
id
- The ID of shipment.deliveryDay
- Delivery days restriction to use when filtering.deliveryAccuracy
- Delivery days accuracy restriction to use when filtering.- Returns:
- lowest SmartRate object
- Throws:
EasyPostException
- when the request fails.
-
getSmartrates
@Deprecated @InlineMe(replacement="this.smartrates(id, null)") public final List<SmartRate> getSmartrates(String id) throws EasyPostException Deprecated.Usesmartrates(String, Map)
instead. Deprecated: v5.5.0 - v7.0.0Get SmartRates for this Shipment.- Parameters:
id
- The ID of shipment.- Returns:
- List of SmartRate objects
- Throws:
EasyPostException
- when the request fails.
-
getLowestSmartRate
@Deprecated @InlineMe(replacement="this.findLowestSmartrate(smartRates, deliveryDay, SmartrateAccuracy.getByKeyName(deliveryAccuracy))", imports="com.easypost.model.SmartrateAccuracy") public final SmartRate getLowestSmartRate(List<SmartRate> smartRates, int deliveryDay, String deliveryAccuracy) throws EasyPostException Deprecated.UsefindLowestSmartrate(List, int, SmartrateAccuracy)
instead. Deprecated: v5.5.0 - v7.0.0Get the lowest SmartRate from a list of SmartRates.- Parameters:
smartRates
- List of SmartRates to filter from.deliveryDay
- Delivery days restriction to use when filtering.deliveryAccuracy
- Delivery days accuracy restriction to use when filtering.- Returns:
- lowest SmartRate object
- Throws:
EasyPostException
- when the request fails.
-
findLowestSmartrate
public SmartRate findLowestSmartrate(List<SmartRate> smartRates, int deliveryDay, SmartrateAccuracy deliveryAccuracy) throws EasyPostException Find the lowest SmartRate from a list of SmartRates.- Parameters:
smartRates
- List of SmartRates to filter from.deliveryDay
- Delivery days restriction to use when filtering.deliveryAccuracy
- Delivery days accuracy restriction to use when filtering.- Returns:
- lowest Smartrate object
- Throws:
EasyPostException
- when the request fails.
-
generateForm
Generate a form for this shipment.- Parameters:
id
- The ID of shipment.formType
- The form type for this shipment.- Returns:
- Return a shipment object.
- Throws:
EasyPostException
- when the request fails.
-
generateForm
public Shipment generateForm(String id, String formType, Map<String, Object> formOptions) throws EasyPostExceptionGenerate a form for this shipment.- Parameters:
id
- The ID of shipment.formType
- The form type for this shipment.formOptions
- The form options for this shipment.- Returns:
- Return a shipment object.
- Throws:
EasyPostException
- when the request fails.
-
retrieveEstimatedDeliveryDate
public List<EstimatedDeliveryDate> retrieveEstimatedDeliveryDate(String id, String plannedShipDate) throws EasyPostException Retrieves the estimated delivery date of each Rate via SmartRate.- Parameters:
id
- The id of the shipment.plannedShipDate
- The planned shipment date.- Returns:
- EstimatedDeliveryDate object.
- Throws:
EasyPostException
- When the request fails.
-
recommendShipDate
public List<RecommendShipDateForShipmentResult> recommendShipDate(String id, String desiredDeliveryDate) throws EasyPostException Retrieve a recommended ship date for an existing Shipment via the Precision Shipping API, based on a specific desired delivery date.- Parameters:
id
- The id of the shipment.desiredDeliveryDate
- The desired delivery date.- Returns:
- EstimatedDeliveryDate object.
- Throws:
EasyPostException
- When the request fails.
-
findLowestSmartrate(List, int, SmartrateAccuracy)
instead.