diff --git a/CHANGELOG.md b/CHANGELOG.md index cafa414..0a51673 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## v9.0.1 (2023-12-20) + +- Corrects the return type of `regenerate_rates` + ## v9.0.0 (2023-12-06) See our [Upgrade Guide](UPGRADE_GUIDE.md#upgrading-from-8x-to-90) for more details. diff --git a/easypost/services/shipment_service.py b/easypost/services/shipment_service.py index aa85bc9..409eb7b 100644 --- a/easypost/services/shipment_service.py +++ b/easypost/services/shipment_service.py @@ -72,7 +72,7 @@ def get_next_page( return self.all(**params) - def regenerate_rates(self, id: str) -> Shipment: + def regenerate_rates(self, id: str) -> Dict[str, List[Rate]]: """Regenerate Rates for a Shipment.""" url = f"{self._instance_url(self._model_class, id)}/rerate" diff --git a/easypost/util.py b/easypost/util.py index b46555c..31a81ea 100644 --- a/easypost/util.py +++ b/easypost/util.py @@ -7,6 +7,7 @@ Dict, List, Optional, + Union, ) from easypost.constant import ( @@ -24,14 +25,15 @@ InvalidParameterError, SignatureVerificationError, ) +from easypost.models.rate import Rate def get_lowest_object_rate( - easypost_object: EasyPostObject, + easypost_object: Union[EasyPostObject, Dict[str, Any]], carriers: Optional[List[str]] = None, services: Optional[List[str]] = None, rates_key: str = "rates", -): +) -> Rate: """Gets the lowest rate of an EasyPost object such as a Shipment, Order, or Pickup.""" carriers = carriers or [] services = services or [] @@ -53,7 +55,7 @@ def get_lowest_object_rate( return lowest_rate -def get_lowest_smart_rate(smart_rates, delivery_days: int, delivery_accuracy: str): +def get_lowest_smart_rate(smart_rates: List[Rate], delivery_days: int, delivery_accuracy: str) -> Rate: """Get the lowest SmartRate from a list of SmartRates.""" valid_delivery_accuracy_values = { "percentile_50",