Skip to content

Commit 8f48b6a

Browse files
feat(api): api update (#492)
1 parent 1f41a57 commit 8f48b6a

File tree

7 files changed

+801
-95
lines changed

7 files changed

+801
-95
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 101
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-ac2f736602bc631b92de358a7edb395cf53ed506b2cb3d0494fffa31be9e2d9f.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-11f40c15fa889d9752019e8a35b82d2e7a3d42f2b42c850b469f120a5b2c47ba.yml

src/orb/resources/prices/prices.py

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,98 @@ def create(
11331133
"""
11341134
...
11351135

1136+
@overload
1137+
def create(
1138+
self,
1139+
*,
1140+
cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"],
1141+
currency: str,
1142+
item_id: str,
1143+
max_group_tiered_config: Dict[str, object],
1144+
model_type: Literal["max_group_tiered"],
1145+
name: str,
1146+
billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN,
1147+
billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN,
1148+
billing_cycle_configuration: Optional[
1149+
price_create_params.NewFloatingMaxGroupTieredPriceBillingCycleConfiguration
1150+
]
1151+
| NotGiven = NOT_GIVEN,
1152+
conversion_rate: Optional[float] | NotGiven = NOT_GIVEN,
1153+
external_price_id: Optional[str] | NotGiven = NOT_GIVEN,
1154+
fixed_price_quantity: Optional[float] | NotGiven = NOT_GIVEN,
1155+
invoice_grouping_key: Optional[str] | NotGiven = NOT_GIVEN,
1156+
invoicing_cycle_configuration: Optional[
1157+
price_create_params.NewFloatingMaxGroupTieredPriceInvoicingCycleConfiguration
1158+
]
1159+
| NotGiven = NOT_GIVEN,
1160+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
1161+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1162+
# The extra values given here take precedence over values defined on the client or passed to this method.
1163+
extra_headers: Headers | None = None,
1164+
extra_query: Query | None = None,
1165+
extra_body: Body | None = None,
1166+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1167+
idempotency_key: str | None = None,
1168+
) -> Price:
1169+
"""This endpoint is used to create a [price](../reference/price).
1170+
1171+
A price created
1172+
using this endpoint is always an add-on, meaning that it’s not associated with a
1173+
specific plan and can instead be individually added to subscriptions, including
1174+
subscriptions on different plans.
1175+
1176+
An `external_price_id` can be optionally specified as an alias to allow
1177+
ergonomic interaction with prices in the Orb API.
1178+
1179+
See the [Price resource](../reference/price) for the specification of different
1180+
price model configurations possible in this endpoint.
1181+
1182+
Args:
1183+
cadence: The cadence to bill for this price on.
1184+
1185+
currency: An ISO 4217 currency string for which this price is billed in.
1186+
1187+
item_id: The id of the item the plan will be associated with.
1188+
1189+
name: The name of the price.
1190+
1191+
billable_metric_id: The id of the billable metric for the price. Only needed if the price is
1192+
usage-based.
1193+
1194+
billed_in_advance: If the Price represents a fixed cost, the price will be billed in-advance if
1195+
this is true, and in-arrears if this is false.
1196+
1197+
billing_cycle_configuration: For custom cadence: specifies the duration of the billing period in days or
1198+
months.
1199+
1200+
conversion_rate: The per unit conversion rate of the price currency to the invoicing currency.
1201+
1202+
external_price_id: An alias for the price.
1203+
1204+
fixed_price_quantity: If the Price represents a fixed cost, this represents the quantity of units
1205+
applied.
1206+
1207+
invoice_grouping_key: The property used to group this price on an invoice
1208+
1209+
invoicing_cycle_configuration: Within each billing cycle, specifies the cadence at which invoices are produced.
1210+
If unspecified, a single invoice is produced per billing cycle.
1211+
1212+
metadata: User-specified key/value pairs for the resource. Individual keys can be removed
1213+
by setting the value to `null`, and the entire metadata mapping can be cleared
1214+
by setting `metadata` to `null`.
1215+
1216+
extra_headers: Send extra headers
1217+
1218+
extra_query: Add additional query parameters to the request
1219+
1220+
extra_body: Add additional JSON properties to the request
1221+
1222+
timeout: Override the client-level default timeout for this request, in seconds
1223+
1224+
idempotency_key: Specify a custom idempotency key for this request
1225+
"""
1226+
...
1227+
11361228
@overload
11371229
def create(
11381230
self,
@@ -2250,6 +2342,7 @@ def create(
22502342
["cadence", "currency", "item_id", "model_type", "name", "threshold_total_amount_config"],
22512343
["cadence", "currency", "item_id", "model_type", "name", "tiered_package_config"],
22522344
["cadence", "currency", "grouped_tiered_config", "item_id", "model_type", "name"],
2345+
["cadence", "currency", "item_id", "max_group_tiered_config", "model_type", "name"],
22532346
["cadence", "currency", "item_id", "model_type", "name", "tiered_with_minimum_config"],
22542347
["cadence", "currency", "item_id", "model_type", "name", "package_with_allocation_config"],
22552348
["cadence", "currency", "item_id", "model_type", "name", "tiered_package_with_minimum_config"],
@@ -2281,6 +2374,7 @@ def create(
22812374
| Literal["threshold_total_amount"]
22822375
| Literal["tiered_package"]
22832376
| Literal["grouped_tiered"]
2377+
| Literal["max_group_tiered"]
22842378
| Literal["tiered_with_minimum"]
22852379
| Literal["package_with_allocation"]
22862380
| Literal["tiered_package_with_minimum"]
@@ -2318,6 +2412,7 @@ def create(
23182412
threshold_total_amount_config: Dict[str, object] | NotGiven = NOT_GIVEN,
23192413
tiered_package_config: Dict[str, object] | NotGiven = NOT_GIVEN,
23202414
grouped_tiered_config: Dict[str, object] | NotGiven = NOT_GIVEN,
2415+
max_group_tiered_config: Dict[str, object] | NotGiven = NOT_GIVEN,
23212416
tiered_with_minimum_config: Dict[str, object] | NotGiven = NOT_GIVEN,
23222417
package_with_allocation_config: Dict[str, object] | NotGiven = NOT_GIVEN,
23232418
tiered_package_with_minimum_config: Dict[str, object] | NotGiven = NOT_GIVEN,
@@ -2370,6 +2465,7 @@ def create(
23702465
"threshold_total_amount_config": threshold_total_amount_config,
23712466
"tiered_package_config": tiered_package_config,
23722467
"grouped_tiered_config": grouped_tiered_config,
2468+
"max_group_tiered_config": max_group_tiered_config,
23732469
"tiered_with_minimum_config": tiered_with_minimum_config,
23742470
"package_with_allocation_config": package_with_allocation_config,
23752471
"tiered_package_with_minimum_config": tiered_package_with_minimum_config,
@@ -3725,6 +3821,98 @@ async def create(
37253821
"""
37263822
...
37273823

3824+
@overload
3825+
async def create(
3826+
self,
3827+
*,
3828+
cadence: Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"],
3829+
currency: str,
3830+
item_id: str,
3831+
max_group_tiered_config: Dict[str, object],
3832+
model_type: Literal["max_group_tiered"],
3833+
name: str,
3834+
billable_metric_id: Optional[str] | NotGiven = NOT_GIVEN,
3835+
billed_in_advance: Optional[bool] | NotGiven = NOT_GIVEN,
3836+
billing_cycle_configuration: Optional[
3837+
price_create_params.NewFloatingMaxGroupTieredPriceBillingCycleConfiguration
3838+
]
3839+
| NotGiven = NOT_GIVEN,
3840+
conversion_rate: Optional[float] | NotGiven = NOT_GIVEN,
3841+
external_price_id: Optional[str] | NotGiven = NOT_GIVEN,
3842+
fixed_price_quantity: Optional[float] | NotGiven = NOT_GIVEN,
3843+
invoice_grouping_key: Optional[str] | NotGiven = NOT_GIVEN,
3844+
invoicing_cycle_configuration: Optional[
3845+
price_create_params.NewFloatingMaxGroupTieredPriceInvoicingCycleConfiguration
3846+
]
3847+
| NotGiven = NOT_GIVEN,
3848+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
3849+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
3850+
# The extra values given here take precedence over values defined on the client or passed to this method.
3851+
extra_headers: Headers | None = None,
3852+
extra_query: Query | None = None,
3853+
extra_body: Body | None = None,
3854+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
3855+
idempotency_key: str | None = None,
3856+
) -> Price:
3857+
"""This endpoint is used to create a [price](../reference/price).
3858+
3859+
A price created
3860+
using this endpoint is always an add-on, meaning that it’s not associated with a
3861+
specific plan and can instead be individually added to subscriptions, including
3862+
subscriptions on different plans.
3863+
3864+
An `external_price_id` can be optionally specified as an alias to allow
3865+
ergonomic interaction with prices in the Orb API.
3866+
3867+
See the [Price resource](../reference/price) for the specification of different
3868+
price model configurations possible in this endpoint.
3869+
3870+
Args:
3871+
cadence: The cadence to bill for this price on.
3872+
3873+
currency: An ISO 4217 currency string for which this price is billed in.
3874+
3875+
item_id: The id of the item the plan will be associated with.
3876+
3877+
name: The name of the price.
3878+
3879+
billable_metric_id: The id of the billable metric for the price. Only needed if the price is
3880+
usage-based.
3881+
3882+
billed_in_advance: If the Price represents a fixed cost, the price will be billed in-advance if
3883+
this is true, and in-arrears if this is false.
3884+
3885+
billing_cycle_configuration: For custom cadence: specifies the duration of the billing period in days or
3886+
months.
3887+
3888+
conversion_rate: The per unit conversion rate of the price currency to the invoicing currency.
3889+
3890+
external_price_id: An alias for the price.
3891+
3892+
fixed_price_quantity: If the Price represents a fixed cost, this represents the quantity of units
3893+
applied.
3894+
3895+
invoice_grouping_key: The property used to group this price on an invoice
3896+
3897+
invoicing_cycle_configuration: Within each billing cycle, specifies the cadence at which invoices are produced.
3898+
If unspecified, a single invoice is produced per billing cycle.
3899+
3900+
metadata: User-specified key/value pairs for the resource. Individual keys can be removed
3901+
by setting the value to `null`, and the entire metadata mapping can be cleared
3902+
by setting `metadata` to `null`.
3903+
3904+
extra_headers: Send extra headers
3905+
3906+
extra_query: Add additional query parameters to the request
3907+
3908+
extra_body: Add additional JSON properties to the request
3909+
3910+
timeout: Override the client-level default timeout for this request, in seconds
3911+
3912+
idempotency_key: Specify a custom idempotency key for this request
3913+
"""
3914+
...
3915+
37283916
@overload
37293917
async def create(
37303918
self,
@@ -4842,6 +5030,7 @@ async def create(
48425030
["cadence", "currency", "item_id", "model_type", "name", "threshold_total_amount_config"],
48435031
["cadence", "currency", "item_id", "model_type", "name", "tiered_package_config"],
48445032
["cadence", "currency", "grouped_tiered_config", "item_id", "model_type", "name"],
5033+
["cadence", "currency", "item_id", "max_group_tiered_config", "model_type", "name"],
48455034
["cadence", "currency", "item_id", "model_type", "name", "tiered_with_minimum_config"],
48465035
["cadence", "currency", "item_id", "model_type", "name", "package_with_allocation_config"],
48475036
["cadence", "currency", "item_id", "model_type", "name", "tiered_package_with_minimum_config"],
@@ -4873,6 +5062,7 @@ async def create(
48735062
| Literal["threshold_total_amount"]
48745063
| Literal["tiered_package"]
48755064
| Literal["grouped_tiered"]
5065+
| Literal["max_group_tiered"]
48765066
| Literal["tiered_with_minimum"]
48775067
| Literal["package_with_allocation"]
48785068
| Literal["tiered_package_with_minimum"]
@@ -4910,6 +5100,7 @@ async def create(
49105100
threshold_total_amount_config: Dict[str, object] | NotGiven = NOT_GIVEN,
49115101
tiered_package_config: Dict[str, object] | NotGiven = NOT_GIVEN,
49125102
grouped_tiered_config: Dict[str, object] | NotGiven = NOT_GIVEN,
5103+
max_group_tiered_config: Dict[str, object] | NotGiven = NOT_GIVEN,
49135104
tiered_with_minimum_config: Dict[str, object] | NotGiven = NOT_GIVEN,
49145105
package_with_allocation_config: Dict[str, object] | NotGiven = NOT_GIVEN,
49155106
tiered_package_with_minimum_config: Dict[str, object] | NotGiven = NOT_GIVEN,
@@ -4962,6 +5153,7 @@ async def create(
49625153
"threshold_total_amount_config": threshold_total_amount_config,
49635154
"tiered_package_config": tiered_package_config,
49645155
"grouped_tiered_config": grouped_tiered_config,
5156+
"max_group_tiered_config": max_group_tiered_config,
49655157
"tiered_with_minimum_config": tiered_with_minimum_config,
49665158
"package_with_allocation_config": package_with_allocation_config,
49675159
"tiered_package_with_minimum_config": tiered_package_with_minimum_config,

src/orb/types/plan_create_params.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@
8484
"PriceNewPlanGroupedTieredPackagePrice",
8585
"PriceNewPlanGroupedTieredPackagePriceBillingCycleConfiguration",
8686
"PriceNewPlanGroupedTieredPackagePriceInvoicingCycleConfiguration",
87+
"PriceNewPlanMaxGroupTieredPrice",
88+
"PriceNewPlanMaxGroupTieredPriceBillingCycleConfiguration",
89+
"PriceNewPlanMaxGroupTieredPriceInvoicingCycleConfiguration",
8790
]
8891

8992

@@ -1991,6 +1994,89 @@ class PriceNewPlanGroupedTieredPackagePrice(TypedDict, total=False):
19911994
"""
19921995

19931996

1997+
class PriceNewPlanMaxGroupTieredPriceBillingCycleConfiguration(TypedDict, total=False):
1998+
duration: Required[int]
1999+
"""The duration of the billing period."""
2000+
2001+
duration_unit: Required[Literal["day", "month"]]
2002+
"""The unit of billing period duration."""
2003+
2004+
2005+
class PriceNewPlanMaxGroupTieredPriceInvoicingCycleConfiguration(TypedDict, total=False):
2006+
duration: Required[int]
2007+
"""The duration of the billing period."""
2008+
2009+
duration_unit: Required[Literal["day", "month"]]
2010+
"""The unit of billing period duration."""
2011+
2012+
2013+
class PriceNewPlanMaxGroupTieredPrice(TypedDict, total=False):
2014+
cadence: Required[Literal["annual", "semi_annual", "monthly", "quarterly", "one_time", "custom"]]
2015+
"""The cadence to bill for this price on."""
2016+
2017+
item_id: Required[str]
2018+
"""The id of the item the plan will be associated with."""
2019+
2020+
max_group_tiered_config: Required[Dict[str, object]]
2021+
2022+
model_type: Required[Literal["max_group_tiered"]]
2023+
2024+
name: Required[str]
2025+
"""The name of the price."""
2026+
2027+
billable_metric_id: Optional[str]
2028+
"""The id of the billable metric for the price.
2029+
2030+
Only needed if the price is usage-based.
2031+
"""
2032+
2033+
billed_in_advance: Optional[bool]
2034+
"""
2035+
If the Price represents a fixed cost, the price will be billed in-advance if
2036+
this is true, and in-arrears if this is false.
2037+
"""
2038+
2039+
billing_cycle_configuration: Optional[PriceNewPlanMaxGroupTieredPriceBillingCycleConfiguration]
2040+
"""
2041+
For custom cadence: specifies the duration of the billing period in days or
2042+
months.
2043+
"""
2044+
2045+
conversion_rate: Optional[float]
2046+
"""The per unit conversion rate of the price currency to the invoicing currency."""
2047+
2048+
currency: Optional[str]
2049+
"""
2050+
An ISO 4217 currency string, or custom pricing unit identifier, in which this
2051+
price is billed.
2052+
"""
2053+
2054+
external_price_id: Optional[str]
2055+
"""An alias for the price."""
2056+
2057+
fixed_price_quantity: Optional[float]
2058+
"""
2059+
If the Price represents a fixed cost, this represents the quantity of units
2060+
applied.
2061+
"""
2062+
2063+
invoice_grouping_key: Optional[str]
2064+
"""The property used to group this price on an invoice"""
2065+
2066+
invoicing_cycle_configuration: Optional[PriceNewPlanMaxGroupTieredPriceInvoicingCycleConfiguration]
2067+
"""Within each billing cycle, specifies the cadence at which invoices are produced.
2068+
2069+
If unspecified, a single invoice is produced per billing cycle.
2070+
"""
2071+
2072+
metadata: Optional[Dict[str, Optional[str]]]
2073+
"""User-specified key/value pairs for the resource.
2074+
2075+
Individual keys can be removed by setting the value to `null`, and the entire
2076+
metadata mapping can be cleared by setting `metadata` to `null`.
2077+
"""
2078+
2079+
19942080
Price: TypeAlias = Union[
19952081
PriceNewPlanUnitPrice,
19962082
PriceNewPlanPackagePrice,
@@ -2013,4 +2099,5 @@ class PriceNewPlanGroupedTieredPackagePrice(TypedDict, total=False):
20132099
PriceNewPlanMatrixWithDisplayNamePrice,
20142100
PriceNewPlanBulkWithProrationPrice,
20152101
PriceNewPlanGroupedTieredPackagePrice,
2102+
PriceNewPlanMaxGroupTieredPrice,
20162103
]

0 commit comments

Comments
 (0)