def update_by_key( self, key: str, version: int, actions: List[types.CartDiscountUpdateAction], expand: OptionalListStr = None, *, force_update: bool = False, ) -> types.CartDiscount: query_params = {} if expand: query_params["expand"] = expand update_action = types.CartDiscountUpdate(version=version, actions=actions) return self._client._post( endpoint=f"cart-discounts/key={key}", params=query_params, data_object=update_action, request_schema_cls=schemas.CartDiscountUpdateSchema, response_schema_cls=schemas.CartDiscountSchema, force_update=force_update, )
def post_load(self, data): return types.CartDiscountUpdate(**data)