diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0f2463a3..141929c0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.24.0" + ".": "4.25.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 3407ffd1..32f63a30 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 118 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-b070c1d97a6e3b400f43d2bce36c22ed89d432345b26374728c55dd0a20f0afa.yml -openapi_spec_hash: dba4ff52c381cda6159fc56d8b77eb32 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-15e42bc01739abea4a925894a1a7de447de40b003a3433461952e8e06919588b.yml +openapi_spec_hash: 8a0bc5b6ab417f7256cbf83d70c459a3 config_hash: 1f73a949b649ecfe6ec68ba1bb459dc2 diff --git a/CHANGELOG.md b/CHANGELOG.md index fbc972bc..0527471b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.25.0 (2025-10-10) + +Full Changelog: [v4.24.0...v4.25.0](https://github.com/orbcorp/orb-python/compare/v4.24.0...v4.25.0) + +### Features + +* **api:** api update ([266c259](https://github.com/orbcorp/orb-python/commit/266c25947607ca8f83228cd6170274c141af3f99)) + ## 4.24.0 (2025-10-07) Full Changelog: [v4.23.0...v4.24.0](https://github.com/orbcorp/orb-python/compare/v4.23.0...v4.24.0) diff --git a/pyproject.toml b/pyproject.toml index c142c0d8..124ef966 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "orb-billing" -version = "4.24.0" +version = "4.25.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 975c0923..205196a3 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.24.0" # x-release-please-version +__version__ = "4.25.0" # x-release-please-version diff --git a/src/orb/resources/invoice_line_items.py b/src/orb/resources/invoice_line_items.py index cc97c45b..0bc3c106 100644 --- a/src/orb/resources/invoice_line_items.py +++ b/src/orb/resources/invoice_line_items.py @@ -2,14 +2,14 @@ from __future__ import annotations -from typing import Union +from typing import Union, Optional from datetime import date import httpx from .. import _legacy_response from ..types import invoice_line_item_create_params -from .._types import Body, Query, Headers, NotGiven, not_given +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -46,9 +46,10 @@ def create( amount: str, end_date: Union[str, date], invoice_id: str, - name: str, quantity: float, start_date: Union[str, date], + item_id: Optional[str] | Omit = omit, + name: 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. extra_headers: Headers | None = None, @@ -62,6 +63,17 @@ def create( This can only be done for invoices that are in a `draft` status. + The behavior depends on which parameters are provided: + + - If `item_id` is provided without `name`: The item is looked up by ID, and the + item's name is used for the line item. + - If `name` is provided without `item_id`: An item with the given name is + searched for in the account. If found, that item is used. If not found, a new + item is created with that name. The new item's name is used for the line item. + - If both `item_id` and `name` are provided: The item is looked up by ID for + association, but the provided `name` is used for the line item (not the item's + name). + Args: amount: The total amount in the invoice's currency to add to the line item. @@ -69,13 +81,22 @@ def create( invoice_id: The id of the Invoice to add this line item. - name: The item name associated with this line item. If an item with the same name - exists in Orb, that item will be associated with the line item. - quantity: The number of units on the line item start_date: A date string to specify the line item's start date in the customer's timezone. + item_id: The id of the item to associate with this line item. If provided without `name`, + the item's name will be used for the price/line item. If provided with `name`, + the item will be associated but `name` will be used for the line item. At least + one of `name` or `item_id` must be provided. + + name: The name to use for the line item. If `item_id` is not provided, Orb will search + for an item with this name. If found, that item will be associated with the line + item. If not found, a new item will be created with this name. If `item_id` is + provided, this name will be used for the line item, but the item association + will be based on `item_id`. At least one of `name` or `item_id` must be + provided. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -93,9 +114,10 @@ def create( "amount": amount, "end_date": end_date, "invoice_id": invoice_id, - "name": name, "quantity": quantity, "start_date": start_date, + "item_id": item_id, + "name": name, }, invoice_line_item_create_params.InvoiceLineItemCreateParams, ), @@ -136,9 +158,10 @@ async def create( amount: str, end_date: Union[str, date], invoice_id: str, - name: str, quantity: float, start_date: Union[str, date], + item_id: Optional[str] | Omit = omit, + name: 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. extra_headers: Headers | None = None, @@ -152,6 +175,17 @@ async def create( This can only be done for invoices that are in a `draft` status. + The behavior depends on which parameters are provided: + + - If `item_id` is provided without `name`: The item is looked up by ID, and the + item's name is used for the line item. + - If `name` is provided without `item_id`: An item with the given name is + searched for in the account. If found, that item is used. If not found, a new + item is created with that name. The new item's name is used for the line item. + - If both `item_id` and `name` are provided: The item is looked up by ID for + association, but the provided `name` is used for the line item (not the item's + name). + Args: amount: The total amount in the invoice's currency to add to the line item. @@ -159,13 +193,22 @@ async def create( invoice_id: The id of the Invoice to add this line item. - name: The item name associated with this line item. If an item with the same name - exists in Orb, that item will be associated with the line item. - quantity: The number of units on the line item start_date: A date string to specify the line item's start date in the customer's timezone. + item_id: The id of the item to associate with this line item. If provided without `name`, + the item's name will be used for the price/line item. If provided with `name`, + the item will be associated but `name` will be used for the line item. At least + one of `name` or `item_id` must be provided. + + name: The name to use for the line item. If `item_id` is not provided, Orb will search + for an item with this name. If found, that item will be associated with the line + item. If not found, a new item will be created with this name. If `item_id` is + provided, this name will be used for the line item, but the item association + will be based on `item_id`. At least one of `name` or `item_id` must be + provided. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -183,9 +226,10 @@ async def create( "amount": amount, "end_date": end_date, "invoice_id": invoice_id, - "name": name, "quantity": quantity, "start_date": start_date, + "item_id": item_id, + "name": name, }, invoice_line_item_create_params.InvoiceLineItemCreateParams, ), diff --git a/src/orb/types/invoice_line_item_create_params.py b/src/orb/types/invoice_line_item_create_params.py index 03016bfd..a633cc1e 100644 --- a/src/orb/types/invoice_line_item_create_params.py +++ b/src/orb/types/invoice_line_item_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union +from typing import Union, Optional from datetime import date from typing_extensions import Required, Annotated, TypedDict @@ -21,15 +21,26 @@ class InvoiceLineItemCreateParams(TypedDict, total=False): invoice_id: Required[str] """The id of the Invoice to add this line item.""" - name: Required[str] - """The item name associated with this line item. - - If an item with the same name exists in Orb, that item will be associated with - the line item. - """ - quantity: Required[float] """The number of units on the line item""" start_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] """A date string to specify the line item's start date in the customer's timezone.""" + + item_id: Optional[str] + """The id of the item to associate with this line item. + + If provided without `name`, the item's name will be used for the price/line + item. If provided with `name`, the item will be associated but `name` will be + used for the line item. At least one of `name` or `item_id` must be provided. + """ + + name: Optional[str] + """The name to use for the line item. + + If `item_id` is not provided, Orb will search for an item with this name. If + found, that item will be associated with the line item. If not found, a new item + will be created with this name. If `item_id` is provided, this name will be used + for the line item, but the item association will be based on `item_id`. At least + one of `name` or `item_id` must be provided. + """ diff --git a/tests/api_resources/test_invoice_line_items.py b/tests/api_resources/test_invoice_line_items.py index 0c9c4ab8..4cf8e001 100644 --- a/tests/api_resources/test_invoice_line_items.py +++ b/tests/api_resources/test_invoice_line_items.py @@ -24,19 +24,30 @@ def test_method_create(self, client: Orb) -> None: amount="12.00", end_date=parse_date("2023-09-22"), invoice_id="4khy3nwzktxv7", - name="Item Name", quantity=1, start_date=parse_date("2023-09-22"), ) assert_matches_type(InvoiceLineItemCreateResponse, invoice_line_item, path=["response"]) + @parametrize + def test_method_create_with_all_params(self, client: Orb) -> None: + invoice_line_item = client.invoice_line_items.create( + amount="12.00", + end_date=parse_date("2023-09-22"), + invoice_id="4khy3nwzktxv7", + quantity=1, + start_date=parse_date("2023-09-22"), + item_id="4khy3nwzktxv7", + name="Item Name", + ) + assert_matches_type(InvoiceLineItemCreateResponse, invoice_line_item, path=["response"]) + @parametrize def test_raw_response_create(self, client: Orb) -> None: response = client.invoice_line_items.with_raw_response.create( amount="12.00", end_date=parse_date("2023-09-22"), invoice_id="4khy3nwzktxv7", - name="Item Name", quantity=1, start_date=parse_date("2023-09-22"), ) @@ -52,7 +63,6 @@ def test_streaming_response_create(self, client: Orb) -> None: amount="12.00", end_date=parse_date("2023-09-22"), invoice_id="4khy3nwzktxv7", - name="Item Name", quantity=1, start_date=parse_date("2023-09-22"), ) as response: @@ -76,19 +86,30 @@ async def test_method_create(self, async_client: AsyncOrb) -> None: amount="12.00", end_date=parse_date("2023-09-22"), invoice_id="4khy3nwzktxv7", - name="Item Name", quantity=1, start_date=parse_date("2023-09-22"), ) assert_matches_type(InvoiceLineItemCreateResponse, invoice_line_item, path=["response"]) + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> None: + invoice_line_item = await async_client.invoice_line_items.create( + amount="12.00", + end_date=parse_date("2023-09-22"), + invoice_id="4khy3nwzktxv7", + quantity=1, + start_date=parse_date("2023-09-22"), + item_id="4khy3nwzktxv7", + name="Item Name", + ) + assert_matches_type(InvoiceLineItemCreateResponse, invoice_line_item, path=["response"]) + @parametrize async def test_raw_response_create(self, async_client: AsyncOrb) -> None: response = await async_client.invoice_line_items.with_raw_response.create( amount="12.00", end_date=parse_date("2023-09-22"), invoice_id="4khy3nwzktxv7", - name="Item Name", quantity=1, start_date=parse_date("2023-09-22"), ) @@ -104,7 +125,6 @@ async def test_streaming_response_create(self, async_client: AsyncOrb) -> None: amount="12.00", end_date=parse_date("2023-09-22"), invoice_id="4khy3nwzktxv7", - name="Item Name", quantity=1, start_date=parse_date("2023-09-22"), ) as response: