Skip to content

Commit 6a7f4af

Browse files
feat(api): api update
1 parent 058d853 commit 6a7f4af

File tree

4 files changed

+28
-23
lines changed

4 files changed

+28
-23
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 115
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-028b94908fa562ed9c31c1137078f958f859e79b33b8fddbd64934e1bb4ffd32.yml
3-
openapi_spec_hash: e9a8403fd1da4edf627451a88ba27a55
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-baf431485e9392b6fbff7c2f4d53d0dc3d1e49e2bec417501c924231c95dc09d.yml
3+
openapi_spec_hash: f80f4798ac7266ef21a9c069ccfef259
44
config_hash: 1e2186b09e57d7d27b6ab5c8e6410b31

src/orb/resources/subscriptions.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,9 +1368,10 @@ def redeem_coupon(
13681368
subscription_id: str,
13691369
*,
13701370
change_option: Literal["requested_date", "end_of_subscription_term", "immediate"],
1371-
coupon_id: str,
13721371
allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN,
13731372
change_date: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
1373+
coupon_id: Optional[str] | NotGiven = NOT_GIVEN,
1374+
coupon_redemption_code: Optional[str] | NotGiven = NOT_GIVEN,
13741375
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
13751376
# The extra values given here take precedence over values defined on the client or passed to this method.
13761377
extra_headers: Headers | None = None,
@@ -1383,15 +1384,17 @@ def redeem_coupon(
13831384
Redeem a coupon effective at a given time.
13841385
13851386
Args:
1386-
coupon_id: Coupon ID to be redeemed for this subscription.
1387-
13881387
allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a
13891388
credit note. Consider using this as a safety mechanism if you do not expect
13901389
existing invoices to be changed.
13911390
13921391
change_date: The date that the coupon discount should take effect. This parameter can only be
13931392
passed if the `change_option` is `requested_date`.
13941393
1394+
coupon_id: Coupon ID to be redeemed for this subscription.
1395+
1396+
coupon_redemption_code: Redemption code of the coupon to be redeemed for this subscription.
1397+
13951398
extra_headers: Send extra headers
13961399
13971400
extra_query: Add additional query parameters to the request
@@ -1409,9 +1412,10 @@ def redeem_coupon(
14091412
body=maybe_transform(
14101413
{
14111414
"change_option": change_option,
1412-
"coupon_id": coupon_id,
14131415
"allow_invoice_credit_or_void": allow_invoice_credit_or_void,
14141416
"change_date": change_date,
1417+
"coupon_id": coupon_id,
1418+
"coupon_redemption_code": coupon_redemption_code,
14151419
},
14161420
subscription_redeem_coupon_params.SubscriptionRedeemCouponParams,
14171421
),
@@ -3454,9 +3458,10 @@ async def redeem_coupon(
34543458
subscription_id: str,
34553459
*,
34563460
change_option: Literal["requested_date", "end_of_subscription_term", "immediate"],
3457-
coupon_id: str,
34583461
allow_invoice_credit_or_void: Optional[bool] | NotGiven = NOT_GIVEN,
34593462
change_date: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
3463+
coupon_id: Optional[str] | NotGiven = NOT_GIVEN,
3464+
coupon_redemption_code: Optional[str] | NotGiven = NOT_GIVEN,
34603465
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
34613466
# The extra values given here take precedence over values defined on the client or passed to this method.
34623467
extra_headers: Headers | None = None,
@@ -3469,15 +3474,17 @@ async def redeem_coupon(
34693474
Redeem a coupon effective at a given time.
34703475
34713476
Args:
3472-
coupon_id: Coupon ID to be redeemed for this subscription.
3473-
34743477
allow_invoice_credit_or_void: If false, this request will fail if it would void an issued invoice or create a
34753478
credit note. Consider using this as a safety mechanism if you do not expect
34763479
existing invoices to be changed.
34773480
34783481
change_date: The date that the coupon discount should take effect. This parameter can only be
34793482
passed if the `change_option` is `requested_date`.
34803483
3484+
coupon_id: Coupon ID to be redeemed for this subscription.
3485+
3486+
coupon_redemption_code: Redemption code of the coupon to be redeemed for this subscription.
3487+
34813488
extra_headers: Send extra headers
34823489
34833490
extra_query: Add additional query parameters to the request
@@ -3495,9 +3502,10 @@ async def redeem_coupon(
34953502
body=await async_maybe_transform(
34963503
{
34973504
"change_option": change_option,
3498-
"coupon_id": coupon_id,
34993505
"allow_invoice_credit_or_void": allow_invoice_credit_or_void,
35003506
"change_date": change_date,
3507+
"coupon_id": coupon_id,
3508+
"coupon_redemption_code": coupon_redemption_code,
35013509
},
35023510
subscription_redeem_coupon_params.SubscriptionRedeemCouponParams,
35033511
),

src/orb/types/subscription_redeem_coupon_params.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
class SubscriptionRedeemCouponParams(TypedDict, total=False):
1515
change_option: Required[Literal["requested_date", "end_of_subscription_term", "immediate"]]
1616

17-
coupon_id: Required[str]
18-
"""Coupon ID to be redeemed for this subscription."""
19-
2017
allow_invoice_credit_or_void: Optional[bool]
2118
"""
2219
If false, this request will fail if it would void an issued invoice or create a
@@ -29,3 +26,9 @@ class SubscriptionRedeemCouponParams(TypedDict, total=False):
2926
3027
This parameter can only be passed if the `change_option` is `requested_date`.
3128
"""
29+
30+
coupon_id: Optional[str]
31+
"""Coupon ID to be redeemed for this subscription."""
32+
33+
coupon_redemption_code: Optional[str]
34+
"""Redemption code of the coupon to be redeemed for this subscription."""

tests/api_resources/test_subscriptions.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,6 @@ def test_method_redeem_coupon(self, client: Orb) -> None:
736736
subscription = client.subscriptions.redeem_coupon(
737737
subscription_id="subscription_id",
738738
change_option="requested_date",
739-
coupon_id="coupon_id",
740739
)
741740
assert_matches_type(SubscriptionRedeemCouponResponse, subscription, path=["response"])
742741

@@ -745,9 +744,10 @@ def test_method_redeem_coupon_with_all_params(self, client: Orb) -> None:
745744
subscription = client.subscriptions.redeem_coupon(
746745
subscription_id="subscription_id",
747746
change_option="requested_date",
748-
coupon_id="coupon_id",
749747
allow_invoice_credit_or_void=True,
750748
change_date=parse_datetime("2017-07-21T17:32:28Z"),
749+
coupon_id="coupon_id",
750+
coupon_redemption_code="coupon_redemption_code",
751751
)
752752
assert_matches_type(SubscriptionRedeemCouponResponse, subscription, path=["response"])
753753

@@ -756,7 +756,6 @@ def test_raw_response_redeem_coupon(self, client: Orb) -> None:
756756
response = client.subscriptions.with_raw_response.redeem_coupon(
757757
subscription_id="subscription_id",
758758
change_option="requested_date",
759-
coupon_id="coupon_id",
760759
)
761760

762761
assert response.is_closed is True
@@ -769,7 +768,6 @@ def test_streaming_response_redeem_coupon(self, client: Orb) -> None:
769768
with client.subscriptions.with_streaming_response.redeem_coupon(
770769
subscription_id="subscription_id",
771770
change_option="requested_date",
772-
coupon_id="coupon_id",
773771
) as response:
774772
assert not response.is_closed
775773
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -785,7 +783,6 @@ def test_path_params_redeem_coupon(self, client: Orb) -> None:
785783
client.subscriptions.with_raw_response.redeem_coupon(
786784
subscription_id="",
787785
change_option="requested_date",
788-
coupon_id="coupon_id",
789786
)
790787

791788
@parametrize
@@ -1986,7 +1983,6 @@ async def test_method_redeem_coupon(self, async_client: AsyncOrb) -> None:
19861983
subscription = await async_client.subscriptions.redeem_coupon(
19871984
subscription_id="subscription_id",
19881985
change_option="requested_date",
1989-
coupon_id="coupon_id",
19901986
)
19911987
assert_matches_type(SubscriptionRedeemCouponResponse, subscription, path=["response"])
19921988

@@ -1995,9 +1991,10 @@ async def test_method_redeem_coupon_with_all_params(self, async_client: AsyncOrb
19951991
subscription = await async_client.subscriptions.redeem_coupon(
19961992
subscription_id="subscription_id",
19971993
change_option="requested_date",
1998-
coupon_id="coupon_id",
19991994
allow_invoice_credit_or_void=True,
20001995
change_date=parse_datetime("2017-07-21T17:32:28Z"),
1996+
coupon_id="coupon_id",
1997+
coupon_redemption_code="coupon_redemption_code",
20011998
)
20021999
assert_matches_type(SubscriptionRedeemCouponResponse, subscription, path=["response"])
20032000

@@ -2006,7 +2003,6 @@ async def test_raw_response_redeem_coupon(self, async_client: AsyncOrb) -> None:
20062003
response = await async_client.subscriptions.with_raw_response.redeem_coupon(
20072004
subscription_id="subscription_id",
20082005
change_option="requested_date",
2009-
coupon_id="coupon_id",
20102006
)
20112007

20122008
assert response.is_closed is True
@@ -2019,7 +2015,6 @@ async def test_streaming_response_redeem_coupon(self, async_client: AsyncOrb) ->
20192015
async with async_client.subscriptions.with_streaming_response.redeem_coupon(
20202016
subscription_id="subscription_id",
20212017
change_option="requested_date",
2022-
coupon_id="coupon_id",
20232018
) as response:
20242019
assert not response.is_closed
20252020
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -2035,7 +2030,6 @@ async def test_path_params_redeem_coupon(self, async_client: AsyncOrb) -> None:
20352030
await async_client.subscriptions.with_raw_response.redeem_coupon(
20362031
subscription_id="",
20372032
change_option="requested_date",
2038-
coupon_id="coupon_id",
20392033
)
20402034

20412035
@parametrize

0 commit comments

Comments
 (0)