diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4191c889..e0dc5001 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.0.0" + ".": "3.1.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index ae59be0a..8070692c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 103 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-0dbb8ba730f755468357ebda41332664e8396faf29a6a6a64ad37cf35cf70d0c.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-43a4d1d907fd25faa99fef58ba7afb3dd39fae36f955b29bfe27b4bfdaa0ee54.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a4d76ae..2fa426b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 3.1.0 (2025-02-07) + +Full Changelog: [v3.0.0...v3.1.0](https://github.com/orbcorp/orb-python/compare/v3.0.0...v3.1.0) + +### Features + +* **api:** api update ([#526](https://github.com/orbcorp/orb-python/issues/526)) ([8cd8251](https://github.com/orbcorp/orb-python/commit/8cd82517459b39259d4551ce972c0b1ba2096586)) +* **client:** send `X-Stainless-Read-Timeout` header ([#522](https://github.com/orbcorp/orb-python/issues/522)) ([0ddac77](https://github.com/orbcorp/orb-python/commit/0ddac777a1d37ef24b57c95a9f5db00db2c67674)) + + +### Chores + +* **internal:** fix type traversing dictionary params ([#524](https://github.com/orbcorp/orb-python/issues/524)) ([23de87d](https://github.com/orbcorp/orb-python/commit/23de87d4360b0159a279697b2e8cf9015b7d434b)) +* **internal:** minor type handling changes ([#525](https://github.com/orbcorp/orb-python/issues/525)) ([67a742b](https://github.com/orbcorp/orb-python/commit/67a742b9f14b924a84709174512ca2b0a58a1d0b)) + ## 3.0.0 (2025-02-04) Full Changelog: [v2.26.0...v3.0.0](https://github.com/orbcorp/orb-python/compare/v2.26.0...v3.0.0) diff --git a/pyproject.toml b/pyproject.toml index 91fccb9a..64859814 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "orb-billing" -version = "3.0.0" +version = "3.1.0" description = "The official Python library for the orb API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/orb/_base_client.py b/src/orb/_base_client.py index 8c04d929..49374230 100644 --- a/src/orb/_base_client.py +++ b/src/orb/_base_client.py @@ -419,10 +419,17 @@ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0 if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers: headers[idempotency_header] = options.idempotency_key or self._idempotency_key() - # Don't set the retry count header if it was already set or removed by the caller. We check + # Don't set these headers if they were already set or removed by the caller. We check # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case. - if "x-stainless-retry-count" not in (header.lower() for header in custom_headers): + lower_custom_headers = [header.lower() for header in custom_headers] + if "x-stainless-retry-count" not in lower_custom_headers: headers["x-stainless-retry-count"] = str(retries_taken) + if "x-stainless-read-timeout" not in lower_custom_headers: + timeout = self.timeout if isinstance(options.timeout, NotGiven) else options.timeout + if isinstance(timeout, Timeout): + timeout = timeout.read + if timeout is not None: + headers["x-stainless-read-timeout"] = str(timeout) return headers diff --git a/src/orb/_models.py b/src/orb/_models.py index 12c34b7d..c4401ff8 100644 --- a/src/orb/_models.py +++ b/src/orb/_models.py @@ -426,10 +426,16 @@ def construct_type(*, value: object, type_: object) -> object: If the given value does not match the expected type then it is returned as-is. """ + + # store a reference to the original type we were given before we extract any inner + # types so that we can properly resolve forward references in `TypeAliasType` annotations + original_type = None + # we allow `object` as the input type because otherwise, passing things like # `Literal['value']` will be reported as a type error by type checkers type_ = cast("type[object]", type_) if is_type_alias_type(type_): + original_type = type_ # type: ignore[unreachable] type_ = type_.__value__ # type: ignore[unreachable] # unwrap `Annotated[T, ...]` -> `T` @@ -446,7 +452,7 @@ def construct_type(*, value: object, type_: object) -> object: if is_union(origin): try: - return validate_type(type_=cast("type[object]", type_), value=value) + return validate_type(type_=cast("type[object]", original_type or type_), value=value) except Exception: pass diff --git a/src/orb/_utils/_transform.py b/src/orb/_utils/_transform.py index a6b62cad..18afd9d8 100644 --- a/src/orb/_utils/_transform.py +++ b/src/orb/_utils/_transform.py @@ -25,7 +25,7 @@ is_annotated_type, strip_annotated_type, ) -from .._compat import model_dump, is_typeddict +from .._compat import get_origin, model_dump, is_typeddict _T = TypeVar("_T") @@ -164,9 +164,14 @@ def _transform_recursive( inner_type = annotation stripped_type = strip_annotated_type(inner_type) + origin = get_origin(stripped_type) or stripped_type if is_typeddict(stripped_type) and is_mapping(data): return _transform_typeddict(data, stripped_type) + if origin == dict and is_mapping(data): + items_type = get_args(stripped_type)[1] + return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()} + if ( # List[T] (is_list_type(stripped_type) and is_list(data)) @@ -307,9 +312,14 @@ async def _async_transform_recursive( inner_type = annotation stripped_type = strip_annotated_type(inner_type) + origin = get_origin(stripped_type) or stripped_type if is_typeddict(stripped_type) and is_mapping(data): return await _async_transform_typeddict(data, stripped_type) + if origin == dict and is_mapping(data): + items_type = get_args(stripped_type)[1] + return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()} + if ( # List[T] (is_list_type(stripped_type) and is_list(data)) diff --git a/src/orb/_version.py b/src/orb/_version.py index 10088ac0..4418c2e3 100644 --- a/src/orb/_version.py +++ b/src/orb/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "orb" -__version__ = "3.0.0" # x-release-please-version +__version__ = "3.1.0" # x-release-please-version diff --git a/src/orb/types/events/backfill_close_response.py b/src/orb/types/events/backfill_close_response.py index 14fd9974..058edebe 100644 --- a/src/orb/types/events/backfill_close_response.py +++ b/src/orb/types/events/backfill_close_response.py @@ -29,6 +29,13 @@ class BackfillCloseResponse(BaseModel): events_ingested: int """The number of events ingested in this backfill.""" + replace_existing_events: bool + """ + If `true`, existing events in the backfill's timeframe will be replaced with the + newly ingested events associated with the backfill. If `false`, newly ingested + events will be added to the existing events. + """ + reverted_at: Optional[datetime] = None """The time at which this backfill was reverted.""" diff --git a/src/orb/types/events/backfill_create_response.py b/src/orb/types/events/backfill_create_response.py index 1a23d5f1..90e185d5 100644 --- a/src/orb/types/events/backfill_create_response.py +++ b/src/orb/types/events/backfill_create_response.py @@ -29,6 +29,13 @@ class BackfillCreateResponse(BaseModel): events_ingested: int """The number of events ingested in this backfill.""" + replace_existing_events: bool + """ + If `true`, existing events in the backfill's timeframe will be replaced with the + newly ingested events associated with the backfill. If `false`, newly ingested + events will be added to the existing events. + """ + reverted_at: Optional[datetime] = None """The time at which this backfill was reverted.""" diff --git a/src/orb/types/events/backfill_fetch_response.py b/src/orb/types/events/backfill_fetch_response.py index bd397acc..2c253373 100644 --- a/src/orb/types/events/backfill_fetch_response.py +++ b/src/orb/types/events/backfill_fetch_response.py @@ -29,6 +29,13 @@ class BackfillFetchResponse(BaseModel): events_ingested: int """The number of events ingested in this backfill.""" + replace_existing_events: bool + """ + If `true`, existing events in the backfill's timeframe will be replaced with the + newly ingested events associated with the backfill. If `false`, newly ingested + events will be added to the existing events. + """ + reverted_at: Optional[datetime] = None """The time at which this backfill was reverted.""" diff --git a/src/orb/types/events/backfill_list_response.py b/src/orb/types/events/backfill_list_response.py index 2657d36e..b470ba1f 100644 --- a/src/orb/types/events/backfill_list_response.py +++ b/src/orb/types/events/backfill_list_response.py @@ -29,6 +29,13 @@ class BackfillListResponse(BaseModel): events_ingested: int """The number of events ingested in this backfill.""" + replace_existing_events: bool + """ + If `true`, existing events in the backfill's timeframe will be replaced with the + newly ingested events associated with the backfill. If `false`, newly ingested + events will be added to the existing events. + """ + reverted_at: Optional[datetime] = None """The time at which this backfill was reverted.""" diff --git a/src/orb/types/events/backfill_revert_response.py b/src/orb/types/events/backfill_revert_response.py index 8a3bae07..52ec1314 100644 --- a/src/orb/types/events/backfill_revert_response.py +++ b/src/orb/types/events/backfill_revert_response.py @@ -29,6 +29,13 @@ class BackfillRevertResponse(BaseModel): events_ingested: int """The number of events ingested in this backfill.""" + replace_existing_events: bool + """ + If `true`, existing events in the backfill's timeframe will be replaced with the + newly ingested events associated with the backfill. If `false`, newly ingested + events will be added to the existing events. + """ + reverted_at: Optional[datetime] = None """The time at which this backfill was reverted.""" diff --git a/src/orb/types/invoice.py b/src/orb/types/invoice.py index 7a5f2987..0da763aa 100644 --- a/src/orb/types/invoice.py +++ b/src/orb/types/invoice.py @@ -22,11 +22,11 @@ "CustomerTaxID", "LineItem", "LineItemAdjustment", - "LineItemAdjustmentAmountDiscountAdjustment", - "LineItemAdjustmentPercentageDiscountAdjustment", - "LineItemAdjustmentUsageDiscountAdjustment", - "LineItemAdjustmentMinimumAdjustment", - "LineItemAdjustmentMaximumAdjustment", + "LineItemAdjustmentMonetaryUsageDiscountAdjustment", + "LineItemAdjustmentMonetaryAmountDiscountAdjustment", + "LineItemAdjustmentMonetaryPercentageDiscountAdjustment", + "LineItemAdjustmentMonetaryMinimumAdjustment", + "LineItemAdjustmentMonetaryMaximumAdjustment", "LineItemMaximum", "LineItemMinimum", "LineItemSubLineItem", @@ -325,16 +325,13 @@ class CustomerTaxID(BaseModel): value: str -class LineItemAdjustmentAmountDiscountAdjustment(BaseModel): +class LineItemAdjustmentMonetaryUsageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["amount_discount"] + adjustment_type: Literal["usage_discount"] - amount_discount: str - """ - The amount by which to discount the prices this adjustment applies to in a given - billing period. - """ + amount: str + """The value applied by an adjustment.""" applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -345,17 +342,29 @@ class LineItemAdjustmentAmountDiscountAdjustment(BaseModel): that apply to only one price. """ - plan_phase_order: Optional[int] = None - """The plan phase in which this adjustment is active.""" - reason: Optional[str] = None """The reason for the adjustment.""" + usage_discount: float + """ + The number of usage units by which to discount the price this adjustment applies + to in a given billing period. + """ + -class LineItemAdjustmentPercentageDiscountAdjustment(BaseModel): +class LineItemAdjustmentMonetaryAmountDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["percentage_discount"] + adjustment_type: Literal["amount_discount"] + + amount: str + """The value applied by an adjustment.""" + + amount_discount: str + """ + The amount by which to discount the prices this adjustment applies to in a given + billing period. + """ applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -366,23 +375,17 @@ class LineItemAdjustmentPercentageDiscountAdjustment(BaseModel): that apply to only one price. """ - percentage_discount: float - """ - The percentage (as a value between 0 and 1) by which to discount the price - intervals this adjustment applies to in a given billing period. - """ - - plan_phase_order: Optional[int] = None - """The plan phase in which this adjustment is active.""" - reason: Optional[str] = None """The reason for the adjustment.""" -class LineItemAdjustmentUsageDiscountAdjustment(BaseModel): +class LineItemAdjustmentMonetaryPercentageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["usage_discount"] + adjustment_type: Literal["percentage_discount"] + + amount: str + """The value applied by an adjustment.""" applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -393,24 +396,24 @@ class LineItemAdjustmentUsageDiscountAdjustment(BaseModel): that apply to only one price. """ - plan_phase_order: Optional[int] = None - """The plan phase in which this adjustment is active.""" + percentage_discount: float + """ + The percentage (as a value between 0 and 1) by which to discount the price + intervals this adjustment applies to in a given billing period. + """ reason: Optional[str] = None """The reason for the adjustment.""" - usage_discount: float - """ - The number of usage units by which to discount the price this adjustment applies - to in a given billing period. - """ - -class LineItemAdjustmentMinimumAdjustment(BaseModel): +class LineItemAdjustmentMonetaryMinimumAdjustment(BaseModel): id: str adjustment_type: Literal["minimum"] + amount: str + """The value applied by an adjustment.""" + applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -429,18 +432,18 @@ class LineItemAdjustmentMinimumAdjustment(BaseModel): adjustment applies to. """ - plan_phase_order: Optional[int] = None - """The plan phase in which this adjustment is active.""" - reason: Optional[str] = None """The reason for the adjustment.""" -class LineItemAdjustmentMaximumAdjustment(BaseModel): +class LineItemAdjustmentMonetaryMaximumAdjustment(BaseModel): id: str adjustment_type: Literal["maximum"] + amount: str + """The value applied by an adjustment.""" + applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -456,20 +459,17 @@ class LineItemAdjustmentMaximumAdjustment(BaseModel): adjustment applies to. """ - plan_phase_order: Optional[int] = None - """The plan phase in which this adjustment is active.""" - reason: Optional[str] = None """The reason for the adjustment.""" LineItemAdjustment: TypeAlias = Annotated[ Union[ - LineItemAdjustmentAmountDiscountAdjustment, - LineItemAdjustmentPercentageDiscountAdjustment, - LineItemAdjustmentUsageDiscountAdjustment, - LineItemAdjustmentMinimumAdjustment, - LineItemAdjustmentMaximumAdjustment, + LineItemAdjustmentMonetaryUsageDiscountAdjustment, + LineItemAdjustmentMonetaryAmountDiscountAdjustment, + LineItemAdjustmentMonetaryPercentageDiscountAdjustment, + LineItemAdjustmentMonetaryMinimumAdjustment, + LineItemAdjustmentMonetaryMaximumAdjustment, ], PropertyInfo(discriminator="adjustment_type"), ] @@ -599,18 +599,21 @@ class LineItem(BaseModel): adjusted_subtotal: str """ - The line amount after any adjustments, before overage conversion, credits and + The line amount after any adjustments and before overage conversion, credits and partial invoicing. """ adjustments: List[LineItemAdjustment] - """All adjustments applied to the line item.""" + """All adjustments (ie. maximums, minimums, discounts) applied to the line item.""" amount: str - """The final amount after any discounts or minimums.""" + """ + The final amount for a line item after all adjustments and pre paid credits have + been applied. + """ credits_applied: str - """The number of credits used""" + """The number of prepaid credits applied.""" discount: Optional[Discount] = None @@ -657,6 +660,7 @@ class LineItem(BaseModel): """ quantity: float + """Either the fixed fee quantity or the usage during the service period.""" start_date: datetime """The start date of the range of time applied for this line item's price.""" @@ -668,7 +672,7 @@ class LineItem(BaseModel): """ subtotal: str - """The line amount before any line item-specific discounts or minimums.""" + """The line amount before before any adjustments.""" tax_amounts: List[LineItemTaxAmount] """An array of tax rates and their incurred tax amounts. diff --git a/src/orb/types/invoice_fetch_upcoming_response.py b/src/orb/types/invoice_fetch_upcoming_response.py index bd2310b2..64509902 100644 --- a/src/orb/types/invoice_fetch_upcoming_response.py +++ b/src/orb/types/invoice_fetch_upcoming_response.py @@ -22,11 +22,11 @@ "CustomerTaxID", "LineItem", "LineItemAdjustment", - "LineItemAdjustmentAmountDiscountAdjustment", - "LineItemAdjustmentPercentageDiscountAdjustment", - "LineItemAdjustmentUsageDiscountAdjustment", - "LineItemAdjustmentMinimumAdjustment", - "LineItemAdjustmentMaximumAdjustment", + "LineItemAdjustmentMonetaryUsageDiscountAdjustment", + "LineItemAdjustmentMonetaryAmountDiscountAdjustment", + "LineItemAdjustmentMonetaryPercentageDiscountAdjustment", + "LineItemAdjustmentMonetaryMinimumAdjustment", + "LineItemAdjustmentMonetaryMaximumAdjustment", "LineItemMaximum", "LineItemMinimum", "LineItemSubLineItem", @@ -325,16 +325,13 @@ class CustomerTaxID(BaseModel): value: str -class LineItemAdjustmentAmountDiscountAdjustment(BaseModel): +class LineItemAdjustmentMonetaryUsageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["amount_discount"] + adjustment_type: Literal["usage_discount"] - amount_discount: str - """ - The amount by which to discount the prices this adjustment applies to in a given - billing period. - """ + amount: str + """The value applied by an adjustment.""" applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -345,17 +342,29 @@ class LineItemAdjustmentAmountDiscountAdjustment(BaseModel): that apply to only one price. """ - plan_phase_order: Optional[int] = None - """The plan phase in which this adjustment is active.""" - reason: Optional[str] = None """The reason for the adjustment.""" + usage_discount: float + """ + The number of usage units by which to discount the price this adjustment applies + to in a given billing period. + """ + -class LineItemAdjustmentPercentageDiscountAdjustment(BaseModel): +class LineItemAdjustmentMonetaryAmountDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["percentage_discount"] + adjustment_type: Literal["amount_discount"] + + amount: str + """The value applied by an adjustment.""" + + amount_discount: str + """ + The amount by which to discount the prices this adjustment applies to in a given + billing period. + """ applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -366,23 +375,17 @@ class LineItemAdjustmentPercentageDiscountAdjustment(BaseModel): that apply to only one price. """ - percentage_discount: float - """ - The percentage (as a value between 0 and 1) by which to discount the price - intervals this adjustment applies to in a given billing period. - """ - - plan_phase_order: Optional[int] = None - """The plan phase in which this adjustment is active.""" - reason: Optional[str] = None """The reason for the adjustment.""" -class LineItemAdjustmentUsageDiscountAdjustment(BaseModel): +class LineItemAdjustmentMonetaryPercentageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["usage_discount"] + adjustment_type: Literal["percentage_discount"] + + amount: str + """The value applied by an adjustment.""" applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -393,24 +396,24 @@ class LineItemAdjustmentUsageDiscountAdjustment(BaseModel): that apply to only one price. """ - plan_phase_order: Optional[int] = None - """The plan phase in which this adjustment is active.""" + percentage_discount: float + """ + The percentage (as a value between 0 and 1) by which to discount the price + intervals this adjustment applies to in a given billing period. + """ reason: Optional[str] = None """The reason for the adjustment.""" - usage_discount: float - """ - The number of usage units by which to discount the price this adjustment applies - to in a given billing period. - """ - -class LineItemAdjustmentMinimumAdjustment(BaseModel): +class LineItemAdjustmentMonetaryMinimumAdjustment(BaseModel): id: str adjustment_type: Literal["minimum"] + amount: str + """The value applied by an adjustment.""" + applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -429,18 +432,18 @@ class LineItemAdjustmentMinimumAdjustment(BaseModel): adjustment applies to. """ - plan_phase_order: Optional[int] = None - """The plan phase in which this adjustment is active.""" - reason: Optional[str] = None """The reason for the adjustment.""" -class LineItemAdjustmentMaximumAdjustment(BaseModel): +class LineItemAdjustmentMonetaryMaximumAdjustment(BaseModel): id: str adjustment_type: Literal["maximum"] + amount: str + """The value applied by an adjustment.""" + applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -456,20 +459,17 @@ class LineItemAdjustmentMaximumAdjustment(BaseModel): adjustment applies to. """ - plan_phase_order: Optional[int] = None - """The plan phase in which this adjustment is active.""" - reason: Optional[str] = None """The reason for the adjustment.""" LineItemAdjustment: TypeAlias = Annotated[ Union[ - LineItemAdjustmentAmountDiscountAdjustment, - LineItemAdjustmentPercentageDiscountAdjustment, - LineItemAdjustmentUsageDiscountAdjustment, - LineItemAdjustmentMinimumAdjustment, - LineItemAdjustmentMaximumAdjustment, + LineItemAdjustmentMonetaryUsageDiscountAdjustment, + LineItemAdjustmentMonetaryAmountDiscountAdjustment, + LineItemAdjustmentMonetaryPercentageDiscountAdjustment, + LineItemAdjustmentMonetaryMinimumAdjustment, + LineItemAdjustmentMonetaryMaximumAdjustment, ], PropertyInfo(discriminator="adjustment_type"), ] @@ -599,18 +599,21 @@ class LineItem(BaseModel): adjusted_subtotal: str """ - The line amount after any adjustments, before overage conversion, credits and + The line amount after any adjustments and before overage conversion, credits and partial invoicing. """ adjustments: List[LineItemAdjustment] - """All adjustments applied to the line item.""" + """All adjustments (ie. maximums, minimums, discounts) applied to the line item.""" amount: str - """The final amount after any discounts or minimums.""" + """ + The final amount for a line item after all adjustments and pre paid credits have + been applied. + """ credits_applied: str - """The number of credits used""" + """The number of prepaid credits applied.""" discount: Optional[Discount] = None @@ -657,6 +660,7 @@ class LineItem(BaseModel): """ quantity: float + """Either the fixed fee quantity or the usage during the service period.""" start_date: datetime """The start date of the range of time applied for this line item's price.""" @@ -668,7 +672,7 @@ class LineItem(BaseModel): """ subtotal: str - """The line amount before any line item-specific discounts or minimums.""" + """The line amount before before any adjustments.""" tax_amounts: List[LineItemTaxAmount] """An array of tax rates and their incurred tax amounts. diff --git a/src/orb/types/invoice_line_item_create_response.py b/src/orb/types/invoice_line_item_create_response.py index 4593d8a8..06d85b10 100644 --- a/src/orb/types/invoice_line_item_create_response.py +++ b/src/orb/types/invoice_line_item_create_response.py @@ -12,11 +12,11 @@ __all__ = [ "InvoiceLineItemCreateResponse", "Adjustment", - "AdjustmentAmountDiscountAdjustment", - "AdjustmentPercentageDiscountAdjustment", - "AdjustmentUsageDiscountAdjustment", - "AdjustmentMinimumAdjustment", - "AdjustmentMaximumAdjustment", + "AdjustmentMonetaryUsageDiscountAdjustment", + "AdjustmentMonetaryAmountDiscountAdjustment", + "AdjustmentMonetaryPercentageDiscountAdjustment", + "AdjustmentMonetaryMinimumAdjustment", + "AdjustmentMonetaryMaximumAdjustment", "Maximum", "Minimum", "SubLineItem", @@ -32,16 +32,13 @@ ] -class AdjustmentAmountDiscountAdjustment(BaseModel): +class AdjustmentMonetaryUsageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["amount_discount"] + adjustment_type: Literal["usage_discount"] - amount_discount: str - """ - The amount by which to discount the prices this adjustment applies to in a given - billing period. - """ + amount: str + """The value applied by an adjustment.""" applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -52,17 +49,29 @@ class AdjustmentAmountDiscountAdjustment(BaseModel): that apply to only one price. """ - plan_phase_order: Optional[int] = None - """The plan phase in which this adjustment is active.""" - reason: Optional[str] = None """The reason for the adjustment.""" + usage_discount: float + """ + The number of usage units by which to discount the price this adjustment applies + to in a given billing period. + """ + -class AdjustmentPercentageDiscountAdjustment(BaseModel): +class AdjustmentMonetaryAmountDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["percentage_discount"] + adjustment_type: Literal["amount_discount"] + + amount: str + """The value applied by an adjustment.""" + + amount_discount: str + """ + The amount by which to discount the prices this adjustment applies to in a given + billing period. + """ applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -73,23 +82,17 @@ class AdjustmentPercentageDiscountAdjustment(BaseModel): that apply to only one price. """ - percentage_discount: float - """ - The percentage (as a value between 0 and 1) by which to discount the price - intervals this adjustment applies to in a given billing period. - """ - - plan_phase_order: Optional[int] = None - """The plan phase in which this adjustment is active.""" - reason: Optional[str] = None """The reason for the adjustment.""" -class AdjustmentUsageDiscountAdjustment(BaseModel): +class AdjustmentMonetaryPercentageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["usage_discount"] + adjustment_type: Literal["percentage_discount"] + + amount: str + """The value applied by an adjustment.""" applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -100,24 +103,24 @@ class AdjustmentUsageDiscountAdjustment(BaseModel): that apply to only one price. """ - plan_phase_order: Optional[int] = None - """The plan phase in which this adjustment is active.""" + percentage_discount: float + """ + The percentage (as a value between 0 and 1) by which to discount the price + intervals this adjustment applies to in a given billing period. + """ reason: Optional[str] = None """The reason for the adjustment.""" - usage_discount: float - """ - The number of usage units by which to discount the price this adjustment applies - to in a given billing period. - """ - -class AdjustmentMinimumAdjustment(BaseModel): +class AdjustmentMonetaryMinimumAdjustment(BaseModel): id: str adjustment_type: Literal["minimum"] + amount: str + """The value applied by an adjustment.""" + applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -136,18 +139,18 @@ class AdjustmentMinimumAdjustment(BaseModel): adjustment applies to. """ - plan_phase_order: Optional[int] = None - """The plan phase in which this adjustment is active.""" - reason: Optional[str] = None """The reason for the adjustment.""" -class AdjustmentMaximumAdjustment(BaseModel): +class AdjustmentMonetaryMaximumAdjustment(BaseModel): id: str adjustment_type: Literal["maximum"] + amount: str + """The value applied by an adjustment.""" + applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -163,20 +166,17 @@ class AdjustmentMaximumAdjustment(BaseModel): adjustment applies to. """ - plan_phase_order: Optional[int] = None - """The plan phase in which this adjustment is active.""" - reason: Optional[str] = None """The reason for the adjustment.""" Adjustment: TypeAlias = Annotated[ Union[ - AdjustmentAmountDiscountAdjustment, - AdjustmentPercentageDiscountAdjustment, - AdjustmentUsageDiscountAdjustment, - AdjustmentMinimumAdjustment, - AdjustmentMaximumAdjustment, + AdjustmentMonetaryUsageDiscountAdjustment, + AdjustmentMonetaryAmountDiscountAdjustment, + AdjustmentMonetaryPercentageDiscountAdjustment, + AdjustmentMonetaryMinimumAdjustment, + AdjustmentMonetaryMaximumAdjustment, ], PropertyInfo(discriminator="adjustment_type"), ] @@ -304,18 +304,21 @@ class InvoiceLineItemCreateResponse(BaseModel): adjusted_subtotal: str """ - The line amount after any adjustments, before overage conversion, credits and + The line amount after any adjustments and before overage conversion, credits and partial invoicing. """ adjustments: List[Adjustment] - """All adjustments applied to the line item.""" + """All adjustments (ie. maximums, minimums, discounts) applied to the line item.""" amount: str - """The final amount after any discounts or minimums.""" + """ + The final amount for a line item after all adjustments and pre paid credits have + been applied. + """ credits_applied: str - """The number of credits used""" + """The number of prepaid credits applied.""" discount: Optional[Discount] = None @@ -362,6 +365,7 @@ class InvoiceLineItemCreateResponse(BaseModel): """ quantity: float + """Either the fixed fee quantity or the usage during the service period.""" start_date: datetime """The start date of the range of time applied for this line item's price.""" @@ -373,7 +377,7 @@ class InvoiceLineItemCreateResponse(BaseModel): """ subtotal: str - """The line amount before any line item-specific discounts or minimums.""" + """The line amount before before any adjustments.""" tax_amounts: List[TaxAmount] """An array of tax rates and their incurred tax amounts. diff --git a/src/orb/types/plan.py b/src/orb/types/plan.py index 1f72a913..a4b43d96 100644 --- a/src/orb/types/plan.py +++ b/src/orb/types/plan.py @@ -12,11 +12,11 @@ __all__ = [ "Plan", "Adjustment", - "AdjustmentAmountDiscountAdjustment", - "AdjustmentPercentageDiscountAdjustment", - "AdjustmentUsageDiscountAdjustment", - "AdjustmentMinimumAdjustment", - "AdjustmentMaximumAdjustment", + "AdjustmentPlanPhaseUsageDiscountAdjustment", + "AdjustmentPlanPhaseAmountDiscountAdjustment", + "AdjustmentPlanPhasePercentageDiscountAdjustment", + "AdjustmentPlanPhaseMinimumAdjustment", + "AdjustmentPlanPhaseMaximumAdjustment", "BasePlan", "Maximum", "Minimum", @@ -28,16 +28,10 @@ ] -class AdjustmentAmountDiscountAdjustment(BaseModel): +class AdjustmentPlanPhaseUsageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["amount_discount"] - - amount_discount: str - """ - The amount by which to discount the prices this adjustment applies to in a given - billing period. - """ + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -54,11 +48,23 @@ class AdjustmentAmountDiscountAdjustment(BaseModel): reason: Optional[str] = None """The reason for the adjustment.""" + usage_discount: float + """ + The number of usage units by which to discount the price this adjustment applies + to in a given billing period. + """ + -class AdjustmentPercentageDiscountAdjustment(BaseModel): +class AdjustmentPlanPhaseAmountDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["percentage_discount"] + adjustment_type: Literal["amount_discount"] + + amount_discount: str + """ + The amount by which to discount the prices this adjustment applies to in a given + billing period. + """ applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -69,12 +75,6 @@ class AdjustmentPercentageDiscountAdjustment(BaseModel): that apply to only one price. """ - percentage_discount: float - """ - The percentage (as a value between 0 and 1) by which to discount the price - intervals this adjustment applies to in a given billing period. - """ - plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" @@ -82,10 +82,10 @@ class AdjustmentPercentageDiscountAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentUsageDiscountAdjustment(BaseModel): +class AdjustmentPlanPhasePercentageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["usage_discount"] + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -96,20 +96,20 @@ class AdjustmentUsageDiscountAdjustment(BaseModel): that apply to only one price. """ + percentage_discount: float + """ + The percentage (as a value between 0 and 1) by which to discount the price + intervals this adjustment applies to in a given billing period. + """ + plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" reason: Optional[str] = None """The reason for the adjustment.""" - usage_discount: float - """ - The number of usage units by which to discount the price this adjustment applies - to in a given billing period. - """ - -class AdjustmentMinimumAdjustment(BaseModel): +class AdjustmentPlanPhaseMinimumAdjustment(BaseModel): id: str adjustment_type: Literal["minimum"] @@ -139,7 +139,7 @@ class AdjustmentMinimumAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentMaximumAdjustment(BaseModel): +class AdjustmentPlanPhaseMaximumAdjustment(BaseModel): id: str adjustment_type: Literal["maximum"] @@ -168,11 +168,11 @@ class AdjustmentMaximumAdjustment(BaseModel): Adjustment: TypeAlias = Annotated[ Union[ - AdjustmentAmountDiscountAdjustment, - AdjustmentPercentageDiscountAdjustment, - AdjustmentUsageDiscountAdjustment, - AdjustmentMinimumAdjustment, - AdjustmentMaximumAdjustment, + AdjustmentPlanPhaseUsageDiscountAdjustment, + AdjustmentPlanPhaseAmountDiscountAdjustment, + AdjustmentPlanPhasePercentageDiscountAdjustment, + AdjustmentPlanPhaseMinimumAdjustment, + AdjustmentPlanPhaseMaximumAdjustment, ], PropertyInfo(discriminator="adjustment_type"), ] diff --git a/src/orb/types/subscription.py b/src/orb/types/subscription.py index f6cc403f..6af398ea 100644 --- a/src/orb/types/subscription.py +++ b/src/orb/types/subscription.py @@ -14,11 +14,11 @@ "Subscription", "AdjustmentInterval", "AdjustmentIntervalAdjustment", - "AdjustmentIntervalAdjustmentAmountDiscountAdjustment", - "AdjustmentIntervalAdjustmentPercentageDiscountAdjustment", - "AdjustmentIntervalAdjustmentUsageDiscountAdjustment", - "AdjustmentIntervalAdjustmentMinimumAdjustment", - "AdjustmentIntervalAdjustmentMaximumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment", "BillingCycleAnchorConfiguration", "DiscountInterval", "DiscountIntervalAmountDiscountInterval", @@ -34,16 +34,10 @@ ] -class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["amount_discount"] - - amount_discount: str - """ - The amount by which to discount the prices this adjustment applies to in a given - billing period. - """ + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -60,11 +54,23 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): reason: Optional[str] = None """The reason for the adjustment.""" + usage_discount: float + """ + The number of usage units by which to discount the price this adjustment applies + to in a given billing period. + """ + -class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["percentage_discount"] + adjustment_type: Literal["amount_discount"] + + amount_discount: str + """ + The amount by which to discount the prices this adjustment applies to in a given + billing period. + """ applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -75,12 +81,6 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): that apply to only one price. """ - percentage_discount: float - """ - The percentage (as a value between 0 and 1) by which to discount the price - intervals this adjustment applies to in a given billing period. - """ - plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" @@ -88,10 +88,10 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["usage_discount"] + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -102,20 +102,20 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): that apply to only one price. """ + percentage_discount: float + """ + The percentage (as a value between 0 and 1) by which to discount the price + intervals this adjustment applies to in a given billing period. + """ + plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" reason: Optional[str] = None """The reason for the adjustment.""" - usage_discount: float - """ - The number of usage units by which to discount the price this adjustment applies - to in a given billing period. - """ - -class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment(BaseModel): id: str adjustment_type: Literal["minimum"] @@ -145,7 +145,7 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment(BaseModel): id: str adjustment_type: Literal["maximum"] @@ -174,11 +174,11 @@ class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): AdjustmentIntervalAdjustment: TypeAlias = Annotated[ Union[ - AdjustmentIntervalAdjustmentAmountDiscountAdjustment, - AdjustmentIntervalAdjustmentPercentageDiscountAdjustment, - AdjustmentIntervalAdjustmentUsageDiscountAdjustment, - AdjustmentIntervalAdjustmentMinimumAdjustment, - AdjustmentIntervalAdjustmentMaximumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment, ], PropertyInfo(discriminator="adjustment_type"), ] diff --git a/src/orb/types/subscription_cancel_response.py b/src/orb/types/subscription_cancel_response.py index ed5c10ac..16d83f53 100644 --- a/src/orb/types/subscription_cancel_response.py +++ b/src/orb/types/subscription_cancel_response.py @@ -14,11 +14,11 @@ "SubscriptionCancelResponse", "AdjustmentInterval", "AdjustmentIntervalAdjustment", - "AdjustmentIntervalAdjustmentAmountDiscountAdjustment", - "AdjustmentIntervalAdjustmentPercentageDiscountAdjustment", - "AdjustmentIntervalAdjustmentUsageDiscountAdjustment", - "AdjustmentIntervalAdjustmentMinimumAdjustment", - "AdjustmentIntervalAdjustmentMaximumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment", "BillingCycleAnchorConfiguration", "DiscountInterval", "DiscountIntervalAmountDiscountInterval", @@ -34,16 +34,10 @@ ] -class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["amount_discount"] - - amount_discount: str - """ - The amount by which to discount the prices this adjustment applies to in a given - billing period. - """ + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -60,11 +54,23 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): reason: Optional[str] = None """The reason for the adjustment.""" + usage_discount: float + """ + The number of usage units by which to discount the price this adjustment applies + to in a given billing period. + """ + -class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["percentage_discount"] + adjustment_type: Literal["amount_discount"] + + amount_discount: str + """ + The amount by which to discount the prices this adjustment applies to in a given + billing period. + """ applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -75,12 +81,6 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): that apply to only one price. """ - percentage_discount: float - """ - The percentage (as a value between 0 and 1) by which to discount the price - intervals this adjustment applies to in a given billing period. - """ - plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" @@ -88,10 +88,10 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["usage_discount"] + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -102,20 +102,20 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): that apply to only one price. """ + percentage_discount: float + """ + The percentage (as a value between 0 and 1) by which to discount the price + intervals this adjustment applies to in a given billing period. + """ + plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" reason: Optional[str] = None """The reason for the adjustment.""" - usage_discount: float - """ - The number of usage units by which to discount the price this adjustment applies - to in a given billing period. - """ - -class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment(BaseModel): id: str adjustment_type: Literal["minimum"] @@ -145,7 +145,7 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment(BaseModel): id: str adjustment_type: Literal["maximum"] @@ -174,11 +174,11 @@ class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): AdjustmentIntervalAdjustment: TypeAlias = Annotated[ Union[ - AdjustmentIntervalAdjustmentAmountDiscountAdjustment, - AdjustmentIntervalAdjustmentPercentageDiscountAdjustment, - AdjustmentIntervalAdjustmentUsageDiscountAdjustment, - AdjustmentIntervalAdjustmentMinimumAdjustment, - AdjustmentIntervalAdjustmentMaximumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment, ], PropertyInfo(discriminator="adjustment_type"), ] diff --git a/src/orb/types/subscription_create_params.py b/src/orb/types/subscription_create_params.py index 10c0e2c0..a6529dad 100644 --- a/src/orb/types/subscription_create_params.py +++ b/src/orb/types/subscription_create_params.py @@ -412,8 +412,7 @@ class AddAdjustment(TypedDict, total=False): """The end date of the adjustment interval. This is the date that the adjustment will stop affecting prices on the - subscription. If null, the adjustment will start when the phase or subscription - starts. + subscription. """ plan_phase_order: Optional[int] diff --git a/src/orb/types/subscription_create_response.py b/src/orb/types/subscription_create_response.py index 89a32e0f..f1aca973 100644 --- a/src/orb/types/subscription_create_response.py +++ b/src/orb/types/subscription_create_response.py @@ -14,11 +14,11 @@ "SubscriptionCreateResponse", "AdjustmentInterval", "AdjustmentIntervalAdjustment", - "AdjustmentIntervalAdjustmentAmountDiscountAdjustment", - "AdjustmentIntervalAdjustmentPercentageDiscountAdjustment", - "AdjustmentIntervalAdjustmentUsageDiscountAdjustment", - "AdjustmentIntervalAdjustmentMinimumAdjustment", - "AdjustmentIntervalAdjustmentMaximumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment", "BillingCycleAnchorConfiguration", "DiscountInterval", "DiscountIntervalAmountDiscountInterval", @@ -34,16 +34,10 @@ ] -class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["amount_discount"] - - amount_discount: str - """ - The amount by which to discount the prices this adjustment applies to in a given - billing period. - """ + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -60,11 +54,23 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): reason: Optional[str] = None """The reason for the adjustment.""" + usage_discount: float + """ + The number of usage units by which to discount the price this adjustment applies + to in a given billing period. + """ + -class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["percentage_discount"] + adjustment_type: Literal["amount_discount"] + + amount_discount: str + """ + The amount by which to discount the prices this adjustment applies to in a given + billing period. + """ applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -75,12 +81,6 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): that apply to only one price. """ - percentage_discount: float - """ - The percentage (as a value between 0 and 1) by which to discount the price - intervals this adjustment applies to in a given billing period. - """ - plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" @@ -88,10 +88,10 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["usage_discount"] + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -102,20 +102,20 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): that apply to only one price. """ + percentage_discount: float + """ + The percentage (as a value between 0 and 1) by which to discount the price + intervals this adjustment applies to in a given billing period. + """ + plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" reason: Optional[str] = None """The reason for the adjustment.""" - usage_discount: float - """ - The number of usage units by which to discount the price this adjustment applies - to in a given billing period. - """ - -class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment(BaseModel): id: str adjustment_type: Literal["minimum"] @@ -145,7 +145,7 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment(BaseModel): id: str adjustment_type: Literal["maximum"] @@ -174,11 +174,11 @@ class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): AdjustmentIntervalAdjustment: TypeAlias = Annotated[ Union[ - AdjustmentIntervalAdjustmentAmountDiscountAdjustment, - AdjustmentIntervalAdjustmentPercentageDiscountAdjustment, - AdjustmentIntervalAdjustmentUsageDiscountAdjustment, - AdjustmentIntervalAdjustmentMinimumAdjustment, - AdjustmentIntervalAdjustmentMaximumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment, ], PropertyInfo(discriminator="adjustment_type"), ] diff --git a/src/orb/types/subscription_price_intervals_response.py b/src/orb/types/subscription_price_intervals_response.py index d84119bb..37823cba 100644 --- a/src/orb/types/subscription_price_intervals_response.py +++ b/src/orb/types/subscription_price_intervals_response.py @@ -14,11 +14,11 @@ "SubscriptionPriceIntervalsResponse", "AdjustmentInterval", "AdjustmentIntervalAdjustment", - "AdjustmentIntervalAdjustmentAmountDiscountAdjustment", - "AdjustmentIntervalAdjustmentPercentageDiscountAdjustment", - "AdjustmentIntervalAdjustmentUsageDiscountAdjustment", - "AdjustmentIntervalAdjustmentMinimumAdjustment", - "AdjustmentIntervalAdjustmentMaximumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment", "BillingCycleAnchorConfiguration", "DiscountInterval", "DiscountIntervalAmountDiscountInterval", @@ -34,16 +34,10 @@ ] -class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["amount_discount"] - - amount_discount: str - """ - The amount by which to discount the prices this adjustment applies to in a given - billing period. - """ + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -60,11 +54,23 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): reason: Optional[str] = None """The reason for the adjustment.""" + usage_discount: float + """ + The number of usage units by which to discount the price this adjustment applies + to in a given billing period. + """ + -class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["percentage_discount"] + adjustment_type: Literal["amount_discount"] + + amount_discount: str + """ + The amount by which to discount the prices this adjustment applies to in a given + billing period. + """ applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -75,12 +81,6 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): that apply to only one price. """ - percentage_discount: float - """ - The percentage (as a value between 0 and 1) by which to discount the price - intervals this adjustment applies to in a given billing period. - """ - plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" @@ -88,10 +88,10 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["usage_discount"] + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -102,20 +102,20 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): that apply to only one price. """ + percentage_discount: float + """ + The percentage (as a value between 0 and 1) by which to discount the price + intervals this adjustment applies to in a given billing period. + """ + plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" reason: Optional[str] = None """The reason for the adjustment.""" - usage_discount: float - """ - The number of usage units by which to discount the price this adjustment applies - to in a given billing period. - """ - -class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment(BaseModel): id: str adjustment_type: Literal["minimum"] @@ -145,7 +145,7 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment(BaseModel): id: str adjustment_type: Literal["maximum"] @@ -174,11 +174,11 @@ class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): AdjustmentIntervalAdjustment: TypeAlias = Annotated[ Union[ - AdjustmentIntervalAdjustmentAmountDiscountAdjustment, - AdjustmentIntervalAdjustmentPercentageDiscountAdjustment, - AdjustmentIntervalAdjustmentUsageDiscountAdjustment, - AdjustmentIntervalAdjustmentMinimumAdjustment, - AdjustmentIntervalAdjustmentMaximumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment, ], PropertyInfo(discriminator="adjustment_type"), ] diff --git a/src/orb/types/subscription_schedule_plan_change_params.py b/src/orb/types/subscription_schedule_plan_change_params.py index 7bb70108..0b11cc12 100644 --- a/src/orb/types/subscription_schedule_plan_change_params.py +++ b/src/orb/types/subscription_schedule_plan_change_params.py @@ -412,8 +412,7 @@ class AddAdjustment(TypedDict, total=False): """The end date of the adjustment interval. This is the date that the adjustment will stop affecting prices on the - subscription. If null, the adjustment will start when the phase or subscription - starts. + subscription. """ plan_phase_order: Optional[int] diff --git a/src/orb/types/subscription_schedule_plan_change_response.py b/src/orb/types/subscription_schedule_plan_change_response.py index 4b0063b3..bce88950 100644 --- a/src/orb/types/subscription_schedule_plan_change_response.py +++ b/src/orb/types/subscription_schedule_plan_change_response.py @@ -14,11 +14,11 @@ "SubscriptionSchedulePlanChangeResponse", "AdjustmentInterval", "AdjustmentIntervalAdjustment", - "AdjustmentIntervalAdjustmentAmountDiscountAdjustment", - "AdjustmentIntervalAdjustmentPercentageDiscountAdjustment", - "AdjustmentIntervalAdjustmentUsageDiscountAdjustment", - "AdjustmentIntervalAdjustmentMinimumAdjustment", - "AdjustmentIntervalAdjustmentMaximumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment", "BillingCycleAnchorConfiguration", "DiscountInterval", "DiscountIntervalAmountDiscountInterval", @@ -34,16 +34,10 @@ ] -class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["amount_discount"] - - amount_discount: str - """ - The amount by which to discount the prices this adjustment applies to in a given - billing period. - """ + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -60,11 +54,23 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): reason: Optional[str] = None """The reason for the adjustment.""" + usage_discount: float + """ + The number of usage units by which to discount the price this adjustment applies + to in a given billing period. + """ + -class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["percentage_discount"] + adjustment_type: Literal["amount_discount"] + + amount_discount: str + """ + The amount by which to discount the prices this adjustment applies to in a given + billing period. + """ applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -75,12 +81,6 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): that apply to only one price. """ - percentage_discount: float - """ - The percentage (as a value between 0 and 1) by which to discount the price - intervals this adjustment applies to in a given billing period. - """ - plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" @@ -88,10 +88,10 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["usage_discount"] + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -102,20 +102,20 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): that apply to only one price. """ + percentage_discount: float + """ + The percentage (as a value between 0 and 1) by which to discount the price + intervals this adjustment applies to in a given billing period. + """ + plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" reason: Optional[str] = None """The reason for the adjustment.""" - usage_discount: float - """ - The number of usage units by which to discount the price this adjustment applies - to in a given billing period. - """ - -class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment(BaseModel): id: str adjustment_type: Literal["minimum"] @@ -145,7 +145,7 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment(BaseModel): id: str adjustment_type: Literal["maximum"] @@ -174,11 +174,11 @@ class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): AdjustmentIntervalAdjustment: TypeAlias = Annotated[ Union[ - AdjustmentIntervalAdjustmentAmountDiscountAdjustment, - AdjustmentIntervalAdjustmentPercentageDiscountAdjustment, - AdjustmentIntervalAdjustmentUsageDiscountAdjustment, - AdjustmentIntervalAdjustmentMinimumAdjustment, - AdjustmentIntervalAdjustmentMaximumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment, ], PropertyInfo(discriminator="adjustment_type"), ] diff --git a/src/orb/types/subscription_trigger_phase_response.py b/src/orb/types/subscription_trigger_phase_response.py index 78470558..1389c7db 100644 --- a/src/orb/types/subscription_trigger_phase_response.py +++ b/src/orb/types/subscription_trigger_phase_response.py @@ -14,11 +14,11 @@ "SubscriptionTriggerPhaseResponse", "AdjustmentInterval", "AdjustmentIntervalAdjustment", - "AdjustmentIntervalAdjustmentAmountDiscountAdjustment", - "AdjustmentIntervalAdjustmentPercentageDiscountAdjustment", - "AdjustmentIntervalAdjustmentUsageDiscountAdjustment", - "AdjustmentIntervalAdjustmentMinimumAdjustment", - "AdjustmentIntervalAdjustmentMaximumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment", "BillingCycleAnchorConfiguration", "DiscountInterval", "DiscountIntervalAmountDiscountInterval", @@ -34,16 +34,10 @@ ] -class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["amount_discount"] - - amount_discount: str - """ - The amount by which to discount the prices this adjustment applies to in a given - billing period. - """ + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -60,11 +54,23 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): reason: Optional[str] = None """The reason for the adjustment.""" + usage_discount: float + """ + The number of usage units by which to discount the price this adjustment applies + to in a given billing period. + """ + -class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["percentage_discount"] + adjustment_type: Literal["amount_discount"] + + amount_discount: str + """ + The amount by which to discount the prices this adjustment applies to in a given + billing period. + """ applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -75,12 +81,6 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): that apply to only one price. """ - percentage_discount: float - """ - The percentage (as a value between 0 and 1) by which to discount the price - intervals this adjustment applies to in a given billing period. - """ - plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" @@ -88,10 +88,10 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["usage_discount"] + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -102,20 +102,20 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): that apply to only one price. """ + percentage_discount: float + """ + The percentage (as a value between 0 and 1) by which to discount the price + intervals this adjustment applies to in a given billing period. + """ + plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" reason: Optional[str] = None """The reason for the adjustment.""" - usage_discount: float - """ - The number of usage units by which to discount the price this adjustment applies - to in a given billing period. - """ - -class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment(BaseModel): id: str adjustment_type: Literal["minimum"] @@ -145,7 +145,7 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment(BaseModel): id: str adjustment_type: Literal["maximum"] @@ -174,11 +174,11 @@ class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): AdjustmentIntervalAdjustment: TypeAlias = Annotated[ Union[ - AdjustmentIntervalAdjustmentAmountDiscountAdjustment, - AdjustmentIntervalAdjustmentPercentageDiscountAdjustment, - AdjustmentIntervalAdjustmentUsageDiscountAdjustment, - AdjustmentIntervalAdjustmentMinimumAdjustment, - AdjustmentIntervalAdjustmentMaximumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment, ], PropertyInfo(discriminator="adjustment_type"), ] diff --git a/src/orb/types/subscription_unschedule_cancellation_response.py b/src/orb/types/subscription_unschedule_cancellation_response.py index 49777bc2..b0f5ffee 100644 --- a/src/orb/types/subscription_unschedule_cancellation_response.py +++ b/src/orb/types/subscription_unschedule_cancellation_response.py @@ -14,11 +14,11 @@ "SubscriptionUnscheduleCancellationResponse", "AdjustmentInterval", "AdjustmentIntervalAdjustment", - "AdjustmentIntervalAdjustmentAmountDiscountAdjustment", - "AdjustmentIntervalAdjustmentPercentageDiscountAdjustment", - "AdjustmentIntervalAdjustmentUsageDiscountAdjustment", - "AdjustmentIntervalAdjustmentMinimumAdjustment", - "AdjustmentIntervalAdjustmentMaximumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment", "BillingCycleAnchorConfiguration", "DiscountInterval", "DiscountIntervalAmountDiscountInterval", @@ -34,16 +34,10 @@ ] -class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["amount_discount"] - - amount_discount: str - """ - The amount by which to discount the prices this adjustment applies to in a given - billing period. - """ + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -60,11 +54,23 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): reason: Optional[str] = None """The reason for the adjustment.""" + usage_discount: float + """ + The number of usage units by which to discount the price this adjustment applies + to in a given billing period. + """ + -class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["percentage_discount"] + adjustment_type: Literal["amount_discount"] + + amount_discount: str + """ + The amount by which to discount the prices this adjustment applies to in a given + billing period. + """ applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -75,12 +81,6 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): that apply to only one price. """ - percentage_discount: float - """ - The percentage (as a value between 0 and 1) by which to discount the price - intervals this adjustment applies to in a given billing period. - """ - plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" @@ -88,10 +88,10 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["usage_discount"] + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -102,20 +102,20 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): that apply to only one price. """ + percentage_discount: float + """ + The percentage (as a value between 0 and 1) by which to discount the price + intervals this adjustment applies to in a given billing period. + """ + plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" reason: Optional[str] = None """The reason for the adjustment.""" - usage_discount: float - """ - The number of usage units by which to discount the price this adjustment applies - to in a given billing period. - """ - -class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment(BaseModel): id: str adjustment_type: Literal["minimum"] @@ -145,7 +145,7 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment(BaseModel): id: str adjustment_type: Literal["maximum"] @@ -174,11 +174,11 @@ class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): AdjustmentIntervalAdjustment: TypeAlias = Annotated[ Union[ - AdjustmentIntervalAdjustmentAmountDiscountAdjustment, - AdjustmentIntervalAdjustmentPercentageDiscountAdjustment, - AdjustmentIntervalAdjustmentUsageDiscountAdjustment, - AdjustmentIntervalAdjustmentMinimumAdjustment, - AdjustmentIntervalAdjustmentMaximumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment, ], PropertyInfo(discriminator="adjustment_type"), ] diff --git a/src/orb/types/subscription_unschedule_fixed_fee_quantity_updates_response.py b/src/orb/types/subscription_unschedule_fixed_fee_quantity_updates_response.py index 9472d9e7..589339ca 100644 --- a/src/orb/types/subscription_unschedule_fixed_fee_quantity_updates_response.py +++ b/src/orb/types/subscription_unschedule_fixed_fee_quantity_updates_response.py @@ -14,11 +14,11 @@ "SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse", "AdjustmentInterval", "AdjustmentIntervalAdjustment", - "AdjustmentIntervalAdjustmentAmountDiscountAdjustment", - "AdjustmentIntervalAdjustmentPercentageDiscountAdjustment", - "AdjustmentIntervalAdjustmentUsageDiscountAdjustment", - "AdjustmentIntervalAdjustmentMinimumAdjustment", - "AdjustmentIntervalAdjustmentMaximumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment", "BillingCycleAnchorConfiguration", "DiscountInterval", "DiscountIntervalAmountDiscountInterval", @@ -34,16 +34,10 @@ ] -class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["amount_discount"] - - amount_discount: str - """ - The amount by which to discount the prices this adjustment applies to in a given - billing period. - """ + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -60,11 +54,23 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): reason: Optional[str] = None """The reason for the adjustment.""" + usage_discount: float + """ + The number of usage units by which to discount the price this adjustment applies + to in a given billing period. + """ + -class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["percentage_discount"] + adjustment_type: Literal["amount_discount"] + + amount_discount: str + """ + The amount by which to discount the prices this adjustment applies to in a given + billing period. + """ applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -75,12 +81,6 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): that apply to only one price. """ - percentage_discount: float - """ - The percentage (as a value between 0 and 1) by which to discount the price - intervals this adjustment applies to in a given billing period. - """ - plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" @@ -88,10 +88,10 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["usage_discount"] + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -102,20 +102,20 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): that apply to only one price. """ + percentage_discount: float + """ + The percentage (as a value between 0 and 1) by which to discount the price + intervals this adjustment applies to in a given billing period. + """ + plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" reason: Optional[str] = None """The reason for the adjustment.""" - usage_discount: float - """ - The number of usage units by which to discount the price this adjustment applies - to in a given billing period. - """ - -class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment(BaseModel): id: str adjustment_type: Literal["minimum"] @@ -145,7 +145,7 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment(BaseModel): id: str adjustment_type: Literal["maximum"] @@ -174,11 +174,11 @@ class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): AdjustmentIntervalAdjustment: TypeAlias = Annotated[ Union[ - AdjustmentIntervalAdjustmentAmountDiscountAdjustment, - AdjustmentIntervalAdjustmentPercentageDiscountAdjustment, - AdjustmentIntervalAdjustmentUsageDiscountAdjustment, - AdjustmentIntervalAdjustmentMinimumAdjustment, - AdjustmentIntervalAdjustmentMaximumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment, ], PropertyInfo(discriminator="adjustment_type"), ] diff --git a/src/orb/types/subscription_unschedule_pending_plan_changes_response.py b/src/orb/types/subscription_unschedule_pending_plan_changes_response.py index 3b249d81..0e4dc3a1 100644 --- a/src/orb/types/subscription_unschedule_pending_plan_changes_response.py +++ b/src/orb/types/subscription_unschedule_pending_plan_changes_response.py @@ -14,11 +14,11 @@ "SubscriptionUnschedulePendingPlanChangesResponse", "AdjustmentInterval", "AdjustmentIntervalAdjustment", - "AdjustmentIntervalAdjustmentAmountDiscountAdjustment", - "AdjustmentIntervalAdjustmentPercentageDiscountAdjustment", - "AdjustmentIntervalAdjustmentUsageDiscountAdjustment", - "AdjustmentIntervalAdjustmentMinimumAdjustment", - "AdjustmentIntervalAdjustmentMaximumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment", "BillingCycleAnchorConfiguration", "DiscountInterval", "DiscountIntervalAmountDiscountInterval", @@ -34,16 +34,10 @@ ] -class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["amount_discount"] - - amount_discount: str - """ - The amount by which to discount the prices this adjustment applies to in a given - billing period. - """ + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -60,11 +54,23 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): reason: Optional[str] = None """The reason for the adjustment.""" + usage_discount: float + """ + The number of usage units by which to discount the price this adjustment applies + to in a given billing period. + """ + -class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["percentage_discount"] + adjustment_type: Literal["amount_discount"] + + amount_discount: str + """ + The amount by which to discount the prices this adjustment applies to in a given + billing period. + """ applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -75,12 +81,6 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): that apply to only one price. """ - percentage_discount: float - """ - The percentage (as a value between 0 and 1) by which to discount the price - intervals this adjustment applies to in a given billing period. - """ - plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" @@ -88,10 +88,10 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["usage_discount"] + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -102,20 +102,20 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): that apply to only one price. """ + percentage_discount: float + """ + The percentage (as a value between 0 and 1) by which to discount the price + intervals this adjustment applies to in a given billing period. + """ + plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" reason: Optional[str] = None """The reason for the adjustment.""" - usage_discount: float - """ - The number of usage units by which to discount the price this adjustment applies - to in a given billing period. - """ - -class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment(BaseModel): id: str adjustment_type: Literal["minimum"] @@ -145,7 +145,7 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment(BaseModel): id: str adjustment_type: Literal["maximum"] @@ -174,11 +174,11 @@ class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): AdjustmentIntervalAdjustment: TypeAlias = Annotated[ Union[ - AdjustmentIntervalAdjustmentAmountDiscountAdjustment, - AdjustmentIntervalAdjustmentPercentageDiscountAdjustment, - AdjustmentIntervalAdjustmentUsageDiscountAdjustment, - AdjustmentIntervalAdjustmentMinimumAdjustment, - AdjustmentIntervalAdjustmentMaximumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment, ], PropertyInfo(discriminator="adjustment_type"), ] diff --git a/src/orb/types/subscription_update_fixed_fee_quantity_response.py b/src/orb/types/subscription_update_fixed_fee_quantity_response.py index 4c100c7f..a9209366 100644 --- a/src/orb/types/subscription_update_fixed_fee_quantity_response.py +++ b/src/orb/types/subscription_update_fixed_fee_quantity_response.py @@ -14,11 +14,11 @@ "SubscriptionUpdateFixedFeeQuantityResponse", "AdjustmentInterval", "AdjustmentIntervalAdjustment", - "AdjustmentIntervalAdjustmentAmountDiscountAdjustment", - "AdjustmentIntervalAdjustmentPercentageDiscountAdjustment", - "AdjustmentIntervalAdjustmentUsageDiscountAdjustment", - "AdjustmentIntervalAdjustmentMinimumAdjustment", - "AdjustmentIntervalAdjustmentMaximumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment", "BillingCycleAnchorConfiguration", "DiscountInterval", "DiscountIntervalAmountDiscountInterval", @@ -34,16 +34,10 @@ ] -class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["amount_discount"] - - amount_discount: str - """ - The amount by which to discount the prices this adjustment applies to in a given - billing period. - """ + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -60,11 +54,23 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): reason: Optional[str] = None """The reason for the adjustment.""" + usage_discount: float + """ + The number of usage units by which to discount the price this adjustment applies + to in a given billing period. + """ + -class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["percentage_discount"] + adjustment_type: Literal["amount_discount"] + + amount_discount: str + """ + The amount by which to discount the prices this adjustment applies to in a given + billing period. + """ applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -75,12 +81,6 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): that apply to only one price. """ - percentage_discount: float - """ - The percentage (as a value between 0 and 1) by which to discount the price - intervals this adjustment applies to in a given billing period. - """ - plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" @@ -88,10 +88,10 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["usage_discount"] + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -102,20 +102,20 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): that apply to only one price. """ + percentage_discount: float + """ + The percentage (as a value between 0 and 1) by which to discount the price + intervals this adjustment applies to in a given billing period. + """ + plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" reason: Optional[str] = None """The reason for the adjustment.""" - usage_discount: float - """ - The number of usage units by which to discount the price this adjustment applies - to in a given billing period. - """ - -class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment(BaseModel): id: str adjustment_type: Literal["minimum"] @@ -145,7 +145,7 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment(BaseModel): id: str adjustment_type: Literal["maximum"] @@ -174,11 +174,11 @@ class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): AdjustmentIntervalAdjustment: TypeAlias = Annotated[ Union[ - AdjustmentIntervalAdjustmentAmountDiscountAdjustment, - AdjustmentIntervalAdjustmentPercentageDiscountAdjustment, - AdjustmentIntervalAdjustmentUsageDiscountAdjustment, - AdjustmentIntervalAdjustmentMinimumAdjustment, - AdjustmentIntervalAdjustmentMaximumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment, ], PropertyInfo(discriminator="adjustment_type"), ] diff --git a/src/orb/types/subscription_update_trial_response.py b/src/orb/types/subscription_update_trial_response.py index 66dd2cc9..40a211ba 100644 --- a/src/orb/types/subscription_update_trial_response.py +++ b/src/orb/types/subscription_update_trial_response.py @@ -14,11 +14,11 @@ "SubscriptionUpdateTrialResponse", "AdjustmentInterval", "AdjustmentIntervalAdjustment", - "AdjustmentIntervalAdjustmentAmountDiscountAdjustment", - "AdjustmentIntervalAdjustmentPercentageDiscountAdjustment", - "AdjustmentIntervalAdjustmentUsageDiscountAdjustment", - "AdjustmentIntervalAdjustmentMinimumAdjustment", - "AdjustmentIntervalAdjustmentMaximumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment", + "AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment", "BillingCycleAnchorConfiguration", "DiscountInterval", "DiscountIntervalAmountDiscountInterval", @@ -34,16 +34,10 @@ ] -class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["amount_discount"] - - amount_discount: str - """ - The amount by which to discount the prices this adjustment applies to in a given - billing period. - """ + adjustment_type: Literal["usage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -60,11 +54,23 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel): reason: Optional[str] = None """The reason for the adjustment.""" + usage_discount: float + """ + The number of usage units by which to discount the price this adjustment applies + to in a given billing period. + """ + -class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["percentage_discount"] + adjustment_type: Literal["amount_discount"] + + amount_discount: str + """ + The amount by which to discount the prices this adjustment applies to in a given + billing period. + """ applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -75,12 +81,6 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): that apply to only one price. """ - percentage_discount: float - """ - The percentage (as a value between 0 and 1) by which to discount the price - intervals this adjustment applies to in a given billing period. - """ - plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" @@ -88,10 +88,10 @@ class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment(BaseModel): id: str - adjustment_type: Literal["usage_discount"] + adjustment_type: Literal["percentage_discount"] applies_to_price_ids: List[str] """The price IDs that this adjustment applies to.""" @@ -102,20 +102,20 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel): that apply to only one price. """ + percentage_discount: float + """ + The percentage (as a value between 0 and 1) by which to discount the price + intervals this adjustment applies to in a given billing period. + """ + plan_phase_order: Optional[int] = None """The plan phase in which this adjustment is active.""" reason: Optional[str] = None """The reason for the adjustment.""" - usage_discount: float - """ - The number of usage units by which to discount the price this adjustment applies - to in a given billing period. - """ - -class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment(BaseModel): id: str adjustment_type: Literal["minimum"] @@ -145,7 +145,7 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel): """The reason for the adjustment.""" -class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): +class AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment(BaseModel): id: str adjustment_type: Literal["maximum"] @@ -174,11 +174,11 @@ class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel): AdjustmentIntervalAdjustment: TypeAlias = Annotated[ Union[ - AdjustmentIntervalAdjustmentAmountDiscountAdjustment, - AdjustmentIntervalAdjustmentPercentageDiscountAdjustment, - AdjustmentIntervalAdjustmentUsageDiscountAdjustment, - AdjustmentIntervalAdjustmentMinimumAdjustment, - AdjustmentIntervalAdjustmentMaximumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseUsageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseAmountDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhasePercentageDiscountAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMinimumAdjustment, + AdjustmentIntervalAdjustmentPlanPhaseMaximumAdjustment, ], PropertyInfo(discriminator="adjustment_type"), ] diff --git a/tests/test_transform.py b/tests/test_transform.py index b0cb5089..dd25243b 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -2,7 +2,7 @@ import io import pathlib -from typing import Any, List, Union, TypeVar, Iterable, Optional, cast +from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict @@ -388,6 +388,15 @@ def my_iter() -> Iterable[Baz8]: } +@parametrize +@pytest.mark.asyncio +async def test_dictionary_items(use_async: bool) -> None: + class DictItems(TypedDict): + foo_baz: Annotated[str, PropertyInfo(alias="fooBaz")] + + assert await transform({"foo": {"foo_baz": "bar"}}, Dict[str, DictItems], use_async) == {"foo": {"fooBaz": "bar"}} + + class TypedDictIterableUnionStr(TypedDict): foo: Annotated[Union[str, Iterable[Baz8]], PropertyInfo(alias="FOO")]