diff --git a/.stats.yml b/.stats.yml index e7af37ec..b83ed004 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 90 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-a6a1b7ffd49d131bfc4a1e8e508ac1fe23875c64b27c99f97dd4df06ea5e3ff5.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-6bef7452aabfcad0e298c7e0bbbd90aa6a1d954ad99a04fe756b827fd12a7ce9.yml diff --git a/src/orb/resources/invoices.py b/src/orb/resources/invoices.py index 5da67aa6..e43f9b33 100644 --- a/src/orb/resources/invoices.py +++ b/src/orb/resources/invoices.py @@ -10,6 +10,7 @@ from .. import _legacy_response from ..types import ( + shared_params, invoice_list_params, invoice_create_params, invoice_mark_paid_params, @@ -51,6 +52,7 @@ def create( line_items: Iterable[invoice_create_params.LineItem], net_terms: int, customer_id: Optional[str] | NotGiven = NOT_GIVEN, + discount: Optional[shared_params.Discount] | NotGiven = NOT_GIVEN, external_customer_id: Optional[str] | NotGiven = NOT_GIVEN, memo: Optional[str] | NotGiven = NOT_GIVEN, metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN, @@ -81,6 +83,8 @@ def create( customer_id: The id of the `Customer` to create this invoice for. One of `customer_id` and `external_customer_id` are required. + discount: An optional discount to attach to the invoice. + external_customer_id: The `external_customer_id` of the `Customer` to create this invoice for. One of `customer_id` and `external_customer_id` are required. @@ -112,6 +116,7 @@ def create( "line_items": line_items, "net_terms": net_terms, "customer_id": customer_id, + "discount": discount, "external_customer_id": external_customer_id, "memo": memo, "metadata": metadata, @@ -462,6 +467,7 @@ async def create( line_items: Iterable[invoice_create_params.LineItem], net_terms: int, customer_id: Optional[str] | NotGiven = NOT_GIVEN, + discount: Optional[shared_params.Discount] | NotGiven = NOT_GIVEN, external_customer_id: Optional[str] | NotGiven = NOT_GIVEN, memo: Optional[str] | NotGiven = NOT_GIVEN, metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN, @@ -492,6 +498,8 @@ async def create( customer_id: The id of the `Customer` to create this invoice for. One of `customer_id` and `external_customer_id` are required. + discount: An optional discount to attach to the invoice. + external_customer_id: The `external_customer_id` of the `Customer` to create this invoice for. One of `customer_id` and `external_customer_id` are required. @@ -523,6 +531,7 @@ async def create( "line_items": line_items, "net_terms": net_terms, "customer_id": customer_id, + "discount": discount, "external_customer_id": external_customer_id, "memo": memo, "metadata": metadata, diff --git a/src/orb/resources/items.py b/src/orb/resources/items.py index 94d76a02..da1358a6 100644 --- a/src/orb/resources/items.py +++ b/src/orb/resources/items.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Iterable, Optional import httpx @@ -81,7 +81,6 @@ def update( item_id: str, *, external_connections: Optional[Iterable[item_update_params.ExternalConnection]], - metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -90,15 +89,10 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, idempotency_key: str | None = None, ) -> Item: - """Update items + """ + Update items Args: - metadata: User-specified key/value pairs for the resource. - - Individual keys can be removed - by setting the value to `null`, and the entire metadata mapping can be cleared - by setting `metadata` to `null`. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -113,13 +107,7 @@ def update( raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}") return self._put( f"/items/{item_id}", - body=maybe_transform( - { - "external_connections": external_connections, - "metadata": metadata, - }, - item_update_params.ItemUpdateParams, - ), + body=maybe_transform({"external_connections": external_connections}, item_update_params.ItemUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -268,7 +256,6 @@ async def update( item_id: str, *, external_connections: Optional[Iterable[item_update_params.ExternalConnection]], - metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -277,15 +264,10 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, idempotency_key: str | None = None, ) -> Item: - """Update items + """ + Update items Args: - metadata: User-specified key/value pairs for the resource. - - Individual keys can be removed - by setting the value to `null`, and the entire metadata mapping can be cleared - by setting `metadata` to `null`. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -301,11 +283,7 @@ async def update( return await self._put( f"/items/{item_id}", body=await async_maybe_transform( - { - "external_connections": external_connections, - "metadata": metadata, - }, - item_update_params.ItemUpdateParams, + {"external_connections": external_connections}, item_update_params.ItemUpdateParams ), options=make_request_options( extra_headers=extra_headers, diff --git a/src/orb/resources/prices/prices.py b/src/orb/resources/prices/prices.py index 60a78c4e..b8885ad6 100644 --- a/src/orb/resources/prices/prices.py +++ b/src/orb/resources/prices/prices.py @@ -55,7 +55,7 @@ def with_streaming_response(self) -> PricesWithStreamingResponse: def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit"], @@ -128,7 +128,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["package"], @@ -201,7 +201,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, matrix_config: price_create_params.NewFloatingMatrixPriceMatrixConfig, @@ -274,7 +274,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, matrix_with_allocation_config: price_create_params.NewFloatingMatrixWithAllocationPriceMatrixWithAllocationConfig, @@ -347,7 +347,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered"], @@ -420,7 +420,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_bps"], @@ -494,7 +494,7 @@ def create( self, *, bps_config: price_create_params.NewFloatingBpsPriceBpsConfig, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bps"], @@ -567,7 +567,7 @@ def create( self, *, bulk_bps_config: price_create_params.NewFloatingBulkBpsPriceBulkBpsConfig, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bulk_bps"], @@ -640,7 +640,7 @@ def create( self, *, bulk_config: price_create_params.NewFloatingBulkPriceBulkConfig, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bulk"], @@ -712,7 +712,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["threshold_total_amount"], @@ -785,7 +785,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_package"], @@ -858,7 +858,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, grouped_tiered_config: Dict[str, object], item_id: str, @@ -931,7 +931,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_with_minimum"], @@ -1004,7 +1004,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["package_with_allocation"], @@ -1077,7 +1077,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_package_with_minimum"], @@ -1150,7 +1150,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit_with_percent"], @@ -1223,7 +1223,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_with_proration"], @@ -1296,7 +1296,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit_with_proration"], @@ -1388,7 +1388,7 @@ def create( def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit"] @@ -1688,7 +1688,7 @@ def with_streaming_response(self) -> AsyncPricesWithStreamingResponse: async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit"], @@ -1761,7 +1761,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["package"], @@ -1834,7 +1834,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, matrix_config: price_create_params.NewFloatingMatrixPriceMatrixConfig, @@ -1907,7 +1907,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, matrix_with_allocation_config: price_create_params.NewFloatingMatrixWithAllocationPriceMatrixWithAllocationConfig, @@ -1980,7 +1980,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered"], @@ -2053,7 +2053,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_bps"], @@ -2127,7 +2127,7 @@ async def create( self, *, bps_config: price_create_params.NewFloatingBpsPriceBpsConfig, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bps"], @@ -2200,7 +2200,7 @@ async def create( self, *, bulk_bps_config: price_create_params.NewFloatingBulkBpsPriceBulkBpsConfig, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bulk_bps"], @@ -2273,7 +2273,7 @@ async def create( self, *, bulk_config: price_create_params.NewFloatingBulkPriceBulkConfig, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["bulk"], @@ -2345,7 +2345,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["threshold_total_amount"], @@ -2418,7 +2418,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_package"], @@ -2491,7 +2491,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, grouped_tiered_config: Dict[str, object], item_id: str, @@ -2564,7 +2564,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_with_minimum"], @@ -2637,7 +2637,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["package_with_allocation"], @@ -2710,7 +2710,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_package_with_minimum"], @@ -2783,7 +2783,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit_with_percent"], @@ -2856,7 +2856,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["tiered_with_proration"], @@ -2929,7 +2929,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit_with_proration"], @@ -3021,7 +3021,7 @@ async def create( async def create( self, *, - cadence: Literal["annual", "monthly", "quarterly", "one_time"], + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"], currency: str, item_id: str, model_type: Literal["unit"] diff --git a/src/orb/resources/subscriptions.py b/src/orb/resources/subscriptions.py index a17ecfa7..e9b8b8bd 100644 --- a/src/orb/resources/subscriptions.py +++ b/src/orb/resources/subscriptions.py @@ -1248,7 +1248,9 @@ def price_intervals( subscription_id: str, *, add: Iterable[subscription_price_intervals_params.Add] | NotGiven = NOT_GIVEN, + add_adjustments: Iterable[subscription_price_intervals_params.AddAdjustment] | NotGiven = NOT_GIVEN, edit: Iterable[subscription_price_intervals_params.Edit] | NotGiven = NOT_GIVEN, + edit_adjustments: Iterable[subscription_price_intervals_params.EditAdjustment] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1319,8 +1321,12 @@ def price_intervals( Args: add: A list of price intervals to add to the subscription. + add_adjustments: A list of adjustments to add to the subscription. + edit: A list of price intervals to edit on the subscription. + edit_adjustments: A list of adjustments to edit on the subscription. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1338,7 +1344,9 @@ def price_intervals( body=maybe_transform( { "add": add, + "add_adjustments": add_adjustments, "edit": edit, + "edit_adjustments": edit_adjustments, }, subscription_price_intervals_params.SubscriptionPriceIntervalsParams, ), @@ -2960,7 +2968,9 @@ async def price_intervals( subscription_id: str, *, add: Iterable[subscription_price_intervals_params.Add] | NotGiven = NOT_GIVEN, + add_adjustments: Iterable[subscription_price_intervals_params.AddAdjustment] | NotGiven = NOT_GIVEN, edit: Iterable[subscription_price_intervals_params.Edit] | NotGiven = NOT_GIVEN, + edit_adjustments: Iterable[subscription_price_intervals_params.EditAdjustment] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -3031,8 +3041,12 @@ async def price_intervals( Args: add: A list of price intervals to add to the subscription. + add_adjustments: A list of adjustments to add to the subscription. + edit: A list of price intervals to edit on the subscription. + edit_adjustments: A list of adjustments to edit on the subscription. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -3050,7 +3064,9 @@ async def price_intervals( body=await async_maybe_transform( { "add": add, + "add_adjustments": add_adjustments, "edit": edit, + "edit_adjustments": edit_adjustments, }, subscription_price_intervals_params.SubscriptionPriceIntervalsParams, ), diff --git a/src/orb/types/invoice.py b/src/orb/types/invoice.py index 23f601ca..b1f6fc02 100644 --- a/src/orb/types/invoice.py +++ b/src/orb/types/invoice.py @@ -50,6 +50,9 @@ class AutoCollection(BaseModel): is not enabled for this invoice, this field will be `null`. """ + num_attempts: Optional[int] = None + """Number of auto-collection payment attempts.""" + previously_attempted_at: Optional[datetime] = None """ If Orb has ever attempted payment auto-collection for this invoice, this field diff --git a/src/orb/types/invoice_create_params.py b/src/orb/types/invoice_create_params.py index aa4b32a2..ffe24569 100644 --- a/src/orb/types/invoice_create_params.py +++ b/src/orb/types/invoice_create_params.py @@ -6,6 +6,7 @@ from datetime import date, datetime from typing_extensions import Literal, Required, Annotated, TypedDict +from ..types import shared_params from .._utils import PropertyInfo __all__ = ["InvoiceCreateParams", "LineItem", "LineItemUnitConfig"] @@ -41,6 +42,9 @@ class InvoiceCreateParams(TypedDict, total=False): One of `customer_id` and `external_customer_id` are required. """ + discount: Optional[shared_params.Discount] + """An optional discount to attach to the invoice.""" + external_customer_id: Optional[str] """The `external_customer_id` of the `Customer` to create this invoice for. diff --git a/src/orb/types/invoice_fetch_upcoming_response.py b/src/orb/types/invoice_fetch_upcoming_response.py index 1de3bebb..bc447274 100644 --- a/src/orb/types/invoice_fetch_upcoming_response.py +++ b/src/orb/types/invoice_fetch_upcoming_response.py @@ -50,6 +50,9 @@ class AutoCollection(BaseModel): is not enabled for this invoice, this field will be `null`. """ + num_attempts: Optional[int] = None + """Number of auto-collection payment attempts.""" + previously_attempted_at: Optional[datetime] = None """ If Orb has ever attempted payment auto-collection for this invoice, this field diff --git a/src/orb/types/item_update_params.py b/src/orb/types/item_update_params.py index fd4e8a38..10c43529 100644 --- a/src/orb/types/item_update_params.py +++ b/src/orb/types/item_update_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["ItemUpdateParams", "ExternalConnection"] @@ -11,13 +11,6 @@ class ItemUpdateParams(TypedDict, total=False): external_connections: Required[Optional[Iterable[ExternalConnection]]] - metadata: Optional[Dict[str, Optional[str]]] - """User-specified key/value pairs for the resource. - - Individual keys can be removed by setting the value to `null`, and the entire - metadata mapping can be cleared by setting `metadata` to `null`. - """ - class ExternalConnection(TypedDict, total=False): external_connection_name: Required[ diff --git a/src/orb/types/plan.py b/src/orb/types/plan.py index 66f81cf8..f3b3b805 100644 --- a/src/orb/types/plan.py +++ b/src/orb/types/plan.py @@ -91,7 +91,7 @@ class PlanPhase(BaseModel): If null, this phase is evergreen and active indefinitely """ - duration_unit: Optional[Literal["daily", "monthly", "quarterly", "annual"]] = None + duration_unit: Optional[Literal["daily", "monthly", "quarterly", "semi_annual", "annual"]] = None maximum: Optional[PlanPhaseMaximum] = None diff --git a/src/orb/types/plan_create_params.py b/src/orb/types/plan_create_params.py index 0cf11ec5..bdcbc685 100644 --- a/src/orb/types/plan_create_params.py +++ b/src/orb/types/plan_create_params.py @@ -82,7 +82,7 @@ class PriceNewPlanUnitPriceUnitConfig(TypedDict, total=False): class PriceNewPlanUnitPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -142,7 +142,7 @@ class PriceNewPlanPackagePricePackageConfig(TypedDict, total=False): class PriceNewPlanPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -213,7 +213,7 @@ class PriceNewPlanMatrixPriceMatrixConfig(TypedDict, total=False): class PriceNewPlanMatrixPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -277,7 +277,7 @@ class PriceNewPlanTieredPriceTieredConfig(TypedDict, total=False): class PriceNewPlanTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -347,7 +347,7 @@ class PriceNewPlanTieredBpsPriceTieredBpsConfig(TypedDict, total=False): class PriceNewPlanTieredBpsPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -405,7 +405,7 @@ class PriceNewPlanBpsPriceBpsConfig(TypedDict, total=False): class PriceNewPlanBpsPrice(TypedDict, total=False): bps_config: Required[PriceNewPlanBpsPriceBpsConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -472,7 +472,7 @@ class PriceNewPlanBulkBpsPriceBulkBpsConfig(TypedDict, total=False): class PriceNewPlanBulkBpsPrice(TypedDict, total=False): bulk_bps_config: Required[PriceNewPlanBulkBpsPriceBulkBpsConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -533,7 +533,7 @@ class PriceNewPlanBulkPriceBulkConfig(TypedDict, total=False): class PriceNewPlanBulkPrice(TypedDict, total=False): bulk_config: Required[PriceNewPlanBulkPriceBulkConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -579,7 +579,7 @@ class PriceNewPlanBulkPrice(TypedDict, total=False): class PriceNewPlanThresholdTotalAmountPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -627,7 +627,7 @@ class PriceNewPlanThresholdTotalAmountPrice(TypedDict, total=False): class PriceNewPlanTieredPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -675,7 +675,7 @@ class PriceNewPlanTieredPackagePrice(TypedDict, total=False): class PriceNewPlanTieredWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -723,7 +723,7 @@ class PriceNewPlanTieredWithMinimumPrice(TypedDict, total=False): class PriceNewPlanUnitWithPercentPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -771,7 +771,7 @@ class PriceNewPlanUnitWithPercentPrice(TypedDict, total=False): class PriceNewPlanPackageWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -819,7 +819,7 @@ class PriceNewPlanPackageWithAllocationPrice(TypedDict, total=False): class PriceNewPlanTierWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] @@ -867,7 +867,7 @@ class PriceNewPlanTierWithProrationPrice(TypedDict, total=False): class PriceNewPlanUnitWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" item_id: Required[str] diff --git a/src/orb/types/price.py b/src/orb/types/price.py index 7e017b33..d0e1f0a2 100644 --- a/src/orb/types/price.py +++ b/src/orb/types/price.py @@ -186,7 +186,7 @@ class UnitPrice(BaseModel): billable_metric: Optional[UnitPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -278,7 +278,7 @@ class PackagePrice(BaseModel): billable_metric: Optional[PackagePriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -381,7 +381,7 @@ class MatrixPrice(BaseModel): billable_metric: Optional[MatrixPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -477,7 +477,7 @@ class TieredPrice(BaseModel): billable_metric: Optional[TieredPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -579,7 +579,7 @@ class TieredBpsPrice(BaseModel): billable_metric: Optional[TieredBpsPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -669,7 +669,7 @@ class BpsPrice(BaseModel): bps_config: BpsPriceBpsConfig - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -768,7 +768,7 @@ class BulkBpsPrice(BaseModel): bulk_bps_config: BulkBpsPriceBulkBpsConfig - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -861,7 +861,7 @@ class BulkPrice(BaseModel): bulk_config: BulkPriceBulkConfig - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -939,7 +939,7 @@ class ThresholdTotalAmountPrice(BaseModel): billable_metric: Optional[ThresholdTotalAmountPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1019,7 +1019,7 @@ class TieredPackagePrice(BaseModel): billable_metric: Optional[TieredPackagePriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1099,7 +1099,7 @@ class GroupedTieredPrice(BaseModel): billable_metric: Optional[GroupedTieredPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1179,7 +1179,7 @@ class TieredWithMinimumPrice(BaseModel): billable_metric: Optional[TieredWithMinimumPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1259,7 +1259,7 @@ class TieredPackageWithMinimumPrice(BaseModel): billable_metric: Optional[TieredPackageWithMinimumPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1339,7 +1339,7 @@ class PackageWithAllocationPrice(BaseModel): billable_metric: Optional[PackageWithAllocationPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1419,7 +1419,7 @@ class UnitWithPercentPrice(BaseModel): billable_metric: Optional[UnitWithPercentPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1525,7 +1525,7 @@ class MatrixWithAllocationPrice(BaseModel): billable_metric: Optional[MatrixWithAllocationPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1605,7 +1605,7 @@ class TieredWithProrationPrice(BaseModel): billable_metric: Optional[TieredWithProrationPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None @@ -1685,7 +1685,7 @@ class UnitWithProrationPrice(BaseModel): billable_metric: Optional[UnitWithProrationPriceBillableMetric] = None - cadence: Literal["one_time", "monthly", "quarterly", "annual"] + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"] conversion_rate: Optional[float] = None diff --git a/src/orb/types/price_create_params.py b/src/orb/types/price_create_params.py index 5ba3477b..e958358e 100644 --- a/src/orb/types/price_create_params.py +++ b/src/orb/types/price_create_params.py @@ -44,7 +44,7 @@ class NewFloatingUnitPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -94,7 +94,7 @@ class NewFloatingUnitPriceUnitConfig(TypedDict, total=False): class NewFloatingPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -151,7 +151,7 @@ class NewFloatingPackagePricePackageConfig(TypedDict, total=False): class NewFloatingMatrixPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -219,7 +219,7 @@ class NewFloatingMatrixPriceMatrixConfig(TypedDict, total=False): class NewFloatingMatrixWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -290,7 +290,7 @@ class NewFloatingMatrixWithAllocationPriceMatrixWithAllocationConfig(TypedDict, class NewFloatingTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -351,7 +351,7 @@ class NewFloatingTieredPriceTieredConfig(TypedDict, total=False): class NewFloatingTieredBpsPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -420,7 +420,7 @@ class NewFloatingTieredBpsPriceTieredBpsConfig(TypedDict, total=False): class NewFloatingBpsPrice(TypedDict, total=False): bps_config: Required[NewFloatingBpsPriceBpsConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -473,7 +473,7 @@ class NewFloatingBpsPriceBpsConfig(TypedDict, total=False): class NewFloatingBulkBpsPrice(TypedDict, total=False): bulk_bps_config: Required[NewFloatingBulkBpsPriceBulkBpsConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -537,7 +537,7 @@ class NewFloatingBulkBpsPriceBulkBpsConfig(TypedDict, total=False): class NewFloatingBulkPrice(TypedDict, total=False): bulk_config: Required[NewFloatingBulkPriceBulkConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -593,7 +593,7 @@ class NewFloatingBulkPriceBulkConfig(TypedDict, total=False): class NewFloatingThresholdTotalAmountPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -638,7 +638,7 @@ class NewFloatingThresholdTotalAmountPrice(TypedDict, total=False): class NewFloatingTieredPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -683,7 +683,7 @@ class NewFloatingTieredPackagePrice(TypedDict, total=False): class NewFloatingGroupedTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -728,7 +728,7 @@ class NewFloatingGroupedTieredPrice(TypedDict, total=False): class NewFloatingTieredWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -773,7 +773,7 @@ class NewFloatingTieredWithMinimumPrice(TypedDict, total=False): class NewFloatingPackageWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -818,7 +818,7 @@ class NewFloatingPackageWithAllocationPrice(TypedDict, total=False): class NewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -863,7 +863,7 @@ class NewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): class NewFloatingUnitWithPercentPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -908,7 +908,7 @@ class NewFloatingUnitWithPercentPrice(TypedDict, total=False): class NewFloatingTieredWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -953,7 +953,7 @@ class NewFloatingTieredWithProrationPrice(TypedDict, total=False): class NewFloatingUnitWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] diff --git a/src/orb/types/shared_params/__init__.py b/src/orb/types/shared_params/__init__.py index b5237646..ed0e0225 100644 --- a/src/orb/types/shared_params/__init__.py +++ b/src/orb/types/shared_params/__init__.py @@ -1,3 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .discount import Discount as Discount from .billing_cycle_relative_date import BillingCycleRelativeDate as BillingCycleRelativeDate diff --git a/src/orb/types/shared_params/discount.py b/src/orb/types/shared_params/discount.py new file mode 100644 index 00000000..cab49d43 --- /dev/null +++ b/src/orb/types/shared_params/discount.py @@ -0,0 +1,80 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["Discount", "PercentageDiscount", "TrialDiscount", "UsageDiscount", "AmountDiscount"] + + +class PercentageDiscount(TypedDict, total=False): + applies_to_price_ids: Required[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + discount_type: Required[Literal["percentage"]] + + percentage_discount: Required[float] + """Only available if discount_type is `percentage`. + + This is a number between 0 and 1. + """ + + reason: Optional[str] + + +class TrialDiscount(TypedDict, total=False): + applies_to_price_ids: Required[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + discount_type: Required[Literal["trial"]] + + reason: Optional[str] + + trial_amount_discount: Optional[str] + """Only available if discount_type is `trial`""" + + trial_percentage_discount: Optional[float] + """Only available if discount_type is `trial`""" + + +class UsageDiscount(TypedDict, total=False): + applies_to_price_ids: Required[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + discount_type: Required[Literal["usage"]] + + usage_discount: Required[float] + """Only available if discount_type is `usage`. + + Number of usage units that this discount is for + """ + + reason: Optional[str] + + +class AmountDiscount(TypedDict, total=False): + amount_discount: Required[str] + """Only available if discount_type is `amount`.""" + + applies_to_price_ids: Required[List[str]] + """List of price_ids that this discount applies to. + + For plan/plan phase discounts, this can be a subset of prices. + """ + + discount_type: Required[Literal["amount"]] + + reason: Optional[str] + + +Discount = Union[PercentageDiscount, TrialDiscount, UsageDiscount, AmountDiscount] diff --git a/src/orb/types/subscription_price_intervals_params.py b/src/orb/types/subscription_price_intervals_params.py index 3160ae74..7acacca4 100644 --- a/src/orb/types/subscription_price_intervals_params.py +++ b/src/orb/types/subscription_price_intervals_params.py @@ -51,8 +51,15 @@ "AddPriceNewFloatingUnitWithPercentPrice", "AddPriceNewFloatingTieredWithProrationPrice", "AddPriceNewFloatingUnitWithProrationPrice", + "AddAdjustment", + "AddAdjustmentAdjustment", + "AddAdjustmentAdjustmentNewPercentageDiscount", + "AddAdjustmentAdjustmentNewAmountDiscount", + "AddAdjustmentAdjustmentNewMinimum", + "AddAdjustmentAdjustmentNewMaximum", "Edit", "EditFixedFeeQuantityTransition", + "EditAdjustment", ] @@ -60,9 +67,15 @@ class SubscriptionPriceIntervalsParams(TypedDict, total=False): add: Iterable[Add] """A list of price intervals to add to the subscription.""" + add_adjustments: Iterable[AddAdjustment] + """A list of adjustments to add to the subscription.""" + edit: Iterable[Edit] """A list of price intervals to edit on the subscription.""" + edit_adjustments: Iterable[EditAdjustment] + """A list of adjustments to edit on the subscription.""" + class AddDiscountAmountDiscountCreationParams(TypedDict, total=False): amount_discount: Required[float] @@ -112,7 +125,7 @@ class AddPriceNewFloatingUnitPriceUnitConfig(TypedDict, total=False): class AddPriceNewFloatingUnitPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -169,7 +182,7 @@ class AddPriceNewFloatingPackagePricePackageConfig(TypedDict, total=False): class AddPriceNewFloatingPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -237,7 +250,7 @@ class AddPriceNewFloatingMatrixPriceMatrixConfig(TypedDict, total=False): class AddPriceNewFloatingMatrixPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -308,7 +321,7 @@ class AddPriceNewFloatingMatrixWithAllocationPriceMatrixWithAllocationConfig(Typ class AddPriceNewFloatingMatrixWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -369,7 +382,7 @@ class AddPriceNewFloatingTieredPriceTieredConfig(TypedDict, total=False): class AddPriceNewFloatingTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -436,7 +449,7 @@ class AddPriceNewFloatingTieredBpsPriceTieredBpsConfig(TypedDict, total=False): class AddPriceNewFloatingTieredBpsPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -491,7 +504,7 @@ class AddPriceNewFloatingBpsPriceBpsConfig(TypedDict, total=False): class AddPriceNewFloatingBpsPrice(TypedDict, total=False): bps_config: Required[AddPriceNewFloatingBpsPriceBpsConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -555,7 +568,7 @@ class AddPriceNewFloatingBulkBpsPriceBulkBpsConfig(TypedDict, total=False): class AddPriceNewFloatingBulkBpsPrice(TypedDict, total=False): bulk_bps_config: Required[AddPriceNewFloatingBulkBpsPriceBulkBpsConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -613,7 +626,7 @@ class AddPriceNewFloatingBulkPriceBulkConfig(TypedDict, total=False): class AddPriceNewFloatingBulkPrice(TypedDict, total=False): bulk_config: Required[AddPriceNewFloatingBulkPriceBulkConfig] - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -656,7 +669,7 @@ class AddPriceNewFloatingBulkPrice(TypedDict, total=False): class AddPriceNewFloatingThresholdTotalAmountPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -701,7 +714,7 @@ class AddPriceNewFloatingThresholdTotalAmountPrice(TypedDict, total=False): class AddPriceNewFloatingTieredPackagePrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -746,7 +759,7 @@ class AddPriceNewFloatingTieredPackagePrice(TypedDict, total=False): class AddPriceNewFloatingGroupedTieredPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -791,7 +804,7 @@ class AddPriceNewFloatingGroupedTieredPrice(TypedDict, total=False): class AddPriceNewFloatingTieredWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -836,7 +849,7 @@ class AddPriceNewFloatingTieredWithMinimumPrice(TypedDict, total=False): class AddPriceNewFloatingPackageWithAllocationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -881,7 +894,7 @@ class AddPriceNewFloatingPackageWithAllocationPrice(TypedDict, total=False): class AddPriceNewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -926,7 +939,7 @@ class AddPriceNewFloatingTieredPackageWithMinimumPrice(TypedDict, total=False): class AddPriceNewFloatingUnitWithPercentPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -971,7 +984,7 @@ class AddPriceNewFloatingUnitWithPercentPrice(TypedDict, total=False): class AddPriceNewFloatingTieredWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -1016,7 +1029,7 @@ class AddPriceNewFloatingTieredWithProrationPrice(TypedDict, total=False): class AddPriceNewFloatingUnitWithProrationPrice(TypedDict, total=False): - cadence: Required[Literal["annual", "monthly", "quarterly", "one_time"]] + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time"]] """The cadence to bill for this price on.""" currency: Required[str] @@ -1125,6 +1138,74 @@ class Add(TypedDict, total=False): """The id of the price to add to the subscription.""" +class AddAdjustmentAdjustmentNewPercentageDiscount(TypedDict, total=False): + adjustment_type: Required[Literal["percentage_discount"]] + + applies_to_price_ids: Required[List[str]] + """The set of price IDs to which this adjustment applies.""" + + percentage_discount: Required[float] + + +class AddAdjustmentAdjustmentNewAmountDiscount(TypedDict, total=False): + adjustment_type: Required[Literal["amount_discount"]] + + amount_discount: Required[str] + + applies_to_price_ids: Required[List[str]] + """The set of price IDs to which this adjustment applies.""" + + +class AddAdjustmentAdjustmentNewMinimum(TypedDict, total=False): + adjustment_type: Required[Literal["minimum"]] + + applies_to_price_ids: Required[List[str]] + """The set of price IDs to which this adjustment applies.""" + + item_id: Required[str] + """The item ID that revenue from this minimum will be attributed to.""" + + minimum_amount: Required[str] + + +class AddAdjustmentAdjustmentNewMaximum(TypedDict, total=False): + adjustment_type: Required[Literal["maximum"]] + + applies_to_price_ids: Required[List[str]] + """The set of price IDs to which this adjustment applies.""" + + maximum_amount: Required[str] + + +AddAdjustmentAdjustment = Union[ + AddAdjustmentAdjustmentNewPercentageDiscount, + AddAdjustmentAdjustmentNewAmountDiscount, + AddAdjustmentAdjustmentNewMinimum, + AddAdjustmentAdjustmentNewMaximum, +] + + +class AddAdjustment(TypedDict, total=False): + adjustment: Required[AddAdjustmentAdjustment] + """The definition of a new adjustment to create and add to the subscription.""" + + start_date: Required[ + Annotated[Union[Union[str, datetime], BillingCycleRelativeDate], PropertyInfo(format="iso8601")] + ] + """The start date of the adjustment interval. + + This is the date that the adjustment will start affecting prices on the + subscription. + """ + + end_date: Annotated[Union[Union[str, datetime], BillingCycleRelativeDate, None], PropertyInfo(format="iso8601")] + """The end date of the adjustment interval. + + This is the date that the adjustment will stop affecting prices on the + subscription. + """ + + class EditFixedFeeQuantityTransition(TypedDict, total=False): effective_date: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] """The date that the fixed fee quantity transition should take effect.""" @@ -1162,3 +1243,20 @@ class Edit(TypedDict, total=False): If not specified, the start date will not be updated. """ + + +class EditAdjustment(TypedDict, total=False): + adjustment_interval_id: Required[str] + """The id of the adjustment interval to edit.""" + + end_date: Annotated[Union[Union[str, datetime], BillingCycleRelativeDate, None], PropertyInfo(format="iso8601")] + """The updated end date of this adjustment interval. + + If not specified, the start date will not be updated. + """ + + start_date: Annotated[Union[Union[str, datetime], BillingCycleRelativeDate], PropertyInfo(format="iso8601")] + """The updated start date of this adjustment interval. + + If not specified, the start date will not be updated. + """ diff --git a/tests/api_resources/test_invoices.py b/tests/api_resources/test_invoices.py index a180b838..0d2e2df5 100644 --- a/tests/api_resources/test_invoices.py +++ b/tests/api_resources/test_invoices.py @@ -96,6 +96,12 @@ def test_method_create_with_all_params(self, client: Orb) -> None: ], net_terms=0, customer_id="4khy3nwzktxv7", + discount={ + "discount_type": "percentage", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], + "reason": "string", + "percentage_discount": 0.15, + }, external_customer_id="external-customer-id", memo="An optional memo for my invoice.", metadata={"foo": "string"}, @@ -515,6 +521,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No ], net_terms=0, customer_id="4khy3nwzktxv7", + discount={ + "discount_type": "percentage", + "applies_to_price_ids": ["h74gfhdjvn7ujokd", "7hfgtgjnbvc3ujkl"], + "reason": "string", + "percentage_discount": 0.15, + }, external_customer_id="external-customer-id", memo="An optional memo for my invoice.", metadata={"foo": "string"}, diff --git a/tests/api_resources/test_items.py b/tests/api_resources/test_items.py index 7561bdb6..87fc7207 100644 --- a/tests/api_resources/test_items.py +++ b/tests/api_resources/test_items.py @@ -70,28 +70,6 @@ def test_method_update(self, client: Orb) -> None: ) assert_matches_type(Item, item, path=["response"]) - @parametrize - def test_method_update_with_all_params(self, client: Orb) -> None: - item = client.items.update( - "string", - external_connections=[ - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - ], - metadata={"foo": "string"}, - ) - assert_matches_type(Item, item, path=["response"]) - @parametrize def test_raw_response_update(self, client: Orb) -> None: response = client.items.with_raw_response.update( @@ -292,28 +270,6 @@ async def test_method_update(self, async_client: AsyncOrb) -> None: ) assert_matches_type(Item, item, path=["response"]) - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> None: - item = await async_client.items.update( - "string", - external_connections=[ - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - { - "external_connection_name": "stripe", - "external_entity_id": "string", - }, - ], - metadata={"foo": "string"}, - ) - assert_matches_type(Item, item, path=["response"]) - @parametrize async def test_raw_response_update(self, async_client: AsyncOrb) -> None: response = await async_client.items.with_raw_response.update( diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index c8a8dc64..73f116a4 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -635,6 +635,35 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "maximum_amount": 0, }, ], + add_adjustments=[ + { + "adjustment": { + "applies_to_price_ids": ["price_1", "price_2"], + "adjustment_type": "percentage_discount", + "percentage_discount": 0, + }, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + { + "adjustment": { + "applies_to_price_ids": ["price_1", "price_2"], + "adjustment_type": "percentage_discount", + "percentage_discount": 0, + }, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + { + "adjustment": { + "applies_to_price_ids": ["price_1", "price_2"], + "adjustment_type": "percentage_discount", + "percentage_discount": 0, + }, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + ], edit=[ { "price_interval_id": "sdfs6wdjvn7ujokd", @@ -697,6 +726,23 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "billing_cycle_day": 0, }, ], + edit_adjustments=[ + { + "adjustment_interval_id": "sdfs6wdjvn7ujokd", + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + { + "adjustment_interval_id": "sdfs6wdjvn7ujokd", + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + { + "adjustment_interval_id": "sdfs6wdjvn7ujokd", + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + ], ) assert_matches_type(Subscription, subscription, path=["response"]) @@ -1686,6 +1732,35 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "maximum_amount": 0, }, ], + add_adjustments=[ + { + "adjustment": { + "applies_to_price_ids": ["price_1", "price_2"], + "adjustment_type": "percentage_discount", + "percentage_discount": 0, + }, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + { + "adjustment": { + "applies_to_price_ids": ["price_1", "price_2"], + "adjustment_type": "percentage_discount", + "percentage_discount": 0, + }, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + { + "adjustment": { + "applies_to_price_ids": ["price_1", "price_2"], + "adjustment_type": "percentage_discount", + "percentage_discount": 0, + }, + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + ], edit=[ { "price_interval_id": "sdfs6wdjvn7ujokd", @@ -1748,6 +1823,23 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "billing_cycle_day": 0, }, ], + edit_adjustments=[ + { + "adjustment_interval_id": "sdfs6wdjvn7ujokd", + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + { + "adjustment_interval_id": "sdfs6wdjvn7ujokd", + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + { + "adjustment_interval_id": "sdfs6wdjvn7ujokd", + "start_date": parse_datetime("2019-12-27T18:11:19.117Z"), + "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + ], ) assert_matches_type(Subscription, subscription, path=["response"])