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.11.1"
".": "4.12.0"
}
6 changes: 3 additions & 3 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-4f31d46f5ba187fc4d702c9f9f1573dacb891edbd086f935707578d7c4f5fed8.yml
openapi_spec_hash: 25b1019f20a47b8af665aae5f8fd0025
config_hash: d8a0d696f3250ab096fac87b6b0eab53
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-6b2550b95f82872b3825619c109352352b9c92281c8b2470fce158e971142881.yml
openapi_spec_hash: 379df18de1af6a9d0b50d3653aab4d44
config_hash: 1f73a949b649ecfe6ec68ba1bb459dc2
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## 4.12.0 (2025-09-03)

Full Changelog: [v4.11.1...v4.12.0](https://github.com/orbcorp/orb-python/compare/v4.11.1...v4.12.0)

### ⚠ BREAKING CHANGES

* **api:** define shared model ConversionRateConfig

### Features

* **api:** api update ([9f4c932](https://github.com/orbcorp/orb-python/commit/9f4c9321d5fd23eafbca5a91411976d1ea73fc1c))
* **api:** define shared model ConversionRateConfig ([fe3cedb](https://github.com/orbcorp/orb-python/commit/fe3cedb638aeda208d325e7ea78d7db90f596857))
* extract minimum composite to type ([4dba245](https://github.com/orbcorp/orb-python/commit/4dba2455ca1d390b7079a462cc03dddc2ce89b01))
* **types:** replace List[str] with SequenceNotStr in params ([7a4eb7b](https://github.com/orbcorp/orb-python/commit/7a4eb7bcce5a2db055a7bfa27b074311c310aecc))


### Chores

* **internal:** add Sequence related utils ([8427f8a](https://github.com/orbcorp/orb-python/commit/8427f8ae3bb00a9af89dd42b5c70479452350070))
* **internal:** codegen related update ([4a2abd9](https://github.com/orbcorp/orb-python/commit/4a2abd95d4b6771171ca0f7de99a390c8b268dd9))

## 4.11.1 (2025-08-29)

Full Changelog: [v4.11.0...v4.11.1](https://github.com/orbcorp/orb-python/compare/v4.11.0...v4.11.1)
Expand Down
17 changes: 3 additions & 14 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ from orb.types import (
BillingCycleAnchorConfiguration,
BillingCycleConfiguration,
BillingCycleRelativeDate,
BPSConfig,
BPSTier,
BulkBPSConfig,
BulkBPSTier,
BulkConfig,
BulkTier,
ChangedSubscriptionResources,
Expand Down Expand Up @@ -53,8 +49,6 @@ from orb.types import (
NewAmountDiscount,
NewBillingCycleConfiguration,
NewDimensionalPriceConfiguration,
NewFloatingBPSPrice,
NewFloatingBulkBPSPrice,
NewFloatingBulkPrice,
NewFloatingBulkWithProrationPrice,
NewFloatingCumulativeGroupedBulkPrice,
Expand All @@ -67,12 +61,12 @@ from orb.types import (
NewFloatingMatrixWithAllocationPrice,
NewFloatingMatrixWithDisplayNamePrice,
NewFloatingMaxGroupTieredPackagePrice,
NewFloatingMinimumCompositePrice,
NewFloatingPackagePrice,
NewFloatingPackageWithAllocationPrice,
NewFloatingScalableMatrixWithTieredPricingPrice,
NewFloatingScalableMatrixWithUnitPricingPrice,
NewFloatingThresholdTotalAmountPrice,
NewFloatingTieredBPSPrice,
NewFloatingTieredPackagePrice,
NewFloatingTieredPackageWithMinimumPrice,
NewFloatingTieredPrice,
Expand All @@ -84,8 +78,6 @@ from orb.types import (
NewMaximum,
NewMinimum,
NewPercentageDiscount,
NewPlanBPSPrice,
NewPlanBulkBPSPrice,
NewPlanBulkPrice,
NewPlanBulkWithProrationPrice,
NewPlanCumulativeGroupedBulkPrice,
Expand All @@ -98,13 +90,13 @@ from orb.types import (
NewPlanMatrixWithAllocationPrice,
NewPlanMatrixWithDisplayNamePrice,
NewPlanMaxGroupTieredPackagePrice,
NewPlanMinimumCompositePrice,
NewPlanPackagePrice,
NewPlanPackageWithAllocationPrice,
NewPlanScalableMatrixWithTieredPricingPrice,
NewPlanScalableMatrixWithUnitPricingPrice,
NewPlanThresholdTotalAmountPrice,
NewPlanTierWithProrationPrice,
NewPlanTieredBPSPrice,
NewPlanTieredPackagePrice,
NewPlanTieredPackageWithMinimumPrice,
NewPlanTieredPrice,
Expand Down Expand Up @@ -135,7 +127,6 @@ from orb.types import (
Tier,
TierConfig,
TierSubLineItem,
TieredBPSConfig,
TieredConfig,
TieredConversionRateConfig,
TransformPriceFilter,
Expand Down Expand Up @@ -506,8 +497,6 @@ Types:
```python
from orb.types import (
DiscountOverride,
NewSubscriptionBPSPrice,
NewSubscriptionBulkBPSPrice,
NewSubscriptionBulkPrice,
NewSubscriptionBulkWithProrationPrice,
NewSubscriptionCumulativeGroupedBulkPrice,
Expand All @@ -520,13 +509,13 @@ from orb.types import (
NewSubscriptionMatrixWithAllocationPrice,
NewSubscriptionMatrixWithDisplayNamePrice,
NewSubscriptionMaxGroupTieredPackagePrice,
NewSubscriptionMinimumCompositePrice,
NewSubscriptionPackagePrice,
NewSubscriptionPackageWithAllocationPrice,
NewSubscriptionScalableMatrixWithTieredPricingPrice,
NewSubscriptionScalableMatrixWithUnitPricingPrice,
NewSubscriptionThresholdTotalAmountPrice,
NewSubscriptionTierWithProrationPrice,
NewSubscriptionTieredBPSPrice,
NewSubscriptionTieredPackagePrice,
NewSubscriptionTieredPackageWithMinimumPrice,
NewSubscriptionTieredPrice,
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.11.1"
version = "4.12.0"
description = "The official Python library for the orb API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
36 changes: 35 additions & 1 deletion src/orb/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,21 @@
Mapping,
TypeVar,
Callable,
Iterator,
Optional,
Sequence,
)
from typing_extensions import Set, Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable
from typing_extensions import (
Set,
Literal,
Protocol,
TypeAlias,
TypedDict,
SupportsIndex,
overload,
override,
runtime_checkable,
)

import httpx
import pydantic
Expand Down Expand Up @@ -219,3 +230,26 @@ class _GenericAlias(Protocol):
class HttpxSendArgs(TypedDict, total=False):
auth: httpx.Auth
follow_redirects: bool


_T_co = TypeVar("_T_co", covariant=True)


if TYPE_CHECKING:
# This works because str.__contains__ does not accept object (either in typeshed or at runtime)
# https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285
class SequenceNotStr(Protocol[_T_co]):
@overload
def __getitem__(self, index: SupportsIndex, /) -> _T_co: ...
@overload
def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ...
def __contains__(self, value: object, /) -> bool: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T_co]: ...
def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ...
def count(self, value: Any, /) -> int: ...
def __reversed__(self) -> Iterator[_T_co]: ...
else:
# just point this to a normal `Sequence` at runtime to avoid having to special case
# deserializing our custom sequence type
SequenceNotStr = Sequence
1 change: 1 addition & 0 deletions src/orb/_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
extract_type_arg as extract_type_arg,
is_iterable_type as is_iterable_type,
is_required_type as is_required_type,
is_sequence_type as is_sequence_type,
is_annotated_type as is_annotated_type,
is_type_alias_type as is_type_alias_type,
strip_annotated_type as strip_annotated_type,
Expand Down
6 changes: 6 additions & 0 deletions src/orb/_utils/_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
lru_cache,
is_mapping,
is_iterable,
is_sequence,
)
from .._files import is_base64_file_input
from ._typing import (
Expand All @@ -24,6 +25,7 @@
extract_type_arg,
is_iterable_type,
is_required_type,
is_sequence_type,
is_annotated_type,
strip_annotated_type,
)
Expand Down Expand Up @@ -184,6 +186,8 @@ def _transform_recursive(
(is_list_type(stripped_type) and is_list(data))
# Iterable[T]
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
# Sequence[T]
or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
):
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
# intended as an iterable, so we don't transform it.
Expand Down Expand Up @@ -346,6 +350,8 @@ async def _async_transform_recursive(
(is_list_type(stripped_type) and is_list(data))
# Iterable[T]
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
# Sequence[T]
or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
):
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
# intended as an iterable, so we don't transform it.
Expand Down
5 changes: 5 additions & 0 deletions src/orb/_utils/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ def is_list_type(typ: type) -> bool:
return (get_origin(typ) or typ) == list


def is_sequence_type(typ: type) -> bool:
origin = get_origin(typ) or typ
return origin == typing_extensions.Sequence or origin == typing.Sequence or origin == _c_abc.Sequence


def is_iterable_type(typ: type) -> bool:
"""If the given type is `typing.Iterable[T]`"""
origin = get_origin(typ) or typ
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.11.1" # x-release-please-version
__version__ = "4.12.0" # x-release-please-version
4 changes: 2 additions & 2 deletions src/orb/resources/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def list(
The request must specify one of `customer_id`, `external_customer_id`, or
`subscription_id`.

If querying by subscripion_id, the endpoint will return the subscription level
If querying by subscription_id, the endpoint will return the subscription level
alerts as well as the plan level alerts associated with the subscription.

The list of alerts is ordered starting from the most recently created alert.
Expand Down Expand Up @@ -630,7 +630,7 @@ def list(
The request must specify one of `customer_id`, `external_customer_id`, or
`subscription_id`.

If querying by subscripion_id, the endpoint will return the subscription level
If querying by subscription_id, the endpoint will return the subscription level
alerts as well as the plan level alerts associated with the subscription.

The list of alerts is ordered starting from the most recently created alert.
Expand Down
8 changes: 4 additions & 4 deletions src/orb/resources/customers/credits/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def list(
Note that for this entry type, `starting_balance` will equal `ending_balance`,
and the `amount` represents the balance transferred. The credit block linked to
the ledger entry is the source credit block from which there was an expiration
change
change.

## Credits expiry

Expand Down Expand Up @@ -2088,7 +2088,7 @@ def list_by_external_id(
Note that for this entry type, `starting_balance` will equal `ending_balance`,
and the `amount` represents the balance transferred. The credit block linked to
the ledger entry is the source credit block from which there was an expiration
change
change.

## Credits expiry

Expand Down Expand Up @@ -2273,7 +2273,7 @@ def list(
Note that for this entry type, `starting_balance` will equal `ending_balance`,
and the `amount` represents the balance transferred. The credit block linked to
the ledger entry is the source credit block from which there was an expiration
change
change.

## Credits expiry

Expand Down Expand Up @@ -4219,7 +4219,7 @@ def list_by_external_id(
Note that for this entry type, `starting_balance` will equal `ending_balance`,
and the `amount` represents the balance transferred. The credit block linked to
the ledger entry is the source credit block from which there was an expiration
change
change.

## Credits expiry

Expand Down
Loading