diff --git a/google/genai/_gaos/models/__init__.py b/google/genai/_gaos/models/__init__.py index 6e3953107..29a9317ef 100644 --- a/google/genai/_gaos/models/__init__.py +++ b/google/genai/_gaos/models/__init__.py @@ -43,12 +43,6 @@ CreateInteractionResponse, CreateInteractionResponseTypedDict, ) - from .createtrigger import ( - CreateTriggerGlobals, - CreateTriggerGlobalsTypedDict, - CreateTriggerRequest, - CreateTriggerRequestParam, - ) from .createwebhook import ( CreateWebhookGlobals, CreateWebhookGlobalsTypedDict, @@ -67,12 +61,6 @@ DeleteInteractionRequest, DeleteInteractionRequestParam, ) - from .deletetrigger import ( - DeleteTriggerGlobals, - DeleteTriggerGlobalsTypedDict, - DeleteTriggerRequest, - DeleteTriggerRequestParam, - ) from .deletewebhook import ( DeleteWebhookGlobals, DeleteWebhookGlobalsTypedDict, @@ -93,12 +81,6 @@ GetInteractionByIDResponse, GetInteractionByIDResponseTypedDict, ) - from .gettrigger import ( - GetTriggerGlobals, - GetTriggerGlobalsTypedDict, - GetTriggerRequest, - GetTriggerRequestParam, - ) from .getwebhook import ( GetWebhookGlobals, GetWebhookGlobalsTypedDict, @@ -111,18 +93,6 @@ ListAgentsRequest, ListAgentsRequestParam, ) - from .listtriggerexecutions import ( - ListTriggerExecutionsGlobals, - ListTriggerExecutionsGlobalsTypedDict, - ListTriggerExecutionsRequest, - ListTriggerExecutionsRequestParam, - ) - from .listtriggers import ( - ListTriggersGlobals, - ListTriggersGlobalsTypedDict, - ListTriggersRequest, - ListTriggersRequestParam, - ) from .listwebhooks import ( ListWebhooksGlobals, ListWebhooksGlobalsTypedDict, @@ -141,18 +111,6 @@ RotateSigningSecretRequest, RotateSigningSecretRequestParam, ) - from .runtrigger import ( - RunTriggerGlobals, - RunTriggerGlobalsTypedDict, - RunTriggerRequest, - RunTriggerRequestParam, - ) - from .updatetrigger import ( - UpdateTriggerGlobals, - UpdateTriggerGlobalsTypedDict, - UpdateTriggerRequest, - UpdateTriggerRequestParam, - ) from .updatewebhook import ( UpdateWebhookGlobals, UpdateWebhookGlobalsTypedDict, @@ -178,10 +136,6 @@ "CreateInteractionRequestParam", "CreateInteractionResponse", "CreateInteractionResponseTypedDict", - "CreateTriggerGlobals", - "CreateTriggerGlobalsTypedDict", - "CreateTriggerRequest", - "CreateTriggerRequestParam", "CreateWebhookGlobals", "CreateWebhookGlobalsTypedDict", "CreateWebhookRequest", @@ -194,10 +148,6 @@ "DeleteInteractionGlobalsTypedDict", "DeleteInteractionRequest", "DeleteInteractionRequestParam", - "DeleteTriggerGlobals", - "DeleteTriggerGlobalsTypedDict", - "DeleteTriggerRequest", - "DeleteTriggerRequestParam", "DeleteWebhookGlobals", "DeleteWebhookGlobalsTypedDict", "DeleteWebhookRequest", @@ -212,10 +162,6 @@ "GetInteractionByIDRequestParam", "GetInteractionByIDResponse", "GetInteractionByIDResponseTypedDict", - "GetTriggerGlobals", - "GetTriggerGlobalsTypedDict", - "GetTriggerRequest", - "GetTriggerRequestParam", "GetWebhookGlobals", "GetWebhookGlobalsTypedDict", "GetWebhookRequest", @@ -224,14 +170,6 @@ "ListAgentsGlobalsTypedDict", "ListAgentsRequest", "ListAgentsRequestParam", - "ListTriggerExecutionsGlobals", - "ListTriggerExecutionsGlobalsTypedDict", - "ListTriggerExecutionsRequest", - "ListTriggerExecutionsRequestParam", - "ListTriggersGlobals", - "ListTriggersGlobalsTypedDict", - "ListTriggersRequest", - "ListTriggersRequestParam", "ListWebhooksGlobals", "ListWebhooksGlobalsTypedDict", "ListWebhooksRequest", @@ -244,14 +182,6 @@ "RotateSigningSecretGlobalsTypedDict", "RotateSigningSecretRequest", "RotateSigningSecretRequestParam", - "RunTriggerGlobals", - "RunTriggerGlobalsTypedDict", - "RunTriggerRequest", - "RunTriggerRequestParam", - "UpdateTriggerGlobals", - "UpdateTriggerGlobalsTypedDict", - "UpdateTriggerRequest", - "UpdateTriggerRequestParam", "UpdateWebhookGlobals", "UpdateWebhookGlobalsTypedDict", "UpdateWebhookRequest", @@ -275,10 +205,6 @@ "CreateInteractionRequestParam": ".createinteraction", "CreateInteractionResponse": ".createinteraction", "CreateInteractionResponseTypedDict": ".createinteraction", - "CreateTriggerGlobals": ".createtrigger", - "CreateTriggerGlobalsTypedDict": ".createtrigger", - "CreateTriggerRequest": ".createtrigger", - "CreateTriggerRequestParam": ".createtrigger", "CreateWebhookGlobals": ".createwebhook", "CreateWebhookGlobalsTypedDict": ".createwebhook", "CreateWebhookRequest": ".createwebhook", @@ -291,10 +217,6 @@ "DeleteInteractionGlobalsTypedDict": ".deleteinteraction", "DeleteInteractionRequest": ".deleteinteraction", "DeleteInteractionRequestParam": ".deleteinteraction", - "DeleteTriggerGlobals": ".deletetrigger", - "DeleteTriggerGlobalsTypedDict": ".deletetrigger", - "DeleteTriggerRequest": ".deletetrigger", - "DeleteTriggerRequestParam": ".deletetrigger", "DeleteWebhookGlobals": ".deletewebhook", "DeleteWebhookGlobalsTypedDict": ".deletewebhook", "DeleteWebhookRequest": ".deletewebhook", @@ -309,10 +231,6 @@ "GetInteractionByIDRequestParam": ".getinteractionbyid", "GetInteractionByIDResponse": ".getinteractionbyid", "GetInteractionByIDResponseTypedDict": ".getinteractionbyid", - "GetTriggerGlobals": ".gettrigger", - "GetTriggerGlobalsTypedDict": ".gettrigger", - "GetTriggerRequest": ".gettrigger", - "GetTriggerRequestParam": ".gettrigger", "GetWebhookGlobals": ".getwebhook", "GetWebhookGlobalsTypedDict": ".getwebhook", "GetWebhookRequest": ".getwebhook", @@ -321,14 +239,6 @@ "ListAgentsGlobalsTypedDict": ".listagents", "ListAgentsRequest": ".listagents", "ListAgentsRequestParam": ".listagents", - "ListTriggerExecutionsGlobals": ".listtriggerexecutions", - "ListTriggerExecutionsGlobalsTypedDict": ".listtriggerexecutions", - "ListTriggerExecutionsRequest": ".listtriggerexecutions", - "ListTriggerExecutionsRequestParam": ".listtriggerexecutions", - "ListTriggersGlobals": ".listtriggers", - "ListTriggersGlobalsTypedDict": ".listtriggers", - "ListTriggersRequest": ".listtriggers", - "ListTriggersRequestParam": ".listtriggers", "ListWebhooksGlobals": ".listwebhooks", "ListWebhooksGlobalsTypedDict": ".listwebhooks", "ListWebhooksRequest": ".listwebhooks", @@ -341,14 +251,6 @@ "RotateSigningSecretGlobalsTypedDict": ".rotatesigningsecret", "RotateSigningSecretRequest": ".rotatesigningsecret", "RotateSigningSecretRequestParam": ".rotatesigningsecret", - "RunTriggerGlobals": ".runtrigger", - "RunTriggerGlobalsTypedDict": ".runtrigger", - "RunTriggerRequest": ".runtrigger", - "RunTriggerRequestParam": ".runtrigger", - "UpdateTriggerGlobals": ".updatetrigger", - "UpdateTriggerGlobalsTypedDict": ".updatetrigger", - "UpdateTriggerRequest": ".updatetrigger", - "UpdateTriggerRequestParam": ".updatetrigger", "UpdateWebhookGlobals": ".updatewebhook", "UpdateWebhookGlobalsTypedDict": ".updatewebhook", "UpdateWebhookRequest": ".updatewebhook", diff --git a/google/genai/_gaos/models/createtrigger.py b/google/genai/_gaos/models/createtrigger.py deleted file mode 100644 index 2b1ccc375..000000000 --- a/google/genai/_gaos/models/createtrigger.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from ..types import BaseModel, UNSET_SENTINEL -from ..types.triggers import trigger_input as triggers_trigger_input -from ..utils import FieldMetadata, PathParamMetadata, RequestMetadata -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class CreateTriggerGlobalsTypedDict(TypedDict): - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class CreateTriggerGlobals(BaseModel): - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class CreateTriggerRequestParam(TypedDict): - body: triggers_trigger_input.TriggerInputParam - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class CreateTriggerRequest(BaseModel): - body: Annotated[ - triggers_trigger_input.TriggerInput, - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] - - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/models/deletetrigger.py b/google/genai/_gaos/models/deletetrigger.py deleted file mode 100644 index edecf6c55..000000000 --- a/google/genai/_gaos/models/deletetrigger.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from ..types import BaseModel, UNSET_SENTINEL -from ..utils import FieldMetadata, PathParamMetadata -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class DeleteTriggerGlobalsTypedDict(TypedDict): - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class DeleteTriggerGlobals(BaseModel): - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class DeleteTriggerRequestParam(TypedDict): - id: str - r"""Resource name of the trigger.""" - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class DeleteTriggerRequest(BaseModel): - id: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] - r"""Resource name of the trigger.""" - - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/models/gettrigger.py b/google/genai/_gaos/models/gettrigger.py deleted file mode 100644 index a108858fe..000000000 --- a/google/genai/_gaos/models/gettrigger.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from ..types import BaseModel, UNSET_SENTINEL -from ..utils import FieldMetadata, PathParamMetadata -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetTriggerGlobalsTypedDict(TypedDict): - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class GetTriggerGlobals(BaseModel): - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class GetTriggerRequestParam(TypedDict): - id: str - r"""Resource name of the trigger.""" - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class GetTriggerRequest(BaseModel): - id: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] - r"""Resource name of the trigger.""" - - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/models/listtriggerexecutions.py b/google/genai/_gaos/models/listtriggerexecutions.py deleted file mode 100644 index 6aa44afa0..000000000 --- a/google/genai/_gaos/models/listtriggerexecutions.py +++ /dev/null @@ -1,105 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from ..types import BaseModel, UNSET_SENTINEL -from ..utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListTriggerExecutionsGlobalsTypedDict(TypedDict): - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class ListTriggerExecutionsGlobals(BaseModel): - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class ListTriggerExecutionsRequestParam(TypedDict): - id: str - r"""Resource name of the trigger.""" - api_version: NotRequired[str] - r"""Which version of the API to use.""" - page_size: NotRequired[int] - r"""Optional. The maximum number of executions to return per page.""" - page_token: NotRequired[str] - r"""Optional. A page token from a previous ListTriggerExecutions call.""" - - -class ListTriggerExecutionsRequest(BaseModel): - id: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] - r"""Resource name of the trigger.""" - - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - page_size: Annotated[ - Optional[int], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Optional. The maximum number of executions to return per page.""" - - page_token: Annotated[ - Optional[str], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Optional. A page token from a previous ListTriggerExecutions call.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version", "page_size", "page_token"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/models/listtriggers.py b/google/genai/_gaos/models/listtriggers.py deleted file mode 100644 index 58e3602b9..000000000 --- a/google/genai/_gaos/models/listtriggers.py +++ /dev/null @@ -1,108 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from ..types import BaseModel, UNSET_SENTINEL -from ..utils import FieldMetadata, PathParamMetadata, QueryParamMetadata -import pydantic -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListTriggersGlobalsTypedDict(TypedDict): - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class ListTriggersGlobals(BaseModel): - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class ListTriggersRequestParam(TypedDict): - api_version: NotRequired[str] - r"""Which version of the API to use.""" - filter_: NotRequired[str] - r"""Optional. Filter expression (e.g., by state).""" - page_size: NotRequired[int] - r"""Optional. The maximum number of triggers to return per page.""" - page_token: NotRequired[str] - r"""Optional. A page token from a previous ListTriggers call.""" - - -class ListTriggersRequest(BaseModel): - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - filter_: Annotated[ - Optional[str], - pydantic.Field(alias="filter"), - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Optional. Filter expression (e.g., by state).""" - - page_size: Annotated[ - Optional[int], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Optional. The maximum number of triggers to return per page.""" - - page_token: Annotated[ - Optional[str], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Optional. A page token from a previous ListTriggers call.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version", "filter", "page_size", "page_token"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/models/runtrigger.py b/google/genai/_gaos/models/runtrigger.py deleted file mode 100644 index 1943d9d05..000000000 --- a/google/genai/_gaos/models/runtrigger.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from ..types import BaseModel, UNSET_SENTINEL -from ..utils import FieldMetadata, PathParamMetadata -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class RunTriggerGlobalsTypedDict(TypedDict): - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class RunTriggerGlobals(BaseModel): - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class RunTriggerRequestParam(TypedDict): - id: str - r"""Resource name of the trigger.""" - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class RunTriggerRequest(BaseModel): - id: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] - r"""Resource name of the trigger.""" - - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/models/updatetrigger.py b/google/genai/_gaos/models/updatetrigger.py deleted file mode 100644 index 6cbd4ac7f..000000000 --- a/google/genai/_gaos/models/updatetrigger.py +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from ..types import BaseModel, UNSET_SENTINEL -from ..types.triggers import triggerupdate as triggers_triggerupdate -from ..utils import FieldMetadata, PathParamMetadata, RequestMetadata -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class UpdateTriggerGlobalsTypedDict(TypedDict): - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class UpdateTriggerGlobals(BaseModel): - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - -class UpdateTriggerRequestParam(TypedDict): - id: str - r"""Resource name of the trigger.""" - body: triggers_triggerupdate.TriggerUpdateParam - api_version: NotRequired[str] - r"""Which version of the API to use.""" - - -class UpdateTriggerRequest(BaseModel): - id: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] - r"""Resource name of the trigger.""" - - body: Annotated[ - triggers_triggerupdate.TriggerUpdate, - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] - - api_version: Annotated[ - Optional[str], - FieldMetadata(path=PathParamMetadata(style="simple", explode=False)), - ] = None - r"""Which version of the API to use.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["api_version"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/resources/__init__.py b/google/genai/_gaos/resources/__init__.py index 787000262..e8225e9ae 100644 --- a/google/genai/_gaos/resources/__init__.py +++ b/google/genai/_gaos/resources/__init__.py @@ -18,7 +18,6 @@ from . import agents from . import interactions -from . import triggers from . import webhooks -__all__ = ["agents", "interactions", "triggers", "webhooks"] +__all__ = ["agents", "interactions", "webhooks"] diff --git a/google/genai/_gaos/resources/triggers/__init__.py b/google/genai/_gaos/resources/triggers/__init__.py deleted file mode 100644 index 190a7bfdd..000000000 --- a/google/genai/_gaos/resources/triggers/__init__.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from ...models.createtrigger import CreateTriggerRequestParam as TriggerCreateParams -from ...models.deletetrigger import DeleteTriggerRequestParam as TriggerDeleteParams -from ...models.gettrigger import GetTriggerRequestParam as TriggerGetParams -from ...models.listtriggerexecutions import ( - ListTriggerExecutionsRequestParam as TriggerListExecutionsParams, -) -from ...models.listtriggers import ListTriggersRequestParam as TriggerListParams -from ...models.runtrigger import RunTriggerRequestParam as TriggerRunParams -from ...models.updatetrigger import UpdateTriggerRequestParam as TriggerUpdateParams -from ...types.interactions.empty import Empty as TriggerDeleteResponse -from ...types.triggers.listtriggerexecutionsresponse import ( - ListTriggerExecutionsResponse, -) -from ...types.triggers.listtriggersresponse import ListTriggersResponse -from ...types.triggers.trigger import Trigger -from ...types.triggers.trigger_input import ( - TriggerInput, - TriggerInputParam as TriggerParam, -) -from ...types.triggers.triggerexecution import TriggerExecution -from ...types.triggers.triggerinteractionrequest import TriggerInteractionRequest -from ...types.triggers.triggerupdate import TriggerUpdate - -TriggerListExecutionsResponse = ListTriggerExecutionsResponse -TriggerListResponse = ListTriggersResponse -__all__ = [ - "ListTriggerExecutionsResponse", - "ListTriggersResponse", - "Trigger", - "TriggerCreateParams", - "TriggerDeleteParams", - "TriggerDeleteResponse", - "TriggerExecution", - "TriggerGetParams", - "TriggerInput", - "TriggerInteractionRequest", - "TriggerListExecutionsParams", - "TriggerListExecutionsResponse", - "TriggerListParams", - "TriggerListResponse", - "TriggerParam", - "TriggerRunParams", - "TriggerUpdate", - "TriggerUpdateParams", -] diff --git a/google/genai/_gaos/sdk.py b/google/genai/_gaos/sdk.py index 57562e585..452882316 100644 --- a/google/genai/_gaos/sdk.py +++ b/google/genai/_gaos/sdk.py @@ -40,7 +40,6 @@ if TYPE_CHECKING: from .agents import Agents, AsyncAgents from .interactions import AsyncInteractions, Interactions - from .triggers import AsyncTriggers, Triggers from .webhooks import AsyncWebhooks, Webhooks @@ -58,12 +57,10 @@ def with_streaming_response(self): interactions: "Interactions" webhooks: "Webhooks" agents: "Agents" - triggers: "Triggers" _sub_sdk_map = { "interactions": (".interactions", "Interactions"), "webhooks": (".webhooks", "Webhooks"), "agents": (".agents", "Agents"), - "triggers": (".triggers", "Triggers"), } def __init__( @@ -219,10 +216,6 @@ def webhooks(self): def agents(self): return self._sdk.agents.with_raw_response - @property - def triggers(self): - return self._sdk.triggers.with_raw_response - class GenAIWithStreamingResponse: def __init__(self, sdk: GenAI) -> None: @@ -240,10 +233,6 @@ def webhooks(self): def agents(self): return self._sdk.agents.with_streaming_response - @property - def triggers(self): - return self._sdk.triggers.with_streaming_response - class AsyncGenAI(AsyncBaseSDK): r"""Gemini API: The Gemini Interactions API allows developers to build generative AI applications using Gemini models. Gemini is our most capable model, built from the ground up to be multimodal. It can generalize and seamlessly understand, operate across, and combine different types of information including language, images, audio, video, and code. You can use the Gemini API for use cases like reasoning across text and images, content generation, dialogue agents, summarization and classification systems, and more.""" @@ -259,12 +248,10 @@ def with_streaming_response(self): interactions: "AsyncInteractions" webhooks: "AsyncWebhooks" agents: "AsyncAgents" - triggers: "AsyncTriggers" _sub_sdk_map = { "interactions": (".interactions", "AsyncInteractions"), "webhooks": (".webhooks", "AsyncWebhooks"), "agents": (".agents", "AsyncAgents"), - "triggers": (".triggers", "AsyncTriggers"), } def __init__( @@ -418,10 +405,6 @@ def webhooks(self): def agents(self): return self._sdk.agents.with_raw_response - @property - def triggers(self): - return self._sdk.triggers.with_raw_response - class AsyncGenAIWithStreamingResponse: def __init__(self, sdk: AsyncGenAI) -> None: @@ -438,7 +421,3 @@ def webhooks(self): @property def agents(self): return self._sdk.agents.with_streaming_response - - @property - def triggers(self): - return self._sdk.triggers.with_streaming_response diff --git a/google/genai/_gaos/triggers.py b/google/genai/_gaos/triggers.py deleted file mode 100644 index 9a37b875f..000000000 --- a/google/genai/_gaos/triggers.py +++ /dev/null @@ -1,2403 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from . import errors, models, types, utils -from ._hooks import AfterParseErrorContext, HookContext, ResponseContext -from .basesdk import AsyncBaseSDK, BaseSDK -from .types import OptionalNullable, UNSET, interactions, triggers -from .types.triggers import ( - triggerinteractionrequest as triggers_triggerinteractionrequest, - triggerupdate as triggers_triggerupdate, -) -from .utils import get_security_from_env, response_helpers -from .utils.unmarshal_json_response import unmarshal_json_response -import httpx -from typing import Any, Mapping, Optional, Union, cast - - -class Triggers(BaseSDK): - @property - def with_raw_response(self): - return TriggersWithRawResponse(self) - - @property - def with_streaming_response(self): - return TriggersWithStreamingResponse(self) - - def create( - self, - *, - interaction: Union[ - triggers_triggerinteractionrequest.TriggerInteractionRequest, - triggers_triggerinteractionrequest.TriggerInteractionRequestParam, - ], - schedule: str, - time_zone: str, - api_version: Optional[str] = None, - display_name: Optional[str] = None, - environment_id: Optional[str] = None, - execution_timeout_seconds: Optional[int] = None, - max_consecutive_failures: Optional[int] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.Trigger: - r"""Creates a new trigger that will invoke the specified agent on the given cron schedule. - - :param interaction: Configuration parameters for the interaction request template. - :param schedule: Required. The cron schedule on which the trigger should run. - Standard cron format. - :param time_zone: Required. Time zone in which the schedule should be interpreted. - :param api_version: Which version of the API to use. - :param display_name: Optional. The display name of the trigger. - :param environment_id: Optional. The environment ID for the trigger execution. - :param execution_timeout_seconds: Optional. The execution timeout for the triggered interaction. - :param max_consecutive_failures: Optional. The maximum number of consecutive failures allowed before - the trigger is automatically paused (status becomes ERROR). - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.CreateTriggerRequest( - api_version=api_version, - body=triggers.TriggerInput( - display_name=display_name, - environment_id=environment_id, - execution_timeout_seconds=execution_timeout_seconds, - interaction=utils.get_pydantic_model( - interaction, triggers.TriggerInteractionRequest - ), - max_consecutive_failures=max_consecutive_failures, - schedule=schedule, - time_zone=time_zone, - ), - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request( - method="POST", - path="/{api_version}/triggers", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.CreateTriggerGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body, - False, - False, - "json", - triggers.TriggerInput, - extra_body=extra_body, - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - triggers.Trigger, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="CreateTrigger", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="sync"), - ) - http_res = self.do_request( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - http_res.read() - try: - _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.StreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.APIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - ), - ) - try: - return _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - def list( - self, - *, - api_version: Optional[str] = None, - filter_: Optional[str] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.ListTriggersResponse: - r"""Lists triggers for a project. - - :param api_version: Which version of the API to use. - :param filter_: Optional. Filter expression (e.g., by state). - :param page_size: Optional. The maximum number of triggers to return per page. - :param page_token: Optional. A page token from a previous ListTriggers call. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.ListTriggersRequest( - api_version=api_version, - filter_=filter_, - page_size=page_size, - page_token=page_token, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request( - method="GET", - path="/{api_version}/triggers", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.ListTriggersGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - triggers.ListTriggersResponse, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="ListTriggers", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="sync"), - ) - http_res = self.do_request( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - http_res.read() - try: - _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.StreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.APIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - ), - ) - try: - return _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - def get( - self, - id: str, - *, - api_version: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.Trigger: - r"""Gets details of a single trigger. - - :param id: Resource name of the trigger. - :param api_version: Which version of the API to use. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.GetTriggerRequest( - api_version=api_version, - id=id, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request( - method="GET", - path="/{api_version}/triggers/{id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.GetTriggerGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - triggers.Trigger, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="GetTrigger", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="sync"), - ) - http_res = self.do_request( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - http_res.read() - try: - _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.StreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.APIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - ), - ) - try: - return _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - def update( - self, - id: str, - *, - api_version: Optional[str] = None, - display_name: Optional[str] = None, - status: Optional[triggers_triggerupdate.TriggerUpdateStatus] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.Trigger: - r"""Updates a trigger. - - :param id: Resource name of the trigger. - :param api_version: Which version of the API to use. - :param display_name: Optional. The display name of the trigger. - :param status: Optional. The status of the trigger. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.UpdateTriggerRequest( - api_version=api_version, - id=id, - body=triggers.TriggerUpdate( - display_name=display_name, - status=status, - ), - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request( - method="PATCH", - path="/{api_version}/triggers/{id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.UpdateTriggerGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body, - False, - False, - "json", - triggers.TriggerUpdate, - extra_body=extra_body, - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - triggers.Trigger, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="UpdateTrigger", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="sync"), - ) - http_res = self.do_request( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - http_res.read() - try: - _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.StreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.APIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - ), - ) - try: - return _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - def delete( - self, - id: str, - *, - api_version: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.Empty: - r"""Deletes a trigger. - - :param id: Resource name of the trigger. - :param api_version: Which version of the API to use. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.DeleteTriggerRequest( - api_version=api_version, - id=id, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request( - method="DELETE", - path="/{api_version}/triggers/{id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.DeleteTriggerGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - interactions.Empty, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="DeleteTrigger", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="sync"), - ) - http_res = self.do_request( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - http_res.read() - try: - _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.StreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.APIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - ), - ) - try: - return _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - def run( - self, - id: str, - *, - api_version: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.TriggerExecution: - r"""Runs a trigger immediately. - - :param id: Resource name of the trigger. - :param api_version: Which version of the API to use. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.RunTriggerRequest( - api_version=api_version, - id=id, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request( - method="POST", - path="/{api_version}/triggers/{id}/executions", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.RunTriggerGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - triggers.TriggerExecution, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="RunTrigger", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="sync"), - ) - http_res = self.do_request( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - http_res.read() - try: - _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.StreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.APIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - ), - ) - try: - return _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - def list_executions( - self, - id: str, - *, - api_version: Optional[str] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.ListTriggerExecutionsResponse: - r"""Lists executions for a trigger. - - :param id: Resource name of the trigger. - :param api_version: Which version of the API to use. - :param page_size: Optional. The maximum number of executions to return per page. - :param page_token: Optional. A page token from a previous ListTriggerExecutions call. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.ListTriggerExecutionsRequest( - api_version=api_version, - id=id, - page_size=page_size, - page_token=page_token, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request( - method="GET", - path="/{api_version}/triggers/{id}/executions", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.ListTriggerExecutionsGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - triggers.ListTriggerExecutionsResponse, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="ListTriggerExecutions", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="sync"), - ) - http_res = self.do_request( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - http_res.read() - try: - _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.StreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.APIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - ), - ) - try: - return _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - response_helpers.raise_parse_error( - self.sdk_configuration.__dict__["_hooks"], - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - -class TriggersWithRawResponse: - def __init__(self, sdk: Triggers) -> None: - self._sdk = sdk - self.create = response_helpers.to_raw_response_wrapper( - sdk.create, "extra_headers" - ) - self.list = response_helpers.to_raw_response_wrapper(sdk.list, "extra_headers") - self.get = response_helpers.to_raw_response_wrapper(sdk.get, "extra_headers") - self.update = response_helpers.to_raw_response_wrapper( - sdk.update, "extra_headers" - ) - self.delete = response_helpers.to_raw_response_wrapper( - sdk.delete, "extra_headers" - ) - self.run = response_helpers.to_raw_response_wrapper(sdk.run, "extra_headers") - self.list_executions = response_helpers.to_raw_response_wrapper( - sdk.list_executions, "extra_headers" - ) - - -class TriggersWithStreamingResponse: - def __init__(self, sdk: Triggers) -> None: - self._sdk = sdk - self.create = response_helpers.to_streamed_response_wrapper( - sdk.create, "extra_headers" - ) - self.list = response_helpers.to_streamed_response_wrapper( - sdk.list, "extra_headers" - ) - self.get = response_helpers.to_streamed_response_wrapper( - sdk.get, "extra_headers" - ) - self.update = response_helpers.to_streamed_response_wrapper( - sdk.update, "extra_headers" - ) - self.delete = response_helpers.to_streamed_response_wrapper( - sdk.delete, "extra_headers" - ) - self.run = response_helpers.to_streamed_response_wrapper( - sdk.run, "extra_headers" - ) - self.list_executions = response_helpers.to_streamed_response_wrapper( - sdk.list_executions, "extra_headers" - ) - - -class AsyncTriggers(AsyncBaseSDK): - @property - def with_raw_response(self): - return AsyncTriggersWithRawResponse(self) - - @property - def with_streaming_response(self): - return AsyncTriggersWithStreamingResponse(self) - - async def create( - self, - *, - interaction: Union[ - triggers_triggerinteractionrequest.TriggerInteractionRequest, - triggers_triggerinteractionrequest.TriggerInteractionRequestParam, - ], - schedule: str, - time_zone: str, - api_version: Optional[str] = None, - display_name: Optional[str] = None, - environment_id: Optional[str] = None, - execution_timeout_seconds: Optional[int] = None, - max_consecutive_failures: Optional[int] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.Trigger: - r"""Creates a new trigger that will invoke the specified agent on the given cron schedule. - - :param interaction: Configuration parameters for the interaction request template. - :param schedule: Required. The cron schedule on which the trigger should run. - Standard cron format. - :param time_zone: Required. Time zone in which the schedule should be interpreted. - :param api_version: Which version of the API to use. - :param display_name: Optional. The display name of the trigger. - :param environment_id: Optional. The environment ID for the trigger execution. - :param execution_timeout_seconds: Optional. The execution timeout for the triggered interaction. - :param max_consecutive_failures: Optional. The maximum number of consecutive failures allowed before - the trigger is automatically paused (status becomes ERROR). - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.CreateTriggerRequest( - api_version=api_version, - body=triggers.TriggerInput( - display_name=display_name, - environment_id=environment_id, - execution_timeout_seconds=execution_timeout_seconds, - interaction=utils.get_pydantic_model( - interaction, triggers.TriggerInteractionRequest - ), - max_consecutive_failures=max_consecutive_failures, - schedule=schedule, - time_zone=time_zone, - ), - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="POST", - path="/{api_version}/triggers", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.CreateTriggerGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body, - False, - False, - "json", - triggers.TriggerInput, - extra_body=extra_body, - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - async def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - triggers.Trigger, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="CreateTrigger", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="async"), - ) - http_res = await self.do_request_async( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - await http_res.aread() - try: - await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.AsyncStreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.AsyncAPIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - async_hooks=self.sdk_configuration.__dict__.get("_async_hooks"), - ), - ) - try: - return await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - async def list( - self, - *, - api_version: Optional[str] = None, - filter_: Optional[str] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.ListTriggersResponse: - r"""Lists triggers for a project. - - :param api_version: Which version of the API to use. - :param filter_: Optional. Filter expression (e.g., by state). - :param page_size: Optional. The maximum number of triggers to return per page. - :param page_token: Optional. A page token from a previous ListTriggers call. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.ListTriggersRequest( - api_version=api_version, - filter_=filter_, - page_size=page_size, - page_token=page_token, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="GET", - path="/{api_version}/triggers", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.ListTriggersGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - async def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - triggers.ListTriggersResponse, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="ListTriggers", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="async"), - ) - http_res = await self.do_request_async( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - await http_res.aread() - try: - await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.AsyncStreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.AsyncAPIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - async_hooks=self.sdk_configuration.__dict__.get("_async_hooks"), - ), - ) - try: - return await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - async def get( - self, - id: str, - *, - api_version: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.Trigger: - r"""Gets details of a single trigger. - - :param id: Resource name of the trigger. - :param api_version: Which version of the API to use. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.GetTriggerRequest( - api_version=api_version, - id=id, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="GET", - path="/{api_version}/triggers/{id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.GetTriggerGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - async def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - triggers.Trigger, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="GetTrigger", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="async"), - ) - http_res = await self.do_request_async( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - await http_res.aread() - try: - await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.AsyncStreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.AsyncAPIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - async_hooks=self.sdk_configuration.__dict__.get("_async_hooks"), - ), - ) - try: - return await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - async def update( - self, - id: str, - *, - api_version: Optional[str] = None, - display_name: Optional[str] = None, - status: Optional[triggers_triggerupdate.TriggerUpdateStatus] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - extra_body: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.Trigger: - r"""Updates a trigger. - - :param id: Resource name of the trigger. - :param api_version: Which version of the API to use. - :param display_name: Optional. The display name of the trigger. - :param status: Optional. The status of the trigger. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param extra_body: Additional JSON object fields to merge into request bodies. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.UpdateTriggerRequest( - api_version=api_version, - id=id, - body=triggers.TriggerUpdate( - display_name=display_name, - status=status, - ), - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="PATCH", - path="/{api_version}/triggers/{id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.UpdateTriggerGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.body, - False, - False, - "json", - triggers.TriggerUpdate, - extra_body=extra_body, - ), - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - async def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - triggers.Trigger, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="UpdateTrigger", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="async"), - ) - http_res = await self.do_request_async( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - await http_res.aread() - try: - await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.AsyncStreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.AsyncAPIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - async_hooks=self.sdk_configuration.__dict__.get("_async_hooks"), - ), - ) - try: - return await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - async def delete( - self, - id: str, - *, - api_version: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.Empty: - r"""Deletes a trigger. - - :param id: Resource name of the trigger. - :param api_version: Which version of the API to use. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.DeleteTriggerRequest( - api_version=api_version, - id=id, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="DELETE", - path="/{api_version}/triggers/{id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.DeleteTriggerGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - async def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - interactions.Empty, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="DeleteTrigger", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="async"), - ) - http_res = await self.do_request_async( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - await http_res.aread() - try: - await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.AsyncStreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.AsyncAPIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - async_hooks=self.sdk_configuration.__dict__.get("_async_hooks"), - ), - ) - try: - return await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - async def run( - self, - id: str, - *, - api_version: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.TriggerExecution: - r"""Runs a trigger immediately. - - :param id: Resource name of the trigger. - :param api_version: Which version of the API to use. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.RunTriggerRequest( - api_version=api_version, - id=id, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="POST", - path="/{api_version}/triggers/{id}/executions", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.RunTriggerGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - async def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - triggers.TriggerExecution, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="RunTrigger", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="async"), - ) - http_res = await self.do_request_async( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - await http_res.aread() - try: - await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.AsyncStreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.AsyncAPIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - async_hooks=self.sdk_configuration.__dict__.get("_async_hooks"), - ), - ) - try: - return await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - async def list_executions( - self, - id: str, - *, - api_version: Optional[str] = None, - page_size: Optional[int] = None, - page_token: Optional[str] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> triggers.ListTriggerExecutionsResponse: - r"""Lists executions for a trigger. - - :param id: Resource name of the trigger. - :param api_version: Which version of the API to use. - :param page_size: Optional. The maximum number of executions to return per page. - :param page_token: Optional. A page token from a previous ListTriggerExecutions call. - :param extra_headers: Additional headers to set or replace on requests. - :param extra_query: Additional query parameters to append to requests. - :param timeout: Override the default request timeout configuration for this method in seconds - """ - base_url = None - url_variables = None - retries: OptionalNullable[utils.RetryConfig] = UNSET - server_url = None - http_headers = extra_headers - timeout_ms = self._coerce_timeout_ms(timeout) - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.ListTriggerExecutionsRequest( - api_version=api_version, - id=id, - page_size=page_size, - page_token=page_token, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="GET", - path="/{api_version}/triggers/{id}/executions", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - _globals=models.ListTriggerExecutionsGlobals( - api_version=self.sdk_configuration.globals.api_version, - ), - security=self.sdk_configuration.security, - allow_empty_value=None, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - else: - retries = utils.RetryConfig( - "attempt-count-backoff", - utils.BackoffStrategy(500, 8000, 2, 30000), - True, - max_retries=4, - ) - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["408", "409", "429", "5XX"]) - - async def _speakeasy_parse_response(http_res): - if utils.match_response(http_res, "200", "application/json"): - return unmarshal_json_response( - triggers.ListTriggerExecutionsResponse, http_res, validate=False - ) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise errors.GenAiDefaultError( - "API error occurred", http_res, http_res_text - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="ListTriggerExecutions", - oauth2_scopes=None, - security_source=get_security_from_env( - self.sdk_configuration.security, types.Security - ), - tags=None, - extensions=None, - response=ResponseContext(mode=_speakeasy_response_mode, execution="async"), - ) - http_res = await self.do_request_async( - hook_ctx=_speakeasy_hook_ctx, - request=req, - is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), - stream=_speakeasy_response_mode == "streaming", - retry_config=retry_config, - ) - if _speakeasy_response_mode != "parsed": - if utils.match_status_codes(["4XX", "5XX"], http_res.status_code): - await http_res.aread() - try: - await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - _speakeasy_response_cls = ( - response_helpers.AsyncStreamedAPIResponse - if _speakeasy_response_mode == "streaming" - else response_helpers.AsyncAPIResponse - ) - return cast( - Any, - _speakeasy_response_cls( - raw=http_res, - parser=_speakeasy_parse_response, - mode="buffered", - client_ref=self, - hook_ctx=AfterParseErrorContext(_speakeasy_hook_ctx), - hooks=self.sdk_configuration.__dict__.get("_hooks"), - async_hooks=self.sdk_configuration.__dict__.get("_async_hooks"), - ), - ) - try: - return await _speakeasy_parse_response(http_res) - except Exception as parse_exc_: - await response_helpers.raise_parse_error_async( - self.sdk_configuration.__dict__.get("_async_hooks"), - self.sdk_configuration.__dict__.get("_hooks"), - AfterParseErrorContext(_speakeasy_hook_ctx), - http_res, - parse_exc_, - ) - - -class AsyncTriggersWithRawResponse: - def __init__(self, sdk: AsyncTriggers) -> None: - self._sdk = sdk - self.create = response_helpers.async_to_raw_response_wrapper( - sdk.create, "extra_headers" - ) - self.list = response_helpers.async_to_raw_response_wrapper( - sdk.list, "extra_headers" - ) - self.get = response_helpers.async_to_raw_response_wrapper( - sdk.get, "extra_headers" - ) - self.update = response_helpers.async_to_raw_response_wrapper( - sdk.update, "extra_headers" - ) - self.delete = response_helpers.async_to_raw_response_wrapper( - sdk.delete, "extra_headers" - ) - self.run = response_helpers.async_to_raw_response_wrapper( - sdk.run, "extra_headers" - ) - self.list_executions = response_helpers.async_to_raw_response_wrapper( - sdk.list_executions, "extra_headers" - ) - - -class AsyncTriggersWithStreamingResponse: - def __init__(self, sdk: AsyncTriggers) -> None: - self._sdk = sdk - self.create = response_helpers.async_to_streamed_response_wrapper( - sdk.create, "extra_headers" - ) - self.list = response_helpers.async_to_streamed_response_wrapper( - sdk.list, "extra_headers" - ) - self.get = response_helpers.async_to_streamed_response_wrapper( - sdk.get, "extra_headers" - ) - self.update = response_helpers.async_to_streamed_response_wrapper( - sdk.update, "extra_headers" - ) - self.delete = response_helpers.async_to_streamed_response_wrapper( - sdk.delete, "extra_headers" - ) - self.run = response_helpers.async_to_streamed_response_wrapper( - sdk.run, "extra_headers" - ) - self.list_executions = response_helpers.async_to_streamed_response_wrapper( - sdk.list_executions, "extra_headers" - ) diff --git a/google/genai/_gaos/types/__init__.py b/google/genai/_gaos/types/__init__.py index cc3a48953..995e476ee 100644 --- a/google/genai/_gaos/types/__init__.py +++ b/google/genai/_gaos/types/__init__.py @@ -32,7 +32,7 @@ if TYPE_CHECKING: from .security import Security, SecurityTypedDict - from . import agents, interactions, triggers, webhooks + from . import agents, interactions, webhooks __all__ = [ "Base64EncodedString", @@ -53,7 +53,7 @@ "SecurityTypedDict": ".security", } -_sub_packages = ["agents", "interactions", "triggers", "webhooks"] +_sub_packages = ["agents", "interactions", "webhooks"] def __getattr__(attr_name: str) -> Any: diff --git a/google/genai/_gaos/types/triggers/__init__.py b/google/genai/_gaos/types/triggers/__init__.py deleted file mode 100644 index 6ef9134e3..000000000 --- a/google/genai/_gaos/types/triggers/__init__.py +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from typing import Any, TYPE_CHECKING - -from ...utils.dynamic_imports import lazy_getattr, lazy_dir - -if TYPE_CHECKING: - from .listtriggerexecutionsresponse import ( - ListTriggerExecutionsResponse, - ListTriggerExecutionsResponseTypedDict, - ) - from .listtriggersresponse import ( - ListTriggersResponse, - ListTriggersResponseTypedDict, - ) - from .trigger import Trigger, TriggerStatus, TriggerTypedDict - from .trigger_input import TriggerInput, TriggerInputParam - from .triggerexecution import ( - TriggerExecution, - TriggerExecutionStatus, - TriggerExecutionTypedDict, - ) - from .triggerinteractionrequest import ( - TriggerInteractionRequest, - TriggerInteractionRequestParam, - ) - from .triggerupdate import TriggerUpdate, TriggerUpdateParam, TriggerUpdateStatus - -__all__ = [ - "ListTriggerExecutionsResponse", - "ListTriggerExecutionsResponseTypedDict", - "ListTriggersResponse", - "ListTriggersResponseTypedDict", - "Trigger", - "TriggerExecution", - "TriggerExecutionStatus", - "TriggerExecutionTypedDict", - "TriggerInput", - "TriggerInputParam", - "TriggerInteractionRequest", - "TriggerInteractionRequestParam", - "TriggerStatus", - "TriggerTypedDict", - "TriggerUpdate", - "TriggerUpdateParam", - "TriggerUpdateStatus", -] - -_dynamic_imports: dict[str, str] = { - "ListTriggerExecutionsResponse": ".listtriggerexecutionsresponse", - "ListTriggerExecutionsResponseTypedDict": ".listtriggerexecutionsresponse", - "ListTriggersResponse": ".listtriggersresponse", - "ListTriggersResponseTypedDict": ".listtriggersresponse", - "Trigger": ".trigger", - "TriggerStatus": ".trigger", - "TriggerTypedDict": ".trigger", - "TriggerInput": ".trigger_input", - "TriggerInputParam": ".trigger_input", - "TriggerExecution": ".triggerexecution", - "TriggerExecutionStatus": ".triggerexecution", - "TriggerExecutionTypedDict": ".triggerexecution", - "TriggerInteractionRequest": ".triggerinteractionrequest", - "TriggerInteractionRequestParam": ".triggerinteractionrequest", - "TriggerUpdate": ".triggerupdate", - "TriggerUpdateParam": ".triggerupdate", - "TriggerUpdateStatus": ".triggerupdate", -} - - -def __getattr__(attr_name: str) -> Any: - return lazy_getattr( - attr_name, package=__package__, dynamic_imports=_dynamic_imports - ) - - -def __dir__(): - return lazy_dir(dynamic_imports=_dynamic_imports) diff --git a/google/genai/_gaos/types/triggers/listtriggerexecutionsresponse.py b/google/genai/_gaos/types/triggers/listtriggerexecutionsresponse.py deleted file mode 100644 index 7d3064aff..000000000 --- a/google/genai/_gaos/types/triggers/listtriggerexecutionsresponse.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from .triggerexecution import TriggerExecution, TriggerExecutionTypedDict -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import NotRequired, TypedDict - - -class ListTriggerExecutionsResponseTypedDict(TypedDict): - r"""Response message for TriggerService.ListTriggerExecutions.""" - - next_page_token: NotRequired[str] - r"""A page token, received from a previous `ListTriggerExecutions` call. - Provide this to retrieve the subsequent page. - """ - trigger_executions: NotRequired[List[TriggerExecutionTypedDict]] - r"""The list of trigger executions.""" - - -class ListTriggerExecutionsResponse(BaseModel): - r"""Response message for TriggerService.ListTriggerExecutions.""" - - next_page_token: Optional[str] = None - r"""A page token, received from a previous `ListTriggerExecutions` call. - Provide this to retrieve the subsequent page. - """ - - trigger_executions: Optional[List[TriggerExecution]] = None - r"""The list of trigger executions.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["next_page_token", "trigger_executions"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/types/triggers/listtriggersresponse.py b/google/genai/_gaos/types/triggers/listtriggersresponse.py deleted file mode 100644 index b433607e6..000000000 --- a/google/genai/_gaos/types/triggers/listtriggersresponse.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from .trigger import Trigger, TriggerTypedDict -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import NotRequired, TypedDict - - -class ListTriggersResponseTypedDict(TypedDict): - r"""Response message for TriggerService.ListTriggers.""" - - next_page_token: NotRequired[str] - r"""A page token, received from a previous `ListTriggers` call. - Provide this to retrieve the subsequent page. - """ - triggers: NotRequired[List[TriggerTypedDict]] - r"""The list of triggers.""" - - -class ListTriggersResponse(BaseModel): - r"""Response message for TriggerService.ListTriggers.""" - - next_page_token: Optional[str] = None - r"""A page token, received from a previous `ListTriggers` call. - Provide this to retrieve the subsequent page. - """ - - triggers: Optional[List[Trigger]] = None - r"""The list of triggers.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["next_page_token", "triggers"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/types/triggers/trigger.py b/google/genai/_gaos/types/triggers/trigger.py deleted file mode 100644 index b2f8c3299..000000000 --- a/google/genai/_gaos/types/triggers/trigger.py +++ /dev/null @@ -1,177 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr -from .triggerinteractionrequest import ( - TriggerInteractionRequest, - TriggerInteractionRequestParam, -) -from datetime import datetime -from pydantic import model_serializer -from typing import Literal, Optional, Union -from typing_extensions import NotRequired, TypedDict - - -TriggerStatus = Union[ - Literal[ - "active", - "paused", - "error", - ], - UnrecognizedStr, -] -r"""Output only. The current status of the trigger.""" - - -class TriggerTypedDict(TypedDict): - r"""A trigger configuration that is scheduled to run an agent.""" - - id: str - r"""Required. Output only. Identifier. The ID of the trigger.""" - interaction: TriggerInteractionRequestParam - r"""Configuration parameters for the interaction request template.""" - schedule: str - r"""Required. The cron schedule on which the trigger should run. - Standard cron format. - """ - time_zone: str - r"""Required. Time zone in which the schedule should be interpreted.""" - consecutive_failure_count: NotRequired[int] - r"""Output only. The number of consecutive failures that have occurred - since the last successful execution. - """ - create_time: NotRequired[datetime] - r"""Output only. The time when the trigger was created.""" - display_name: NotRequired[str] - r"""Optional. The display name of the trigger.""" - environment_id: NotRequired[str] - r"""Optional. The environment ID for the trigger execution.""" - execution_timeout_seconds: NotRequired[int] - r"""Optional. The execution timeout for the triggered interaction.""" - last_pause_time: NotRequired[datetime] - r"""Output only. The time when the trigger was last paused.""" - last_resume_time: NotRequired[datetime] - r"""Output only. The time when the trigger was last resumed.""" - last_run_time: NotRequired[datetime] - r"""Output only. The time when the trigger was last run.""" - max_consecutive_failures: NotRequired[int] - r"""Optional. The maximum number of consecutive failures allowed before - the trigger is automatically paused (status becomes ERROR). - """ - next_run_time: NotRequired[datetime] - r"""Output only. The time when the trigger is scheduled to run next.""" - previous_interaction_id: NotRequired[str] - r"""Output only. The ID of the last interaction created by this trigger.""" - status: NotRequired[TriggerStatus] - r"""Output only. The current status of the trigger.""" - update_time: NotRequired[datetime] - r"""Output only. The time when the trigger was last updated.""" - - -class Trigger(BaseModel): - r"""A trigger configuration that is scheduled to run an agent.""" - - id: str - r"""Required. Output only. Identifier. The ID of the trigger.""" - - interaction: TriggerInteractionRequest - r"""Configuration parameters for the interaction request template.""" - - schedule: str - r"""Required. The cron schedule on which the trigger should run. - Standard cron format. - """ - - time_zone: str - r"""Required. Time zone in which the schedule should be interpreted.""" - - consecutive_failure_count: Optional[int] = None - r"""Output only. The number of consecutive failures that have occurred - since the last successful execution. - """ - - create_time: Optional[datetime] = None - r"""Output only. The time when the trigger was created.""" - - display_name: Optional[str] = None - r"""Optional. The display name of the trigger.""" - - environment_id: Optional[str] = None - r"""Optional. The environment ID for the trigger execution.""" - - execution_timeout_seconds: Optional[int] = None - r"""Optional. The execution timeout for the triggered interaction.""" - - last_pause_time: Optional[datetime] = None - r"""Output only. The time when the trigger was last paused.""" - - last_resume_time: Optional[datetime] = None - r"""Output only. The time when the trigger was last resumed.""" - - last_run_time: Optional[datetime] = None - r"""Output only. The time when the trigger was last run.""" - - max_consecutive_failures: Optional[int] = None - r"""Optional. The maximum number of consecutive failures allowed before - the trigger is automatically paused (status becomes ERROR). - """ - - next_run_time: Optional[datetime] = None - r"""Output only. The time when the trigger is scheduled to run next.""" - - previous_interaction_id: Optional[str] = None - r"""Output only. The ID of the last interaction created by this trigger.""" - - status: Optional[TriggerStatus] = None - r"""Output only. The current status of the trigger.""" - - update_time: Optional[datetime] = None - r"""Output only. The time when the trigger was last updated.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "consecutive_failure_count", - "create_time", - "display_name", - "environment_id", - "execution_timeout_seconds", - "last_pause_time", - "last_resume_time", - "last_run_time", - "max_consecutive_failures", - "next_run_time", - "previous_interaction_id", - "status", - "update_time", - ] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/types/triggers/trigger_input.py b/google/genai/_gaos/types/triggers/trigger_input.py deleted file mode 100644 index 143406a5d..000000000 --- a/google/genai/_gaos/types/triggers/trigger_input.py +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from .triggerinteractionrequest import ( - TriggerInteractionRequest, - TriggerInteractionRequestParam, -) -from pydantic import model_serializer -from typing import Optional -from typing_extensions import NotRequired, TypedDict - - -class TriggerInputParam(TypedDict): - r"""A trigger configuration that is scheduled to run an agent.""" - - interaction: TriggerInteractionRequestParam - r"""Configuration parameters for the interaction request template.""" - schedule: str - r"""Required. The cron schedule on which the trigger should run. - Standard cron format. - """ - time_zone: str - r"""Required. Time zone in which the schedule should be interpreted.""" - display_name: NotRequired[str] - r"""Optional. The display name of the trigger.""" - environment_id: NotRequired[str] - r"""Optional. The environment ID for the trigger execution.""" - execution_timeout_seconds: NotRequired[int] - r"""Optional. The execution timeout for the triggered interaction.""" - max_consecutive_failures: NotRequired[int] - r"""Optional. The maximum number of consecutive failures allowed before - the trigger is automatically paused (status becomes ERROR). - """ - - -class TriggerInput(BaseModel): - r"""A trigger configuration that is scheduled to run an agent.""" - - interaction: TriggerInteractionRequest - r"""Configuration parameters for the interaction request template.""" - - schedule: str - r"""Required. The cron schedule on which the trigger should run. - Standard cron format. - """ - - time_zone: str - r"""Required. Time zone in which the schedule should be interpreted.""" - - display_name: Optional[str] = None - r"""Optional. The display name of the trigger.""" - - environment_id: Optional[str] = None - r"""Optional. The environment ID for the trigger execution.""" - - execution_timeout_seconds: Optional[int] = None - r"""Optional. The execution timeout for the triggered interaction.""" - - max_consecutive_failures: Optional[int] = None - r"""Optional. The maximum number of consecutive failures allowed before - the trigger is automatically paused (status becomes ERROR). - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "display_name", - "environment_id", - "execution_timeout_seconds", - "max_consecutive_failures", - ] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/types/triggers/triggerexecution.py b/google/genai/_gaos/types/triggers/triggerexecution.py deleted file mode 100644 index f6f721651..000000000 --- a/google/genai/_gaos/types/triggers/triggerexecution.py +++ /dev/null @@ -1,117 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr -from datetime import datetime -from pydantic import model_serializer -from typing import Literal, Optional, Union -from typing_extensions import NotRequired, TypedDict - - -TriggerExecutionStatus = Union[ - Literal[ - "in_progress", - "completed", - "failed", - "skipped", - "timed_out", - ], - UnrecognizedStr, -] -r"""Output only. The status of the execution.""" - - -class TriggerExecutionTypedDict(TypedDict): - r"""An execution instance of a trigger.""" - - id: str - r"""Required. Output only. Identifier. The ID of the trigger execution.""" - trigger_id: str - r"""Required. Output only. Identifier. The ID of the trigger that created this execution.""" - end_time: NotRequired[datetime] - r"""Output only. The time when the execution finished.""" - environment_id: NotRequired[str] - r"""Output only. The environment ID used for the execution.""" - error: NotRequired[str] - r"""Output only. The error message if the execution failed.""" - interaction_id: NotRequired[str] - r"""Output only. The ID of the interaction created by this execution, if any.""" - scheduled_time: NotRequired[datetime] - r"""Output only. The time when the execution was scheduled to run.""" - start_time: NotRequired[datetime] - r"""Output only. The time when the execution started.""" - status: NotRequired[TriggerExecutionStatus] - r"""Output only. The status of the execution.""" - - -class TriggerExecution(BaseModel): - r"""An execution instance of a trigger.""" - - id: str - r"""Required. Output only. Identifier. The ID of the trigger execution.""" - - trigger_id: str - r"""Required. Output only. Identifier. The ID of the trigger that created this execution.""" - - end_time: Optional[datetime] = None - r"""Output only. The time when the execution finished.""" - - environment_id: Optional[str] = None - r"""Output only. The environment ID used for the execution.""" - - error: Optional[str] = None - r"""Output only. The error message if the execution failed.""" - - interaction_id: Optional[str] = None - r"""Output only. The ID of the interaction created by this execution, if any.""" - - scheduled_time: Optional[datetime] = None - r"""Output only. The time when the execution was scheduled to run.""" - - start_time: Optional[datetime] = None - r"""Output only. The time when the execution started.""" - - status: Optional[TriggerExecutionStatus] = None - r"""Output only. The status of the execution.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "end_time", - "environment_id", - "error", - "interaction_id", - "scheduled_time", - "start_time", - "status", - ] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/types/triggers/triggerinteractionrequest.py b/google/genai/_gaos/types/triggers/triggerinteractionrequest.py deleted file mode 100644 index 92bb88f5b..000000000 --- a/google/genai/_gaos/types/triggers/triggerinteractionrequest.py +++ /dev/null @@ -1,170 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from ..interactions import ( - deepresearchagentconfig as interactions_deepresearchagentconfig, - dynamicagentconfig as interactions_dynamicagentconfig, - generationconfig as interactions_generationconfig, - interactionsinput as interactions_interactionsinput, - model as interactions_model, - responsemodality as interactions_responsemodality, - servicetier as interactions_servicetier, - tool as interactions_tool, - webhookconfig as interactions_webhookconfig, -) -from pydantic import model_serializer -from typing import Dict, List, Optional -from typing_extensions import NotRequired, TypedDict - - -class TriggerInteractionRequestParam(TypedDict): - r"""Configuration parameters for the interaction request template.""" - - stream: NotRequired[bool] - r"""Input only. Whether the interaction will be streamed.""" - store: NotRequired[bool] - r"""Input only. Whether to store the response and request for later retrieval.""" - background: NotRequired[bool] - r"""Input only. Whether to run the model interaction in the background.""" - input: NotRequired[interactions_interactionsinput.InteractionsInputParam] - r"""The input for the interaction.""" - agent: NotRequired[str] - r"""The agent to execute.""" - model: NotRequired[interactions_model.Model] - r"""The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.""" - dynamic_config: NotRequired[interactions_dynamicagentconfig.DynamicAgentConfigParam] - r"""Configuration for dynamic agents.""" - deep_research_config: NotRequired[ - interactions_deepresearchagentconfig.DeepResearchAgentConfigParam - ] - r"""Configuration for the Deep Research agent.""" - labels: NotRequired[Dict[str, str]] - r"""Labels for the interaction.""" - tools: NotRequired[List[interactions_tool.ToolParam]] - r"""A list of tool declarations the model may call during interaction.""" - system_instruction: NotRequired[str] - r"""System instruction for the interaction.""" - generation_config: NotRequired[interactions_generationconfig.GenerationConfigParam] - r"""Configuration parameters for model interactions.""" - response_modalities: NotRequired[ - List[interactions_responsemodality.ResponseModality] - ] - r"""The requested modalities of the response.""" - response_mime_type: NotRequired[str] - r"""The mime type of the response.""" - previous_interaction_id: NotRequired[str] - r"""Optional. The ID of the previous interaction, if any.""" - service_tier: NotRequired[interactions_servicetier.ServiceTier] - webhook_config: NotRequired[interactions_webhookconfig.WebhookConfigParam] - r"""Message for configuring webhook events for a request.""" - - -class TriggerInteractionRequest(BaseModel): - r"""Configuration parameters for the interaction request template.""" - - stream: Optional[bool] = None - r"""Input only. Whether the interaction will be streamed.""" - - store: Optional[bool] = None - r"""Input only. Whether to store the response and request for later retrieval.""" - - background: Optional[bool] = None - r"""Input only. Whether to run the model interaction in the background.""" - - input: Optional[interactions_interactionsinput.InteractionsInput] = None - r"""The input for the interaction.""" - - agent: Optional[str] = None - r"""The agent to execute.""" - - model: Optional[interactions_model.Model] = None - r"""The model that will complete your prompt.\n\nSee [models](https://ai.google.dev/gemini-api/docs/models) for additional details.""" - - dynamic_config: Optional[interactions_dynamicagentconfig.DynamicAgentConfig] = None - r"""Configuration for dynamic agents.""" - - deep_research_config: Optional[ - interactions_deepresearchagentconfig.DeepResearchAgentConfig - ] = None - r"""Configuration for the Deep Research agent.""" - - labels: Optional[Dict[str, str]] = None - r"""Labels for the interaction.""" - - tools: Optional[List[interactions_tool.Tool]] = None - r"""A list of tool declarations the model may call during interaction.""" - - system_instruction: Optional[str] = None - r"""System instruction for the interaction.""" - - generation_config: Optional[interactions_generationconfig.GenerationConfig] = None - r"""Configuration parameters for model interactions.""" - - response_modalities: Optional[ - List[interactions_responsemodality.ResponseModality] - ] = None - r"""The requested modalities of the response.""" - - response_mime_type: Optional[str] = None - r"""The mime type of the response.""" - - previous_interaction_id: Optional[str] = None - r"""Optional. The ID of the previous interaction, if any.""" - - service_tier: Optional[interactions_servicetier.ServiceTier] = None - - webhook_config: Optional[interactions_webhookconfig.WebhookConfig] = None - r"""Message for configuring webhook events for a request.""" - - @model_serializer(mode="wrap") - def _serialize_model(self, handler): - optional_fields = set( - [ - "stream", - "store", - "background", - "input", - "agent", - "model", - "dynamic_config", - "deep_research_config", - "labels", - "tools", - "system_instruction", - "generation_config", - "response_modalities", - "response_mime_type", - "previous_interaction_id", - "service_tier", - "webhook_config", - ] - ) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m diff --git a/google/genai/_gaos/types/triggers/triggerupdate.py b/google/genai/_gaos/types/triggers/triggerupdate.py deleted file mode 100644 index a1742adc3..000000000 --- a/google/genai/_gaos/types/triggers/triggerupdate.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# pyformat: disable - -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .. import BaseModel, UNSET_SENTINEL -from pydantic import model_serializer -from typing import Literal, Optional -from typing_extensions import NotRequired, TypedDict - - -TriggerUpdateStatus = Literal[ - "active", - "paused", - "error", -] -r"""Optional. The status of the trigger.""" - - -class TriggerUpdateParam(TypedDict): - r"""Represents the fields of a Trigger that can be updated.""" - - display_name: NotRequired[str] - r"""Optional. The display name of the trigger.""" - status: NotRequired[TriggerUpdateStatus] - r"""Optional. The status of the trigger.""" - - -class TriggerUpdate(BaseModel): - r"""Represents the fields of a Trigger that can be updated.""" - - display_name: Optional[str] = None - r"""Optional. The display name of the trigger.""" - - status: Optional[TriggerUpdateStatus] = None - r"""Optional. The status of the trigger.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["display_name", "status"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m