diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f391d416..27d2fbbc 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.6.0" + ".": "3.7.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index fb35dc35..1847c9b0 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-097aa5c0e1408d7bd31c15caded400b84f45c0296aebdf67a1dc1a4013f371dd.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-26c7b0375aaf9218b32f9af29242d38e67a8318f3ae3e8cc5d1cd86c60e89e51.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 14640afb..75f9d547 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 3.7.0 (2025-02-21) + +Full Changelog: [v3.6.0...v3.7.0](https://github.com/orbcorp/orb-python/compare/v3.6.0...v3.7.0) + +### Features + +* **api:** api update ([#551](https://github.com/orbcorp/orb-python/issues/551)) ([9af0efd](https://github.com/orbcorp/orb-python/commit/9af0efd82d4c18870479dd0ce966899d04f14485)) + ## 3.6.0 (2025-02-21) Full Changelog: [v3.5.0...v3.6.0](https://github.com/orbcorp/orb-python/compare/v3.5.0...v3.6.0) diff --git a/pyproject.toml b/pyproject.toml index c449291a..4667a142 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "orb-billing" -version = "3.6.0" +version = "3.7.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 21b275ed..45074dc9 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.6.0" # x-release-please-version +__version__ = "3.7.0" # x-release-please-version diff --git a/src/orb/resources/customers/credits/top_ups.py b/src/orb/resources/customers/credits/top_ups.py index 916a4c21..c0fc0a98 100644 --- a/src/orb/resources/customers/credits/top_ups.py +++ b/src/orb/resources/customers/credits/top_ups.py @@ -2,7 +2,8 @@ from __future__ import annotations -from typing import Optional +from typing import Union, Optional +from datetime import datetime from typing_extensions import Literal import httpx @@ -61,6 +62,7 @@ def create( invoice_settings: top_up_create_params.InvoiceSettings, per_unit_cost_basis: str, threshold: str, + active_from: Union[str, datetime, None] | NotGiven = NOT_GIVEN, expires_after: Optional[int] | NotGiven = NOT_GIVEN, expires_after_unit: Optional[Literal["day", "month"]] | NotGiven = NOT_GIVEN, # 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( threshold: The threshold at which to trigger the top-up. If the balance is at or below this threshold, the top-up will be triggered. + active_from: The date from which the top-up is active. If unspecified, the top-up is active + immediately. + expires_after: The number of days or months after which the top-up expires. If unspecified, it does not expire. @@ -119,6 +124,7 @@ def create( "invoice_settings": invoice_settings, "per_unit_cost_basis": per_unit_cost_basis, "threshold": threshold, + "active_from": active_from, "expires_after": expires_after, "expires_after_unit": expires_after_unit, }, @@ -239,6 +245,7 @@ def create_by_external_id( invoice_settings: top_up_create_by_external_id_params.InvoiceSettings, per_unit_cost_basis: str, threshold: str, + active_from: Union[str, datetime, None] | NotGiven = NOT_GIVEN, expires_after: Optional[int] | NotGiven = NOT_GIVEN, expires_after_unit: Optional[Literal["day", "month"]] | NotGiven = NOT_GIVEN, # 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( threshold: The threshold at which to trigger the top-up. If the balance is at or below this threshold, the top-up will be triggered. + active_from: The date from which the top-up is active. If unspecified, the top-up is active + immediately. + expires_after: The number of days or months after which the top-up expires. If unspecified, it does not expire. @@ -299,6 +309,7 @@ def create_by_external_id( "invoice_settings": invoice_settings, "per_unit_cost_basis": per_unit_cost_basis, "threshold": threshold, + "active_from": active_from, "expires_after": expires_after, "expires_after_unit": expires_after_unit, }, @@ -444,6 +455,7 @@ async def create( invoice_settings: top_up_create_params.InvoiceSettings, per_unit_cost_basis: str, threshold: str, + active_from: Union[str, datetime, None] | NotGiven = NOT_GIVEN, expires_after: Optional[int] | NotGiven = NOT_GIVEN, expires_after_unit: Optional[Literal["day", "month"]] | NotGiven = NOT_GIVEN, # 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( threshold: The threshold at which to trigger the top-up. If the balance is at or below this threshold, the top-up will be triggered. + active_from: The date from which the top-up is active. If unspecified, the top-up is active + immediately. + expires_after: The number of days or months after which the top-up expires. If unspecified, it does not expire. @@ -502,6 +517,7 @@ async def create( "invoice_settings": invoice_settings, "per_unit_cost_basis": per_unit_cost_basis, "threshold": threshold, + "active_from": active_from, "expires_after": expires_after, "expires_after_unit": expires_after_unit, }, @@ -622,6 +638,7 @@ async def create_by_external_id( invoice_settings: top_up_create_by_external_id_params.InvoiceSettings, per_unit_cost_basis: str, threshold: str, + active_from: Union[str, datetime, None] | NotGiven = NOT_GIVEN, expires_after: Optional[int] | NotGiven = NOT_GIVEN, expires_after_unit: Optional[Literal["day", "month"]] | NotGiven = NOT_GIVEN, # 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( threshold: The threshold at which to trigger the top-up. If the balance is at or below this threshold, the top-up will be triggered. + active_from: The date from which the top-up is active. If unspecified, the top-up is active + immediately. + expires_after: The number of days or months after which the top-up expires. If unspecified, it does not expire. @@ -682,6 +702,7 @@ async def create_by_external_id( "invoice_settings": invoice_settings, "per_unit_cost_basis": per_unit_cost_basis, "threshold": threshold, + "active_from": active_from, "expires_after": expires_after, "expires_after_unit": expires_after_unit, }, diff --git a/src/orb/resources/invoices.py b/src/orb/resources/invoices.py index ac264f3e..22c82be0 100644 --- a/src/orb/resources/invoices.py +++ b/src/orb/resources/invoices.py @@ -543,6 +543,10 @@ def void( invoice used $10 of customer balance, that amount will be added back to the customer balance upon voiding. + If the invoice was used to purchase a credit block, but the invoice is not yet + paid, the credit block will be voided. If the invoice was created due to a + top-up, the top-up will be disabled. + Args: extra_headers: Send extra headers @@ -1078,6 +1082,10 @@ async def void( invoice used $10 of customer balance, that amount will be added back to the customer balance upon voiding. + If the invoice was used to purchase a credit block, but the invoice is not yet + paid, the credit block will be voided. If the invoice was created due to a + top-up, the top-up will be disabled. + Args: extra_headers: Send extra headers diff --git a/src/orb/types/customers/credits/top_up_create_by_external_id_params.py b/src/orb/types/customers/credits/top_up_create_by_external_id_params.py index bbddd72e..65022b53 100644 --- a/src/orb/types/customers/credits/top_up_create_by_external_id_params.py +++ b/src/orb/types/customers/credits/top_up_create_by_external_id_params.py @@ -2,8 +2,11 @@ from __future__ import annotations -from typing import Optional -from typing_extensions import Literal, Required, TypedDict +from typing import Union, Optional +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._utils import PropertyInfo __all__ = ["TopUpCreateByExternalIDParams", "InvoiceSettings"] @@ -31,6 +34,12 @@ class TopUpCreateByExternalIDParams(TypedDict, total=False): If the balance is at or below this threshold, the top-up will be triggered. """ + active_from: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """The date from which the top-up is active. + + If unspecified, the top-up is active immediately. + """ + expires_after: Optional[int] """The number of days or months after which the top-up expires. diff --git a/src/orb/types/customers/credits/top_up_create_params.py b/src/orb/types/customers/credits/top_up_create_params.py index 571263d6..3d33860f 100644 --- a/src/orb/types/customers/credits/top_up_create_params.py +++ b/src/orb/types/customers/credits/top_up_create_params.py @@ -2,8 +2,11 @@ from __future__ import annotations -from typing import Optional -from typing_extensions import Literal, Required, TypedDict +from typing import Union, Optional +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ...._utils import PropertyInfo __all__ = ["TopUpCreateParams", "InvoiceSettings"] @@ -31,6 +34,12 @@ class TopUpCreateParams(TypedDict, total=False): If the balance is at or below this threshold, the top-up will be triggered. """ + active_from: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """The date from which the top-up is active. + + If unspecified, the top-up is active immediately. + """ + expires_after: Optional[int] """The number of days or months after which the top-up expires. diff --git a/tests/api_resources/customers/credits/test_top_ups.py b/tests/api_resources/customers/credits/test_top_ups.py index b830664e..03281ee1 100644 --- a/tests/api_resources/customers/credits/test_top_ups.py +++ b/tests/api_resources/customers/credits/test_top_ups.py @@ -8,6 +8,7 @@ import pytest from orb import Orb, AsyncOrb +from orb._utils import parse_datetime from tests.utils import assert_matches_type from orb.pagination import SyncPage, AsyncPage from orb.types.customers.credits import ( @@ -52,6 +53,7 @@ def test_method_create_with_all_params(self, client: Orb) -> None: }, per_unit_cost_basis="per_unit_cost_basis", threshold="threshold", + active_from=parse_datetime("2019-12-27T18:11:19.117Z"), expires_after=0, expires_after_unit="day", ) @@ -236,6 +238,7 @@ def test_method_create_by_external_id_with_all_params(self, client: Orb) -> None }, per_unit_cost_basis="per_unit_cost_basis", threshold="threshold", + active_from=parse_datetime("2019-12-27T18:11:19.117Z"), expires_after=0, expires_after_unit="day", ) @@ -424,6 +427,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No }, per_unit_cost_basis="per_unit_cost_basis", threshold="threshold", + active_from=parse_datetime("2019-12-27T18:11:19.117Z"), expires_after=0, expires_after_unit="day", ) @@ -608,6 +612,7 @@ async def test_method_create_by_external_id_with_all_params(self, async_client: }, per_unit_cost_basis="per_unit_cost_basis", threshold="threshold", + active_from=parse_datetime("2019-12-27T18:11:19.117Z"), expires_after=0, expires_after_unit="day", )