From 5f0ffd1bd6084e314a8080078bca2b50d15afdd5 Mon Sep 17 00:00:00 2001 From: "onepin-pipeline-bot[bot]" <290953255+onepin-pipeline-bot[bot]@users.noreply.github.com> Date: Wed, 1 Jul 2026 03:05:07 +0000 Subject: [PATCH] feat: sync SDK to OnePin API v0.41.10 --- .spec-sha | 2 +- src/onepin/.fern/metadata.json | 2 +- src/onepin/client.py | 20 +++++++++++++++++ src/onepin/core/client_wrapper.py | 32 +++++++++++++++++++++++++-- src/onepin/core/http_sse/_api.py | 14 ++++++++++-- src/onepin/core/request_options.py | 2 ++ src/onepin/providers/client.py | 14 +++++++----- src/onepin/providers/raw_client.py | 14 +++++++----- src/onepin/reference.md | 7 +++--- src/onepin/types/node_type.py | 1 + src/onepin/types/voice_out.py | 2 +- src/onepin/types/voice_similar_out.py | 2 +- 12 files changed, 89 insertions(+), 23 deletions(-) diff --git a/.spec-sha b/.spec-sha index 3b27483..0c30210 100644 --- a/.spec-sha +++ b/.spec-sha @@ -1 +1 @@ -8f933ed904093dc331cc8d2a8bc9c6cf4ac5e03b +d5f013e70d4328c7c69b14d933b6db8b77fb41c9 diff --git a/src/onepin/.fern/metadata.json b/src/onepin/.fern/metadata.json index 2e6b6c3..62a7592 100644 --- a/src/onepin/.fern/metadata.json +++ b/src/onepin/.fern/metadata.json @@ -17,7 +17,7 @@ } ] }, - "originGitCommit": "aa97888912968233d7b8278a5e028789d15ef281", + "originGitCommit": "9acc656075c4ab37342d99405b9e12debae3aa64", "originGitCommitIsDirty": false, "invokedBy": "ci", "ciProvider": "github" diff --git a/src/onepin/client.py b/src/onepin/client.py index 9fcc96a..c96f9ba 100644 --- a/src/onepin/client.py +++ b/src/onepin/client.py @@ -59,6 +59,12 @@ class OnePinClient: max_retries : typing.Optional[int] The default maximum number of retries for failed requests. Defaults to 2. Per-request `max_retries` in `request_options` takes precedence over this value. + stream_reconnection_enabled : typing.Optional[bool] + Whether to automatically reconnect on stream disconnection for resumable streaming endpoints. Defaults to True. Per-request `stream_reconnection_enabled` in `request_options` takes precedence over this value. + + max_stream_reconnection_attempts : typing.Optional[int] + The maximum number of reconnection attempts for resumable streaming endpoints. Defaults to no limit. Per-request `max_stream_reconnection_attempts` in `request_options` takes precedence over this value. + follow_redirects : typing.Optional[bool] Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in. @@ -86,6 +92,8 @@ def __init__( headers: typing.Optional[typing.Dict[str, str]] = None, timeout: typing.Optional[float] = None, max_retries: typing.Optional[int] = None, + stream_reconnection_enabled: typing.Optional[bool] = None, + max_stream_reconnection_attempts: typing.Optional[int] = None, follow_redirects: typing.Optional[bool] = True, httpx_client: typing.Optional[httpx.Client] = None, logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, @@ -105,6 +113,8 @@ def __init__( else httpx.Client(timeout=_defaulted_timeout), timeout=_defaulted_timeout, max_retries=_defaulted_max_retries, + stream_reconnection_enabled=stream_reconnection_enabled, + max_stream_reconnection_attempts=max_stream_reconnection_attempts, logging=logging, ) self._health: typing.Optional[HealthClient] = None @@ -329,6 +339,12 @@ class AsyncOnePinClient: max_retries : typing.Optional[int] The default maximum number of retries for failed requests. Defaults to 2. Per-request `max_retries` in `request_options` takes precedence over this value. + stream_reconnection_enabled : typing.Optional[bool] + Whether to automatically reconnect on stream disconnection for resumable streaming endpoints. Defaults to True. Per-request `stream_reconnection_enabled` in `request_options` takes precedence over this value. + + max_stream_reconnection_attempts : typing.Optional[int] + The maximum number of reconnection attempts for resumable streaming endpoints. Defaults to no limit. Per-request `max_stream_reconnection_attempts` in `request_options` takes precedence over this value. + follow_redirects : typing.Optional[bool] Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in. @@ -357,6 +373,8 @@ def __init__( async_token: typing.Optional[typing.Callable[[], typing.Awaitable[str]]] = None, timeout: typing.Optional[float] = None, max_retries: typing.Optional[int] = None, + stream_reconnection_enabled: typing.Optional[bool] = None, + max_stream_reconnection_attempts: typing.Optional[int] = None, follow_redirects: typing.Optional[bool] = True, httpx_client: typing.Optional[httpx.AsyncClient] = None, logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, @@ -375,6 +393,8 @@ def __init__( else _make_default_async_client(timeout=_defaulted_timeout, follow_redirects=follow_redirects), timeout=_defaulted_timeout, max_retries=_defaulted_max_retries, + stream_reconnection_enabled=stream_reconnection_enabled, + max_stream_reconnection_attempts=max_stream_reconnection_attempts, logging=logging, ) self._health: typing.Optional[AsyncHealthClient] = None diff --git a/src/onepin/core/client_wrapper.py b/src/onepin/core/client_wrapper.py index 82c42af..f88ecaa 100644 --- a/src/onepin/core/client_wrapper.py +++ b/src/onepin/core/client_wrapper.py @@ -16,6 +16,8 @@ def __init__( base_url: str, timeout: typing.Optional[float] = None, max_retries: int = 2, + stream_reconnection_enabled: typing.Optional[bool] = None, + max_stream_reconnection_attempts: typing.Optional[int] = None, logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, ): self._token = token @@ -23,6 +25,8 @@ def __init__( self._base_url = base_url self._timeout = timeout self._max_retries = max_retries + self._stream_reconnection_enabled = stream_reconnection_enabled + self._max_stream_reconnection_attempts = max_stream_reconnection_attempts self._logging = logging def get_headers(self) -> typing.Dict[str, str]: @@ -58,6 +62,12 @@ def get_timeout(self) -> typing.Optional[float]: def get_max_retries(self) -> int: return self._max_retries + def get_stream_reconnection_enabled(self) -> bool: + return self._stream_reconnection_enabled if self._stream_reconnection_enabled is not None else True + + def get_max_stream_reconnection_attempts(self) -> typing.Optional[int]: + return self._max_stream_reconnection_attempts + class SyncClientWrapper(BaseClientWrapper): def __init__( @@ -68,11 +78,20 @@ def __init__( base_url: str, timeout: typing.Optional[float] = None, max_retries: int = 2, + stream_reconnection_enabled: typing.Optional[bool] = None, + max_stream_reconnection_attempts: typing.Optional[int] = None, logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, httpx_client: httpx.Client, ): super().__init__( - token=token, headers=headers, base_url=base_url, timeout=timeout, max_retries=max_retries, logging=logging + token=token, + headers=headers, + base_url=base_url, + timeout=timeout, + max_retries=max_retries, + stream_reconnection_enabled=stream_reconnection_enabled, + max_stream_reconnection_attempts=max_stream_reconnection_attempts, + logging=logging, ) self.httpx_client = HttpClient( httpx_client=httpx_client, @@ -93,12 +112,21 @@ def __init__( base_url: str, timeout: typing.Optional[float] = None, max_retries: int = 2, + stream_reconnection_enabled: typing.Optional[bool] = None, + max_stream_reconnection_attempts: typing.Optional[int] = None, logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, async_token: typing.Optional[typing.Callable[[], typing.Awaitable[str]]] = None, httpx_client: httpx.AsyncClient, ): super().__init__( - token=token, headers=headers, base_url=base_url, timeout=timeout, max_retries=max_retries, logging=logging + token=token, + headers=headers, + base_url=base_url, + timeout=timeout, + max_retries=max_retries, + stream_reconnection_enabled=stream_reconnection_enabled, + max_stream_reconnection_attempts=max_stream_reconnection_attempts, + logging=logging, ) self._async_token = async_token self.httpx_client = AsyncHttpClient( diff --git a/src/onepin/core/http_sse/_api.py b/src/onepin/core/http_sse/_api.py index fd13730..192ec0d 100644 --- a/src/onepin/core/http_sse/_api.py +++ b/src/onepin/core/http_sse/_api.py @@ -3,7 +3,7 @@ import codecs import re from contextlib import asynccontextmanager, contextmanager -from typing import Any, AsyncGenerator, AsyncIterator, Iterator +from typing import Any, AsyncGenerator, AsyncIterator, Iterator, Optional import httpx from ._decoders import SSEDecoder @@ -14,8 +14,18 @@ class EventSource: - def __init__(self, response: httpx.Response) -> None: + def __init__( + self, + response: httpx.Response, + *, + resumable: bool = False, + stream_reconnection_enabled: bool = True, + max_stream_reconnection_attempts: Optional[int] = None, + ) -> None: self._response = response + self._resumable = resumable + self._stream_reconnection_enabled = stream_reconnection_enabled + self._max_stream_reconnection_attempts = max_stream_reconnection_attempts def _check_content_type(self) -> None: content_type = self._response.headers.get("content-type", "").partition(";")[0] diff --git a/src/onepin/core/request_options.py b/src/onepin/core/request_options.py index 1b38804..ebf17bc 100644 --- a/src/onepin/core/request_options.py +++ b/src/onepin/core/request_options.py @@ -33,3 +33,5 @@ class RequestOptions(typing.TypedDict, total=False): additional_query_parameters: NotRequired[typing.Dict[str, typing.Any]] additional_body_parameters: NotRequired[typing.Dict[str, typing.Any]] chunk_size: NotRequired[int] + stream_reconnection_enabled: NotRequired[bool] + max_stream_reconnection_attempts: NotRequired[int] diff --git a/src/onepin/providers/client.py b/src/onepin/providers/client.py index 1a1a7e2..c3ff01a 100644 --- a/src/onepin/providers/client.py +++ b/src/onepin/providers/client.py @@ -153,11 +153,12 @@ def list_catalog_provider_model_voices( request_options: typing.Optional[RequestOptions] = None, ) -> ApiCountedListResponseCatalogVoiceOut: """ - List platform voices catalogued under an exact `(provider, model)`. + List platform voices whose `supported_models` contains `model`. Lean voice shape with a presigned `preview_url`. Platform catalog voices only - (System workspace); model-less voices are excluded. Paginated via `offset` / - `limit`. The flat `/voices?provider=&model=` endpoint remains for the picker. + (System workspace); a voice surfaces under every model in its `supported_models` + array (JSONB `@>`), and voices with no models (NULL) surface under none. Paginated + via `offset` / `limit`. The flat `/voices?provider=&model=` endpoint remains for the picker. Parameters ---------- @@ -408,11 +409,12 @@ async def list_catalog_provider_model_voices( request_options: typing.Optional[RequestOptions] = None, ) -> ApiCountedListResponseCatalogVoiceOut: """ - List platform voices catalogued under an exact `(provider, model)`. + List platform voices whose `supported_models` contains `model`. Lean voice shape with a presigned `preview_url`. Platform catalog voices only - (System workspace); model-less voices are excluded. Paginated via `offset` / - `limit`. The flat `/voices?provider=&model=` endpoint remains for the picker. + (System workspace); a voice surfaces under every model in its `supported_models` + array (JSONB `@>`), and voices with no models (NULL) surface under none. Paginated + via `offset` / `limit`. The flat `/voices?provider=&model=` endpoint remains for the picker. Parameters ---------- diff --git a/src/onepin/providers/raw_client.py b/src/onepin/providers/raw_client.py index 933636a..494f4f6 100644 --- a/src/onepin/providers/raw_client.py +++ b/src/onepin/providers/raw_client.py @@ -242,11 +242,12 @@ def list_catalog_provider_model_voices( request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[ApiCountedListResponseCatalogVoiceOut]: """ - List platform voices catalogued under an exact `(provider, model)`. + List platform voices whose `supported_models` contains `model`. Lean voice shape with a presigned `preview_url`. Platform catalog voices only - (System workspace); model-less voices are excluded. Paginated via `offset` / - `limit`. The flat `/voices?provider=&model=` endpoint remains for the picker. + (System workspace); a voice surfaces under every model in its `supported_models` + array (JSONB `@>`), and voices with no models (NULL) surface under none. Paginated + via `offset` / `limit`. The flat `/voices?provider=&model=` endpoint remains for the picker. Parameters ---------- @@ -620,11 +621,12 @@ async def list_catalog_provider_model_voices( request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[ApiCountedListResponseCatalogVoiceOut]: """ - List platform voices catalogued under an exact `(provider, model)`. + List platform voices whose `supported_models` contains `model`. Lean voice shape with a presigned `preview_url`. Platform catalog voices only - (System workspace); model-less voices are excluded. Paginated via `offset` / - `limit`. The flat `/voices?provider=&model=` endpoint remains for the picker. + (System workspace); a voice surfaces under every model in its `supported_models` + array (JSONB `@>`), and voices with no models (NULL) surface under none. Paginated + via `offset` / `limit`. The flat `/voices?provider=&model=` endpoint remains for the picker. Parameters ---------- diff --git a/src/onepin/reference.md b/src/onepin/reference.md index ac55156..b82d6a9 100644 --- a/src/onepin/reference.md +++ b/src/onepin/reference.md @@ -2378,11 +2378,12 @@ client.providers.list_catalog_provider_models(
-List platform voices catalogued under an exact `(provider, model)`. +List platform voices whose `supported_models` contains `model`. Lean voice shape with a presigned `preview_url`. Platform catalog voices only -(System workspace); model-less voices are excluded. Paginated via `offset` / -`limit`. The flat `/voices?provider=&model=` endpoint remains for the picker. +(System workspace); a voice surfaces under every model in its `supported_models` +array (JSONB `@>`), and voices with no models (NULL) surface under none. Paginated +via `offset` / `limit`. The flat `/voices?provider=&model=` endpoint remains for the picker.
diff --git a/src/onepin/types/node_type.py b/src/onepin/types/node_type.py index 4794994..121623c 100644 --- a/src/onepin/types/node_type.py +++ b/src/onepin/types/node_type.py @@ -11,6 +11,7 @@ "sink_preview", "validator_error_rate", "validator_naturalness", + "validator_noise", ], typing.Any, ] diff --git a/src/onepin/types/voice_out.py b/src/onepin/types/voice_out.py index 23887a6..6116558 100644 --- a/src/onepin/types/voice_out.py +++ b/src/onepin/types/voice_out.py @@ -17,7 +17,6 @@ class VoiceOut(UniversalBaseModel): name: str provider: str provider_voice_id: str - model: typing.Optional[str] = None description: typing.Optional[str] = None is_active: bool gender: typing.Optional[VoiceGender] = None @@ -33,6 +32,7 @@ class VoiceOut(UniversalBaseModel): duration_seconds: typing.Optional[float] = None sample_url: typing.Optional[str] = None supported_languages: typing.Optional[typing.List[str]] = None + supported_models: typing.Optional[typing.List[str]] = None is_favorite: typing.Optional[bool] = None created_at: dt.datetime updated_at: dt.datetime diff --git a/src/onepin/types/voice_similar_out.py b/src/onepin/types/voice_similar_out.py index 87bbf1f..1da2553 100644 --- a/src/onepin/types/voice_similar_out.py +++ b/src/onepin/types/voice_similar_out.py @@ -17,7 +17,6 @@ class VoiceSimilarOut(UniversalBaseModel): name: str provider: str provider_voice_id: str - model: typing.Optional[str] = None description: typing.Optional[str] = None is_active: bool gender: typing.Optional[VoiceGender] = None @@ -33,6 +32,7 @@ class VoiceSimilarOut(UniversalBaseModel): duration_seconds: typing.Optional[float] = None sample_url: typing.Optional[str] = None supported_languages: typing.Optional[typing.List[str]] = None + supported_models: typing.Optional[typing.List[str]] = None is_favorite: typing.Optional[bool] = None created_at: dt.datetime updated_at: dt.datetime