From 81c8ac5237fb13783b9930ef1d50db0e6daf72b1 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Mon, 25 Nov 2024 19:06:51 +0000 Subject: [PATCH] feat(api): api update --- .stats.yml | 2 +- src/orb/resources/subscriptions.py | 10 +++++++ ...ubscription_schedule_plan_change_params.py | 27 +++++++++++++++++++ tests/api_resources/test_subscriptions.py | 10 +++++++ 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index e670c774..6a74fe0f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-bf3e71b33372f4a9307f4b6cb689ea46b3cf583ecc5d79eee9601cd0b0467c9a.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-0f43f737c6520ed2a2407628511350362959997f89a868c50aa38d47d5791171.yml diff --git a/src/orb/resources/subscriptions.py b/src/orb/resources/subscriptions.py index 41fad6dd..1e938904 100644 --- a/src/orb/resources/subscriptions.py +++ b/src/orb/resources/subscriptions.py @@ -1336,6 +1336,10 @@ def schedule_plan_change( auto_collection: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_alignment: Optional[Literal["unchanged", "plan_change_date", "start_of_month"]] | NotGiven = NOT_GIVEN, + billing_cycle_anchor_configuration: Optional[ + subscription_schedule_plan_change_params.BillingCycleAnchorConfiguration + ] + | NotGiven = NOT_GIVEN, change_date: Union[str, datetime, None] | NotGiven = NOT_GIVEN, coupon_redemption_code: Optional[str] | NotGiven = NOT_GIVEN, credits_overage_rate: Optional[float] | NotGiven = NOT_GIVEN, @@ -1635,6 +1639,7 @@ def schedule_plan_change( "align_billing_with_plan_change_date": align_billing_with_plan_change_date, "auto_collection": auto_collection, "billing_cycle_alignment": billing_cycle_alignment, + "billing_cycle_anchor_configuration": billing_cycle_anchor_configuration, "change_date": change_date, "coupon_redemption_code": coupon_redemption_code, "credits_overage_rate": credits_overage_rate, @@ -3280,6 +3285,10 @@ async def schedule_plan_change( auto_collection: Optional[bool] | NotGiven = NOT_GIVEN, billing_cycle_alignment: Optional[Literal["unchanged", "plan_change_date", "start_of_month"]] | NotGiven = NOT_GIVEN, + billing_cycle_anchor_configuration: Optional[ + subscription_schedule_plan_change_params.BillingCycleAnchorConfiguration + ] + | NotGiven = NOT_GIVEN, change_date: Union[str, datetime, None] | NotGiven = NOT_GIVEN, coupon_redemption_code: Optional[str] | NotGiven = NOT_GIVEN, credits_overage_rate: Optional[float] | NotGiven = NOT_GIVEN, @@ -3579,6 +3588,7 @@ async def schedule_plan_change( "align_billing_with_plan_change_date": align_billing_with_plan_change_date, "auto_collection": auto_collection, "billing_cycle_alignment": billing_cycle_alignment, + "billing_cycle_anchor_configuration": billing_cycle_anchor_configuration, "change_date": change_date, "coupon_redemption_code": coupon_redemption_code, "credits_overage_rate": credits_overage_rate, diff --git a/src/orb/types/subscription_schedule_plan_change_params.py b/src/orb/types/subscription_schedule_plan_change_params.py index 4d6c8b0c..1d559687 100644 --- a/src/orb/types/subscription_schedule_plan_change_params.py +++ b/src/orb/types/subscription_schedule_plan_change_params.py @@ -86,6 +86,7 @@ "AddPricePriceNewSubscriptionBulkWithProrationPrice", "AddPricePriceNewSubscriptionBulkWithProrationPriceBillingCycleConfiguration", "AddPricePriceNewSubscriptionBulkWithProrationPriceInvoicingCycleConfiguration", + "BillingCycleAnchorConfiguration", "RemoveAdjustment", "RemovePrice", "ReplaceAdjustment", @@ -204,6 +205,8 @@ class SubscriptionSchedulePlanChangeParams(TypedDict, total=False): billing cycle alignment. """ + billing_cycle_anchor_configuration: Optional[BillingCycleAnchorConfiguration] + change_date: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] """The date that the plan change should take effect. @@ -2193,6 +2196,30 @@ class AddPrice(TypedDict, total=False): """ +class BillingCycleAnchorConfiguration(TypedDict, total=False): + day: Required[int] + """The day of the month on which the billing cycle is anchored. + + If the maximum number of days in a month is greater than this value, the last + day of the month is the billing cycle day (e.g. billing_cycle_day=31 for April + means the billing period begins on the 30th. + """ + + month: Optional[int] + """The month on which the billing cycle is anchored (e.g. + + a quarterly price anchored in February would have cycles starting February, May, + August, and November). + """ + + year: Optional[int] + """The year on which the billing cycle is anchored (e.g. + + a 2 year billing cycle anchored on 2021 would have cycles starting on 2021, + 2023, 2025, etc.). + """ + + class RemoveAdjustment(TypedDict, total=False): adjustment_id: Required[str] """The id of the adjustment to remove on the subscription.""" diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index 6d316c64..8cbb8bf3 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -749,6 +749,11 @@ def test_method_schedule_plan_change_with_all_params(self, client: Orb) -> None: align_billing_with_plan_change_date=True, auto_collection=True, billing_cycle_alignment="unchanged", + billing_cycle_anchor_configuration={ + "day": 1, + "month": 1, + "year": 0, + }, change_date=parse_datetime("2017-07-21T17:32:28Z"), coupon_redemption_code="coupon_redemption_code", credits_overage_rate=0, @@ -1849,6 +1854,11 @@ async def test_method_schedule_plan_change_with_all_params(self, async_client: A align_billing_with_plan_change_date=True, auto_collection=True, billing_cycle_alignment="unchanged", + billing_cycle_anchor_configuration={ + "day": 1, + "month": 1, + "year": 0, + }, change_date=parse_datetime("2017-07-21T17:32:28Z"), coupon_redemption_code="coupon_redemption_code", credits_overage_rate=0,