diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ff1c7af5..2437b419 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.3.0" + ".": "3.4.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index a279c92e..e5439953 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 103 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-25409f3b13e6d1d003e351fc18d248ecf3c5821cfde5f409a1d356e4fc917d8c.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-4dede72b827939939b5386cda07c3bc1fa2eea79901819792c1820e8531718d6.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index f417400b..7f32851d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 3.4.0 (2025-02-14) + +Full Changelog: [v3.3.0...v3.4.0](https://github.com/orbcorp/orb-python/compare/v3.3.0...v3.4.0) + +### Features + +* **api:** api update ([#535](https://github.com/orbcorp/orb-python/issues/535)) ([546bfa0](https://github.com/orbcorp/orb-python/commit/546bfa0021c27e59e6be15a5a011796c740abf3e)) + ## 3.3.0 (2025-02-13) Full Changelog: [v3.2.0...v3.3.0](https://github.com/orbcorp/orb-python/compare/v3.2.0...v3.3.0) diff --git a/pyproject.toml b/pyproject.toml index c659d8aa..7d09ebc8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "orb-billing" -version = "3.3.0" +version = "3.4.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 a0d396e9..5046f5e5 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__ = "3.3.0" # x-release-please-version +__version__ = "3.4.0" # x-release-please-version diff --git a/src/orb/resources/subscriptions.py b/src/orb/resources/subscriptions.py index a737c752..a0f7140e 100644 --- a/src/orb/resources/subscriptions.py +++ b/src/orb/resources/subscriptions.py @@ -651,6 +651,7 @@ def cancel( subscription_id: str, *, cancel_option: Literal["end_of_subscription_term", "immediate", "requested_date"], + allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN, cancellation_date: Union[str, datetime, None] | 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. @@ -727,6 +728,10 @@ def cancel( Args: cancel_option: Determines the timing of subscription cancellation + allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a + credit note. Consider using this as a safety mechanism if you do not expect + existing invoices to be changed. + cancellation_date: The date that the cancellation should take effect. This parameter can only be passed if the `cancel_option` is `requested_date`. @@ -747,6 +752,7 @@ def cancel( body=maybe_transform( { "cancel_option": cancel_option, + "allow_invoice_credit_or_void": allow_invoice_credit_or_void, "cancellation_date": cancellation_date, }, subscription_cancel_params.SubscriptionCancelParams, @@ -1207,6 +1213,7 @@ def price_intervals( *, add: Iterable[subscription_price_intervals_params.Add] | NotGiven = NOT_GIVEN, add_adjustments: Iterable[subscription_price_intervals_params.AddAdjustment] | NotGiven = NOT_GIVEN, + allow_invoice_credit_or_void: Optional[bool] | 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. @@ -1296,6 +1303,10 @@ def price_intervals( add_adjustments: A list of adjustments to add to the subscription. + allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a + credit note. Consider using this as a safety mechanism if you do not expect + existing invoices to be changed. + edit: A list of price intervals to edit on the subscription. edit_adjustments: A list of adjustments to edit on the subscription. @@ -1318,6 +1329,7 @@ def price_intervals( { "add": add, "add_adjustments": add_adjustments, + "allow_invoice_credit_or_void": allow_invoice_credit_or_void, "edit": edit, "edit_adjustments": edit_adjustments, }, @@ -1693,6 +1705,7 @@ def trigger_phase( self, subscription_id: str, *, + allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN, effective_date: Union[str, date, None] | 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. @@ -1707,6 +1720,10 @@ def trigger_phase( specified). Args: + allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a + credit note. Consider using this as a safety mechanism if you do not expect + existing invoices to be changed. + effective_date: The date on which the phase change should take effect. If not provided, defaults to today in the customer's timezone. @@ -1725,7 +1742,11 @@ def trigger_phase( return self._post( f"/subscriptions/{subscription_id}/trigger_phase", body=maybe_transform( - {"effective_date": effective_date}, subscription_trigger_phase_params.SubscriptionTriggerPhaseParams + { + "allow_invoice_credit_or_void": allow_invoice_credit_or_void, + "effective_date": effective_date, + }, + subscription_trigger_phase_params.SubscriptionTriggerPhaseParams, ), options=make_request_options( extra_headers=extra_headers, @@ -1880,6 +1901,7 @@ def update_fixed_fee_quantity( *, price_id: str, quantity: float, + allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN, change_option: Literal["immediate", "upcoming_invoice", "effective_date"] | NotGiven = NOT_GIVEN, effective_date: Union[str, date, None] | NotGiven = NOT_GIVEN, # 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( Args: price_id: Price for which the quantity should be updated. Must be a fixed fee. + allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a + credit note. Consider using this as a safety mechanism if you do not expect + existing invoices to be changed. + change_option: Determines when the change takes effect. Note that if `effective_date` is specified, this defaults to `effective_date`. Otherwise, this defaults to `immediate` unless it's explicitly set to `upcoming_invoice. @@ -1935,6 +1961,7 @@ def update_fixed_fee_quantity( { "price_id": price_id, "quantity": quantity, + "allow_invoice_credit_or_void": allow_invoice_credit_or_void, "change_option": change_option, "effective_date": effective_date, }, @@ -2619,6 +2646,7 @@ async def cancel( subscription_id: str, *, cancel_option: Literal["end_of_subscription_term", "immediate", "requested_date"], + allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN, cancellation_date: Union[str, datetime, None] | 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. @@ -2695,6 +2723,10 @@ async def cancel( Args: cancel_option: Determines the timing of subscription cancellation + allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a + credit note. Consider using this as a safety mechanism if you do not expect + existing invoices to be changed. + cancellation_date: The date that the cancellation should take effect. This parameter can only be passed if the `cancel_option` is `requested_date`. @@ -2715,6 +2747,7 @@ async def cancel( body=await async_maybe_transform( { "cancel_option": cancel_option, + "allow_invoice_credit_or_void": allow_invoice_credit_or_void, "cancellation_date": cancellation_date, }, subscription_cancel_params.SubscriptionCancelParams, @@ -3175,6 +3208,7 @@ async def price_intervals( *, add: Iterable[subscription_price_intervals_params.Add] | NotGiven = NOT_GIVEN, add_adjustments: Iterable[subscription_price_intervals_params.AddAdjustment] | NotGiven = NOT_GIVEN, + allow_invoice_credit_or_void: Optional[bool] | 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. @@ -3264,6 +3298,10 @@ async def price_intervals( add_adjustments: A list of adjustments to add to the subscription. + allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a + credit note. Consider using this as a safety mechanism if you do not expect + existing invoices to be changed. + edit: A list of price intervals to edit on the subscription. edit_adjustments: A list of adjustments to edit on the subscription. @@ -3286,6 +3324,7 @@ async def price_intervals( { "add": add, "add_adjustments": add_adjustments, + "allow_invoice_credit_or_void": allow_invoice_credit_or_void, "edit": edit, "edit_adjustments": edit_adjustments, }, @@ -3661,6 +3700,7 @@ async def trigger_phase( self, subscription_id: str, *, + allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN, effective_date: Union[str, date, None] | 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. @@ -3675,6 +3715,10 @@ async def trigger_phase( specified). Args: + allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a + credit note. Consider using this as a safety mechanism if you do not expect + existing invoices to be changed. + effective_date: The date on which the phase change should take effect. If not provided, defaults to today in the customer's timezone. @@ -3693,7 +3737,11 @@ async def trigger_phase( return await self._post( f"/subscriptions/{subscription_id}/trigger_phase", body=await async_maybe_transform( - {"effective_date": effective_date}, subscription_trigger_phase_params.SubscriptionTriggerPhaseParams + { + "allow_invoice_credit_or_void": allow_invoice_credit_or_void, + "effective_date": effective_date, + }, + subscription_trigger_phase_params.SubscriptionTriggerPhaseParams, ), options=make_request_options( extra_headers=extra_headers, @@ -3848,6 +3896,7 @@ async def update_fixed_fee_quantity( *, price_id: str, quantity: float, + allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN, change_option: Literal["immediate", "upcoming_invoice", "effective_date"] | NotGiven = NOT_GIVEN, effective_date: Union[str, date, None] | NotGiven = NOT_GIVEN, # 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( Args: price_id: Price for which the quantity should be updated. Must be a fixed fee. + allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a + credit note. Consider using this as a safety mechanism if you do not expect + existing invoices to be changed. + change_option: Determines when the change takes effect. Note that if `effective_date` is specified, this defaults to `effective_date`. Otherwise, this defaults to `immediate` unless it's explicitly set to `upcoming_invoice. @@ -3903,6 +3956,7 @@ async def update_fixed_fee_quantity( { "price_id": price_id, "quantity": quantity, + "allow_invoice_credit_or_void": allow_invoice_credit_or_void, "change_option": change_option, "effective_date": effective_date, }, diff --git a/src/orb/types/subscription_cancel_params.py b/src/orb/types/subscription_cancel_params.py index 6ce855b1..adb583e4 100644 --- a/src/orb/types/subscription_cancel_params.py +++ b/src/orb/types/subscription_cancel_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union +from typing import Union, Optional from datetime import datetime from typing_extensions import Literal, Required, Annotated, TypedDict @@ -15,6 +15,13 @@ class SubscriptionCancelParams(TypedDict, total=False): cancel_option: Required[Literal["end_of_subscription_term", "immediate", "requested_date"]] """Determines the timing of subscription cancellation""" + allow_invoice_credit_or_void: Optional[bool] + """ + If false, this request will fail if it would void an issued invoice or create a + credit note. Consider using this as a safety mechanism if you do not expect + existing invoices to be changed. + """ + cancellation_date: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] """The date that the cancellation should take effect. diff --git a/src/orb/types/subscription_price_intervals_params.py b/src/orb/types/subscription_price_intervals_params.py index 10a9e2d1..16e71a74 100644 --- a/src/orb/types/subscription_price_intervals_params.py +++ b/src/orb/types/subscription_price_intervals_params.py @@ -138,6 +138,13 @@ class SubscriptionPriceIntervalsParams(TypedDict, total=False): add_adjustments: Iterable[AddAdjustment] """A list of adjustments to add to the subscription.""" + allow_invoice_credit_or_void: Optional[bool] + """ + If false, this request will fail if it would void an issued invoice or create a + credit note. Consider using this as a safety mechanism if you do not expect + existing invoices to be changed. + """ + edit: Iterable[Edit] """A list of price intervals to edit on the subscription.""" diff --git a/src/orb/types/subscription_trigger_phase_params.py b/src/orb/types/subscription_trigger_phase_params.py index 504862ad..59367f7a 100644 --- a/src/orb/types/subscription_trigger_phase_params.py +++ b/src/orb/types/subscription_trigger_phase_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union +from typing import Union, Optional from datetime import date from typing_extensions import Annotated, TypedDict @@ -12,6 +12,13 @@ class SubscriptionTriggerPhaseParams(TypedDict, total=False): + allow_invoice_credit_or_void: Optional[bool] + """ + If false, this request will fail if it would void an issued invoice or create a + credit note. Consider using this as a safety mechanism if you do not expect + existing invoices to be changed. + """ + effective_date: Annotated[Union[str, date, None], PropertyInfo(format="iso8601")] """The date on which the phase change should take effect. diff --git a/src/orb/types/subscription_update_fixed_fee_quantity_params.py b/src/orb/types/subscription_update_fixed_fee_quantity_params.py index 2fa701f1..af22b7ee 100644 --- a/src/orb/types/subscription_update_fixed_fee_quantity_params.py +++ b/src/orb/types/subscription_update_fixed_fee_quantity_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union +from typing import Union, Optional from datetime import date from typing_extensions import Literal, Required, Annotated, TypedDict @@ -17,6 +17,13 @@ class SubscriptionUpdateFixedFeeQuantityParams(TypedDict, total=False): quantity: Required[float] + allow_invoice_credit_or_void: Optional[bool] + """ + If false, this request will fail if it would void an issued invoice or create a + credit note. Consider using this as a safety mechanism if you do not expect + existing invoices to be changed. + """ + change_option: Literal["immediate", "upcoming_invoice", "effective_date"] """Determines when the change takes effect. diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index 8e834c39..d936b958 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -324,6 +324,7 @@ def test_method_cancel_with_all_params(self, client: Orb) -> None: subscription = client.subscriptions.cancel( subscription_id="subscription_id", cancel_option="end_of_subscription_term", + allow_invoice_credit_or_void=True, cancellation_date=parse_datetime("2019-12-27T18:11:19.117Z"), ) assert_matches_type(SubscriptionCancelResponse, subscription, path=["response"]) @@ -636,6 +637,7 @@ def test_method_price_intervals_with_all_params(self, client: Orb) -> None: "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), } ], + allow_invoice_credit_or_void=True, edit=[ { "price_interval_id": "sdfs6wdjvn7ujokd", @@ -905,6 +907,7 @@ def test_method_trigger_phase(self, client: Orb) -> None: def test_method_trigger_phase_with_all_params(self, client: Orb) -> None: subscription = client.subscriptions.trigger_phase( subscription_id="subscription_id", + allow_invoice_credit_or_void=True, effective_date=parse_date("2019-12-27"), ) assert_matches_type(SubscriptionTriggerPhaseResponse, subscription, path=["response"]) @@ -1073,6 +1076,7 @@ def test_method_update_fixed_fee_quantity_with_all_params(self, client: Orb) -> subscription_id="subscription_id", price_id="price_id", quantity=0, + allow_invoice_credit_or_void=True, change_option="immediate", effective_date=parse_date("2022-12-21"), ) @@ -1460,6 +1464,7 @@ async def test_method_cancel_with_all_params(self, async_client: AsyncOrb) -> No subscription = await async_client.subscriptions.cancel( subscription_id="subscription_id", cancel_option="end_of_subscription_term", + allow_invoice_credit_or_void=True, cancellation_date=parse_datetime("2019-12-27T18:11:19.117Z"), ) assert_matches_type(SubscriptionCancelResponse, subscription, path=["response"]) @@ -1772,6 +1777,7 @@ async def test_method_price_intervals_with_all_params(self, async_client: AsyncO "end_date": parse_datetime("2019-12-27T18:11:19.117Z"), } ], + allow_invoice_credit_or_void=True, edit=[ { "price_interval_id": "sdfs6wdjvn7ujokd", @@ -2041,6 +2047,7 @@ async def test_method_trigger_phase(self, async_client: AsyncOrb) -> None: async def test_method_trigger_phase_with_all_params(self, async_client: AsyncOrb) -> None: subscription = await async_client.subscriptions.trigger_phase( subscription_id="subscription_id", + allow_invoice_credit_or_void=True, effective_date=parse_date("2019-12-27"), ) 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 subscription_id="subscription_id", price_id="price_id", quantity=0, + allow_invoice_credit_or_void=True, change_option="immediate", effective_date=parse_date("2022-12-21"), )