From 75d9027a7d3c665dc26128b5d8fb70e24bb231f2 Mon Sep 17 00:00:00 2001 From: "onepin-pipeline-bot[bot]" <290953255+onepin-pipeline-bot[bot]@users.noreply.github.com> Date: Tue, 23 Jun 2026 05:39:43 +0000 Subject: [PATCH] feat: sync SDK to OnePin API v0.40.2 --- .spec-sha | 2 +- src/onepin/.fern/metadata.json | 2 +- src/onepin/__init__.py | 15 +- src/onepin/api_keys/raw_client.py | 49 ++- src/onepin/auth/raw_client.py | 9 +- src/onepin/billing/raw_client.py | 17 +- src/onepin/core/client_wrapper.py | 2 +- src/onepin/dictionary/raw_client.py | 57 ++- src/onepin/errors/__init__.py | 6 +- src/onepin/errors/bad_request_error.py | 11 + src/onepin/errors/forbidden_error.py | 11 + .../errors/unprocessable_entity_error.py | 3 +- src/onepin/nodes/raw_client.py | 17 +- src/onepin/provider_keys/raw_client.py | 25 +- src/onepin/providers/raw_client.py | 41 +- src/onepin/reference.md | 289 ++++++++++++- src/onepin/templates/raw_client.py | 73 ++-- src/onepin/types/__init__.py | 9 + .../api_response_slug_availability_out.py | 22 + .../email_notification_preferences_out.py | 3 +- src/onepin/types/runs_summary_out.py | 1 + src/onepin/types/slug_availability_out.py | 26 ++ .../types/slug_availability_out_reason.py | 5 + src/onepin/types/usage_runs_out.py | 1 + src/onepin/types/workflow_run_detail_out.py | 2 + src/onepin/types/workflow_run_list_item.py | 2 + src/onepin/types/workflow_run_out.py | 2 + src/onepin/types/workflow_run_status_out.py | 2 + src/onepin/types/workspace_runs_stats_out.py | 1 + .../types/workspace_workflows_stats_out.py | 15 +- src/onepin/uploads/raw_client.py | 25 +- src/onepin/usage/raw_client.py | 25 +- src/onepin/users/client.py | 20 +- src/onepin/users/raw_client.py | 141 +++--- src/onepin/voices/raw_client.py | 41 +- src/onepin/workflows/client.py | 209 ++++++++- src/onepin/workflows/raw_client.py | 406 +++++++++++++++--- src/onepin/workflows/runs/raw_client.py | 41 +- src/onepin/workspace/raw_client.py | 9 +- src/onepin/workspace_aggregates/raw_client.py | 17 +- src/onepin/workspace_members/raw_client.py | 57 ++- src/onepin/workspaces/client.py | 111 +++++ src/onepin/workspaces/raw_client.py | 309 ++++++++++++- 43 files changed, 1666 insertions(+), 465 deletions(-) create mode 100644 src/onepin/errors/bad_request_error.py create mode 100644 src/onepin/errors/forbidden_error.py create mode 100644 src/onepin/types/api_response_slug_availability_out.py create mode 100644 src/onepin/types/slug_availability_out.py create mode 100644 src/onepin/types/slug_availability_out_reason.py diff --git a/.spec-sha b/.spec-sha index 68677bc..81350ad 100644 --- a/.spec-sha +++ b/.spec-sha @@ -1 +1 @@ -22d7f164e18c741e9d6e2cba0f280a3a3af4d153 +6363a658f424759e28af8f8fc73ab0912d855c51 diff --git a/src/onepin/.fern/metadata.json b/src/onepin/.fern/metadata.json index 8c61ab7..30ebef7 100644 --- a/src/onepin/.fern/metadata.json +++ b/src/onepin/.fern/metadata.json @@ -17,7 +17,7 @@ } ] }, - "originGitCommit": "e61a07d289073104a086ed6aec6161a6169f829a", + "originGitCommit": "930bf67ab47aa5c39e42e042ccd13eb95aa1d11d", "originGitCommitIsDirty": false, "invokedBy": "ci", "ciProvider": "github" diff --git a/src/onepin/__init__.py b/src/onepin/__init__.py index 21a972c..b10060b 100644 --- a/src/onepin/__init__.py +++ b/src/onepin/__init__.py @@ -57,6 +57,7 @@ ApiResponseProviderKeysManifestOut, ApiResponseRunsSummaryOut, ApiResponseSetupIntentResponse, + ApiResponseSlugAvailabilityOut, ApiResponseTemplateEstimateResponse, ApiResponseTemplateOut, ApiResponseUnionCustomerSubscriptionResponseNoneType, @@ -134,6 +135,8 @@ ProviderKeysManifestOut, RunsSummaryOut, SetupIntentResponse, + SlugAvailabilityOut, + SlugAvailabilityOutReason, TemplateCategory, TemplateEstimateResponse, TemplateEstimateResponseCacheStatus, @@ -222,7 +225,7 @@ WorkspaceSettingsOut, WorkspaceWorkflowsStatsOut, ) - from .errors import ConflictError, NotFoundError, UnprocessableEntityError + from .errors import BadRequestError, ConflictError, ForbiddenError, NotFoundError, UnprocessableEntityError from . import ( api_keys, auth, @@ -325,6 +328,7 @@ "ApiResponseProviderKeysManifestOut": ".types", "ApiResponseRunsSummaryOut": ".types", "ApiResponseSetupIntentResponse": ".types", + "ApiResponseSlugAvailabilityOut": ".types", "ApiResponseTemplateEstimateResponse": ".types", "ApiResponseTemplateOut": ".types", "ApiResponseUnionCustomerSubscriptionResponseNoneType": ".types", @@ -346,6 +350,7 @@ "AsyncOnePinClient": ".client", "AuthWhoamiOut": ".types", "AuthWhoamiOutAuthKind": ".types", + "BadRequestError": ".errors", "BalanceResponse": ".types", "CatalogLink": ".types", "CatalogModelOut": ".types", @@ -367,6 +372,7 @@ "EnumOption": ".types", "EstimateResponse": ".types", "ExecutionDefinition": ".types", + "ForbiddenError": ".errors", "GraphDefinitionInput": ".types", "GraphDefinitionOutput": ".types", "GraphEdge": ".types", @@ -425,6 +431,8 @@ "SearchDictionaryEntriesApiV1DictionarySearchGetRequestOrder": ".dictionary", "SearchDictionaryEntriesApiV1DictionarySearchGetRequestSort": ".dictionary", "SetupIntentResponse": ".types", + "SlugAvailabilityOut": ".types", + "SlugAvailabilityOutReason": ".types", "TemplateCategory": ".types", "TemplateEstimateResponse": ".types", "TemplateEstimateResponseCacheStatus": ".types", @@ -616,6 +624,7 @@ def __dir__(): "ApiResponseProviderKeysManifestOut", "ApiResponseRunsSummaryOut", "ApiResponseSetupIntentResponse", + "ApiResponseSlugAvailabilityOut", "ApiResponseTemplateEstimateResponse", "ApiResponseTemplateOut", "ApiResponseUnionCustomerSubscriptionResponseNoneType", @@ -637,6 +646,7 @@ def __dir__(): "AsyncOnePinClient", "AuthWhoamiOut", "AuthWhoamiOutAuthKind", + "BadRequestError", "BalanceResponse", "CatalogLink", "CatalogModelOut", @@ -658,6 +668,7 @@ def __dir__(): "EnumOption", "EstimateResponse", "ExecutionDefinition", + "ForbiddenError", "GraphDefinitionInput", "GraphDefinitionOutput", "GraphEdge", @@ -716,6 +727,8 @@ def __dir__(): "SearchDictionaryEntriesApiV1DictionarySearchGetRequestOrder", "SearchDictionaryEntriesApiV1DictionarySearchGetRequestSort", "SetupIntentResponse", + "SlugAvailabilityOut", + "SlugAvailabilityOutReason", "TemplateCategory", "TemplateEstimateResponse", "TemplateEstimateResponseCacheStatus", diff --git a/src/onepin/api_keys/raw_client.py b/src/onepin/api_keys/raw_client.py index e63fe7a..b174ee6 100644 --- a/src/onepin/api_keys/raw_client.py +++ b/src/onepin/api_keys/raw_client.py @@ -17,7 +17,6 @@ from ..types.api_response_api_key_created_out import ApiResponseApiKeyCreatedOut from ..types.api_response_api_key_out import ApiResponseApiKeyOut from ..types.api_response_api_key_rotate_out import ApiResponseApiKeyRotateOut -from ..types.http_validation_error import HttpValidationError from pydantic import ValidationError # this is used as the default value for optional parameters @@ -86,9 +85,9 @@ def list_api_keys( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -166,9 +165,9 @@ def create_api_key( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -228,9 +227,9 @@ def get_api_key( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -290,9 +289,9 @@ def delete_api_key( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -372,9 +371,9 @@ def update_api_key( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -434,9 +433,9 @@ def rotate_api_key( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -513,9 +512,9 @@ async def list_api_keys( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -593,9 +592,9 @@ async def create_api_key( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -655,9 +654,9 @@ async def get_api_key( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -717,9 +716,9 @@ async def delete_api_key( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -799,9 +798,9 @@ async def update_api_key( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -861,9 +860,9 @@ async def rotate_api_key( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/auth/raw_client.py b/src/onepin/auth/raw_client.py index df529d9..1b3300d 100644 --- a/src/onepin/auth/raw_client.py +++ b/src/onepin/auth/raw_client.py @@ -11,7 +11,6 @@ from ..core.request_options import RequestOptions from ..errors.unprocessable_entity_error import UnprocessableEntityError from ..types.api_response_auth_whoami_out import ApiResponseAuthWhoamiOut -from ..types.http_validation_error import HttpValidationError from pydantic import ValidationError @@ -54,9 +53,9 @@ def whoami( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -110,9 +109,9 @@ async def whoami( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/billing/raw_client.py b/src/onepin/billing/raw_client.py index 4107267..1885d3c 100644 --- a/src/onepin/billing/raw_client.py +++ b/src/onepin/billing/raw_client.py @@ -14,7 +14,6 @@ from ..types.api_list_response_customer_plan_response import ApiListResponseCustomerPlanResponse from ..types.api_response_checkout_response import ApiResponseCheckoutResponse from ..types.api_response_customer_plan_change_preview_response import ApiResponseCustomerPlanChangePreviewResponse -from ..types.http_validation_error import HttpValidationError from pydantic import ValidationError # this is used as the default value for optional parameters @@ -107,9 +106,9 @@ def preview_plan_change( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -170,9 +169,9 @@ def create_checkout( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -273,9 +272,9 @@ async def preview_plan_change( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -336,9 +335,9 @@ async def create_checkout( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/core/client_wrapper.py b/src/onepin/core/client_wrapper.py index fb6bf54..82c42af 100644 --- a/src/onepin/core/client_wrapper.py +++ b/src/onepin/core/client_wrapper.py @@ -29,7 +29,7 @@ def get_headers(self) -> typing.Dict[str, str]: import platform headers: typing.Dict[str, str] = { - "User-Agent": "onepin/0.6.1", + "User-Agent": "onepin/0.7.2", "X-Fern-Language": "Python", "X-Fern-Runtime": f"python/{platform.python_version()}", "X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}", diff --git a/src/onepin/dictionary/raw_client.py b/src/onepin/dictionary/raw_client.py index f8dcf43..83e78ca 100644 --- a/src/onepin/dictionary/raw_client.py +++ b/src/onepin/dictionary/raw_client.py @@ -17,7 +17,6 @@ from ..types.api_response_list_dictionary_language_out import ApiResponseListDictionaryLanguageOut from ..types.api_response_pronunciation_suggestion import ApiResponsePronunciationSuggestion from ..types.dictionary_method import DictionaryMethod -from ..types.http_validation_error import HttpValidationError from .types.list_dictionary_entries_api_v1dictionary_get_request_language import ( ListDictionaryEntriesApiV1DictionaryGetRequestLanguage, ) @@ -117,9 +116,9 @@ def list_dictionary_entries( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -209,9 +208,9 @@ def create_dictionary_entry( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -297,9 +296,9 @@ def search_dictionary_entries( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -353,9 +352,9 @@ def list_dictionary_languages( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -432,9 +431,9 @@ def suggest_pronunciation( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -527,9 +526,9 @@ def update_dictionary_entry( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -589,9 +588,9 @@ def delete_dictionary_entry( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -681,9 +680,9 @@ async def list_dictionary_entries( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -773,9 +772,9 @@ async def create_dictionary_entry( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -861,9 +860,9 @@ async def search_dictionary_entries( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -917,9 +916,9 @@ async def list_dictionary_languages( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -996,9 +995,9 @@ async def suggest_pronunciation( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1091,9 +1090,9 @@ async def update_dictionary_entry( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1153,9 +1152,9 @@ async def delete_dictionary_entry( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/errors/__init__.py b/src/onepin/errors/__init__.py index 1bb22fc..40b2059 100644 --- a/src/onepin/errors/__init__.py +++ b/src/onepin/errors/__init__.py @@ -6,11 +6,15 @@ from importlib import import_module if typing.TYPE_CHECKING: + from .bad_request_error import BadRequestError from .conflict_error import ConflictError + from .forbidden_error import ForbiddenError from .not_found_error import NotFoundError from .unprocessable_entity_error import UnprocessableEntityError _dynamic_imports: typing.Dict[str, str] = { + "BadRequestError": ".bad_request_error", "ConflictError": ".conflict_error", + "ForbiddenError": ".forbidden_error", "NotFoundError": ".not_found_error", "UnprocessableEntityError": ".unprocessable_entity_error", } @@ -37,4 +41,4 @@ def __dir__(): return sorted(lazy_attrs) -__all__ = ["ConflictError", "NotFoundError", "UnprocessableEntityError"] +__all__ = ["BadRequestError", "ConflictError", "ForbiddenError", "NotFoundError", "UnprocessableEntityError"] diff --git a/src/onepin/errors/bad_request_error.py b/src/onepin/errors/bad_request_error.py new file mode 100644 index 0000000..9f10365 --- /dev/null +++ b/src/onepin/errors/bad_request_error.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.api_error import ApiError +from ..types.api_error_response import ApiErrorResponse + + +class BadRequestError(ApiError): + def __init__(self, body: ApiErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None): + super().__init__(status_code=400, headers=headers, body=body) diff --git a/src/onepin/errors/forbidden_error.py b/src/onepin/errors/forbidden_error.py new file mode 100644 index 0000000..b04ad93 --- /dev/null +++ b/src/onepin/errors/forbidden_error.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.api_error import ApiError +from ..types.api_error_response import ApiErrorResponse + + +class ForbiddenError(ApiError): + def __init__(self, body: ApiErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None): + super().__init__(status_code=403, headers=headers, body=body) diff --git a/src/onepin/errors/unprocessable_entity_error.py b/src/onepin/errors/unprocessable_entity_error.py index d3f9c5d..1c801a4 100644 --- a/src/onepin/errors/unprocessable_entity_error.py +++ b/src/onepin/errors/unprocessable_entity_error.py @@ -3,9 +3,8 @@ import typing from ..core.api_error import ApiError -from ..types.http_validation_error import HttpValidationError class UnprocessableEntityError(ApiError): - def __init__(self, body: HttpValidationError, headers: typing.Optional[typing.Dict[str, str]] = None): + def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None): super().__init__(status_code=422, headers=headers, body=body) diff --git a/src/onepin/nodes/raw_client.py b/src/onepin/nodes/raw_client.py index 8f1ff8f..a140cc7 100644 --- a/src/onepin/nodes/raw_client.py +++ b/src/onepin/nodes/raw_client.py @@ -14,7 +14,6 @@ from ..errors.unprocessable_entity_error import UnprocessableEntityError from ..types.api_list_response_node_ports_out import ApiListResponseNodePortsOut from ..types.api_response_node_detail_out import ApiResponseNodeDetailOut -from ..types.http_validation_error import HttpValidationError from pydantic import ValidationError @@ -130,9 +129,9 @@ def get_node_detail( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -210,9 +209,9 @@ def get_node_detail_v2( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -339,9 +338,9 @@ async def get_node_detail( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -419,9 +418,9 @@ async def get_node_detail_v2( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/provider_keys/raw_client.py b/src/onepin/provider_keys/raw_client.py index 98f819c..d9ae15d 100644 --- a/src/onepin/provider_keys/raw_client.py +++ b/src/onepin/provider_keys/raw_client.py @@ -13,7 +13,6 @@ from ..errors.unprocessable_entity_error import UnprocessableEntityError from ..types.api_response_provider_key_item_out import ApiResponseProviderKeyItemOut from ..types.api_response_provider_keys_manifest_out import ApiResponseProviderKeysManifestOut -from ..types.http_validation_error import HttpValidationError from ..types.provider_key_provider import ProviderKeyProvider from pydantic import ValidationError @@ -65,9 +64,9 @@ def list_provider_keys( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -136,9 +135,9 @@ def put_provider_key( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -198,9 +197,9 @@ def delete_provider_key( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -259,9 +258,9 @@ async def list_provider_keys( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -330,9 +329,9 @@ async def put_provider_key( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -392,9 +391,9 @@ async def delete_provider_key( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/providers/raw_client.py b/src/onepin/providers/raw_client.py index 04f216b..933636a 100644 --- a/src/onepin/providers/raw_client.py +++ b/src/onepin/providers/raw_client.py @@ -17,7 +17,6 @@ from ..types.api_list_response_catalog_provider_out import ApiListResponseCatalogProviderOut from ..types.api_response_catalog_model_out import ApiResponseCatalogModelOut from ..types.api_response_catalog_provider_out import ApiResponseCatalogProviderOut -from ..types.http_validation_error import HttpValidationError from pydantic import ValidationError @@ -70,9 +69,9 @@ def list_catalog_providers( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -143,9 +142,9 @@ def get_catalog_provider( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -216,9 +215,9 @@ def list_catalog_provider_models( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -306,9 +305,9 @@ def list_catalog_provider_model_voices( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -382,9 +381,9 @@ def get_catalog_provider_model( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -448,9 +447,9 @@ async def list_catalog_providers( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -521,9 +520,9 @@ async def get_catalog_provider( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -594,9 +593,9 @@ async def list_catalog_provider_models( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -684,9 +683,9 @@ async def list_catalog_provider_model_voices( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -760,9 +759,9 @@ async def get_catalog_provider_model( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/reference.md b/src/onepin/reference.md index a3cff42..ac55156 100644 --- a/src/onepin/reference.md +++ b/src/onepin/reference.md @@ -4970,6 +4970,97 @@ client.workspaces.create_workspace( + + + + +
client.workspaces.slug_available(...) -> ApiResponseSlugAvailabilityOut +
+
+ +#### 📝 Description + +
+
+ +
+
+ +POD-557: admin-only live availability check for a workspace slug. + +Declared before `/{workspace_id}` so the literal path wins over the UUID +route. Auth is hard 4xx (missing/invalid X-Workspace-Id -> 400, not a member +-> 404, not admin -> 403, missing ?slug -> 422). Slug content is soft 200 +`{available, reason?: invalid|reserved|taken}`, self-excluded against the +X-Workspace-Id workspace's own current slug. Global across tenants. + +Advisory only — a point-in-time snapshot. A concurrent request can claim the +slug between this check and the caller's POST/PATCH, so callers must still +handle 409 WORKSPACE_SLUG_TAKEN on the write path. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from onepin import OnePinClient +from onepin.environment import OnePinClientEnvironment + +client = OnePinClient( + token="", + environment=OnePinClientEnvironment.PROD, +) + +client.workspaces.slug_available( + slug="slug", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**slug:** `str` — Candidate slug; normalized (strip().lower()) before checks. + +
+
+ +
+
+ +**workspace_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ +
@@ -6979,15 +7070,7 @@ client.users.update_current_notification_preferences()
-**weekly_usage_summary_email:** `typing.Optional[bool]` - -
-
- -
-
- -**product_updates_email:** `typing.Optional[bool]` +**failed_generation_email:** `typing.Optional[bool]`
@@ -7196,7 +7279,7 @@ client.workflows.list()
-**status:** `typing.Optional[WorkflowListStatus]` — UI workflow status filter. `paused` is accepted for forward compatibility and currently returns no rows. +**status:** `typing.Optional[WorkflowListStatus]` — UI workflow status filter. `completed` means FINISHED — it matches workflows whose latest run is completed, failed, or cancelled, so it overlaps `failed` on failed runs. `paused` is accepted for forward compatibility and currently returns no rows.
@@ -8602,6 +8685,192 @@ client.workflows.download_run_node( + + + + +
client.workflows.pause_run(...) -> ApiResponseWorkflowRunOut +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Pause a workflow run. + +A running run finishes its current wave (preserving in-flight work) and parks at the +next wave boundary; a pending run parks immediately. Fire-and-forget and idempotent. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from onepin import OnePinClient +from onepin.environment import OnePinClientEnvironment + +client = OnePinClient( + token="", + environment=OnePinClientEnvironment.PROD, +) + +client.workflows.pause_run( + workflow_id="workflow_id", + run_id="run_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**workflow_id:** `str` + +
+
+ +
+
+ +**run_id:** `str` + +
+
+ +
+
+ +**workspace_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.workflows.resume_run(...) -> ApiResponseWorkflowRunOut +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Resume a paused workflow run from its last completed wave. + +Best-effort: if the workflow already has another active run, or the caller is at their +concurrent-run limit, the run stays paused and a 409 explains why (retry later). +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from onepin import OnePinClient +from onepin.environment import OnePinClientEnvironment + +client = OnePinClient( + token="", + environment=OnePinClientEnvironment.PROD, +) + +client.workflows.resume_run( + workflow_id="workflow_id", + run_id="run_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**workflow_id:** `str` + +
+
+ +
+
+ +**run_id:** `str` + +
+
+ +
+
+ +**workspace_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ +
diff --git a/src/onepin/templates/raw_client.py b/src/onepin/templates/raw_client.py index 195fcb9..c761c86 100644 --- a/src/onepin/templates/raw_client.py +++ b/src/onepin/templates/raw_client.py @@ -17,7 +17,6 @@ from ..types.api_response_template_estimate_response import ApiResponseTemplateEstimateResponse from ..types.api_response_template_out import ApiResponseTemplateOut from ..types.api_response_workflow_out import ApiResponseWorkflowOut -from ..types.http_validation_error import HttpValidationError from ..types.template_category import TemplateCategory from ..types.workflow_definition_input import WorkflowDefinitionInput from .types.list_templates_request_sort import ListTemplatesRequestSort @@ -102,9 +101,9 @@ def list( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -189,9 +188,9 @@ def create_template( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -253,9 +252,9 @@ def get( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -315,9 +314,9 @@ def delete_template( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -403,9 +402,9 @@ def update_template( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -465,9 +464,9 @@ def estimate_template( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -544,9 +543,9 @@ def clone( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -605,9 +604,9 @@ def favorite_template( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -661,9 +660,9 @@ def unfavorite_template( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -753,9 +752,9 @@ async def list( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -840,9 +839,9 @@ async def create_template( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -904,9 +903,9 @@ async def get( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -966,9 +965,9 @@ async def delete_template( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1054,9 +1053,9 @@ async def update_template( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1116,9 +1115,9 @@ async def estimate_template( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1195,9 +1194,9 @@ async def clone( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1256,9 +1255,9 @@ async def favorite_template( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1312,9 +1311,9 @@ async def unfavorite_template( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/types/__init__.py b/src/onepin/types/__init__.py index 06c892f..30f2136 100644 --- a/src/onepin/types/__init__.py +++ b/src/onepin/types/__init__.py @@ -56,6 +56,7 @@ from .api_response_provider_keys_manifest_out import ApiResponseProviderKeysManifestOut from .api_response_runs_summary_out import ApiResponseRunsSummaryOut from .api_response_setup_intent_response import ApiResponseSetupIntentResponse + from .api_response_slug_availability_out import ApiResponseSlugAvailabilityOut from .api_response_template_estimate_response import ApiResponseTemplateEstimateResponse from .api_response_template_out import ApiResponseTemplateOut from .api_response_union_customer_subscription_response_none_type import ( @@ -137,6 +138,8 @@ from .provider_keys_manifest_out import ProviderKeysManifestOut from .runs_summary_out import RunsSummaryOut from .setup_intent_response import SetupIntentResponse + from .slug_availability_out import SlugAvailabilityOut + from .slug_availability_out_reason import SlugAvailabilityOutReason from .template_category import TemplateCategory from .template_estimate_response import TemplateEstimateResponse from .template_estimate_response_cache_status import TemplateEstimateResponseCacheStatus @@ -275,6 +278,7 @@ "ApiResponseProviderKeysManifestOut": ".api_response_provider_keys_manifest_out", "ApiResponseRunsSummaryOut": ".api_response_runs_summary_out", "ApiResponseSetupIntentResponse": ".api_response_setup_intent_response", + "ApiResponseSlugAvailabilityOut": ".api_response_slug_availability_out", "ApiResponseTemplateEstimateResponse": ".api_response_template_estimate_response", "ApiResponseTemplateOut": ".api_response_template_out", "ApiResponseUnionCustomerSubscriptionResponseNoneType": ".api_response_union_customer_subscription_response_none_type", @@ -352,6 +356,8 @@ "ProviderKeysManifestOut": ".provider_keys_manifest_out", "RunsSummaryOut": ".runs_summary_out", "SetupIntentResponse": ".setup_intent_response", + "SlugAvailabilityOut": ".slug_availability_out", + "SlugAvailabilityOutReason": ".slug_availability_out_reason", "TemplateCategory": ".template_category", "TemplateEstimateResponse": ".template_estimate_response", "TemplateEstimateResponseCacheStatus": ".template_estimate_response_cache_status", @@ -514,6 +520,7 @@ def __dir__(): "ApiResponseProviderKeysManifestOut", "ApiResponseRunsSummaryOut", "ApiResponseSetupIntentResponse", + "ApiResponseSlugAvailabilityOut", "ApiResponseTemplateEstimateResponse", "ApiResponseTemplateOut", "ApiResponseUnionCustomerSubscriptionResponseNoneType", @@ -591,6 +598,8 @@ def __dir__(): "ProviderKeysManifestOut", "RunsSummaryOut", "SetupIntentResponse", + "SlugAvailabilityOut", + "SlugAvailabilityOutReason", "TemplateCategory", "TemplateEstimateResponse", "TemplateEstimateResponseCacheStatus", diff --git a/src/onepin/types/api_response_slug_availability_out.py b/src/onepin/types/api_response_slug_availability_out.py new file mode 100644 index 0000000..f1335c7 --- /dev/null +++ b/src/onepin/types/api_response_slug_availability_out.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .meta import Meta +from .slug_availability_out import SlugAvailabilityOut + + +class ApiResponseSlugAvailabilityOut(UniversalBaseModel): + data: SlugAvailabilityOut + meta: Meta + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/onepin/types/email_notification_preferences_out.py b/src/onepin/types/email_notification_preferences_out.py index 754a4fd..fa1eb60 100644 --- a/src/onepin/types/email_notification_preferences_out.py +++ b/src/onepin/types/email_notification_preferences_out.py @@ -12,8 +12,7 @@ class EmailNotificationPreferencesOut(UniversalBaseModel): """ completed_generation_email: bool - weekly_usage_summary_email: bool - product_updates_email: bool + failed_generation_email: bool if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/onepin/types/runs_summary_out.py b/src/onepin/types/runs_summary_out.py index d76a88b..eadb21d 100644 --- a/src/onepin/types/runs_summary_out.py +++ b/src/onepin/types/runs_summary_out.py @@ -13,6 +13,7 @@ class RunsSummaryOut(UniversalBaseModel): cancelled: int pending: int running: int + paused: int pass_rate: typing.Optional[float] = None average_duration_seconds: typing.Optional[float] = None diff --git a/src/onepin/types/slug_availability_out.py b/src/onepin/types/slug_availability_out.py new file mode 100644 index 0000000..bce02da --- /dev/null +++ b/src/onepin/types/slug_availability_out.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .slug_availability_out_reason import SlugAvailabilityOutReason + + +class SlugAvailabilityOut(UniversalBaseModel): + """ + POD-557: result of GET /workspaces/slug-available. `reason` is set only + when `available` is False (first failure in order format → reserved → taken). + """ + + available: bool + reason: typing.Optional[SlugAvailabilityOutReason] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/onepin/types/slug_availability_out_reason.py b/src/onepin/types/slug_availability_out_reason.py new file mode 100644 index 0000000..119672d --- /dev/null +++ b/src/onepin/types/slug_availability_out_reason.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SlugAvailabilityOutReason = typing.Union[typing.Literal["invalid", "reserved", "taken"], typing.Any] diff --git a/src/onepin/types/usage_runs_out.py b/src/onepin/types/usage_runs_out.py index 4002565..18188de 100644 --- a/src/onepin/types/usage_runs_out.py +++ b/src/onepin/types/usage_runs_out.py @@ -13,6 +13,7 @@ class UsageRunsOut(UniversalBaseModel): cancelled: int running: int pending: int + paused: typing.Optional[int] = None if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/onepin/types/workflow_run_detail_out.py b/src/onepin/types/workflow_run_detail_out.py index 3ba8866..f018add 100644 --- a/src/onepin/types/workflow_run_detail_out.py +++ b/src/onepin/types/workflow_run_detail_out.py @@ -28,6 +28,8 @@ class WorkflowRunDetailOut(UniversalBaseModel): usage_summary: typing.Optional[typing.Dict[str, typing.Any]] = None started_at: typing.Optional[dt.datetime] = None completed_at: typing.Optional[dt.datetime] = None + pause_requested_at: typing.Optional[dt.datetime] = None + paused_at: typing.Optional[dt.datetime] = None created_at: dt.datetime updated_at: dt.datetime error: typing.Optional[str] = None diff --git a/src/onepin/types/workflow_run_list_item.py b/src/onepin/types/workflow_run_list_item.py index 202a325..1254cae 100644 --- a/src/onepin/types/workflow_run_list_item.py +++ b/src/onepin/types/workflow_run_list_item.py @@ -19,6 +19,8 @@ class WorkflowRunListItem(UniversalBaseModel): usage_summary: typing.Optional[typing.Dict[str, typing.Any]] = None started_at: typing.Optional[dt.datetime] = None completed_at: typing.Optional[dt.datetime] = None + pause_requested_at: typing.Optional[dt.datetime] = None + paused_at: typing.Optional[dt.datetime] = None created_at: dt.datetime triggered_by: typing.Optional[TriggeredByOut] = None diff --git a/src/onepin/types/workflow_run_out.py b/src/onepin/types/workflow_run_out.py index 457588f..d26b06d 100644 --- a/src/onepin/types/workflow_run_out.py +++ b/src/onepin/types/workflow_run_out.py @@ -20,6 +20,8 @@ class WorkflowRunOut(UniversalBaseModel): usage_summary: typing.Optional[typing.Dict[str, typing.Any]] = None started_at: typing.Optional[dt.datetime] = None completed_at: typing.Optional[dt.datetime] = None + pause_requested_at: typing.Optional[dt.datetime] = None + paused_at: typing.Optional[dt.datetime] = None created_at: dt.datetime updated_at: dt.datetime error: typing.Optional[str] = None diff --git a/src/onepin/types/workflow_run_status_out.py b/src/onepin/types/workflow_run_status_out.py index de41a58..13fe7ae 100644 --- a/src/onepin/types/workflow_run_status_out.py +++ b/src/onepin/types/workflow_run_status_out.py @@ -20,6 +20,8 @@ class WorkflowRunStatusOut(UniversalBaseModel): usage_summary: typing.Optional[typing.Dict[str, typing.Any]] = None started_at: typing.Optional[dt.datetime] = None completed_at: typing.Optional[dt.datetime] = None + pause_requested_at: typing.Optional[dt.datetime] = None + paused_at: typing.Optional[dt.datetime] = None created_at: dt.datetime updated_at: dt.datetime error: typing.Optional[str] = None diff --git a/src/onepin/types/workspace_runs_stats_out.py b/src/onepin/types/workspace_runs_stats_out.py index c7f2b8a..b6339c9 100644 --- a/src/onepin/types/workspace_runs_stats_out.py +++ b/src/onepin/types/workspace_runs_stats_out.py @@ -13,6 +13,7 @@ class WorkspaceRunsStatsOut(UniversalBaseModel): completed: int failed: int cancelled: int + paused: int if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/onepin/types/workspace_workflows_stats_out.py b/src/onepin/types/workspace_workflows_stats_out.py index ae9b952..7107801 100644 --- a/src/onepin/types/workspace_workflows_stats_out.py +++ b/src/onepin/types/workspace_workflows_stats_out.py @@ -10,14 +10,13 @@ class WorkspaceWorkflowsStatsOut(UniversalBaseModel): """ Workflow counts grouped by derived ``WorkflowListStatus`` for a workspace. - **Bucket coverage (V1, by design):** - ``total >= draft + running + completed + failed + paused``. Workflows - whose latest run is ``cancelled`` map to **no** bucket because the spec - exposes only the 5 ``WorkflowListStatus`` values. The UI must use - ``total`` for the headline count, not the sum of buckets. - - ``paused`` is always ``0`` (spec Non-Goal — UI exposes the bucket for - forward compatibility). + **Bucket semantics (POD-634):** ``completed`` means FINISHED — its latest + run ended (completed, failed, or cancelled). ``failed`` counts failed-only + and is therefore a SUBSET of ``completed`` (a failed run is counted in + both). The buckets OVERLAP, so their sum can exceed ``total``; the UI must + rely on ``total`` for the headline count, not the sum of buckets. + + ``paused`` is always 0 — paused workflows fold into ``running`` (POD-417: a parked run is still active work). """ total: int diff --git a/src/onepin/uploads/raw_client.py b/src/onepin/uploads/raw_client.py index 9066233..ab5c715 100644 --- a/src/onepin/uploads/raw_client.py +++ b/src/onepin/uploads/raw_client.py @@ -14,7 +14,6 @@ from ..types.api_response_dict import ApiResponseDict from ..types.api_response_upload_create_response import ApiResponseUploadCreateResponse from ..types.api_response_upload_out import ApiResponseUploadOut -from ..types.http_validation_error import HttpValidationError from .types.upload_confirm_request_context_type import UploadConfirmRequestContextType from .types.upload_request_category import UploadRequestCategory from pydantic import ValidationError @@ -82,9 +81,9 @@ def create( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -161,9 +160,9 @@ def confirm( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -233,9 +232,9 @@ def delete( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -309,9 +308,9 @@ async def create( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -388,9 +387,9 @@ async def confirm( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -460,9 +459,9 @@ async def delete( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/usage/raw_client.py b/src/onepin/usage/raw_client.py index 2450861..c8058d4 100644 --- a/src/onepin/usage/raw_client.py +++ b/src/onepin/usage/raw_client.py @@ -13,7 +13,6 @@ from ..types.api_list_response_usage_activity_out import ApiListResponseUsageActivityOut from ..types.api_response_usage_by_language_out import ApiResponseUsageByLanguageOut from ..types.api_response_usage_summary_out import ApiResponseUsageSummaryOut -from ..types.http_validation_error import HttpValidationError from ..types.usage_activity_action import UsageActivityAction from .types.usage_activity_api_v1usage_activity_get_request_range import UsageActivityApiV1UsageActivityGetRequestRange from .types.usage_by_language_api_v1usage_by_language_get_request_activity_view import ( @@ -93,9 +92,9 @@ def usage_summary( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -173,9 +172,9 @@ def usage_by_language( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -263,9 +262,9 @@ def usage_activity( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -344,9 +343,9 @@ async def usage_summary( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -424,9 +423,9 @@ async def usage_by_language( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -514,9 +513,9 @@ async def usage_activity( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/users/client.py b/src/onepin/users/client.py index 79fe715..7c7af6b 100644 --- a/src/onepin/users/client.py +++ b/src/onepin/users/client.py @@ -434,8 +434,7 @@ def update_current_notification_preferences( self, *, completed_generation_email: typing.Optional[bool] = OMIT, - weekly_usage_summary_email: typing.Optional[bool] = OMIT, - product_updates_email: typing.Optional[bool] = OMIT, + failed_generation_email: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> ApiResponseEmailNotificationPreferencesOut: """ @@ -445,9 +444,7 @@ def update_current_notification_preferences( ---------- completed_generation_email : typing.Optional[bool] - weekly_usage_summary_email : typing.Optional[bool] - - product_updates_email : typing.Optional[bool] + failed_generation_email : typing.Optional[bool] request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -468,8 +465,7 @@ def update_current_notification_preferences( """ _response = self._raw_client.update_current_notification_preferences( completed_generation_email=completed_generation_email, - weekly_usage_summary_email=weekly_usage_summary_email, - product_updates_email=product_updates_email, + failed_generation_email=failed_generation_email, request_options=request_options, ) return _response.data @@ -1059,8 +1055,7 @@ async def update_current_notification_preferences( self, *, completed_generation_email: typing.Optional[bool] = OMIT, - weekly_usage_summary_email: typing.Optional[bool] = OMIT, - product_updates_email: typing.Optional[bool] = OMIT, + failed_generation_email: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> ApiResponseEmailNotificationPreferencesOut: """ @@ -1070,9 +1065,7 @@ async def update_current_notification_preferences( ---------- completed_generation_email : typing.Optional[bool] - weekly_usage_summary_email : typing.Optional[bool] - - product_updates_email : typing.Optional[bool] + failed_generation_email : typing.Optional[bool] request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1101,8 +1094,7 @@ async def main() -> None: """ _response = await self._raw_client.update_current_notification_preferences( completed_generation_email=completed_generation_email, - weekly_usage_summary_email=weekly_usage_summary_email, - product_updates_email=product_updates_email, + failed_generation_email=failed_generation_email, request_options=request_options, ) return _response.data diff --git a/src/onepin/users/raw_client.py b/src/onepin/users/raw_client.py index e4e5515..a4620fd 100644 --- a/src/onepin/users/raw_client.py +++ b/src/onepin/users/raw_client.py @@ -23,7 +23,6 @@ from ..types.api_response_union_customer_subscription_response_none_type import ( ApiResponseUnionCustomerSubscriptionResponseNoneType, ) -from ..types.http_validation_error import HttpValidationError from ..types.template_category import TemplateCategory from .types.list_my_templates_api_v1users_me_templates_get_request_sort import ( ListMyTemplatesApiV1UsersMeTemplatesGetRequestSort, @@ -73,9 +72,9 @@ def get_current_subscription( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -133,9 +132,9 @@ def subscribe( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -184,9 +183,9 @@ def cancel_subscription( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -244,9 +243,9 @@ def change_plan( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -295,9 +294,9 @@ def cancel_scheduled_change( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -346,9 +345,9 @@ def list_payment_methods( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -397,9 +396,9 @@ def add_payment_method( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -450,9 +449,9 @@ def delete_payment_method( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -503,9 +502,9 @@ def set_default_payment_method( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -557,9 +556,9 @@ def get_my_credits( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -608,9 +607,9 @@ def get_my_plan_limits( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -671,9 +670,9 @@ def list_invoices( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -722,9 +721,9 @@ def get_current_notification_preferences( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -742,8 +741,7 @@ def update_current_notification_preferences( self, *, completed_generation_email: typing.Optional[bool] = OMIT, - weekly_usage_summary_email: typing.Optional[bool] = OMIT, - product_updates_email: typing.Optional[bool] = OMIT, + failed_generation_email: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[ApiResponseEmailNotificationPreferencesOut]: """ @@ -753,9 +751,7 @@ def update_current_notification_preferences( ---------- completed_generation_email : typing.Optional[bool] - weekly_usage_summary_email : typing.Optional[bool] - - product_updates_email : typing.Optional[bool] + failed_generation_email : typing.Optional[bool] request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -770,8 +766,7 @@ def update_current_notification_preferences( method="PATCH", json={ "completed_generation_email": completed_generation_email, - "weekly_usage_summary_email": weekly_usage_summary_email, - "product_updates_email": product_updates_email, + "failed_generation_email": failed_generation_email, }, headers={ "content-type": "application/json", @@ -793,9 +788,9 @@ def update_current_notification_preferences( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -884,9 +879,9 @@ def list_my_templates( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -940,9 +935,9 @@ async def get_current_subscription( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1000,9 +995,9 @@ async def subscribe( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1051,9 +1046,9 @@ async def cancel_subscription( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1111,9 +1106,9 @@ async def change_plan( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1162,9 +1157,9 @@ async def cancel_scheduled_change( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1213,9 +1208,9 @@ async def list_payment_methods( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1264,9 +1259,9 @@ async def add_payment_method( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1317,9 +1312,9 @@ async def delete_payment_method( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1370,9 +1365,9 @@ async def set_default_payment_method( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1424,9 +1419,9 @@ async def get_my_credits( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1475,9 +1470,9 @@ async def get_my_plan_limits( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1538,9 +1533,9 @@ async def list_invoices( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1589,9 +1584,9 @@ async def get_current_notification_preferences( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1609,8 +1604,7 @@ async def update_current_notification_preferences( self, *, completed_generation_email: typing.Optional[bool] = OMIT, - weekly_usage_summary_email: typing.Optional[bool] = OMIT, - product_updates_email: typing.Optional[bool] = OMIT, + failed_generation_email: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[ApiResponseEmailNotificationPreferencesOut]: """ @@ -1620,9 +1614,7 @@ async def update_current_notification_preferences( ---------- completed_generation_email : typing.Optional[bool] - weekly_usage_summary_email : typing.Optional[bool] - - product_updates_email : typing.Optional[bool] + failed_generation_email : typing.Optional[bool] request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -1637,8 +1629,7 @@ async def update_current_notification_preferences( method="PATCH", json={ "completed_generation_email": completed_generation_email, - "weekly_usage_summary_email": weekly_usage_summary_email, - "product_updates_email": product_updates_email, + "failed_generation_email": failed_generation_email, }, headers={ "content-type": "application/json", @@ -1660,9 +1651,9 @@ async def update_current_notification_preferences( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1751,9 +1742,9 @@ async def list_my_templates( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/voices/raw_client.py b/src/onepin/voices/raw_client.py index 917c1f0..9a47e57 100644 --- a/src/onepin/voices/raw_client.py +++ b/src/onepin/voices/raw_client.py @@ -15,7 +15,6 @@ from ..types.api_list_response_voice_similar_out import ApiListResponseVoiceSimilarOut from ..types.api_response_dict import ApiResponseDict from ..types.api_response_voice_out import ApiResponseVoiceOut -from ..types.http_validation_error import HttpValidationError from ..types.voice_accent import VoiceAccent from ..types.voice_age import VoiceAge from ..types.voice_category import VoiceCategory @@ -161,9 +160,9 @@ def list( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -223,9 +222,9 @@ def get( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -296,9 +295,9 @@ def similar( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -358,9 +357,9 @@ def favorite_voice( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -420,9 +419,9 @@ def unfavorite_voice( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -570,9 +569,9 @@ async def list( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -632,9 +631,9 @@ async def get( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -705,9 +704,9 @@ async def similar( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -767,9 +766,9 @@ async def favorite_voice( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -829,9 +828,9 @@ async def unfavorite_voice( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/workflows/client.py b/src/onepin/workflows/client.py index eafaf39..174d465 100644 --- a/src/onepin/workflows/client.py +++ b/src/onepin/workflows/client.py @@ -15,6 +15,7 @@ from ..types.api_response_list_workflow_run_step_out import ApiResponseListWorkflowRunStepOut from ..types.api_response_runs_summary_out import ApiResponseRunsSummaryOut from ..types.api_response_workflow_out import ApiResponseWorkflowOut +from ..types.api_response_workflow_run_out import ApiResponseWorkflowRunOut from ..types.api_response_workflow_run_overview_out import ApiResponseWorkflowRunOverviewOut from ..types.workflow_definition_input import WorkflowDefinitionInput from ..types.workflow_list_status import WorkflowListStatus @@ -79,7 +80,7 @@ def list( Parameters ---------- status : typing.Optional[WorkflowListStatus] - UI workflow status filter. `paused` is accepted for forward compatibility and currently returns no rows. + UI workflow status filter. `completed` means FINISHED — it matches workflows whose latest run is completed, failed, or cancelled, so it overlaps `failed` on failed runs. `paused` is accepted for forward compatibility and currently returns no rows. search : typing.Optional[str] Case-insensitive search over name and description. @@ -798,6 +799,100 @@ def download_run_node( ) return _response.data + def pause_run( + self, + workflow_id: str, + run_id: str, + *, + workspace_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ApiResponseWorkflowRunOut: + """ + Pause a workflow run. + + A running run finishes its current wave (preserving in-flight work) and parks at the + next wave boundary; a pending run parks immediately. Fire-and-forget and idempotent. + + Parameters + ---------- + workflow_id : str + + run_id : str + + workspace_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ApiResponseWorkflowRunOut + Successful Response + + Examples + -------- + from onepin import OnePinClient + + client = OnePinClient( + token="YOUR_TOKEN", + ) + client.workflows.pause_run( + workflow_id="workflow_id", + run_id="run_id", + ) + """ + _response = self._raw_client.pause_run( + workflow_id, run_id, workspace_id=workspace_id, request_options=request_options + ) + return _response.data + + def resume_run( + self, + workflow_id: str, + run_id: str, + *, + workspace_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ApiResponseWorkflowRunOut: + """ + Resume a paused workflow run from its last completed wave. + + Best-effort: if the workflow already has another active run, or the caller is at their + concurrent-run limit, the run stays paused and a 409 explains why (retry later). + + Parameters + ---------- + workflow_id : str + + run_id : str + + workspace_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ApiResponseWorkflowRunOut + Successful Response + + Examples + -------- + from onepin import OnePinClient + + client = OnePinClient( + token="YOUR_TOKEN", + ) + client.workflows.resume_run( + workflow_id="workflow_id", + run_id="run_id", + ) + """ + _response = self._raw_client.resume_run( + workflow_id, run_id, workspace_id=workspace_id, request_options=request_options + ) + return _response.data + def duplicate_workflow( self, workflow_id: str, @@ -897,7 +992,7 @@ async def list( Parameters ---------- status : typing.Optional[WorkflowListStatus] - UI workflow status filter. `paused` is accepted for forward compatibility and currently returns no rows. + UI workflow status filter. `completed` means FINISHED — it matches workflows whose latest run is completed, failed, or cancelled, so it overlaps `failed` on failed runs. `paused` is accepted for forward compatibility and currently returns no rows. search : typing.Optional[str] Case-insensitive search over name and description. @@ -1736,6 +1831,116 @@ async def main() -> None: ) return _response.data + async def pause_run( + self, + workflow_id: str, + run_id: str, + *, + workspace_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ApiResponseWorkflowRunOut: + """ + Pause a workflow run. + + A running run finishes its current wave (preserving in-flight work) and parks at the + next wave boundary; a pending run parks immediately. Fire-and-forget and idempotent. + + Parameters + ---------- + workflow_id : str + + run_id : str + + workspace_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ApiResponseWorkflowRunOut + Successful Response + + Examples + -------- + import asyncio + + from onepin import AsyncOnePinClient + + client = AsyncOnePinClient( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.workflows.pause_run( + workflow_id="workflow_id", + run_id="run_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.pause_run( + workflow_id, run_id, workspace_id=workspace_id, request_options=request_options + ) + return _response.data + + async def resume_run( + self, + workflow_id: str, + run_id: str, + *, + workspace_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ApiResponseWorkflowRunOut: + """ + Resume a paused workflow run from its last completed wave. + + Best-effort: if the workflow already has another active run, or the caller is at their + concurrent-run limit, the run stays paused and a 409 explains why (retry later). + + Parameters + ---------- + workflow_id : str + + run_id : str + + workspace_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ApiResponseWorkflowRunOut + Successful Response + + Examples + -------- + import asyncio + + from onepin import AsyncOnePinClient + + client = AsyncOnePinClient( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.workflows.resume_run( + workflow_id="workflow_id", + run_id="run_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.resume_run( + workflow_id, run_id, workspace_id=workspace_id, request_options=request_options + ) + return _response.data + async def duplicate_workflow( self, workflow_id: str, diff --git a/src/onepin/workflows/raw_client.py b/src/onepin/workflows/raw_client.py index 676900e..8b9761b 100644 --- a/src/onepin/workflows/raw_client.py +++ b/src/onepin/workflows/raw_client.py @@ -24,8 +24,8 @@ from ..types.api_response_list_workflow_run_step_out import ApiResponseListWorkflowRunStepOut from ..types.api_response_runs_summary_out import ApiResponseRunsSummaryOut from ..types.api_response_workflow_out import ApiResponseWorkflowOut +from ..types.api_response_workflow_run_out import ApiResponseWorkflowRunOut from ..types.api_response_workflow_run_overview_out import ApiResponseWorkflowRunOverviewOut -from ..types.http_validation_error import HttpValidationError from ..types.workflow_definition_input import WorkflowDefinitionInput from ..types.workflow_list_status import WorkflowListStatus from ..types.workflow_run_data_response import WorkflowRunDataResponse @@ -74,7 +74,7 @@ def list( Parameters ---------- status : typing.Optional[WorkflowListStatus] - UI workflow status filter. `paused` is accepted for forward compatibility and currently returns no rows. + UI workflow status filter. `completed` means FINISHED — it matches workflows whose latest run is completed, failed, or cancelled, so it overlaps `failed` on failed runs. `paused` is accepted for forward compatibility and currently returns no rows. search : typing.Optional[str] Case-insensitive search over name and description. @@ -137,9 +137,9 @@ def list( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -214,9 +214,9 @@ def create_workflow( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -276,9 +276,9 @@ def get( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -356,9 +356,9 @@ def update_workflow( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -418,9 +418,9 @@ def delete_workflow( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -498,9 +498,9 @@ def patch_workflow( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -570,9 +570,9 @@ def list_workflow_uploads( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -632,9 +632,9 @@ def estimate_workflow( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -694,9 +694,9 @@ def preview_run( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -773,9 +773,9 @@ def runs_summary( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -838,9 +838,9 @@ def get_run_steps( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -903,9 +903,9 @@ def get_run_overview( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -991,9 +991,9 @@ def get_run_data( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1078,9 +1078,9 @@ def download_run( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1168,9 +1168,145 @@ def download_run_node( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def pause_run( + self, + workflow_id: str, + run_id: str, + *, + workspace_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ApiResponseWorkflowRunOut]: + """ + Pause a workflow run. + + A running run finishes its current wave (preserving in-flight work) and parks at the + next wave boundary; a pending run parks immediately. Fire-and-forget and idempotent. + + Parameters + ---------- + workflow_id : str + + run_id : str + + workspace_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ApiResponseWorkflowRunOut] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"api/v1/workflows/{encode_path_param(workflow_id)}/runs/{encode_path_param(run_id)}/pause", + method="POST", + headers={ + "X-Workspace-Id": str(workspace_id) if workspace_id is not None else None, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ApiResponseWorkflowRunOut, + parse_obj_as( + type_=ApiResponseWorkflowRunOut, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def resume_run( + self, + workflow_id: str, + run_id: str, + *, + workspace_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ApiResponseWorkflowRunOut]: + """ + Resume a paused workflow run from its last completed wave. + + Best-effort: if the workflow already has another active run, or the caller is at their + concurrent-run limit, the run stays paused and a 409 explains why (retry later). + + Parameters + ---------- + workflow_id : str + + run_id : str + + workspace_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ApiResponseWorkflowRunOut] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"api/v1/workflows/{encode_path_param(workflow_id)}/runs/{encode_path_param(run_id)}/resume", + method="POST", + headers={ + "X-Workspace-Id": str(workspace_id) if workspace_id is not None else None, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ApiResponseWorkflowRunOut, + parse_obj_as( + type_=ApiResponseWorkflowRunOut, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1230,9 +1366,9 @@ def duplicate_workflow( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1284,7 +1420,7 @@ async def list( Parameters ---------- status : typing.Optional[WorkflowListStatus] - UI workflow status filter. `paused` is accepted for forward compatibility and currently returns no rows. + UI workflow status filter. `completed` means FINISHED — it matches workflows whose latest run is completed, failed, or cancelled, so it overlaps `failed` on failed runs. `paused` is accepted for forward compatibility and currently returns no rows. search : typing.Optional[str] Case-insensitive search over name and description. @@ -1347,9 +1483,9 @@ async def list( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1424,9 +1560,9 @@ async def create_workflow( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1486,9 +1622,9 @@ async def get( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1566,9 +1702,9 @@ async def update_workflow( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1628,9 +1764,9 @@ async def delete_workflow( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1708,9 +1844,9 @@ async def patch_workflow( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1780,9 +1916,9 @@ async def list_workflow_uploads( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1842,9 +1978,9 @@ async def estimate_workflow( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1904,9 +2040,9 @@ async def preview_run( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -1983,9 +2119,9 @@ async def runs_summary( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -2048,9 +2184,9 @@ async def get_run_steps( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -2113,9 +2249,9 @@ async def get_run_overview( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -2201,9 +2337,9 @@ async def get_run_data( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -2288,9 +2424,9 @@ async def download_run( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -2378,9 +2514,145 @@ async def download_run_node( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def pause_run( + self, + workflow_id: str, + run_id: str, + *, + workspace_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ApiResponseWorkflowRunOut]: + """ + Pause a workflow run. + + A running run finishes its current wave (preserving in-flight work) and parks at the + next wave boundary; a pending run parks immediately. Fire-and-forget and idempotent. + + Parameters + ---------- + workflow_id : str + + run_id : str + + workspace_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ApiResponseWorkflowRunOut] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"api/v1/workflows/{encode_path_param(workflow_id)}/runs/{encode_path_param(run_id)}/pause", + method="POST", + headers={ + "X-Workspace-Id": str(workspace_id) if workspace_id is not None else None, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ApiResponseWorkflowRunOut, + parse_obj_as( + type_=ApiResponseWorkflowRunOut, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def resume_run( + self, + workflow_id: str, + run_id: str, + *, + workspace_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ApiResponseWorkflowRunOut]: + """ + Resume a paused workflow run from its last completed wave. + + Best-effort: if the workflow already has another active run, or the caller is at their + concurrent-run limit, the run stays paused and a 409 explains why (retry later). + + Parameters + ---------- + workflow_id : str + + run_id : str + + workspace_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ApiResponseWorkflowRunOut] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"api/v1/workflows/{encode_path_param(workflow_id)}/runs/{encode_path_param(run_id)}/resume", + method="POST", + headers={ + "X-Workspace-Id": str(workspace_id) if workspace_id is not None else None, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ApiResponseWorkflowRunOut, + parse_obj_as( + type_=ApiResponseWorkflowRunOut, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -2440,9 +2712,9 @@ async def duplicate_workflow( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/workflows/runs/raw_client.py b/src/onepin/workflows/runs/raw_client.py index 09790c1..73da382 100644 --- a/src/onepin/workflows/runs/raw_client.py +++ b/src/onepin/workflows/runs/raw_client.py @@ -15,7 +15,6 @@ from ...types.api_response_workflow_run_detail_out import ApiResponseWorkflowRunDetailOut from ...types.api_response_workflow_run_out import ApiResponseWorkflowRunOut from ...types.api_response_workflow_run_status_out import ApiResponseWorkflowRunStatusOut -from ...types.http_validation_error import HttpValidationError from .types.list_runs_request_order import ListRunsRequestOrder from .types.list_runs_request_sort import ListRunsRequestSort from pydantic import ValidationError @@ -106,9 +105,9 @@ def list( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -168,9 +167,9 @@ def start( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -237,9 +236,9 @@ def get( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -307,9 +306,9 @@ def status( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -372,9 +371,9 @@ def cancel( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -474,9 +473,9 @@ async def list( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -536,9 +535,9 @@ async def start( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -605,9 +604,9 @@ async def get( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -675,9 +674,9 @@ async def status( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -740,9 +739,9 @@ async def cancel( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/workspace/raw_client.py b/src/onepin/workspace/raw_client.py index 8d173fc..cf7df87 100644 --- a/src/onepin/workspace/raw_client.py +++ b/src/onepin/workspace/raw_client.py @@ -12,7 +12,6 @@ from ..core.request_options import RequestOptions from ..errors.unprocessable_entity_error import UnprocessableEntityError from ..types.api_response_workspace_settings_out import ApiResponseWorkspaceSettingsOut -from ..types.http_validation_error import HttpValidationError from pydantic import ValidationError @@ -65,9 +64,9 @@ def get_workspace_settings( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -131,9 +130,9 @@ async def get_workspace_settings( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/workspace_aggregates/raw_client.py b/src/onepin/workspace_aggregates/raw_client.py index 584fa02..7b34660 100644 --- a/src/onepin/workspace_aggregates/raw_client.py +++ b/src/onepin/workspace_aggregates/raw_client.py @@ -14,7 +14,6 @@ from ..errors.unprocessable_entity_error import UnprocessableEntityError from ..types.api_response_workspace_runs_stats_out import ApiResponseWorkspaceRunsStatsOut from ..types.api_response_workspace_workflows_stats_out import ApiResponseWorkspaceWorkflowsStatsOut -from ..types.http_validation_error import HttpValidationError from pydantic import ValidationError @@ -77,9 +76,9 @@ def workspace_runs_stats( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -148,9 +147,9 @@ def workspace_workflows_stats( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -224,9 +223,9 @@ async def workspace_runs_stats( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -295,9 +294,9 @@ async def workspace_workflows_stats( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/workspace_members/raw_client.py b/src/onepin/workspace_members/raw_client.py index 4a5b6e1..1a8198a 100644 --- a/src/onepin/workspace_members/raw_client.py +++ b/src/onepin/workspace_members/raw_client.py @@ -14,7 +14,6 @@ from ..types.api_list_response_workspace_member_out import ApiListResponseWorkspaceMemberOut from ..types.api_response_dict import ApiResponseDict from ..types.api_response_workspace_invite_out import ApiResponseWorkspaceInviteOut -from ..types.http_validation_error import HttpValidationError from ..types.workspace_role import WorkspaceRole from pydantic import ValidationError @@ -63,9 +62,9 @@ def list_members( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -131,9 +130,9 @@ def create_invite( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -186,9 +185,9 @@ def remove_member( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -255,9 +254,9 @@ def update_member_role( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -310,9 +309,9 @@ def revoke_invite( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -379,9 +378,9 @@ def update_invite_role( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -435,9 +434,9 @@ def accept_invite( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -493,9 +492,9 @@ async def list_members( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -561,9 +560,9 @@ async def create_invite( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -616,9 +615,9 @@ async def remove_member( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -685,9 +684,9 @@ async def update_member_role( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -740,9 +739,9 @@ async def revoke_invite( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -809,9 +808,9 @@ async def update_invite_role( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -865,9 +864,9 @@ async def accept_invite( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/onepin/workspaces/client.py b/src/onepin/workspaces/client.py index 3575f3c..2051bce 100644 --- a/src/onepin/workspaces/client.py +++ b/src/onepin/workspaces/client.py @@ -6,6 +6,7 @@ from ..core.request_options import RequestOptions from ..types.api_list_response_workspace_out import ApiListResponseWorkspaceOut from ..types.api_response_dict import ApiResponseDict +from ..types.api_response_slug_availability_out import ApiResponseSlugAvailabilityOut from ..types.api_response_workspace_out import ApiResponseWorkspaceOut from .raw_client import AsyncRawWorkspacesClient, RawWorkspacesClient @@ -111,6 +112,57 @@ def create_workspace( ) return _response.data + def slug_available( + self, + *, + slug: str, + workspace_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ApiResponseSlugAvailabilityOut: + """ + POD-557: admin-only live availability check for a workspace slug. + + Declared before `/{workspace_id}` so the literal path wins over the UUID + route. Auth is hard 4xx (missing/invalid X-Workspace-Id -> 400, not a member + -> 404, not admin -> 403, missing ?slug -> 422). Slug content is soft 200 + `{available, reason?: invalid|reserved|taken}`, self-excluded against the + X-Workspace-Id workspace's own current slug. Global across tenants. + + Advisory only — a point-in-time snapshot. A concurrent request can claim the + slug between this check and the caller's POST/PATCH, so callers must still + handle 409 WORKSPACE_SLUG_TAKEN on the write path. + + Parameters + ---------- + slug : str + Candidate slug; normalized (strip().lower()) before checks. + + workspace_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ApiResponseSlugAvailabilityOut + Successful Response + + Examples + -------- + from onepin import OnePinClient + + client = OnePinClient( + token="YOUR_TOKEN", + ) + client.workspaces.slug_available( + slug="slug", + ) + """ + _response = self._raw_client.slug_available( + slug=slug, workspace_id=workspace_id, request_options=request_options + ) + return _response.data + def get_workspace( self, workspace_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> ApiResponseWorkspaceOut: @@ -336,6 +388,65 @@ async def main() -> None: ) return _response.data + async def slug_available( + self, + *, + slug: str, + workspace_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ApiResponseSlugAvailabilityOut: + """ + POD-557: admin-only live availability check for a workspace slug. + + Declared before `/{workspace_id}` so the literal path wins over the UUID + route. Auth is hard 4xx (missing/invalid X-Workspace-Id -> 400, not a member + -> 404, not admin -> 403, missing ?slug -> 422). Slug content is soft 200 + `{available, reason?: invalid|reserved|taken}`, self-excluded against the + X-Workspace-Id workspace's own current slug. Global across tenants. + + Advisory only — a point-in-time snapshot. A concurrent request can claim the + slug between this check and the caller's POST/PATCH, so callers must still + handle 409 WORKSPACE_SLUG_TAKEN on the write path. + + Parameters + ---------- + slug : str + Candidate slug; normalized (strip().lower()) before checks. + + workspace_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ApiResponseSlugAvailabilityOut + Successful Response + + Examples + -------- + import asyncio + + from onepin import AsyncOnePinClient + + client = AsyncOnePinClient( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.workspaces.slug_available( + slug="slug", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.slug_available( + slug=slug, workspace_id=workspace_id, request_options=request_options + ) + return _response.data + async def get_workspace( self, workspace_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> ApiResponseWorkspaceOut: diff --git a/src/onepin/workspaces/raw_client.py b/src/onepin/workspaces/raw_client.py index dd2e9a1..21fe1a6 100644 --- a/src/onepin/workspaces/raw_client.py +++ b/src/onepin/workspaces/raw_client.py @@ -10,11 +10,16 @@ from ..core.parse_error import ParsingError from ..core.pydantic_utilities import parse_obj_as from ..core.request_options import RequestOptions +from ..errors.bad_request_error import BadRequestError +from ..errors.conflict_error import ConflictError +from ..errors.forbidden_error import ForbiddenError +from ..errors.not_found_error import NotFoundError from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.api_error_response import ApiErrorResponse from ..types.api_list_response_workspace_out import ApiListResponseWorkspaceOut from ..types.api_response_dict import ApiResponseDict +from ..types.api_response_slug_availability_out import ApiResponseSlugAvailabilityOut from ..types.api_response_workspace_out import ApiResponseWorkspaceOut -from ..types.http_validation_error import HttpValidationError from pydantic import ValidationError # this is used as the default value for optional parameters @@ -72,9 +77,9 @@ def list_workspaces( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -143,13 +148,133 @@ def create_workspace( ), ) return HttpResponse(response=_response, data=_data) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def slug_available( + self, + *, + slug: str, + workspace_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ApiResponseSlugAvailabilityOut]: + """ + POD-557: admin-only live availability check for a workspace slug. + + Declared before `/{workspace_id}` so the literal path wins over the UUID + route. Auth is hard 4xx (missing/invalid X-Workspace-Id -> 400, not a member + -> 404, not admin -> 403, missing ?slug -> 422). Slug content is soft 200 + `{available, reason?: invalid|reserved|taken}`, self-excluded against the + X-Workspace-Id workspace's own current slug. Global across tenants. + + Advisory only — a point-in-time snapshot. A concurrent request can claim the + slug between this check and the caller's POST/PATCH, so callers must still + handle 409 WORKSPACE_SLUG_TAKEN on the write path. + + Parameters + ---------- + slug : str + Candidate slug; normalized (strip().lower()) before checks. + + workspace_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ApiResponseSlugAvailabilityOut] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "api/v1/workspaces/slug-available", + method="GET", + params={ + "slug": slug, + }, + headers={ + "X-Workspace-Id": str(workspace_id) if workspace_id is not None else None, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ApiResponseSlugAvailabilityOut, + parse_obj_as( + type_=ApiResponseSlugAvailabilityOut, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + ApiErrorResponse, + parse_obj_as( + type_=ApiErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + ApiErrorResponse, + parse_obj_as( + type_=ApiErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -200,9 +325,9 @@ def get_workspace( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -253,9 +378,9 @@ def delete_workspace( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -323,13 +448,24 @@ def update_workspace( ), ) return HttpResponse(response=_response, data=_data) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -395,9 +531,9 @@ async def list_workspaces( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -466,13 +602,133 @@ async def create_workspace( ), ) return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def slug_available( + self, + *, + slug: str, + workspace_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ApiResponseSlugAvailabilityOut]: + """ + POD-557: admin-only live availability check for a workspace slug. + + Declared before `/{workspace_id}` so the literal path wins over the UUID + route. Auth is hard 4xx (missing/invalid X-Workspace-Id -> 400, not a member + -> 404, not admin -> 403, missing ?slug -> 422). Slug content is soft 200 + `{available, reason?: invalid|reserved|taken}`, self-excluded against the + X-Workspace-Id workspace's own current slug. Global across tenants. + + Advisory only — a point-in-time snapshot. A concurrent request can claim the + slug between this check and the caller's POST/PATCH, so callers must still + handle 409 WORKSPACE_SLUG_TAKEN on the write path. + + Parameters + ---------- + slug : str + Candidate slug; normalized (strip().lower()) before checks. + + workspace_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ApiResponseSlugAvailabilityOut] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "api/v1/workspaces/slug-available", + method="GET", + params={ + "slug": slug, + }, + headers={ + "X-Workspace-Id": str(workspace_id) if workspace_id is not None else None, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ApiResponseSlugAvailabilityOut, + parse_obj_as( + type_=ApiResponseSlugAvailabilityOut, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + ApiErrorResponse, + parse_obj_as( + type_=ApiErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + ApiErrorResponse, + parse_obj_as( + type_=ApiErrorResponse, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -523,9 +779,9 @@ async def get_workspace( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -576,9 +832,9 @@ async def delete_workspace( raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -646,13 +902,24 @@ async def update_workspace( ), ) return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + parse_obj_as( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) if _response.status_code == 422: raise UnprocessableEntityError( headers=dict(_response.headers), body=typing.cast( - HttpValidationError, + typing.Any, parse_obj_as( - type_=HttpValidationError, # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ),