Skip to content

Commit b91c9fb

Browse files
feat(api): add support for adding allocation price to subscription (#295)
1 parent dd2fa17 commit b91c9fb

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 90
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-d9cc087ece8a2eba847035f3cd8ae44d3401046e01761ab6ad7fd6165d93f0c8.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-d08c3c586f46f155358104a907afa8300ce44a25814c1574c0f4344935c1b838.yml

src/orb/types/subscription_price_intervals_params.py

+24
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
__all__ = [
1313
"SubscriptionPriceIntervalsParams",
1414
"Add",
15+
"AddAllocationPrice",
1516
"AddDiscount",
1617
"AddDiscountAmountDiscountCreationParams",
1718
"AddDiscountPercentageDiscountCreationParams",
@@ -77,6 +78,26 @@ class SubscriptionPriceIntervalsParams(TypedDict, total=False):
7778
"""A list of adjustments to edit on the subscription."""
7879

7980

81+
class AddAllocationPrice(TypedDict, total=False):
82+
amount: Required[float]
83+
"""An amount of the currency to allocate to the customer at the specified cadence."""
84+
85+
cadence: Required[Literal["one_time", "monthly", "quarterly", "semi_annual", "annual"]]
86+
"""The cadence at which to allocate the amount to the customer."""
87+
88+
currency: Required[str]
89+
"""
90+
An ISO 4217 currency string or a custom pricing unit identifier in which to bill
91+
this price.
92+
"""
93+
94+
expires_at_end_of_cadence: Required[bool]
95+
"""
96+
Whether the allocated amount should expire at the end of the cadence or roll
97+
over to the next period.
98+
"""
99+
100+
80101
class AddDiscountAmountDiscountCreationParams(TypedDict, total=False):
81102
amount_discount: Required[float]
82103
"""Only available if discount_type is `amount`."""
@@ -1104,6 +1125,9 @@ class Add(TypedDict, total=False):
11041125
This is the date that the price will start billing on the subscription.
11051126
"""
11061127

1128+
allocation_price: Optional[AddAllocationPrice]
1129+
"""The definition of a new allocation price to create and add to the subscription."""
1130+
11071131
discounts: Optional[Iterable[AddDiscount]]
11081132
"""A list of discounts to initialize on the price interval."""
11091133

tests/api_resources/test_subscriptions.py

+36
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,12 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None:
501501
"unit_config": {"unit_amount": "string"},
502502
"currency": "string",
503503
},
504+
"allocation_price": {
505+
"currency": "USD",
506+
"amount": 0,
507+
"cadence": "monthly",
508+
"expires_at_end_of_cadence": True,
509+
},
504510
"start_date": parse_datetime("2019-12-27T18:11:19.117Z"),
505511
"end_date": parse_datetime("2019-12-27T18:11:19.117Z"),
506512
"fixed_fee_quantity_transitions": [
@@ -551,6 +557,12 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None:
551557
"unit_config": {"unit_amount": "string"},
552558
"currency": "string",
553559
},
560+
"allocation_price": {
561+
"currency": "USD",
562+
"amount": 0,
563+
"cadence": "monthly",
564+
"expires_at_end_of_cadence": True,
565+
},
554566
"start_date": parse_datetime("2019-12-27T18:11:19.117Z"),
555567
"end_date": parse_datetime("2019-12-27T18:11:19.117Z"),
556568
"fixed_fee_quantity_transitions": [
@@ -601,6 +613,12 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None:
601613
"unit_config": {"unit_amount": "string"},
602614
"currency": "string",
603615
},
616+
"allocation_price": {
617+
"currency": "USD",
618+
"amount": 0,
619+
"cadence": "monthly",
620+
"expires_at_end_of_cadence": True,
621+
},
604622
"start_date": parse_datetime("2019-12-27T18:11:19.117Z"),
605623
"end_date": parse_datetime("2019-12-27T18:11:19.117Z"),
606624
"fixed_fee_quantity_transitions": [
@@ -1598,6 +1616,12 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO
15981616
"unit_config": {"unit_amount": "string"},
15991617
"currency": "string",
16001618
},
1619+
"allocation_price": {
1620+
"currency": "USD",
1621+
"amount": 0,
1622+
"cadence": "monthly",
1623+
"expires_at_end_of_cadence": True,
1624+
},
16011625
"start_date": parse_datetime("2019-12-27T18:11:19.117Z"),
16021626
"end_date": parse_datetime("2019-12-27T18:11:19.117Z"),
16031627
"fixed_fee_quantity_transitions": [
@@ -1648,6 +1672,12 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO
16481672
"unit_config": {"unit_amount": "string"},
16491673
"currency": "string",
16501674
},
1675+
"allocation_price": {
1676+
"currency": "USD",
1677+
"amount": 0,
1678+
"cadence": "monthly",
1679+
"expires_at_end_of_cadence": True,
1680+
},
16511681
"start_date": parse_datetime("2019-12-27T18:11:19.117Z"),
16521682
"end_date": parse_datetime("2019-12-27T18:11:19.117Z"),
16531683
"fixed_fee_quantity_transitions": [
@@ -1698,6 +1728,12 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO
16981728
"unit_config": {"unit_amount": "string"},
16991729
"currency": "string",
17001730
},
1731+
"allocation_price": {
1732+
"currency": "USD",
1733+
"amount": 0,
1734+
"cadence": "monthly",
1735+
"expires_at_end_of_cadence": True,
1736+
},
17011737
"start_date": parse_datetime("2019-12-27T18:11:19.117Z"),
17021738
"end_date": parse_datetime("2019-12-27T18:11:19.117Z"),
17031739
"fixed_fee_quantity_transitions": [

0 commit comments

Comments
 (0)