Skip to content

Commit ca61a01

Browse files
feat(api): api update (#535)
1 parent 6366c16 commit ca61a01

7 files changed

+96
-6
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 103
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-25409f3b13e6d1d003e351fc18d248ecf3c5821cfde5f409a1d356e4fc917d8c.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-4dede72b827939939b5386cda07c3bc1fa2eea79901819792c1820e8531718d6.yml

src/orb/resources/subscriptions.py

+56-2
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,7 @@ def cancel(
651651
subscription_id: str,
652652
*,
653653
cancel_option: Literal["end_of_subscription_term", "immediate", "requested_date"],
654+
allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN,
654655
cancellation_date: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
655656
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
656657
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -727,6 +728,10 @@ def cancel(
727728
Args:
728729
cancel_option: Determines the timing of subscription cancellation
729730
731+
allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a
732+
credit note. Consider using this as a safety mechanism if you do not expect
733+
existing invoices to be changed.
734+
730735
cancellation_date: The date that the cancellation should take effect. This parameter can only be
731736
passed if the `cancel_option` is `requested_date`.
732737
@@ -747,6 +752,7 @@ def cancel(
747752
body=maybe_transform(
748753
{
749754
"cancel_option": cancel_option,
755+
"allow_invoice_credit_or_void": allow_invoice_credit_or_void,
750756
"cancellation_date": cancellation_date,
751757
},
752758
subscription_cancel_params.SubscriptionCancelParams,
@@ -1207,6 +1213,7 @@ def price_intervals(
12071213
*,
12081214
add: Iterable[subscription_price_intervals_params.Add] | NotGiven = NOT_GIVEN,
12091215
add_adjustments: Iterable[subscription_price_intervals_params.AddAdjustment] | NotGiven = NOT_GIVEN,
1216+
allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN,
12101217
edit: Iterable[subscription_price_intervals_params.Edit] | NotGiven = NOT_GIVEN,
12111218
edit_adjustments: Iterable[subscription_price_intervals_params.EditAdjustment] | NotGiven = NOT_GIVEN,
12121219
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1296,6 +1303,10 @@ def price_intervals(
12961303
12971304
add_adjustments: A list of adjustments to add to the subscription.
12981305
1306+
allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a
1307+
credit note. Consider using this as a safety mechanism if you do not expect
1308+
existing invoices to be changed.
1309+
12991310
edit: A list of price intervals to edit on the subscription.
13001311
13011312
edit_adjustments: A list of adjustments to edit on the subscription.
@@ -1318,6 +1329,7 @@ def price_intervals(
13181329
{
13191330
"add": add,
13201331
"add_adjustments": add_adjustments,
1332+
"allow_invoice_credit_or_void": allow_invoice_credit_or_void,
13211333
"edit": edit,
13221334
"edit_adjustments": edit_adjustments,
13231335
},
@@ -1693,6 +1705,7 @@ def trigger_phase(
16931705
self,
16941706
subscription_id: str,
16951707
*,
1708+
allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN,
16961709
effective_date: Union[str, date, None] | NotGiven = NOT_GIVEN,
16971710
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
16981711
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -1707,6 +1720,10 @@ def trigger_phase(
17071720
specified).
17081721
17091722
Args:
1723+
allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a
1724+
credit note. Consider using this as a safety mechanism if you do not expect
1725+
existing invoices to be changed.
1726+
17101727
effective_date: The date on which the phase change should take effect. If not provided, defaults
17111728
to today in the customer's timezone.
17121729
@@ -1725,7 +1742,11 @@ def trigger_phase(
17251742
return self._post(
17261743
f"/subscriptions/{subscription_id}/trigger_phase",
17271744
body=maybe_transform(
1728-
{"effective_date": effective_date}, subscription_trigger_phase_params.SubscriptionTriggerPhaseParams
1745+
{
1746+
"allow_invoice_credit_or_void": allow_invoice_credit_or_void,
1747+
"effective_date": effective_date,
1748+
},
1749+
subscription_trigger_phase_params.SubscriptionTriggerPhaseParams,
17291750
),
17301751
options=make_request_options(
17311752
extra_headers=extra_headers,
@@ -1880,6 +1901,7 @@ def update_fixed_fee_quantity(
18801901
*,
18811902
price_id: str,
18821903
quantity: float,
1904+
allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN,
18831905
change_option: Literal["immediate", "upcoming_invoice", "effective_date"] | NotGiven = NOT_GIVEN,
18841906
effective_date: Union[str, date, None] | NotGiven = NOT_GIVEN,
18851907
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1909,6 +1931,10 @@ def update_fixed_fee_quantity(
19091931
Args:
19101932
price_id: Price for which the quantity should be updated. Must be a fixed fee.
19111933
1934+
allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a
1935+
credit note. Consider using this as a safety mechanism if you do not expect
1936+
existing invoices to be changed.
1937+
19121938
change_option: Determines when the change takes effect. Note that if `effective_date` is
19131939
specified, this defaults to `effective_date`. Otherwise, this defaults to
19141940
`immediate` unless it's explicitly set to `upcoming_invoice.
@@ -1935,6 +1961,7 @@ def update_fixed_fee_quantity(
19351961
{
19361962
"price_id": price_id,
19371963
"quantity": quantity,
1964+
"allow_invoice_credit_or_void": allow_invoice_credit_or_void,
19381965
"change_option": change_option,
19391966
"effective_date": effective_date,
19401967
},
@@ -2619,6 +2646,7 @@ async def cancel(
26192646
subscription_id: str,
26202647
*,
26212648
cancel_option: Literal["end_of_subscription_term", "immediate", "requested_date"],
2649+
allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN,
26222650
cancellation_date: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
26232651
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
26242652
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -2695,6 +2723,10 @@ async def cancel(
26952723
Args:
26962724
cancel_option: Determines the timing of subscription cancellation
26972725
2726+
allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a
2727+
credit note. Consider using this as a safety mechanism if you do not expect
2728+
existing invoices to be changed.
2729+
26982730
cancellation_date: The date that the cancellation should take effect. This parameter can only be
26992731
passed if the `cancel_option` is `requested_date`.
27002732
@@ -2715,6 +2747,7 @@ async def cancel(
27152747
body=await async_maybe_transform(
27162748
{
27172749
"cancel_option": cancel_option,
2750+
"allow_invoice_credit_or_void": allow_invoice_credit_or_void,
27182751
"cancellation_date": cancellation_date,
27192752
},
27202753
subscription_cancel_params.SubscriptionCancelParams,
@@ -3175,6 +3208,7 @@ async def price_intervals(
31753208
*,
31763209
add: Iterable[subscription_price_intervals_params.Add] | NotGiven = NOT_GIVEN,
31773210
add_adjustments: Iterable[subscription_price_intervals_params.AddAdjustment] | NotGiven = NOT_GIVEN,
3211+
allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN,
31783212
edit: Iterable[subscription_price_intervals_params.Edit] | NotGiven = NOT_GIVEN,
31793213
edit_adjustments: Iterable[subscription_price_intervals_params.EditAdjustment] | NotGiven = NOT_GIVEN,
31803214
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -3264,6 +3298,10 @@ async def price_intervals(
32643298
32653299
add_adjustments: A list of adjustments to add to the subscription.
32663300
3301+
allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a
3302+
credit note. Consider using this as a safety mechanism if you do not expect
3303+
existing invoices to be changed.
3304+
32673305
edit: A list of price intervals to edit on the subscription.
32683306
32693307
edit_adjustments: A list of adjustments to edit on the subscription.
@@ -3286,6 +3324,7 @@ async def price_intervals(
32863324
{
32873325
"add": add,
32883326
"add_adjustments": add_adjustments,
3327+
"allow_invoice_credit_or_void": allow_invoice_credit_or_void,
32893328
"edit": edit,
32903329
"edit_adjustments": edit_adjustments,
32913330
},
@@ -3661,6 +3700,7 @@ async def trigger_phase(
36613700
self,
36623701
subscription_id: str,
36633702
*,
3703+
allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN,
36643704
effective_date: Union[str, date, None] | NotGiven = NOT_GIVEN,
36653705
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
36663706
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -3675,6 +3715,10 @@ async def trigger_phase(
36753715
specified).
36763716
36773717
Args:
3718+
allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a
3719+
credit note. Consider using this as a safety mechanism if you do not expect
3720+
existing invoices to be changed.
3721+
36783722
effective_date: The date on which the phase change should take effect. If not provided, defaults
36793723
to today in the customer's timezone.
36803724
@@ -3693,7 +3737,11 @@ async def trigger_phase(
36933737
return await self._post(
36943738
f"/subscriptions/{subscription_id}/trigger_phase",
36953739
body=await async_maybe_transform(
3696-
{"effective_date": effective_date}, subscription_trigger_phase_params.SubscriptionTriggerPhaseParams
3740+
{
3741+
"allow_invoice_credit_or_void": allow_invoice_credit_or_void,
3742+
"effective_date": effective_date,
3743+
},
3744+
subscription_trigger_phase_params.SubscriptionTriggerPhaseParams,
36973745
),
36983746
options=make_request_options(
36993747
extra_headers=extra_headers,
@@ -3848,6 +3896,7 @@ async def update_fixed_fee_quantity(
38483896
*,
38493897
price_id: str,
38503898
quantity: float,
3899+
allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN,
38513900
change_option: Literal["immediate", "upcoming_invoice", "effective_date"] | NotGiven = NOT_GIVEN,
38523901
effective_date: Union[str, date, None] | NotGiven = NOT_GIVEN,
38533902
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -3877,6 +3926,10 @@ async def update_fixed_fee_quantity(
38773926
Args:
38783927
price_id: Price for which the quantity should be updated. Must be a fixed fee.
38793928
3929+
allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a
3930+
credit note. Consider using this as a safety mechanism if you do not expect
3931+
existing invoices to be changed.
3932+
38803933
change_option: Determines when the change takes effect. Note that if `effective_date` is
38813934
specified, this defaults to `effective_date`. Otherwise, this defaults to
38823935
`immediate` unless it's explicitly set to `upcoming_invoice.
@@ -3903,6 +3956,7 @@ async def update_fixed_fee_quantity(
39033956
{
39043957
"price_id": price_id,
39053958
"quantity": quantity,
3959+
"allow_invoice_credit_or_void": allow_invoice_credit_or_void,
39063960
"change_option": change_option,
39073961
"effective_date": effective_date,
39083962
},

src/orb/types/subscription_cancel_params.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Union
5+
from typing import Union, Optional
66
from datetime import datetime
77
from typing_extensions import Literal, Required, Annotated, TypedDict
88

@@ -15,6 +15,13 @@ class SubscriptionCancelParams(TypedDict, total=False):
1515
cancel_option: Required[Literal["end_of_subscription_term", "immediate", "requested_date"]]
1616
"""Determines the timing of subscription cancellation"""
1717

18+
allow_invoice_credit_or_void: Optional[bool]
19+
"""
20+
If false, this request will fail if it would void an issued invoice or create a
21+
credit note. Consider using this as a safety mechanism if you do not expect
22+
existing invoices to be changed.
23+
"""
24+
1825
cancellation_date: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
1926
"""The date that the cancellation should take effect.
2027

src/orb/types/subscription_price_intervals_params.py

+7
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ class SubscriptionPriceIntervalsParams(TypedDict, total=False):
138138
add_adjustments: Iterable[AddAdjustment]
139139
"""A list of adjustments to add to the subscription."""
140140

141+
allow_invoice_credit_or_void: Optional[bool]
142+
"""
143+
If false, this request will fail if it would void an issued invoice or create a
144+
credit note. Consider using this as a safety mechanism if you do not expect
145+
existing invoices to be changed.
146+
"""
147+
141148
edit: Iterable[Edit]
142149
"""A list of price intervals to edit on the subscription."""
143150

src/orb/types/subscription_trigger_phase_params.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Union
5+
from typing import Union, Optional
66
from datetime import date
77
from typing_extensions import Annotated, TypedDict
88

@@ -12,6 +12,13 @@
1212

1313

1414
class SubscriptionTriggerPhaseParams(TypedDict, total=False):
15+
allow_invoice_credit_or_void: Optional[bool]
16+
"""
17+
If false, this request will fail if it would void an issued invoice or create a
18+
credit note. Consider using this as a safety mechanism if you do not expect
19+
existing invoices to be changed.
20+
"""
21+
1522
effective_date: Annotated[Union[str, date, None], PropertyInfo(format="iso8601")]
1623
"""The date on which the phase change should take effect.
1724

src/orb/types/subscription_update_fixed_fee_quantity_params.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Union
5+
from typing import Union, Optional
66
from datetime import date
77
from typing_extensions import Literal, Required, Annotated, TypedDict
88

@@ -17,6 +17,13 @@ class SubscriptionUpdateFixedFeeQuantityParams(TypedDict, total=False):
1717

1818
quantity: Required[float]
1919

20+
allow_invoice_credit_or_void: Optional[bool]
21+
"""
22+
If false, this request will fail if it would void an issued invoice or create a
23+
credit note. Consider using this as a safety mechanism if you do not expect
24+
existing invoices to be changed.
25+
"""
26+
2027
change_option: Literal["immediate", "upcoming_invoice", "effective_date"]
2128
"""Determines when the change takes effect.
2229

tests/api_resources/test_subscriptions.py

+8
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ def test_method_cancel_with_all_params(self, client: Orb) -> None:
324324
subscription = client.subscriptions.cancel(
325325
subscription_id="subscription_id",
326326
cancel_option="end_of_subscription_term",
327+
allow_invoice_credit_or_void=True,
327328
cancellation_date=parse_datetime("2019-12-27T18:11:19.117Z"),
328329
)
329330
assert_matches_type(SubscriptionCancelResponse, subscription, path=["response"])
@@ -636,6 +637,7 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None:
636637
"end_date": parse_datetime("2019-12-27T18:11:19.117Z"),
637638
}
638639
],
640+
allow_invoice_credit_or_void=True,
639641
edit=[
640642
{
641643
"price_interval_id": "sdfs6wdjvn7ujokd",
@@ -905,6 +907,7 @@ def test_method_trigger_phase(self, client: Orb) -> None:
905907
def test_method_trigger_phase_with_all_params(self, client: Orb) -> None:
906908
subscription = client.subscriptions.trigger_phase(
907909
subscription_id="subscription_id",
910+
allow_invoice_credit_or_void=True,
908911
effective_date=parse_date("2019-12-27"),
909912
)
910913
assert_matches_type(SubscriptionTriggerPhaseResponse, subscription, path=["response"])
@@ -1073,6 +1076,7 @@ def test_method_update_fixed_fee_quantity_with_all_params(self, client: Orb) ->
10731076
subscription_id="subscription_id",
10741077
price_id="price_id",
10751078
quantity=0,
1079+
allow_invoice_credit_or_void=True,
10761080
change_option="immediate",
10771081
effective_date=parse_date("2022-12-21"),
10781082
)
@@ -1460,6 +1464,7 @@ async def test_method_cancel_with_all_params(self, async_client: AsyncOrb) -> No
14601464
subscription = await async_client.subscriptions.cancel(
14611465
subscription_id="subscription_id",
14621466
cancel_option="end_of_subscription_term",
1467+
allow_invoice_credit_or_void=True,
14631468
cancellation_date=parse_datetime("2019-12-27T18:11:19.117Z"),
14641469
)
14651470
assert_matches_type(SubscriptionCancelResponse, subscription, path=["response"])
@@ -1772,6 +1777,7 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO
17721777
"end_date": parse_datetime("2019-12-27T18:11:19.117Z"),
17731778
}
17741779
],
1780+
allow_invoice_credit_or_void=True,
17751781
edit=[
17761782
{
17771783
"price_interval_id": "sdfs6wdjvn7ujokd",
@@ -2041,6 +2047,7 @@ async def test_method_trigger_phase(self, async_client: AsyncOrb) -> None:
20412047
async def test_method_trigger_phase_with_all_params(self, async_client: AsyncOrb) -> None:
20422048
subscription = await async_client.subscriptions.trigger_phase(
20432049
subscription_id="subscription_id",
2050+
allow_invoice_credit_or_void=True,
20442051
effective_date=parse_date("2019-12-27"),
20452052
)
20462053
assert_matches_type(SubscriptionTriggerPhaseResponse, subscription, path=["response"])
@@ -2209,6 +2216,7 @@ async def test_method_update_fixed_fee_quantity_with_all_params(self, async_clie
22092216
subscription_id="subscription_id",
22102217
price_id="price_id",
22112218
quantity=0,
2219+
allow_invoice_credit_or_void=True,
22122220
change_option="immediate",
22132221
effective_date=parse_date("2022-12-21"),
22142222
)

0 commit comments

Comments
 (0)