Skip to content

release: 3.1.0 #523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 9, 2025
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 @@
{
".": "3.0.0"
".": "3.1.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 103
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-0dbb8ba730f755468357ebda41332664e8396faf29a6a6a64ad37cf35cf70d0c.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-43a4d1d907fd25faa99fef58ba7afb3dd39fae36f955b29bfe27b4bfdaa0ee54.yml
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 3.1.0 (2025-02-07)

Full Changelog: [v3.0.0...v3.1.0](https://github.com/orbcorp/orb-python/compare/v3.0.0...v3.1.0)

### Features

* **api:** api update ([#526](https://github.com/orbcorp/orb-python/issues/526)) ([8cd8251](https://github.com/orbcorp/orb-python/commit/8cd82517459b39259d4551ce972c0b1ba2096586))
* **client:** send `X-Stainless-Read-Timeout` header ([#522](https://github.com/orbcorp/orb-python/issues/522)) ([0ddac77](https://github.com/orbcorp/orb-python/commit/0ddac777a1d37ef24b57c95a9f5db00db2c67674))


### Chores

* **internal:** fix type traversing dictionary params ([#524](https://github.com/orbcorp/orb-python/issues/524)) ([23de87d](https://github.com/orbcorp/orb-python/commit/23de87d4360b0159a279697b2e8cf9015b7d434b))
* **internal:** minor type handling changes ([#525](https://github.com/orbcorp/orb-python/issues/525)) ([67a742b](https://github.com/orbcorp/orb-python/commit/67a742b9f14b924a84709174512ca2b0a58a1d0b))

## 3.0.0 (2025-02-04)

Full Changelog: [v2.26.0...v3.0.0](https://github.com/orbcorp/orb-python/compare/v2.26.0...v3.0.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 = "3.0.0"
version = "3.1.0"
description = "The official Python library for the orb API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
11 changes: 9 additions & 2 deletions src/orb/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,17 @@ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0
if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers:
headers[idempotency_header] = options.idempotency_key or self._idempotency_key()

# Don't set the retry count header if it was already set or removed by the caller. We check
# Don't set these headers if they were already set or removed by the caller. We check
# `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case.
if "x-stainless-retry-count" not in (header.lower() for header in custom_headers):
lower_custom_headers = [header.lower() for header in custom_headers]
if "x-stainless-retry-count" not in lower_custom_headers:
headers["x-stainless-retry-count"] = str(retries_taken)
if "x-stainless-read-timeout" not in lower_custom_headers:
timeout = self.timeout if isinstance(options.timeout, NotGiven) else options.timeout
if isinstance(timeout, Timeout):
timeout = timeout.read
if timeout is not None:
headers["x-stainless-read-timeout"] = str(timeout)

return headers

Expand Down
8 changes: 7 additions & 1 deletion src/orb/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,16 @@ def construct_type(*, value: object, type_: object) -> object:

If the given value does not match the expected type then it is returned as-is.
"""

# store a reference to the original type we were given before we extract any inner
# types so that we can properly resolve forward references in `TypeAliasType` annotations
original_type = None

# we allow `object` as the input type because otherwise, passing things like
# `Literal['value']` will be reported as a type error by type checkers
type_ = cast("type[object]", type_)
if is_type_alias_type(type_):
original_type = type_ # type: ignore[unreachable]
type_ = type_.__value__ # type: ignore[unreachable]

# unwrap `Annotated[T, ...]` -> `T`
Expand All @@ -446,7 +452,7 @@ def construct_type(*, value: object, type_: object) -> object:

if is_union(origin):
try:
return validate_type(type_=cast("type[object]", type_), value=value)
return validate_type(type_=cast("type[object]", original_type or type_), value=value)
except Exception:
pass

Expand Down
12 changes: 11 additions & 1 deletion src/orb/_utils/_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
is_annotated_type,
strip_annotated_type,
)
from .._compat import model_dump, is_typeddict
from .._compat import get_origin, model_dump, is_typeddict

_T = TypeVar("_T")

Expand Down Expand Up @@ -164,9 +164,14 @@ def _transform_recursive(
inner_type = annotation

stripped_type = strip_annotated_type(inner_type)
origin = get_origin(stripped_type) or stripped_type
if is_typeddict(stripped_type) and is_mapping(data):
return _transform_typeddict(data, stripped_type)

if origin == dict and is_mapping(data):
items_type = get_args(stripped_type)[1]
return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()}

if (
# List[T]
(is_list_type(stripped_type) and is_list(data))
Expand Down Expand Up @@ -307,9 +312,14 @@ async def _async_transform_recursive(
inner_type = annotation

stripped_type = strip_annotated_type(inner_type)
origin = get_origin(stripped_type) or stripped_type
if is_typeddict(stripped_type) and is_mapping(data):
return await _async_transform_typeddict(data, stripped_type)

if origin == dict and is_mapping(data):
items_type = get_args(stripped_type)[1]
return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()}

if (
# List[T]
(is_list_type(stripped_type) and is_list(data))
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__ = "3.0.0" # x-release-please-version
__version__ = "3.1.0" # x-release-please-version
7 changes: 7 additions & 0 deletions src/orb/types/events/backfill_close_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ class BackfillCloseResponse(BaseModel):
events_ingested: int
"""The number of events ingested in this backfill."""

replace_existing_events: bool
"""
If `true`, existing events in the backfill's timeframe will be replaced with the
newly ingested events associated with the backfill. If `false`, newly ingested
events will be added to the existing events.
"""

reverted_at: Optional[datetime] = None
"""The time at which this backfill was reverted."""

Expand Down
7 changes: 7 additions & 0 deletions src/orb/types/events/backfill_create_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ class BackfillCreateResponse(BaseModel):
events_ingested: int
"""The number of events ingested in this backfill."""

replace_existing_events: bool
"""
If `true`, existing events in the backfill's timeframe will be replaced with the
newly ingested events associated with the backfill. If `false`, newly ingested
events will be added to the existing events.
"""

reverted_at: Optional[datetime] = None
"""The time at which this backfill was reverted."""

Expand Down
7 changes: 7 additions & 0 deletions src/orb/types/events/backfill_fetch_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ class BackfillFetchResponse(BaseModel):
events_ingested: int
"""The number of events ingested in this backfill."""

replace_existing_events: bool
"""
If `true`, existing events in the backfill's timeframe will be replaced with the
newly ingested events associated with the backfill. If `false`, newly ingested
events will be added to the existing events.
"""

reverted_at: Optional[datetime] = None
"""The time at which this backfill was reverted."""

Expand Down
7 changes: 7 additions & 0 deletions src/orb/types/events/backfill_list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ class BackfillListResponse(BaseModel):
events_ingested: int
"""The number of events ingested in this backfill."""

replace_existing_events: bool
"""
If `true`, existing events in the backfill's timeframe will be replaced with the
newly ingested events associated with the backfill. If `false`, newly ingested
events will be added to the existing events.
"""

reverted_at: Optional[datetime] = None
"""The time at which this backfill was reverted."""

Expand Down
7 changes: 7 additions & 0 deletions src/orb/types/events/backfill_revert_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ class BackfillRevertResponse(BaseModel):
events_ingested: int
"""The number of events ingested in this backfill."""

replace_existing_events: bool
"""
If `true`, existing events in the backfill's timeframe will be replaced with the
newly ingested events associated with the backfill. If `false`, newly ingested
events will be added to the existing events.
"""

reverted_at: Optional[datetime] = None
"""The time at which this backfill was reverted."""

Expand Down
Loading