Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.24.0"
".": "4.25.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/orb/_version.py
Original file line number Diff line number Diff line change
@@ -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
68 changes: 56 additions & 12 deletions src/orb/resources/invoice_line_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -62,20 +63,40 @@ 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.

end_date: A date string to specify the line item's end date in the customer's timezone.

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
Expand All @@ -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,
),
Expand Down Expand Up @@ -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,
Expand All @@ -152,20 +175,40 @@ 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.

end_date: A date string to specify the line item's end date in the customer's timezone.

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
Expand All @@ -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,
),
Expand Down
27 changes: 19 additions & 8 deletions src/orb/types/invoice_line_item_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
"""
32 changes: 26 additions & 6 deletions tests/api_resources/test_invoice_line_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
)
Expand All @@ -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:
Expand All @@ -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"),
)
Expand All @@ -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:
Expand Down