diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9b75df70..852ff3c1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.53.0" + ".": "4.54.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index a77b8077..67224ec7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 126 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-6aa83a816c15600a3d6d378d7804a345505c76726059c19369db4e7766a71cbd.yml -openapi_spec_hash: f283d730e5320f9595c3c0a5902f5cbb +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-c92fb451e13f157b3735f188acc8d57aa3adfbaac1683645e1ba4f432dd7a4f8.yml +openapi_spec_hash: dbcd87ecfbd3976eb3b99ec6f9fbc606 config_hash: bcf82bddb691f6be773ac6cae8c03b9a diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e5d8ad0..6b3b521c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 4.54.0 (2026-02-12) + +Full Changelog: [v4.53.0...v4.54.0](https://github.com/orbcorp/orb-python/compare/v4.53.0...v4.54.0) + +### Features + +* **api:** api update ([e19d0dd](https://github.com/orbcorp/orb-python/commit/e19d0dd64cbdd35e4df9a865863f27f4dbbaa947)) + + +### Chores + +* format all `api.md` files ([814eda2](https://github.com/orbcorp/orb-python/commit/814eda22555fe97fe641823f61389c2a673e913d)) +* **internal:** codegen related update ([98c5208](https://github.com/orbcorp/orb-python/commit/98c5208b72deeb740f0e548fb89c61239f4b7492)) +* **internal:** fix lint error on Python 3.14 ([ca05c35](https://github.com/orbcorp/orb-python/commit/ca05c357163d78a443aadc1648bf848ab7e6b9f0)) + ## 4.53.0 (2026-02-10) Full Changelog: [v4.52.0...v4.53.0](https://github.com/orbcorp/orb-python/compare/v4.52.0...v4.53.0) diff --git a/pyproject.toml b/pyproject.toml index 135d49e0..f1bd0369 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "orb-billing" -version = "4.53.0" +version = "4.54.0" description = "The official Python library for the orb API" dynamic = ["readme"] license = "Apache-2.0" @@ -69,7 +69,7 @@ format = { chain = [ # run formatting again to fix any inconsistencies when imports are stripped "format:ruff", ]} -"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md" +"format:docs" = "bash -c 'python scripts/utils/ruffen-docs.py README.md $(find . -type f -name api.md)'" "format:ruff" = "ruff format" "lint" = { chain = [ diff --git a/src/orb/_utils/_compat.py b/src/orb/_utils/_compat.py index dd703233..2c70b299 100644 --- a/src/orb/_utils/_compat.py +++ b/src/orb/_utils/_compat.py @@ -26,7 +26,7 @@ def is_union(tp: Optional[Type[Any]]) -> bool: else: import types - return tp is Union or tp is types.UnionType + return tp is Union or tp is types.UnionType # type: ignore[comparison-overlap] def is_typeddict(tp: Type[Any]) -> bool: diff --git a/src/orb/_version.py b/src/orb/_version.py index b8b574be..8961ebfa 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__ = "4.53.0" # x-release-please-version +__version__ = "4.54.0" # x-release-please-version diff --git a/src/orb/resources/customers/credits/credits.py b/src/orb/resources/customers/credits/credits.py index b0df1ee1..bd4f7c3a 100644 --- a/src/orb/resources/customers/credits/credits.py +++ b/src/orb/resources/customers/credits/credits.py @@ -2,7 +2,8 @@ from __future__ import annotations -from typing import Optional +from typing import Union, Optional +from datetime import datetime import httpx @@ -71,6 +72,10 @@ def list( *, currency: Optional[str] | Omit = omit, cursor: Optional[str] | Omit = omit, + effective_date_gt: Union[str, datetime, None] | Omit = omit, + effective_date_gte: Union[str, datetime, None] | Omit = omit, + effective_date_lt: Union[str, datetime, None] | Omit = omit, + effective_date_lte: Union[str, datetime, None] | Omit = omit, include_all_blocks: bool | Omit = omit, limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -89,6 +94,11 @@ def list( Note that `currency` defaults to credits if not specified. To use a real world currency, set `currency` to an ISO 4217 string. + Results can be filtered by the block's `effective_date` using the + `effective_date[gte]`, `effective_date[gt]`, `effective_date[lt]`, and + `effective_date[lte]` query parameters. This filters on when the credit block + becomes effective, which may differ from creation time for backdated credits. + Args: currency: The ledger currency or custom pricing unit to use. @@ -122,6 +132,10 @@ def list( { "currency": currency, "cursor": cursor, + "effective_date_gt": effective_date_gt, + "effective_date_gte": effective_date_gte, + "effective_date_lt": effective_date_lt, + "effective_date_lte": effective_date_lte, "include_all_blocks": include_all_blocks, "limit": limit, }, @@ -137,6 +151,10 @@ def list_by_external_id( *, currency: Optional[str] | Omit = omit, cursor: Optional[str] | Omit = omit, + effective_date_gt: Union[str, datetime, None] | Omit = omit, + effective_date_gte: Union[str, datetime, None] | Omit = omit, + effective_date_lt: Union[str, datetime, None] | Omit = omit, + effective_date_lte: Union[str, datetime, None] | Omit = omit, include_all_blocks: bool | Omit = omit, limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -155,6 +173,11 @@ def list_by_external_id( Note that `currency` defaults to credits if not specified. To use a real world currency, set `currency` to an ISO 4217 string. + Results can be filtered by the block's `effective_date` using the + `effective_date[gte]`, `effective_date[gt]`, `effective_date[lt]`, and + `effective_date[lte]` query parameters. This filters on when the credit block + becomes effective, which may differ from creation time for backdated credits. + Args: currency: The ledger currency or custom pricing unit to use. @@ -190,6 +213,10 @@ def list_by_external_id( { "currency": currency, "cursor": cursor, + "effective_date_gt": effective_date_gt, + "effective_date_gte": effective_date_gte, + "effective_date_lt": effective_date_lt, + "effective_date_lte": effective_date_lte, "include_all_blocks": include_all_blocks, "limit": limit, }, @@ -234,6 +261,10 @@ def list( *, currency: Optional[str] | Omit = omit, cursor: Optional[str] | Omit = omit, + effective_date_gt: Union[str, datetime, None] | Omit = omit, + effective_date_gte: Union[str, datetime, None] | Omit = omit, + effective_date_lt: Union[str, datetime, None] | Omit = omit, + effective_date_lte: Union[str, datetime, None] | Omit = omit, include_all_blocks: bool | Omit = omit, limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -252,6 +283,11 @@ def list( Note that `currency` defaults to credits if not specified. To use a real world currency, set `currency` to an ISO 4217 string. + Results can be filtered by the block's `effective_date` using the + `effective_date[gte]`, `effective_date[gt]`, `effective_date[lt]`, and + `effective_date[lte]` query parameters. This filters on when the credit block + becomes effective, which may differ from creation time for backdated credits. + Args: currency: The ledger currency or custom pricing unit to use. @@ -285,6 +321,10 @@ def list( { "currency": currency, "cursor": cursor, + "effective_date_gt": effective_date_gt, + "effective_date_gte": effective_date_gte, + "effective_date_lt": effective_date_lt, + "effective_date_lte": effective_date_lte, "include_all_blocks": include_all_blocks, "limit": limit, }, @@ -300,6 +340,10 @@ def list_by_external_id( *, currency: Optional[str] | Omit = omit, cursor: Optional[str] | Omit = omit, + effective_date_gt: Union[str, datetime, None] | Omit = omit, + effective_date_gte: Union[str, datetime, None] | Omit = omit, + effective_date_lt: Union[str, datetime, None] | Omit = omit, + effective_date_lte: Union[str, datetime, None] | Omit = omit, include_all_blocks: bool | Omit = omit, limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -318,6 +362,11 @@ def list_by_external_id( Note that `currency` defaults to credits if not specified. To use a real world currency, set `currency` to an ISO 4217 string. + Results can be filtered by the block's `effective_date` using the + `effective_date[gte]`, `effective_date[gt]`, `effective_date[lt]`, and + `effective_date[lte]` query parameters. This filters on when the credit block + becomes effective, which may differ from creation time for backdated credits. + Args: currency: The ledger currency or custom pricing unit to use. @@ -353,6 +402,10 @@ def list_by_external_id( { "currency": currency, "cursor": cursor, + "effective_date_gt": effective_date_gt, + "effective_date_gte": effective_date_gte, + "effective_date_lt": effective_date_lt, + "effective_date_lte": effective_date_lte, "include_all_blocks": include_all_blocks, "limit": limit, }, diff --git a/src/orb/resources/invoices.py b/src/orb/resources/invoices.py index c10867e8..63fa9ab4 100644 --- a/src/orb/resources/invoices.py +++ b/src/orb/resources/invoices.py @@ -519,7 +519,7 @@ def list_summary( invoice_date_lte: Union[str, datetime, None] | Omit = omit, is_recurring: Optional[bool] | Omit = omit, limit: int | Omit = omit, - status: Optional[List[Literal["draft", "issued", "paid", "synced", "void"]]] | Omit = omit, + status: Optional[Literal["draft", "issued", "paid", "synced", "void"]] | Omit = omit, subscription_id: Optional[str] | Omit = omit, # 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. @@ -1239,7 +1239,7 @@ def list_summary( invoice_date_lte: Union[str, datetime, None] | Omit = omit, is_recurring: Optional[bool] | Omit = omit, limit: int | Omit = omit, - status: Optional[List[Literal["draft", "issued", "paid", "synced", "void"]]] | Omit = omit, + status: Optional[Literal["draft", "issued", "paid", "synced", "void"]] | Omit = omit, subscription_id: Optional[str] | Omit = omit, # 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. diff --git a/src/orb/types/credit_block_retrieve_response.py b/src/orb/types/credit_block_retrieve_response.py index b931d83b..a9bbb22a 100644 --- a/src/orb/types/credit_block_retrieve_response.py +++ b/src/orb/types/credit_block_retrieve_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from typing_extensions import Literal @@ -35,6 +35,14 @@ class CreditBlockRetrieveResponse(BaseModel): maximum_initial_balance: Optional[float] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + per_unit_cost_basis: Optional[str] = None status: Literal["active", "pending_payment"] diff --git a/src/orb/types/customers/credit_list_by_external_id_params.py b/src/orb/types/customers/credit_list_by_external_id_params.py index 4074c82e..0d32d3c5 100644 --- a/src/orb/types/customers/credit_list_by_external_id_params.py +++ b/src/orb/types/customers/credit_list_by_external_id_params.py @@ -2,8 +2,11 @@ from __future__ import annotations -from typing import Optional -from typing_extensions import TypedDict +from typing import Union, Optional +from datetime import datetime +from typing_extensions import Annotated, TypedDict + +from ..._utils import PropertyInfo __all__ = ["CreditListByExternalIDParams"] @@ -19,6 +22,18 @@ class CreditListByExternalIDParams(TypedDict, total=False): request. """ + effective_date_gt: Annotated[Union[str, datetime, None], PropertyInfo(alias="effective_date[gt]", format="iso8601")] + + effective_date_gte: Annotated[ + Union[str, datetime, None], PropertyInfo(alias="effective_date[gte]", format="iso8601") + ] + + effective_date_lt: Annotated[Union[str, datetime, None], PropertyInfo(alias="effective_date[lt]", format="iso8601")] + + effective_date_lte: Annotated[ + Union[str, datetime, None], PropertyInfo(alias="effective_date[lte]", format="iso8601") + ] + include_all_blocks: bool """ If set to True, all expired and depleted blocks, as well as active block will be diff --git a/src/orb/types/customers/credit_list_by_external_id_response.py b/src/orb/types/customers/credit_list_by_external_id_response.py index aeda2c6e..3b0de277 100644 --- a/src/orb/types/customers/credit_list_by_external_id_response.py +++ b/src/orb/types/customers/credit_list_by_external_id_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from typing_extensions import Literal @@ -35,6 +35,14 @@ class CreditListByExternalIDResponse(BaseModel): maximum_initial_balance: Optional[float] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + per_unit_cost_basis: Optional[str] = None status: Literal["active", "pending_payment"] diff --git a/src/orb/types/customers/credit_list_params.py b/src/orb/types/customers/credit_list_params.py index cb3f767b..80c44d5b 100644 --- a/src/orb/types/customers/credit_list_params.py +++ b/src/orb/types/customers/credit_list_params.py @@ -2,8 +2,11 @@ from __future__ import annotations -from typing import Optional -from typing_extensions import TypedDict +from typing import Union, Optional +from datetime import datetime +from typing_extensions import Annotated, TypedDict + +from ..._utils import PropertyInfo __all__ = ["CreditListParams"] @@ -19,6 +22,18 @@ class CreditListParams(TypedDict, total=False): request. """ + effective_date_gt: Annotated[Union[str, datetime, None], PropertyInfo(alias="effective_date[gt]", format="iso8601")] + + effective_date_gte: Annotated[ + Union[str, datetime, None], PropertyInfo(alias="effective_date[gte]", format="iso8601") + ] + + effective_date_lt: Annotated[Union[str, datetime, None], PropertyInfo(alias="effective_date[lt]", format="iso8601")] + + effective_date_lte: Annotated[ + Union[str, datetime, None], PropertyInfo(alias="effective_date[lte]", format="iso8601") + ] + include_all_blocks: bool """ If set to True, all expired and depleted blocks, as well as active block will be diff --git a/src/orb/types/customers/credit_list_response.py b/src/orb/types/customers/credit_list_response.py index d024eaf7..145e0195 100644 --- a/src/orb/types/customers/credit_list_response.py +++ b/src/orb/types/customers/credit_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from typing_extensions import Literal @@ -35,6 +35,14 @@ class CreditListResponse(BaseModel): maximum_initial_balance: Optional[float] = None + metadata: Dict[str, str] + """User specified key-value pairs for the resource. + + If not present, this defaults to an empty dictionary. Individual keys can be + removed by setting the value to `null`, and the entire metadata mapping can be + cleared by setting `metadata` to `null`. + """ + per_unit_cost_basis: Optional[str] = None status: Literal["active", "pending_payment"] diff --git a/src/orb/types/invoice_list_summary_params.py b/src/orb/types/invoice_list_summary_params.py index 7f8849a1..41b86e65 100644 --- a/src/orb/types/invoice_list_summary_params.py +++ b/src/orb/types/invoice_list_summary_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Union, Optional +from typing import Union, Optional from datetime import date, datetime from typing_extensions import Literal, Annotated, TypedDict @@ -58,6 +58,6 @@ class InvoiceListSummaryParams(TypedDict, total=False): limit: int """The number of items to fetch. Defaults to 20.""" - status: Optional[List[Literal["draft", "issued", "paid", "synced", "void"]]] + status: Optional[Literal["draft", "issued", "paid", "synced", "void"]] subscription_id: Optional[str] diff --git a/tests/api_resources/customers/test_credits.py b/tests/api_resources/customers/test_credits.py index 90d60907..20303c88 100644 --- a/tests/api_resources/customers/test_credits.py +++ b/tests/api_resources/customers/test_credits.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 import ( @@ -34,6 +35,10 @@ def test_method_list_with_all_params(self, client: Orb) -> None: customer_id="customer_id", currency="currency", cursor="cursor", + effective_date_gt=parse_datetime("2019-12-27T18:11:19.117Z"), + effective_date_gte=parse_datetime("2019-12-27T18:11:19.117Z"), + effective_date_lt=parse_datetime("2019-12-27T18:11:19.117Z"), + effective_date_lte=parse_datetime("2019-12-27T18:11:19.117Z"), include_all_blocks=True, limit=1, ) @@ -83,6 +88,10 @@ def test_method_list_by_external_id_with_all_params(self, client: Orb) -> None: external_customer_id="external_customer_id", currency="currency", cursor="cursor", + effective_date_gt=parse_datetime("2019-12-27T18:11:19.117Z"), + effective_date_gte=parse_datetime("2019-12-27T18:11:19.117Z"), + effective_date_lt=parse_datetime("2019-12-27T18:11:19.117Z"), + effective_date_lte=parse_datetime("2019-12-27T18:11:19.117Z"), include_all_blocks=True, limit=1, ) @@ -138,6 +147,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None customer_id="customer_id", currency="currency", cursor="cursor", + effective_date_gt=parse_datetime("2019-12-27T18:11:19.117Z"), + effective_date_gte=parse_datetime("2019-12-27T18:11:19.117Z"), + effective_date_lt=parse_datetime("2019-12-27T18:11:19.117Z"), + effective_date_lte=parse_datetime("2019-12-27T18:11:19.117Z"), include_all_blocks=True, limit=1, ) @@ -187,6 +200,10 @@ async def test_method_list_by_external_id_with_all_params(self, async_client: As external_customer_id="external_customer_id", currency="currency", cursor="cursor", + effective_date_gt=parse_datetime("2019-12-27T18:11:19.117Z"), + effective_date_gte=parse_datetime("2019-12-27T18:11:19.117Z"), + effective_date_lt=parse_datetime("2019-12-27T18:11:19.117Z"), + effective_date_lte=parse_datetime("2019-12-27T18:11:19.117Z"), include_all_blocks=True, limit=1, ) diff --git a/tests/api_resources/test_invoices.py b/tests/api_resources/test_invoices.py index 423bfc3b..38ef17ea 100644 --- a/tests/api_resources/test_invoices.py +++ b/tests/api_resources/test_invoices.py @@ -419,7 +419,7 @@ def test_method_list_summary_with_all_params(self, client: Orb) -> None: invoice_date_lte=parse_datetime("2019-12-27T18:11:19.117Z"), is_recurring=True, limit=1, - status=["draft"], + status="draft", subscription_id="subscription_id", ) assert_matches_type(SyncPage[InvoiceListSummaryResponse], invoice, path=["response"]) @@ -974,7 +974,7 @@ async def test_method_list_summary_with_all_params(self, async_client: AsyncOrb) invoice_date_lte=parse_datetime("2019-12-27T18:11:19.117Z"), is_recurring=True, limit=1, - status=["draft"], + status="draft", subscription_id="subscription_id", ) assert_matches_type(AsyncPage[InvoiceListSummaryResponse], invoice, path=["response"])