From 1fa5e759e608fb705a9dce4505db72d4661bd7a1 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Wed, 6 Nov 2024 22:04:58 +0000 Subject: [PATCH 1/2] feat(api): api update (#423) --- .stats.yml | 4 +- src/orb/resources/prices/prices.py | 200 +++++++++++++++++- src/orb/types/plan_create_params.py | 87 ++++++++ src/orb/types/price.py | 113 ++++++++++ src/orb/types/price_create_params.py | 84 ++++++++ .../subscription_price_intervals_params.py | 84 ++++++++ tests/api_resources/test_prices.py | 146 +++++++++++++ 7 files changed, 714 insertions(+), 4 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0f0325a1..3114caa3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 93 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-4df283466fdce46e787565c6480138896b1d7ed98d68a79d5eb3438bed191276.yml +configured_endpoints: 96 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-1345a8e288e34d5477b0e189877225f83939a59078c22fbb5367712e376c5d19.yml diff --git a/src/orb/resources/prices/prices.py b/src/orb/resources/prices/prices.py index 3adc451f..734e65ba 100644 --- a/src/orb/resources/prices/prices.py +++ b/src/orb/resources/prices/prices.py @@ -1950,6 +1950,98 @@ def create( """ ... + @overload + def create( + self, + *, + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], + currency: str, + grouped_tiered_package_config: Dict[str, object], + item_id: str, + model_type: Literal["grouped_tiered_package"], + name: str, + billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, + billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, + billing_cycle_configuration: Optional[ + price_create_params.NewFloatingGroupedTieredPackagePriceBillingCycleConfiguration + ] + | NotGiven = NOT_GIVEN, + conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, + external_price_id: Optional[str] | NotGiven = NOT_GIVEN, + fixed_price_quantity: Optional[float] | NotGiven = NOT_GIVEN, + invoice_grouping_key: Optional[str] | NotGiven = NOT_GIVEN, + invoicing_cycle_configuration: Optional[ + price_create_params.NewFloatingGroupedTieredPackagePriceInvoicingCycleConfiguration + ] + | NotGiven = NOT_GIVEN, + 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, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + idempotency_key: str | None = None, + ) -> Price: + """This endpoint is used to create a [price](../reference/price). + + A price created + using this endpoint is always an add-on, meaning that it’s not associated with a + specific plan and can instead be individually added to subscriptions, including + subscriptions on different plans. + + An `external_price_id` can be optionally specified as an alias to allow + ergonomic interaction with prices in the Orb API. + + See the [Price resource](../reference/price) for the specification of different + price model configurations possible in this endpoint. + + Args: + cadence: The cadence to bill for this price on. + + currency: An ISO 4217 currency string for which this price is billed in. + + item_id: The id of the item the plan will be associated with. + + name: The name of the price. + + billable_metric_id: The id of the billable metric for the price. Only needed if the price is + usage-based. + + billed_in_advance: If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + + billing_cycle_configuration: For custom cadence: specifies the duration of the billing period in days or + months. + + conversion_rate: The per unit conversion rate of the price currency to the invoicing currency. + + external_price_id: An alias for the price. + + fixed_price_quantity: If the Price represents a fixed cost, this represents the quantity of units + applied. + + invoice_grouping_key: The property used to group this price on an invoice + + invoicing_cycle_configuration: Within each billing cycle, specifies the cadence at which invoices are produced. + If unspecified, a single invoice is produced per billing cycle. + + 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 + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + ... + @required_args( ["cadence", "currency", "item_id", "model_type", "name", "unit_config"], ["cadence", "currency", "item_id", "model_type", "name", "package_config"], @@ -1972,6 +2064,7 @@ def create( ["cadence", "currency", "grouped_allocation_config", "item_id", "model_type", "name"], ["cadence", "currency", "grouped_with_prorated_minimum_config", "item_id", "model_type", "name"], ["bulk_with_proration_config", "cadence", "currency", "item_id", "model_type", "name"], + ["cadence", "currency", "grouped_tiered_package_config", "item_id", "model_type", "name"], ) def create( self, @@ -1999,7 +2092,10 @@ def create( | Literal["unit_with_proration"] | Literal["grouped_allocation"] | Literal["grouped_with_prorated_minimum"] - | Literal["bulk_with_proration"], + | Literal["grouped_with_metered_minimum"] + | Literal["matrix_with_display_name"] + | Literal["bulk_with_proration"] + | Literal["grouped_tiered_package"], name: str, unit_config: price_create_params.NewFloatingUnitPriceUnitConfig | NotGiven = NOT_GIVEN, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -2034,6 +2130,7 @@ def create( grouped_allocation_config: Dict[str, object] | NotGiven = NOT_GIVEN, grouped_with_prorated_minimum_config: Dict[str, object] | NotGiven = NOT_GIVEN, bulk_with_proration_config: Dict[str, object] | NotGiven = NOT_GIVEN, + grouped_tiered_package_config: Dict[str, object] | 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, @@ -2083,6 +2180,7 @@ def create( "grouped_allocation_config": grouped_allocation_config, "grouped_with_prorated_minimum_config": grouped_with_prorated_minimum_config, "bulk_with_proration_config": bulk_with_proration_config, + "grouped_tiered_package_config": grouped_tiered_package_config, }, price_create_params.PriceCreateParams, ), @@ -4243,6 +4341,98 @@ async def create( """ ... + @overload + async def create( + self, + *, + cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"], + currency: str, + grouped_tiered_package_config: Dict[str, object], + item_id: str, + model_type: Literal["grouped_tiered_package"], + name: str, + billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, + billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN, + billing_cycle_configuration: Optional[ + price_create_params.NewFloatingGroupedTieredPackagePriceBillingCycleConfiguration + ] + | NotGiven = NOT_GIVEN, + conversion_rate: Optional[float] | NotGiven = NOT_GIVEN, + external_price_id: Optional[str] | NotGiven = NOT_GIVEN, + fixed_price_quantity: Optional[float] | NotGiven = NOT_GIVEN, + invoice_grouping_key: Optional[str] | NotGiven = NOT_GIVEN, + invoicing_cycle_configuration: Optional[ + price_create_params.NewFloatingGroupedTieredPackagePriceInvoicingCycleConfiguration + ] + | NotGiven = NOT_GIVEN, + 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, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + idempotency_key: str | None = None, + ) -> Price: + """This endpoint is used to create a [price](../reference/price). + + A price created + using this endpoint is always an add-on, meaning that it’s not associated with a + specific plan and can instead be individually added to subscriptions, including + subscriptions on different plans. + + An `external_price_id` can be optionally specified as an alias to allow + ergonomic interaction with prices in the Orb API. + + See the [Price resource](../reference/price) for the specification of different + price model configurations possible in this endpoint. + + Args: + cadence: The cadence to bill for this price on. + + currency: An ISO 4217 currency string for which this price is billed in. + + item_id: The id of the item the plan will be associated with. + + name: The name of the price. + + billable_metric_id: The id of the billable metric for the price. Only needed if the price is + usage-based. + + billed_in_advance: If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + + billing_cycle_configuration: For custom cadence: specifies the duration of the billing period in days or + months. + + conversion_rate: The per unit conversion rate of the price currency to the invoicing currency. + + external_price_id: An alias for the price. + + fixed_price_quantity: If the Price represents a fixed cost, this represents the quantity of units + applied. + + invoice_grouping_key: The property used to group this price on an invoice + + invoicing_cycle_configuration: Within each billing cycle, specifies the cadence at which invoices are produced. + If unspecified, a single invoice is produced per billing cycle. + + 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 + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + ... + @required_args( ["cadence", "currency", "item_id", "model_type", "name", "unit_config"], ["cadence", "currency", "item_id", "model_type", "name", "package_config"], @@ -4265,6 +4455,7 @@ async def create( ["cadence", "currency", "grouped_allocation_config", "item_id", "model_type", "name"], ["cadence", "currency", "grouped_with_prorated_minimum_config", "item_id", "model_type", "name"], ["bulk_with_proration_config", "cadence", "currency", "item_id", "model_type", "name"], + ["cadence", "currency", "grouped_tiered_package_config", "item_id", "model_type", "name"], ) async def create( self, @@ -4292,7 +4483,10 @@ async def create( | Literal["unit_with_proration"] | Literal["grouped_allocation"] | Literal["grouped_with_prorated_minimum"] - | Literal["bulk_with_proration"], + | Literal["grouped_with_metered_minimum"] + | Literal["matrix_with_display_name"] + | Literal["bulk_with_proration"] + | Literal["grouped_tiered_package"], name: str, unit_config: price_create_params.NewFloatingUnitPriceUnitConfig | NotGiven = NOT_GIVEN, billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN, @@ -4327,6 +4521,7 @@ async def create( grouped_allocation_config: Dict[str, object] | NotGiven = NOT_GIVEN, grouped_with_prorated_minimum_config: Dict[str, object] | NotGiven = NOT_GIVEN, bulk_with_proration_config: Dict[str, object] | NotGiven = NOT_GIVEN, + grouped_tiered_package_config: Dict[str, object] | 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, @@ -4376,6 +4571,7 @@ async def create( "grouped_allocation_config": grouped_allocation_config, "grouped_with_prorated_minimum_config": grouped_with_prorated_minimum_config, "bulk_with_proration_config": bulk_with_proration_config, + "grouped_tiered_package_config": grouped_tiered_package_config, }, price_create_params.PriceCreateParams, ), diff --git a/src/orb/types/plan_create_params.py b/src/orb/types/plan_create_params.py index e1cf3c36..d84af11a 100644 --- a/src/orb/types/plan_create_params.py +++ b/src/orb/types/plan_create_params.py @@ -75,6 +75,9 @@ "PriceNewPlanBulkWithProrationPrice", "PriceNewPlanBulkWithProrationPriceBillingCycleConfiguration", "PriceNewPlanBulkWithProrationPriceInvoicingCycleConfiguration", + "PriceNewPlanGroupedTieredPackagePrice", + "PriceNewPlanGroupedTieredPackagePriceBillingCycleConfiguration", + "PriceNewPlanGroupedTieredPackagePriceInvoicingCycleConfiguration", ] @@ -1733,6 +1736,89 @@ class PriceNewPlanBulkWithProrationPrice(TypedDict, total=False): """ +class PriceNewPlanGroupedTieredPackagePriceBillingCycleConfiguration(TypedDict, total=False): + duration: Required[int] + """The duration of the billing period.""" + + duration_unit: Required[Literal["day", "month"]] + """The unit of billing period duration.""" + + +class PriceNewPlanGroupedTieredPackagePriceInvoicingCycleConfiguration(TypedDict, total=False): + duration: Required[int] + """The duration of the billing period.""" + + duration_unit: Required[Literal["day", "month"]] + """The unit of billing period duration.""" + + +class PriceNewPlanGroupedTieredPackagePrice(TypedDict, total=False): + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] + """The cadence to bill for this price on.""" + + grouped_tiered_package_config: Required[Dict[str, object]] + + item_id: Required[str] + """The id of the item the plan will be associated with.""" + + model_type: Required[Literal["grouped_tiered_package"]] + + name: Required[str] + """The name of the price.""" + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + billing_cycle_configuration: Optional[PriceNewPlanGroupedTieredPackagePriceBillingCycleConfiguration] + """ + For custom cadence: specifies the duration of the billing period in days or + months. + """ + + conversion_rate: Optional[float] + """The per unit conversion rate of the price currency to the invoicing currency.""" + + currency: Optional[str] + """ + An ISO 4217 currency string, or custom pricing unit identifier, in which this + price is billed. + """ + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + invoicing_cycle_configuration: Optional[PriceNewPlanGroupedTieredPackagePriceInvoicingCycleConfiguration] + """Within each billing cycle, specifies the cadence at which invoices are produced. + + If unspecified, a single invoice is produced per billing cycle. + """ + + 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`. + """ + + Price: TypeAlias = Union[ PriceNewPlanUnitPrice, PriceNewPlanPackagePrice, @@ -1752,4 +1838,5 @@ class PriceNewPlanBulkWithProrationPrice(TypedDict, total=False): PriceNewPlanGroupedAllocationPrice, PriceNewPlanGroupedWithProratedMinimumPrice, PriceNewPlanBulkWithProrationPrice, + PriceNewPlanGroupedTieredPackagePrice, ] diff --git a/src/orb/types/price.py b/src/orb/types/price.py index c20810d8..dcce7864 100644 --- a/src/orb/types/price.py +++ b/src/orb/types/price.py @@ -195,6 +195,14 @@ "BulkWithProrationPriceItem", "BulkWithProrationPriceMaximum", "BulkWithProrationPriceMinimum", + "GroupedTieredPackagePrice", + "GroupedTieredPackagePriceBillableMetric", + "GroupedTieredPackagePriceBillingCycleConfiguration", + "GroupedTieredPackagePriceCreditAllocation", + "GroupedTieredPackagePriceInvoicingCycleConfiguration", + "GroupedTieredPackagePriceItem", + "GroupedTieredPackagePriceMaximum", + "GroupedTieredPackagePriceMinimum", ] @@ -2526,6 +2534,110 @@ class BulkWithProrationPrice(BaseModel): price_type: Literal["usage_price", "fixed_price"] +class GroupedTieredPackagePriceBillableMetric(BaseModel): + id: str + + +class GroupedTieredPackagePriceBillingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + +class GroupedTieredPackagePriceCreditAllocation(BaseModel): + allows_rollover: bool + + currency: str + + +class GroupedTieredPackagePriceInvoicingCycleConfiguration(BaseModel): + duration: int + + duration_unit: Literal["day", "month"] + + +class GroupedTieredPackagePriceItem(BaseModel): + id: str + + name: str + + +class GroupedTieredPackagePriceMaximum(BaseModel): + applies_to_price_ids: List[str] + """List of price_ids that this maximum amount applies to. + + For plan/plan phase maximums, this can be a subset of prices. + """ + + maximum_amount: str + """Maximum amount applied""" + + +class GroupedTieredPackagePriceMinimum(BaseModel): + applies_to_price_ids: List[str] + """List of price_ids that this minimum amount applies to. + + For plan/plan phase minimums, this can be a subset of prices. + """ + + minimum_amount: str + """Minimum amount applied""" + + +class GroupedTieredPackagePrice(BaseModel): + id: str + + billable_metric: Optional[GroupedTieredPackagePriceBillableMetric] = None + + billing_cycle_configuration: GroupedTieredPackagePriceBillingCycleConfiguration + + cadence: Literal["one_time", "monthly", "quarterly", "semi_annual", "annual", "custom"] + + conversion_rate: Optional[float] = None + + created_at: datetime + + credit_allocation: Optional[GroupedTieredPackagePriceCreditAllocation] = None + + currency: str + + discount: Optional[Discount] = None + + external_price_id: Optional[str] = None + + fixed_price_quantity: Optional[float] = None + + grouped_tiered_package_config: Dict[str, object] + + invoicing_cycle_configuration: Optional[GroupedTieredPackagePriceInvoicingCycleConfiguration] = None + + item: GroupedTieredPackagePriceItem + + maximum: Optional[GroupedTieredPackagePriceMaximum] = None + + maximum_amount: Optional[str] = None + + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + + minimum: Optional[GroupedTieredPackagePriceMinimum] = None + + minimum_amount: Optional[str] = None + + price_model_type: Literal["grouped_tiered_package"] = FieldInfo(alias="model_type") + + name: str + + plan_phase_order: Optional[int] = None + + price_type: Literal["usage_price", "fixed_price"] + + Price: TypeAlias = Annotated[ Union[ UnitPrice, @@ -2549,6 +2661,7 @@ class BulkWithProrationPrice(BaseModel): GroupedAllocationPrice, GroupedWithProratedMinimumPrice, BulkWithProrationPrice, + GroupedTieredPackagePrice, ], PropertyInfo(discriminator="price_model_type"), ] diff --git a/src/orb/types/price_create_params.py b/src/orb/types/price_create_params.py index bf7f194e..c0bb199d 100644 --- a/src/orb/types/price_create_params.py +++ b/src/orb/types/price_create_params.py @@ -85,6 +85,9 @@ "NewFloatingBulkWithProrationPrice", "NewFloatingBulkWithProrationPriceBillingCycleConfiguration", "NewFloatingBulkWithProrationPriceInvoicingCycleConfiguration", + "NewFloatingGroupedTieredPackagePrice", + "NewFloatingGroupedTieredPackagePriceBillingCycleConfiguration", + "NewFloatingGroupedTieredPackagePriceInvoicingCycleConfiguration", ] @@ -1912,6 +1915,86 @@ class NewFloatingBulkWithProrationPriceInvoicingCycleConfiguration(TypedDict, to """The unit of billing period duration.""" +class NewFloatingGroupedTieredPackagePrice(TypedDict, total=False): + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] + """The cadence to bill for this price on.""" + + currency: Required[str] + """An ISO 4217 currency string for which this price is billed in.""" + + grouped_tiered_package_config: Required[Dict[str, object]] + + item_id: Required[str] + """The id of the item the plan will be associated with.""" + + model_type: Required[Literal["grouped_tiered_package"]] + + name: Required[str] + """The name of the price.""" + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + billing_cycle_configuration: Optional[NewFloatingGroupedTieredPackagePriceBillingCycleConfiguration] + """ + For custom cadence: specifies the duration of the billing period in days or + months. + """ + + conversion_rate: Optional[float] + """The per unit conversion rate of the price currency to the invoicing currency.""" + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + invoicing_cycle_configuration: Optional[NewFloatingGroupedTieredPackagePriceInvoicingCycleConfiguration] + """Within each billing cycle, specifies the cadence at which invoices are produced. + + If unspecified, a single invoice is produced per billing cycle. + """ + + 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 NewFloatingGroupedTieredPackagePriceBillingCycleConfiguration(TypedDict, total=False): + duration: Required[int] + """The duration of the billing period.""" + + duration_unit: Required[Literal["day", "month"]] + """The unit of billing period duration.""" + + +class NewFloatingGroupedTieredPackagePriceInvoicingCycleConfiguration(TypedDict, total=False): + duration: Required[int] + """The duration of the billing period.""" + + duration_unit: Required[Literal["day", "month"]] + """The unit of billing period duration.""" + + PriceCreateParams: TypeAlias = Union[ NewFloatingUnitPrice, NewFloatingPackagePrice, @@ -1934,4 +2017,5 @@ class NewFloatingBulkWithProrationPriceInvoicingCycleConfiguration(TypedDict, to NewFloatingGroupedAllocationPrice, NewFloatingGroupedWithProratedMinimumPrice, NewFloatingBulkWithProrationPrice, + NewFloatingGroupedTieredPackagePrice, ] diff --git a/src/orb/types/subscription_price_intervals_params.py b/src/orb/types/subscription_price_intervals_params.py index 1811ff2e..eb652b2c 100644 --- a/src/orb/types/subscription_price_intervals_params.py +++ b/src/orb/types/subscription_price_intervals_params.py @@ -97,6 +97,9 @@ "AddPriceNewFloatingBulkWithProrationPrice", "AddPriceNewFloatingBulkWithProrationPriceBillingCycleConfiguration", "AddPriceNewFloatingBulkWithProrationPriceInvoicingCycleConfiguration", + "AddPriceNewFloatingGroupedTieredPackagePrice", + "AddPriceNewFloatingGroupedTieredPackagePriceBillingCycleConfiguration", + "AddPriceNewFloatingGroupedTieredPackagePriceInvoicingCycleConfiguration", "AddAdjustment", "AddAdjustmentAdjustment", "AddAdjustmentAdjustmentNewPercentageDiscount", @@ -2011,6 +2014,86 @@ class AddPriceNewFloatingBulkWithProrationPrice(TypedDict, total=False): """ +class AddPriceNewFloatingGroupedTieredPackagePriceBillingCycleConfiguration(TypedDict, total=False): + duration: Required[int] + """The duration of the billing period.""" + + duration_unit: Required[Literal["day", "month"]] + """The unit of billing period duration.""" + + +class AddPriceNewFloatingGroupedTieredPackagePriceInvoicingCycleConfiguration(TypedDict, total=False): + duration: Required[int] + """The duration of the billing period.""" + + duration_unit: Required[Literal["day", "month"]] + """The unit of billing period duration.""" + + +class AddPriceNewFloatingGroupedTieredPackagePrice(TypedDict, total=False): + cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]] + """The cadence to bill for this price on.""" + + currency: Required[str] + """An ISO 4217 currency string for which this price is billed in.""" + + grouped_tiered_package_config: Required[Dict[str, object]] + + item_id: Required[str] + """The id of the item the plan will be associated with.""" + + model_type: Required[Literal["grouped_tiered_package"]] + + name: Required[str] + """The name of the price.""" + + billable_metric_id: Optional[str] + """The id of the billable metric for the price. + + Only needed if the price is usage-based. + """ + + billed_in_advance: Optional[bool] + """ + If the Price represents a fixed cost, the price will be billed in-advance if + this is true, and in-arrears if this is false. + """ + + billing_cycle_configuration: Optional[AddPriceNewFloatingGroupedTieredPackagePriceBillingCycleConfiguration] + """ + For custom cadence: specifies the duration of the billing period in days or + months. + """ + + conversion_rate: Optional[float] + """The per unit conversion rate of the price currency to the invoicing currency.""" + + external_price_id: Optional[str] + """An alias for the price.""" + + fixed_price_quantity: Optional[float] + """ + If the Price represents a fixed cost, this represents the quantity of units + applied. + """ + + invoice_grouping_key: Optional[str] + """The property used to group this price on an invoice""" + + invoicing_cycle_configuration: Optional[AddPriceNewFloatingGroupedTieredPackagePriceInvoicingCycleConfiguration] + """Within each billing cycle, specifies the cadence at which invoices are produced. + + If unspecified, a single invoice is produced per billing cycle. + """ + + 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`. + """ + + AddPrice: TypeAlias = Union[ AddPriceNewFloatingUnitPrice, AddPriceNewFloatingPackagePrice, @@ -2033,6 +2116,7 @@ class AddPriceNewFloatingBulkWithProrationPrice(TypedDict, total=False): AddPriceNewFloatingGroupedAllocationPrice, AddPriceNewFloatingGroupedWithProratedMinimumPrice, AddPriceNewFloatingBulkWithProrationPrice, + AddPriceNewFloatingGroupedTieredPackagePrice, ] diff --git a/tests/api_resources/test_prices.py b/tests/api_resources/test_prices.py index dbfd062f..a458a3be 100644 --- a/tests/api_resources/test_prices.py +++ b/tests/api_resources/test_prices.py @@ -1890,6 +1890,79 @@ def test_streaming_response_create_overload_21(self, client: Orb) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_create_overload_24(self, client: Orb) -> None: + price = client.prices.create( + cadence="annual", + currency="currency", + grouped_tiered_package_config={"foo": "bar"}, + item_id="item_id", + model_type="grouped_tiered_package", + name="Annual fee", + ) + assert_matches_type(Price, price, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_24(self, client: Orb) -> None: + price = client.prices.create( + cadence="annual", + currency="currency", + grouped_tiered_package_config={"foo": "bar"}, + item_id="item_id", + model_type="grouped_tiered_package", + name="Annual fee", + billable_metric_id="billable_metric_id", + billed_in_advance=True, + billing_cycle_configuration={ + "duration": 0, + "duration_unit": "day", + }, + conversion_rate=0, + external_price_id="external_price_id", + fixed_price_quantity=0, + invoice_grouping_key="invoice_grouping_key", + invoicing_cycle_configuration={ + "duration": 0, + "duration_unit": "day", + }, + metadata={"foo": "string"}, + ) + assert_matches_type(Price, price, path=["response"]) + + @parametrize + def test_raw_response_create_overload_24(self, client: Orb) -> None: + response = client.prices.with_raw_response.create( + cadence="annual", + currency="currency", + grouped_tiered_package_config={"foo": "bar"}, + item_id="item_id", + model_type="grouped_tiered_package", + name="Annual fee", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + price = response.parse() + assert_matches_type(Price, price, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_24(self, client: Orb) -> None: + with client.prices.with_streaming_response.create( + cadence="annual", + currency="currency", + grouped_tiered_package_config={"foo": "bar"}, + item_id="item_id", + model_type="grouped_tiered_package", + name="Annual fee", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + price = response.parse() + assert_matches_type(Price, price, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_update(self, client: Orb) -> None: price = client.prices.update( @@ -3938,6 +4011,79 @@ async def test_streaming_response_create_overload_21(self, async_client: AsyncOr assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_create_overload_24(self, async_client: AsyncOrb) -> None: + price = await async_client.prices.create( + cadence="annual", + currency="currency", + grouped_tiered_package_config={"foo": "bar"}, + item_id="item_id", + model_type="grouped_tiered_package", + name="Annual fee", + ) + assert_matches_type(Price, price, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_24(self, async_client: AsyncOrb) -> None: + price = await async_client.prices.create( + cadence="annual", + currency="currency", + grouped_tiered_package_config={"foo": "bar"}, + item_id="item_id", + model_type="grouped_tiered_package", + name="Annual fee", + billable_metric_id="billable_metric_id", + billed_in_advance=True, + billing_cycle_configuration={ + "duration": 0, + "duration_unit": "day", + }, + conversion_rate=0, + external_price_id="external_price_id", + fixed_price_quantity=0, + invoice_grouping_key="invoice_grouping_key", + invoicing_cycle_configuration={ + "duration": 0, + "duration_unit": "day", + }, + metadata={"foo": "string"}, + ) + assert_matches_type(Price, price, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_24(self, async_client: AsyncOrb) -> None: + response = await async_client.prices.with_raw_response.create( + cadence="annual", + currency="currency", + grouped_tiered_package_config={"foo": "bar"}, + item_id="item_id", + model_type="grouped_tiered_package", + name="Annual fee", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + price = response.parse() + assert_matches_type(Price, price, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_24(self, async_client: AsyncOrb) -> None: + async with async_client.prices.with_streaming_response.create( + cadence="annual", + currency="currency", + grouped_tiered_package_config={"foo": "bar"}, + item_id="item_id", + model_type="grouped_tiered_package", + name="Annual fee", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + price = await response.parse() + assert_matches_type(Price, price, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize async def test_method_update(self, async_client: AsyncOrb) -> None: price = await async_client.prices.update( From 085dba22990582ba0d1f9459e3d3f4b70d9f1e33 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 Nov 2024 22:05:14 +0000 Subject: [PATCH 2/2] release: 2.15.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/orb/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 58682893..cff01f26 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.14.0" + ".": "2.15.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b051f17c..c74492bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 2.15.0 (2024-11-06) + +Full Changelog: [v2.14.0...v2.15.0](https://github.com/orbcorp/orb-python/compare/v2.14.0...v2.15.0) + +### Features + +* **api:** api update ([#423](https://github.com/orbcorp/orb-python/issues/423)) ([1fa5e75](https://github.com/orbcorp/orb-python/commit/1fa5e759e608fb705a9dce4505db72d4661bd7a1)) + ## 2.14.0 (2024-11-06) Full Changelog: [v2.13.0...v2.14.0](https://github.com/orbcorp/orb-python/compare/v2.13.0...v2.14.0) diff --git a/pyproject.toml b/pyproject.toml index 5a37ce23..527302b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "orb-billing" -version = "2.14.0" +version = "2.15.0" description = "The official Python library for the orb API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/orb/_version.py b/src/orb/_version.py index 97f56a9d..95fab6f1 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__ = "2.14.0" # x-release-please-version +__version__ = "2.15.0" # x-release-please-version