Skip to content

Commit c20debe

Browse files
feat(api): api update (#551)
1 parent 3a98525 commit c20debe

File tree

6 files changed

+58
-6
lines changed

6 files changed

+58
-6
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
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-097aa5c0e1408d7bd31c15caded400b84f45c0296aebdf67a1dc1a4013f371dd.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-26c7b0375aaf9218b32f9af29242d38e67a8318f3ae3e8cc5d1cd86c60e89e51.yml

src/orb/resources/customers/credits/top_ups.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
5+
from typing import Union, Optional
6+
from datetime import datetime
67
from typing_extensions import Literal
78

89
import httpx
@@ -61,6 +62,7 @@ def create(
6162
invoice_settings: top_up_create_params.InvoiceSettings,
6263
per_unit_cost_basis: str,
6364
threshold: str,
65+
active_from: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
6466
expires_after: Optional[int] | NotGiven = NOT_GIVEN,
6567
expires_after_unit: Optional[Literal["day", "month"]] | NotGiven = NOT_GIVEN,
6668
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -93,6 +95,9 @@ def create(
9395
threshold: The threshold at which to trigger the top-up. If the balance is at or below this
9496
threshold, the top-up will be triggered.
9597
98+
active_from: The date from which the top-up is active. If unspecified, the top-up is active
99+
immediately.
100+
96101
expires_after: The number of days or months after which the top-up expires. If unspecified, it
97102
does not expire.
98103
@@ -119,6 +124,7 @@ def create(
119124
"invoice_settings": invoice_settings,
120125
"per_unit_cost_basis": per_unit_cost_basis,
121126
"threshold": threshold,
127+
"active_from": active_from,
122128
"expires_after": expires_after,
123129
"expires_after_unit": expires_after_unit,
124130
},
@@ -239,6 +245,7 @@ def create_by_external_id(
239245
invoice_settings: top_up_create_by_external_id_params.InvoiceSettings,
240246
per_unit_cost_basis: str,
241247
threshold: str,
248+
active_from: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
242249
expires_after: Optional[int] | NotGiven = NOT_GIVEN,
243250
expires_after_unit: Optional[Literal["day", "month"]] | NotGiven = NOT_GIVEN,
244251
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -271,6 +278,9 @@ def create_by_external_id(
271278
threshold: The threshold at which to trigger the top-up. If the balance is at or below this
272279
threshold, the top-up will be triggered.
273280
281+
active_from: The date from which the top-up is active. If unspecified, the top-up is active
282+
immediately.
283+
274284
expires_after: The number of days or months after which the top-up expires. If unspecified, it
275285
does not expire.
276286
@@ -299,6 +309,7 @@ def create_by_external_id(
299309
"invoice_settings": invoice_settings,
300310
"per_unit_cost_basis": per_unit_cost_basis,
301311
"threshold": threshold,
312+
"active_from": active_from,
302313
"expires_after": expires_after,
303314
"expires_after_unit": expires_after_unit,
304315
},
@@ -444,6 +455,7 @@ async def create(
444455
invoice_settings: top_up_create_params.InvoiceSettings,
445456
per_unit_cost_basis: str,
446457
threshold: str,
458+
active_from: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
447459
expires_after: Optional[int] | NotGiven = NOT_GIVEN,
448460
expires_after_unit: Optional[Literal["day", "month"]] | NotGiven = NOT_GIVEN,
449461
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -476,6 +488,9 @@ async def create(
476488
threshold: The threshold at which to trigger the top-up. If the balance is at or below this
477489
threshold, the top-up will be triggered.
478490
491+
active_from: The date from which the top-up is active. If unspecified, the top-up is active
492+
immediately.
493+
479494
expires_after: The number of days or months after which the top-up expires. If unspecified, it
480495
does not expire.
481496
@@ -502,6 +517,7 @@ async def create(
502517
"invoice_settings": invoice_settings,
503518
"per_unit_cost_basis": per_unit_cost_basis,
504519
"threshold": threshold,
520+
"active_from": active_from,
505521
"expires_after": expires_after,
506522
"expires_after_unit": expires_after_unit,
507523
},
@@ -622,6 +638,7 @@ async def create_by_external_id(
622638
invoice_settings: top_up_create_by_external_id_params.InvoiceSettings,
623639
per_unit_cost_basis: str,
624640
threshold: str,
641+
active_from: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
625642
expires_after: Optional[int] | NotGiven = NOT_GIVEN,
626643
expires_after_unit: Optional[Literal["day", "month"]] | NotGiven = NOT_GIVEN,
627644
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -654,6 +671,9 @@ async def create_by_external_id(
654671
threshold: The threshold at which to trigger the top-up. If the balance is at or below this
655672
threshold, the top-up will be triggered.
656673
674+
active_from: The date from which the top-up is active. If unspecified, the top-up is active
675+
immediately.
676+
657677
expires_after: The number of days or months after which the top-up expires. If unspecified, it
658678
does not expire.
659679
@@ -682,6 +702,7 @@ async def create_by_external_id(
682702
"invoice_settings": invoice_settings,
683703
"per_unit_cost_basis": per_unit_cost_basis,
684704
"threshold": threshold,
705+
"active_from": active_from,
685706
"expires_after": expires_after,
686707
"expires_after_unit": expires_after_unit,
687708
},

src/orb/resources/invoices.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,10 @@ def void(
543543
invoice used $10 of customer balance, that amount will be added back to the
544544
customer balance upon voiding.
545545
546+
If the invoice was used to purchase a credit block, but the invoice is not yet
547+
paid, the credit block will be voided. If the invoice was created due to a
548+
top-up, the top-up will be disabled.
549+
546550
Args:
547551
extra_headers: Send extra headers
548552
@@ -1078,6 +1082,10 @@ async def void(
10781082
invoice used $10 of customer balance, that amount will be added back to the
10791083
customer balance upon voiding.
10801084
1085+
If the invoice was used to purchase a credit block, but the invoice is not yet
1086+
paid, the credit block will be voided. If the invoice was created due to a
1087+
top-up, the top-up will be disabled.
1088+
10811089
Args:
10821090
extra_headers: Send extra headers
10831091

src/orb/types/customers/credits/top_up_create_by_external_id_params.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
6-
from typing_extensions import Literal, Required, TypedDict
5+
from typing import Union, Optional
6+
from datetime import datetime
7+
from typing_extensions import Literal, Required, Annotated, TypedDict
8+
9+
from ...._utils import PropertyInfo
710

811
__all__ = ["TopUpCreateByExternalIDParams", "InvoiceSettings"]
912

@@ -31,6 +34,12 @@ class TopUpCreateByExternalIDParams(TypedDict, total=False):
3134
If the balance is at or below this threshold, the top-up will be triggered.
3235
"""
3336

37+
active_from: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
38+
"""The date from which the top-up is active.
39+
40+
If unspecified, the top-up is active immediately.
41+
"""
42+
3443
expires_after: Optional[int]
3544
"""The number of days or months after which the top-up expires.
3645

src/orb/types/customers/credits/top_up_create_params.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
6-
from typing_extensions import Literal, Required, TypedDict
5+
from typing import Union, Optional
6+
from datetime import datetime
7+
from typing_extensions import Literal, Required, Annotated, TypedDict
8+
9+
from ...._utils import PropertyInfo
710

811
__all__ = ["TopUpCreateParams", "InvoiceSettings"]
912

@@ -31,6 +34,12 @@ class TopUpCreateParams(TypedDict, total=False):
3134
If the balance is at or below this threshold, the top-up will be triggered.
3235
"""
3336

37+
active_from: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
38+
"""The date from which the top-up is active.
39+
40+
If unspecified, the top-up is active immediately.
41+
"""
42+
3443
expires_after: Optional[int]
3544
"""The number of days or months after which the top-up expires.
3645

tests/api_resources/customers/credits/test_top_ups.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import pytest
99

1010
from orb import Orb, AsyncOrb
11+
from orb._utils import parse_datetime
1112
from tests.utils import assert_matches_type
1213
from orb.pagination import SyncPage, AsyncPage
1314
from orb.types.customers.credits import (
@@ -52,6 +53,7 @@ def test_method_create_with_all_params(self, client: Orb) -> None:
5253
},
5354
per_unit_cost_basis="per_unit_cost_basis",
5455
threshold="threshold",
56+
active_from=parse_datetime("2019-12-27T18:11:19.117Z"),
5557
expires_after=0,
5658
expires_after_unit="day",
5759
)
@@ -236,6 +238,7 @@ def test_method_create_by_external_id_with_all_params(self, client: Orb) -> None
236238
},
237239
per_unit_cost_basis="per_unit_cost_basis",
238240
threshold="threshold",
241+
active_from=parse_datetime("2019-12-27T18:11:19.117Z"),
239242
expires_after=0,
240243
expires_after_unit="day",
241244
)
@@ -424,6 +427,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No
424427
},
425428
per_unit_cost_basis="per_unit_cost_basis",
426429
threshold="threshold",
430+
active_from=parse_datetime("2019-12-27T18:11:19.117Z"),
427431
expires_after=0,
428432
expires_after_unit="day",
429433
)
@@ -608,6 +612,7 @@ async def test_method_create_by_external_id_with_all_params(self, async_client:
608612
},
609613
per_unit_cost_basis="per_unit_cost_basis",
610614
threshold="threshold",
615+
active_from=parse_datetime("2019-12-27T18:11:19.117Z"),
611616
expires_after=0,
612617
expires_after_unit="day",
613618
)

0 commit comments

Comments
 (0)