diff --git a/google/genai/_gaos/environments.py b/google/genai/_gaos/environments.py deleted file mode 100644 index 3beaebd51..000000000 --- a/google/genai/_gaos/environments.py +++ /dev/null @@ -1,1666 +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 BaseModel, OptionalNullable, UNSET, interactions -from .types.interactions import environment as interactions_environment -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 Environments(BaseSDK): - @property - def with_raw_response(self): - return EnvironmentsWithRawResponse(self) - - @property - def with_streaming_response(self): - return EnvironmentsWithStreamingResponse(self) - - def create_environment( - self, - *, - request: Optional[ - Union[ - interactions_environment.Environment, - interactions_environment.EnvironmentParam, - ] - ] = 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, - ) -> interactions.Environment: - r"""Creates an environment. - - :param request: The request object to send. - :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) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, Optional[interactions.Environment]) - request = cast(Optional[interactions.Environment], request) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request( - method="POST", - path="/v1beta/environments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=False, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request, - False, - True, - "json", - Optional[interactions.Environment], - 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, "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 - ) - if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response( - interactions.Environment, http_res, validate=False - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="CreateEnvironment", - 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_environments( - self, - *, - 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, - ) -> interactions.ListEnvironmentsResponse: - r"""Lists environments. - - :param page_size: Optional. Maximum number of environments to return. - If unspecified, defaults to 50. Maximum is 1000. - :param page_token: Optional. Pagination token. - :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.ListEnvironmentsRequest( - 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="/v1beta/environments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=False, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - 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, "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 - ) - if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response( - interactions.ListEnvironmentsResponse, http_res, validate=False - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="ListEnvironments", - 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_environment( - self, - environment: str, - *, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.Environment: - r"""Gets an environment. - - :param environment: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - :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.GetEnvironmentRequest( - environment=environment, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request( - method="GET", - path="/v1beta/environments/{environment}", - 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, - 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, "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 - ) - if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response( - interactions.Environment, http_res, validate=False - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="GetEnvironment", - 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_environment( - self, - environment: str, - *, - 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 an environment. - - :param environment: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - :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.DeleteEnvironmentRequest( - environment=environment, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request( - method="DELETE", - path="/v1beta/environments/{environment}", - 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, - 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, "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 - ) - if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response( - interactions.Empty, http_res, validate=False - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="DeleteEnvironment", - 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_environment_files( - self, - environment: str, - path: str, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, - recursive: Optional[bool] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.GetEnvironmentFilesResponse: - r"""Retrieves a file or directory from an environment's snapshot. - - If the path points to a directory: - - If `alt=media` is specified, it downloads the directory as a tarball. - - Otherwise, it returns the metadata of the files and directories - immediately within it (directory listing). - If the path points to a file: - - If `alt=media` is specified, it downloads the file. - - Otherwise, it returns the file metadata. - - :param environment: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - :param path: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - :param page_size: Optional. Maximum number of entries to return per page (for directory - listing). If unspecified, defaults to 100. Maximum is 1000. - :param page_token: Optional. Pagination token for directory listing. - :param recursive: Optional. If true and the path is a directory, recursively lists all files - and subdirectories. Defaults to false (immediate children only). - :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.GetEnvironmentFilesRequest( - environment=environment, - page_size=page_size, - page_token=page_token, - path=path, - recursive=recursive, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request( - method="GET", - path="/v1beta/environments/{environment}/files/{path}", - 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, - 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, "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 - ) - if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response( - interactions.GetEnvironmentFilesResponse, http_res, validate=False - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="GetEnvironmentFiles", - 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 EnvironmentsWithRawResponse: - def __init__(self, sdk: Environments) -> None: - self._sdk = sdk - self.create_environment = response_helpers.to_raw_response_wrapper( - sdk.create_environment, "extra_headers" - ) - self.list_environments = response_helpers.to_raw_response_wrapper( - sdk.list_environments, "extra_headers" - ) - self.get_environment = response_helpers.to_raw_response_wrapper( - sdk.get_environment, "extra_headers" - ) - self.delete_environment = response_helpers.to_raw_response_wrapper( - sdk.delete_environment, "extra_headers" - ) - self.get_environment_files = response_helpers.to_raw_response_wrapper( - sdk.get_environment_files, "extra_headers" - ) - - -class EnvironmentsWithStreamingResponse: - def __init__(self, sdk: Environments) -> None: - self._sdk = sdk - self.create_environment = response_helpers.to_streamed_response_wrapper( - sdk.create_environment, "extra_headers" - ) - self.list_environments = response_helpers.to_streamed_response_wrapper( - sdk.list_environments, "extra_headers" - ) - self.get_environment = response_helpers.to_streamed_response_wrapper( - sdk.get_environment, "extra_headers" - ) - self.delete_environment = response_helpers.to_streamed_response_wrapper( - sdk.delete_environment, "extra_headers" - ) - self.get_environment_files = response_helpers.to_streamed_response_wrapper( - sdk.get_environment_files, "extra_headers" - ) - - -class AsyncEnvironments(AsyncBaseSDK): - @property - def with_raw_response(self): - return AsyncEnvironmentsWithRawResponse(self) - - @property - def with_streaming_response(self): - return AsyncEnvironmentsWithStreamingResponse(self) - - async def create_environment( - self, - *, - request: Optional[ - Union[ - interactions_environment.Environment, - interactions_environment.EnvironmentParam, - ] - ] = 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, - ) -> interactions.Environment: - r"""Creates an environment. - - :param request: The request object to send. - :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) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, Optional[interactions.Environment]) - request = cast(Optional[interactions.Environment], request) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="POST", - path="/v1beta/environments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=False, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request, - False, - True, - "json", - Optional[interactions.Environment], - 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, "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 - ) - if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response( - interactions.Environment, http_res, validate=False - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="CreateEnvironment", - 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_environments( - self, - *, - 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, - ) -> interactions.ListEnvironmentsResponse: - r"""Lists environments. - - :param page_size: Optional. Maximum number of environments to return. - If unspecified, defaults to 50. Maximum is 1000. - :param page_token: Optional. Pagination token. - :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.ListEnvironmentsRequest( - 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="/v1beta/environments", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=False, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - extra_query_params=extra_query, - 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, "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 - ) - if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response( - interactions.ListEnvironmentsResponse, http_res, validate=False - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="ListEnvironments", - 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_environment( - self, - environment: str, - *, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.Environment: - r"""Gets an environment. - - :param environment: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - :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.GetEnvironmentRequest( - environment=environment, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="GET", - path="/v1beta/environments/{environment}", - 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, - 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, "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 - ) - if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response( - interactions.Environment, http_res, validate=False - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="GetEnvironment", - 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_environment( - self, - environment: str, - *, - 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 an environment. - - :param environment: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - :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.DeleteEnvironmentRequest( - environment=environment, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="DELETE", - path="/v1beta/environments/{environment}", - 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, - 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, "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 - ) - if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response( - interactions.Empty, http_res, validate=False - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="DeleteEnvironment", - 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_environment_files( - self, - environment: str, - path: str, - *, - page_size: Optional[int] = None, - page_token: Optional[str] = None, - recursive: Optional[bool] = None, - extra_headers: Optional[Mapping[str, str]] = None, - extra_query: Optional[Mapping[str, Any]] = None, - timeout: Optional[Union[float, httpx.Timeout]] = None, - ) -> interactions.GetEnvironmentFilesResponse: - r"""Retrieves a file or directory from an environment's snapshot. - - If the path points to a directory: - - If `alt=media` is specified, it downloads the directory as a tarball. - - Otherwise, it returns the metadata of the files and directories - immediately within it (directory listing). - If the path points to a file: - - If `alt=media` is specified, it downloads the file. - - Otherwise, it returns the file metadata. - - :param environment: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - :param path: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - :param page_size: Optional. Maximum number of entries to return per page (for directory - listing). If unspecified, defaults to 100. Maximum is 1000. - :param page_token: Optional. Pagination token for directory listing. - :param recursive: Optional. If true and the path is a directory, recursively lists all files - and subdirectories. Defaults to false (immediate children only). - :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.GetEnvironmentFilesRequest( - environment=environment, - page_size=page_size, - page_token=page_token, - path=path, - recursive=recursive, - ) - - _speakeasy_response_mode, http_headers = response_helpers.consume_response_mode( - http_headers - ) - req = self._build_request_async( - method="GET", - path="/v1beta/environments/{environment}/files/{path}", - 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, - 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, "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 - ) - if utils.match_response(http_res, "default", "application/json"): - return unmarshal_json_response( - interactions.GetEnvironmentFilesResponse, http_res, validate=False - ) - - raise errors.GenAiDefaultError("Unexpected response received", http_res) - - _speakeasy_hook_ctx = HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="GetEnvironmentFiles", - 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 AsyncEnvironmentsWithRawResponse: - def __init__(self, sdk: AsyncEnvironments) -> None: - self._sdk = sdk - self.create_environment = response_helpers.async_to_raw_response_wrapper( - sdk.create_environment, "extra_headers" - ) - self.list_environments = response_helpers.async_to_raw_response_wrapper( - sdk.list_environments, "extra_headers" - ) - self.get_environment = response_helpers.async_to_raw_response_wrapper( - sdk.get_environment, "extra_headers" - ) - self.delete_environment = response_helpers.async_to_raw_response_wrapper( - sdk.delete_environment, "extra_headers" - ) - self.get_environment_files = response_helpers.async_to_raw_response_wrapper( - sdk.get_environment_files, "extra_headers" - ) - - -class AsyncEnvironmentsWithStreamingResponse: - def __init__(self, sdk: AsyncEnvironments) -> None: - self._sdk = sdk - self.create_environment = response_helpers.async_to_streamed_response_wrapper( - sdk.create_environment, "extra_headers" - ) - self.list_environments = response_helpers.async_to_streamed_response_wrapper( - sdk.list_environments, "extra_headers" - ) - self.get_environment = response_helpers.async_to_streamed_response_wrapper( - sdk.get_environment, "extra_headers" - ) - self.delete_environment = response_helpers.async_to_streamed_response_wrapper( - sdk.delete_environment, "extra_headers" - ) - self.get_environment_files = ( - response_helpers.async_to_streamed_response_wrapper( - sdk.get_environment_files, "extra_headers" - ) - ) diff --git a/google/genai/_gaos/google_genai.py b/google/genai/_gaos/google_genai.py index 27cf4fabd..c0552c105 100644 --- a/google/genai/_gaos/google_genai.py +++ b/google/genai/_gaos/google_genai.py @@ -52,8 +52,6 @@ from .triggers import Triggers as GeneratedTriggers from .webhooks import AsyncWebhooks as GeneratedAsyncWebhooks from .webhooks import Webhooks as GeneratedWebhooks -from .environments import AsyncEnvironments as GeneratedAsyncEnvironments -from .environments import Environments as GeneratedEnvironments GOOGLE_GENAI_API_REVISION = _GOOGLE_GENAI_API_REVISION @@ -761,72 +759,6 @@ async def list_executions(self, *args: Any, **kwargs: Any) -> Any: return await async_wrap_sdk_call(super().list_executions, *args, **kwargs) -class GeminiNextGenEnvironments(GeneratedEnvironments): - """Public environments resource backed by the NextGen client.""" - - def __init__(self, api_client: Any): - sdk = build_google_genai_client(api_client) - super().__init__(sdk.sdk_configuration, parent_ref=sdk) - - if not TYPE_CHECKING: - @property - def with_raw_response(self): - return _RawResponseAccessorProxy(super().with_raw_response) - - @property - def with_streaming_response(self): - return _RawResponseAccessorProxy(super().with_streaming_response) - - def create_environment(self, *args: Any, **kwargs: Any) -> Any: - return wrap_sdk_call(super().create_environment, *args, **kwargs) - - def list_environments(self, *args: Any, **kwargs: Any) -> Any: - return wrap_sdk_call(super().list_environments, *args, **kwargs) - - def get_environment(self, *args: Any, **kwargs: Any) -> Any: - return wrap_sdk_call(super().get_environment, *args, **kwargs) - - def delete_environment(self, *args: Any, **kwargs: Any) -> Any: - return wrap_sdk_call(super().delete_environment, *args, **kwargs) - - def get_environment_files(self, *args: Any, **kwargs: Any) -> Any: - return wrap_sdk_call(super().get_environment_files, *args, **kwargs) - - # NOTE: update_environment, patch_environment are handled by fallback if they exist, but we assume they aren't generated based on our openapi.json. - - -class AsyncGeminiNextGenEnvironments(GeneratedAsyncEnvironments): - """Async public environments resource backed by the NextGen client.""" - - def __init__(self, api_client: Any): - sdk = build_google_genai_async_client(api_client) - super().__init__(sdk.sdk_configuration, parent_ref=sdk) - - if not TYPE_CHECKING: - @property - def with_raw_response(self): - return _AsyncRawResponseAccessorProxy(super().with_raw_response) - - @property - def with_streaming_response(self): - return _AsyncRawResponseAccessorProxy(super().with_streaming_response) - - async def create_environment(self, *args: Any, **kwargs: Any) -> Any: - return await async_wrap_sdk_call(super().create_environment, *args, **kwargs) - - async def list_environments(self, *args: Any, **kwargs: Any) -> Any: - return await async_wrap_sdk_call(super().list_environments, *args, **kwargs) - - async def get_environment(self, *args: Any, **kwargs: Any) -> Any: - return await async_wrap_sdk_call(super().get_environment, *args, **kwargs) - - async def delete_environment(self, *args: Any, **kwargs: Any) -> Any: - return await async_wrap_sdk_call(super().delete_environment, *args, **kwargs) - - async def get_environment_files(self, *args: Any, **kwargs: Any) -> Any: - return await async_wrap_sdk_call(super().get_environment_files, *args, **kwargs) - - def _add_output_properties_if_interaction(value: Any) -> Any: normalized = _normalize_interaction_shape(value) if normalized is None: @@ -947,7 +879,6 @@ def _get_value(value: Any, name: str) -> Any: return value.get(name) return getattr(value, name, None) - # Allowed create() body keys, derived from the generated request models so the # set tracks the schema; output-only fields are excluded. _CREATE_BODY_KEYS = frozenset( diff --git a/google/genai/_gaos/models/__init__.py b/google/genai/_gaos/models/__init__.py index 1351c553d..6e3953107 100644 --- a/google/genai/_gaos/models/__init__.py +++ b/google/genai/_gaos/models/__init__.py @@ -61,10 +61,6 @@ DeleteAgentRequest, DeleteAgentRequestParam, ) - from .deleteenvironment import ( - DeleteEnvironmentRequest, - DeleteEnvironmentRequestParam, - ) from .deleteinteraction import ( DeleteInteractionGlobals, DeleteInteractionGlobalsTypedDict, @@ -89,11 +85,6 @@ GetAgentRequest, GetAgentRequestParam, ) - from .getenvironment import GetEnvironmentRequest, GetEnvironmentRequestParam - from .getenvironmentfiles import ( - GetEnvironmentFilesRequest, - GetEnvironmentFilesRequestParam, - ) from .getinteractionbyid import ( GetInteractionByIDGlobals, GetInteractionByIDGlobalsTypedDict, @@ -120,7 +111,6 @@ ListAgentsRequest, ListAgentsRequestParam, ) - from .listenvironments import ListEnvironmentsRequest, ListEnvironmentsRequestParam from .listtriggerexecutions import ( ListTriggerExecutionsGlobals, ListTriggerExecutionsGlobalsTypedDict, @@ -200,8 +190,6 @@ "DeleteAgentGlobalsTypedDict", "DeleteAgentRequest", "DeleteAgentRequestParam", - "DeleteEnvironmentRequest", - "DeleteEnvironmentRequestParam", "DeleteInteractionGlobals", "DeleteInteractionGlobalsTypedDict", "DeleteInteractionRequest", @@ -218,10 +206,6 @@ "GetAgentGlobalsTypedDict", "GetAgentRequest", "GetAgentRequestParam", - "GetEnvironmentFilesRequest", - "GetEnvironmentFilesRequestParam", - "GetEnvironmentRequest", - "GetEnvironmentRequestParam", "GetInteractionByIDGlobals", "GetInteractionByIDGlobalsTypedDict", "GetInteractionByIDRequest", @@ -240,8 +224,6 @@ "ListAgentsGlobalsTypedDict", "ListAgentsRequest", "ListAgentsRequestParam", - "ListEnvironmentsRequest", - "ListEnvironmentsRequestParam", "ListTriggerExecutionsGlobals", "ListTriggerExecutionsGlobalsTypedDict", "ListTriggerExecutionsRequest", @@ -305,8 +287,6 @@ "DeleteAgentGlobalsTypedDict": ".deleteagent", "DeleteAgentRequest": ".deleteagent", "DeleteAgentRequestParam": ".deleteagent", - "DeleteEnvironmentRequest": ".deleteenvironment", - "DeleteEnvironmentRequestParam": ".deleteenvironment", "DeleteInteractionGlobals": ".deleteinteraction", "DeleteInteractionGlobalsTypedDict": ".deleteinteraction", "DeleteInteractionRequest": ".deleteinteraction", @@ -323,10 +303,6 @@ "GetAgentGlobalsTypedDict": ".getagent", "GetAgentRequest": ".getagent", "GetAgentRequestParam": ".getagent", - "GetEnvironmentRequest": ".getenvironment", - "GetEnvironmentRequestParam": ".getenvironment", - "GetEnvironmentFilesRequest": ".getenvironmentfiles", - "GetEnvironmentFilesRequestParam": ".getenvironmentfiles", "GetInteractionByIDGlobals": ".getinteractionbyid", "GetInteractionByIDGlobalsTypedDict": ".getinteractionbyid", "GetInteractionByIDRequest": ".getinteractionbyid", @@ -345,8 +321,6 @@ "ListAgentsGlobalsTypedDict": ".listagents", "ListAgentsRequest": ".listagents", "ListAgentsRequestParam": ".listagents", - "ListEnvironmentsRequest": ".listenvironments", - "ListEnvironmentsRequestParam": ".listenvironments", "ListTriggerExecutionsGlobals": ".listtriggerexecutions", "ListTriggerExecutionsGlobalsTypedDict": ".listtriggerexecutions", "ListTriggerExecutionsRequest": ".listtriggerexecutions", diff --git a/google/genai/_gaos/models/deleteenvironment.py b/google/genai/_gaos/models/deleteenvironment.py deleted file mode 100644 index a744a5baf..000000000 --- a/google/genai/_gaos/models/deleteenvironment.py +++ /dev/null @@ -1,34 +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 -from ..utils import FieldMetadata, PathParamMetadata -from typing_extensions import Annotated, TypedDict - - -class DeleteEnvironmentRequestParam(TypedDict): - environment: str - r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.""" - - -class DeleteEnvironmentRequest(BaseModel): - environment: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] - r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.""" diff --git a/google/genai/_gaos/models/getenvironment.py b/google/genai/_gaos/models/getenvironment.py deleted file mode 100644 index 65fbc158f..000000000 --- a/google/genai/_gaos/models/getenvironment.py +++ /dev/null @@ -1,34 +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 -from ..utils import FieldMetadata, PathParamMetadata -from typing_extensions import Annotated, TypedDict - - -class GetEnvironmentRequestParam(TypedDict): - environment: str - r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.""" - - -class GetEnvironmentRequest(BaseModel): - environment: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] - r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.""" diff --git a/google/genai/_gaos/models/getenvironmentfiles.py b/google/genai/_gaos/models/getenvironmentfiles.py deleted file mode 100644 index 7adc85e60..000000000 --- a/google/genai/_gaos/models/getenvironmentfiles.py +++ /dev/null @@ -1,91 +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 GetEnvironmentFilesRequestParam(TypedDict): - environment: str - r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.""" - path: str - r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.""" - page_size: NotRequired[int] - r"""Optional. Maximum number of entries to return per page (for directory - listing). If unspecified, defaults to 100. Maximum is 1000. - """ - page_token: NotRequired[str] - r"""Optional. Pagination token for directory listing.""" - recursive: NotRequired[bool] - r"""Optional. If true and the path is a directory, recursively lists all files - and subdirectories. Defaults to false (immediate children only). - """ - - -class GetEnvironmentFilesRequest(BaseModel): - environment: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] - r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.""" - - path: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] - r"""Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.""" - - page_size: Annotated[ - Optional[int], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Optional. Maximum number of entries to return per page (for directory - listing). If unspecified, defaults to 100. Maximum is 1000. - """ - - page_token: Annotated[ - Optional[str], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Optional. Pagination token for directory listing.""" - - recursive: Annotated[ - Optional[bool], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Optional. If true and the path is a directory, recursively lists all files - and subdirectories. Defaults to false (immediate children only). - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["page_size", "page_token", "recursive"]) - 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/listenvironments.py b/google/genai/_gaos/models/listenvironments.py deleted file mode 100644 index 61b03b4f8..000000000 --- a/google/genai/_gaos/models/listenvironments.py +++ /dev/null @@ -1,65 +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, QueryParamMetadata -from pydantic import model_serializer -from typing import Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class ListEnvironmentsRequestParam(TypedDict): - page_size: NotRequired[int] - r"""Optional. Maximum number of environments to return. - If unspecified, defaults to 50. Maximum is 1000. - """ - page_token: NotRequired[str] - r"""Optional. Pagination token.""" - - -class ListEnvironmentsRequest(BaseModel): - page_size: Annotated[ - Optional[int], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Optional. Maximum number of environments to return. - If unspecified, defaults to 50. Maximum is 1000. - """ - - page_token: Annotated[ - Optional[str], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = None - r"""Optional. Pagination token.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["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/sdk.py b/google/genai/_gaos/sdk.py index db9910e8b..57562e585 100644 --- a/google/genai/_gaos/sdk.py +++ b/google/genai/_gaos/sdk.py @@ -39,7 +39,6 @@ if TYPE_CHECKING: from .agents import Agents, AsyncAgents - from .environments import AsyncEnvironments, Environments from .interactions import AsyncInteractions, Interactions from .triggers import AsyncTriggers, Triggers from .webhooks import AsyncWebhooks, Webhooks @@ -56,13 +55,11 @@ def with_raw_response(self): def with_streaming_response(self): return GenAIWithStreamingResponse(self) - environments: "Environments" interactions: "Interactions" webhooks: "Webhooks" agents: "Agents" triggers: "Triggers" _sub_sdk_map = { - "environments": (".environments", "Environments"), "interactions": (".interactions", "Interactions"), "webhooks": (".webhooks", "Webhooks"), "agents": (".agents", "Agents"), @@ -210,10 +207,6 @@ class GenAIWithRawResponse: def __init__(self, sdk: GenAI) -> None: self._sdk = sdk - @property - def environments(self): - return self._sdk.environments.with_raw_response - @property def interactions(self): return self._sdk.interactions.with_raw_response @@ -235,10 +228,6 @@ class GenAIWithStreamingResponse: def __init__(self, sdk: GenAI) -> None: self._sdk = sdk - @property - def environments(self): - return self._sdk.environments.with_streaming_response - @property def interactions(self): return self._sdk.interactions.with_streaming_response @@ -267,13 +256,11 @@ def with_raw_response(self): def with_streaming_response(self): return AsyncGenAIWithStreamingResponse(self) - environments: "AsyncEnvironments" interactions: "AsyncInteractions" webhooks: "AsyncWebhooks" agents: "AsyncAgents" triggers: "AsyncTriggers" _sub_sdk_map = { - "environments": (".environments", "AsyncEnvironments"), "interactions": (".interactions", "AsyncInteractions"), "webhooks": (".webhooks", "AsyncWebhooks"), "agents": (".agents", "AsyncAgents"), @@ -419,10 +406,6 @@ class AsyncGenAIWithRawResponse: def __init__(self, sdk: AsyncGenAI) -> None: self._sdk = sdk - @property - def environments(self): - return self._sdk.environments.with_raw_response - @property def interactions(self): return self._sdk.interactions.with_raw_response @@ -444,10 +427,6 @@ class AsyncGenAIWithStreamingResponse: def __init__(self, sdk: AsyncGenAI) -> None: self._sdk = sdk - @property - def environments(self): - return self._sdk.environments.with_streaming_response - @property def interactions(self): return self._sdk.interactions.with_streaming_response diff --git a/google/genai/_gaos/types/interactions/__init__.py b/google/genai/_gaos/types/interactions/__init__.py index db3da3032..011881a31 100644 --- a/google/genai/_gaos/types/interactions/__init__.py +++ b/google/genai/_gaos/types/interactions/__init__.py @@ -63,15 +63,6 @@ CodeExecutionResultStepParam, ) from .codemenderagentconfig import CodeMenderAgentConfig, CodeMenderAgentConfigParam - from .compositemedia import ( - CompositeMedia, - CompositeMediaBlobstore2Info, - CompositeMediaBlobstore2InfoTypedDict, - CompositeMediaObjectID, - CompositeMediaObjectIDTypedDict, - CompositeMediaReferenceType, - CompositeMediaTypedDict, - ) from .computeruse import ( ComputerUse, ComputerUseParam, @@ -121,11 +112,6 @@ NetworkEnum, NetworkParam, ) - from .environmentfile import ( - EnvironmentFile, - EnvironmentFileType, - EnvironmentFileTypedDict, - ) from .environmentnetworkegressallowlist import ( Allowlist, AllowlistParam, @@ -179,73 +165,6 @@ ToolChoice, ToolChoiceParam, ) - from .getenvironmentfilesresponse import ( - Blob, - BlobTypedDict, - ChecksumsInfo, - ChecksumsInfoBlobstore2Info, - ChecksumsInfoBlobstore2InfoTypedDict, - ChecksumsInfoObjectID, - ChecksumsInfoObjectIDTypedDict, - ChecksumsInfoReferenceType, - ChecksumsInfoTypedDict, - ChecksumsLocation, - ChecksumsLocationBlobstore2Info, - ChecksumsLocationBlobstore2InfoTypedDict, - ChecksumsLocationObjectID, - ChecksumsLocationObjectIDTypedDict, - ChecksumsLocationReferenceType, - ChecksumsLocationTypedDict, - ContentTypeInfo, - ContentTypeInfoTypedDict, - DiffChecksumsResponse, - DiffChecksumsResponseObjectLocation, - DiffChecksumsResponseObjectLocationBlobstore2Info, - DiffChecksumsResponseObjectLocationBlobstore2InfoTypedDict, - DiffChecksumsResponseObjectLocationObjectID, - DiffChecksumsResponseObjectLocationObjectIDTypedDict, - DiffChecksumsResponseObjectLocationReferenceType, - DiffChecksumsResponseObjectLocationTypedDict, - DiffChecksumsResponseTypedDict, - DiffDownloadResponse, - DiffDownloadResponseBlobstore2Info, - DiffDownloadResponseBlobstore2InfoTypedDict, - DiffDownloadResponseObjectID, - DiffDownloadResponseObjectIDTypedDict, - DiffDownloadResponseObjectLocation, - DiffDownloadResponseObjectLocationTypedDict, - DiffDownloadResponseReferenceType, - DiffDownloadResponseTypedDict, - DiffUploadRequest, - DiffUploadRequestTypedDict, - DiffUploadResponse, - DiffUploadResponseTypedDict, - DiffVersionResponse, - DiffVersionResponseTypedDict, - DownloadParameters, - DownloadParametersTypedDict, - GetEnvironmentFilesResponse, - GetEnvironmentFilesResponseBlobstore2Info, - GetEnvironmentFilesResponseBlobstore2InfoTypedDict, - GetEnvironmentFilesResponseObjectID, - GetEnvironmentFilesResponseObjectIDTypedDict, - GetEnvironmentFilesResponseReferenceType, - GetEnvironmentFilesResponseTypedDict, - ObjectInfo, - ObjectInfoBlobstore2Info, - ObjectInfoBlobstore2InfoTypedDict, - ObjectInfoObjectID, - ObjectInfoObjectIDTypedDict, - ObjectInfoReferenceType, - ObjectInfoTypedDict, - OriginalObject, - OriginalObjectBlobstore2Info, - OriginalObjectBlobstore2InfoTypedDict, - OriginalObjectObjectID, - OriginalObjectObjectIDTypedDict, - OriginalObjectReferenceType, - OriginalObjectTypedDict, - ) from .googlemaps import GoogleMaps, GoogleMapsParam from .googlemapscallarguments import ( GoogleMapsCallArguments, @@ -349,10 +268,6 @@ InteractionStatusUpdateStatus, InteractionStatusUpdateTypedDict, ) - from .listenvironmentsresponse import ( - ListEnvironmentsResponse, - ListEnvironmentsResponseTypedDict, - ) from .mcpserver import MCPServer, MCPServerParam from .mcpservertoolcalldelta import ( MCPServerToolCallDelta, @@ -505,22 +420,6 @@ "AudioResponseFormatDelivery", "AudioResponseFormatMimeType", "AudioResponseFormatParam", - "Blob", - "BlobTypedDict", - "ChecksumsInfo", - "ChecksumsInfoBlobstore2Info", - "ChecksumsInfoBlobstore2InfoTypedDict", - "ChecksumsInfoObjectID", - "ChecksumsInfoObjectIDTypedDict", - "ChecksumsInfoReferenceType", - "ChecksumsInfoTypedDict", - "ChecksumsLocation", - "ChecksumsLocationBlobstore2Info", - "ChecksumsLocationBlobstore2InfoTypedDict", - "ChecksumsLocationObjectID", - "ChecksumsLocationObjectIDTypedDict", - "ChecksumsLocationReferenceType", - "ChecksumsLocationTypedDict", "CodeExecution", "CodeExecutionCallArguments", "CodeExecutionCallArgumentsParam", @@ -535,19 +434,10 @@ "CodeExecutionResultStepParam", "CodeMenderAgentConfig", "CodeMenderAgentConfigParam", - "CompositeMedia", - "CompositeMediaBlobstore2Info", - "CompositeMediaBlobstore2InfoTypedDict", - "CompositeMediaObjectID", - "CompositeMediaObjectIDTypedDict", - "CompositeMediaReferenceType", - "CompositeMediaTypedDict", "ComputerUse", "ComputerUseParam", "Content", "ContentParam", - "ContentTypeInfo", - "ContentTypeInfoTypedDict", "CreateAgentInteraction", "CreateAgentInteractionAgentConfig", "CreateAgentInteractionAgentConfigParam", @@ -564,30 +454,6 @@ "CreateModelInteractionResponseFormatParam", "DeepResearchAgentConfig", "DeepResearchAgentConfigParam", - "DiffChecksumsResponse", - "DiffChecksumsResponseObjectLocation", - "DiffChecksumsResponseObjectLocationBlobstore2Info", - "DiffChecksumsResponseObjectLocationBlobstore2InfoTypedDict", - "DiffChecksumsResponseObjectLocationObjectID", - "DiffChecksumsResponseObjectLocationObjectIDTypedDict", - "DiffChecksumsResponseObjectLocationReferenceType", - "DiffChecksumsResponseObjectLocationTypedDict", - "DiffChecksumsResponseTypedDict", - "DiffDownloadResponse", - "DiffDownloadResponseBlobstore2Info", - "DiffDownloadResponseBlobstore2InfoTypedDict", - "DiffDownloadResponseObjectID", - "DiffDownloadResponseObjectIDTypedDict", - "DiffDownloadResponseObjectLocation", - "DiffDownloadResponseObjectLocationTypedDict", - "DiffDownloadResponseReferenceType", - "DiffDownloadResponseTypedDict", - "DiffUploadRequest", - "DiffUploadRequestTypedDict", - "DiffUploadResponse", - "DiffUploadResponseTypedDict", - "DiffVersionResponse", - "DiffVersionResponseTypedDict", "Disabled", "DisabledSafetyPolicy", "DocumentContent", @@ -596,17 +462,12 @@ "DocumentDelta", "DocumentDeltaMimeType", "DocumentDeltaTypedDict", - "DownloadParameters", - "DownloadParametersTypedDict", "DynamicAgentConfig", "DynamicAgentConfigParam", "Empty", "EmptyTypedDict", "Environment", "EnvironmentEnum", - "EnvironmentFile", - "EnvironmentFileType", - "EnvironmentFileTypedDict", "EnvironmentNetworkEgressAllowlist", "EnvironmentNetworkEgressAllowlistParam", "EnvironmentParam", @@ -658,13 +519,6 @@ "FunctionResultSubcontentParam", "GenerationConfig", "GenerationConfigParam", - "GetEnvironmentFilesResponse", - "GetEnvironmentFilesResponseBlobstore2Info", - "GetEnvironmentFilesResponseBlobstore2InfoTypedDict", - "GetEnvironmentFilesResponseObjectID", - "GetEnvironmentFilesResponseObjectIDTypedDict", - "GetEnvironmentFilesResponseReferenceType", - "GetEnvironmentFilesResponseTypedDict", "GoogleMaps", "GoogleMapsCallArguments", "GoogleMapsCallArgumentsParam", @@ -745,8 +599,6 @@ "InteractionsInput", "InteractionsInputParam", "Language", - "ListEnvironmentsResponse", - "ListEnvironmentsResponseTypedDict", "MCPServer", "MCPServerParam", "MCPServerToolCallDelta", @@ -776,20 +628,6 @@ "Network", "NetworkEnum", "NetworkParam", - "ObjectInfo", - "ObjectInfoBlobstore2Info", - "ObjectInfoBlobstore2InfoTypedDict", - "ObjectInfoObjectID", - "ObjectInfoObjectIDTypedDict", - "ObjectInfoReferenceType", - "ObjectInfoTypedDict", - "OriginalObject", - "OriginalObjectBlobstore2Info", - "OriginalObjectBlobstore2InfoTypedDict", - "OriginalObjectObjectID", - "OriginalObjectObjectIDTypedDict", - "OriginalObjectReferenceType", - "OriginalObjectTypedDict", "ParallelAISearchConfig", "ParallelAISearchConfigParam", "PlaceCitation", @@ -970,13 +808,6 @@ "CodeExecutionResultStepParam": ".codeexecutionresultstep", "CodeMenderAgentConfig": ".codemenderagentconfig", "CodeMenderAgentConfigParam": ".codemenderagentconfig", - "CompositeMedia": ".compositemedia", - "CompositeMediaBlobstore2Info": ".compositemedia", - "CompositeMediaBlobstore2InfoTypedDict": ".compositemedia", - "CompositeMediaObjectID": ".compositemedia", - "CompositeMediaObjectIDTypedDict": ".compositemedia", - "CompositeMediaReferenceType": ".compositemedia", - "CompositeMediaTypedDict": ".compositemedia", "ComputerUse": ".computeruse", "ComputerUseParam": ".computeruse", "DisabledSafetyPolicy": ".computeruse", @@ -1016,9 +847,6 @@ "Network": ".environment", "NetworkEnum": ".environment", "NetworkParam": ".environment", - "EnvironmentFile": ".environmentfile", - "EnvironmentFileType": ".environmentfile", - "EnvironmentFileTypedDict": ".environmentfile", "Allowlist": ".environmentnetworkegressallowlist", "AllowlistParam": ".environmentnetworkegressallowlist", "Disabled": ".environmentnetworkegressallowlist", @@ -1076,71 +904,6 @@ "GenerationConfigParam": ".generationconfig", "ToolChoice": ".generationconfig", "ToolChoiceParam": ".generationconfig", - "Blob": ".getenvironmentfilesresponse", - "BlobTypedDict": ".getenvironmentfilesresponse", - "ChecksumsInfo": ".getenvironmentfilesresponse", - "ChecksumsInfoBlobstore2Info": ".getenvironmentfilesresponse", - "ChecksumsInfoBlobstore2InfoTypedDict": ".getenvironmentfilesresponse", - "ChecksumsInfoObjectID": ".getenvironmentfilesresponse", - "ChecksumsInfoObjectIDTypedDict": ".getenvironmentfilesresponse", - "ChecksumsInfoReferenceType": ".getenvironmentfilesresponse", - "ChecksumsInfoTypedDict": ".getenvironmentfilesresponse", - "ChecksumsLocation": ".getenvironmentfilesresponse", - "ChecksumsLocationBlobstore2Info": ".getenvironmentfilesresponse", - "ChecksumsLocationBlobstore2InfoTypedDict": ".getenvironmentfilesresponse", - "ChecksumsLocationObjectID": ".getenvironmentfilesresponse", - "ChecksumsLocationObjectIDTypedDict": ".getenvironmentfilesresponse", - "ChecksumsLocationReferenceType": ".getenvironmentfilesresponse", - "ChecksumsLocationTypedDict": ".getenvironmentfilesresponse", - "ContentTypeInfo": ".getenvironmentfilesresponse", - "ContentTypeInfoTypedDict": ".getenvironmentfilesresponse", - "DiffChecksumsResponse": ".getenvironmentfilesresponse", - "DiffChecksumsResponseObjectLocation": ".getenvironmentfilesresponse", - "DiffChecksumsResponseObjectLocationBlobstore2Info": ".getenvironmentfilesresponse", - "DiffChecksumsResponseObjectLocationBlobstore2InfoTypedDict": ".getenvironmentfilesresponse", - "DiffChecksumsResponseObjectLocationObjectID": ".getenvironmentfilesresponse", - "DiffChecksumsResponseObjectLocationObjectIDTypedDict": ".getenvironmentfilesresponse", - "DiffChecksumsResponseObjectLocationReferenceType": ".getenvironmentfilesresponse", - "DiffChecksumsResponseObjectLocationTypedDict": ".getenvironmentfilesresponse", - "DiffChecksumsResponseTypedDict": ".getenvironmentfilesresponse", - "DiffDownloadResponse": ".getenvironmentfilesresponse", - "DiffDownloadResponseBlobstore2Info": ".getenvironmentfilesresponse", - "DiffDownloadResponseBlobstore2InfoTypedDict": ".getenvironmentfilesresponse", - "DiffDownloadResponseObjectID": ".getenvironmentfilesresponse", - "DiffDownloadResponseObjectIDTypedDict": ".getenvironmentfilesresponse", - "DiffDownloadResponseObjectLocation": ".getenvironmentfilesresponse", - "DiffDownloadResponseObjectLocationTypedDict": ".getenvironmentfilesresponse", - "DiffDownloadResponseReferenceType": ".getenvironmentfilesresponse", - "DiffDownloadResponseTypedDict": ".getenvironmentfilesresponse", - "DiffUploadRequest": ".getenvironmentfilesresponse", - "DiffUploadRequestTypedDict": ".getenvironmentfilesresponse", - "DiffUploadResponse": ".getenvironmentfilesresponse", - "DiffUploadResponseTypedDict": ".getenvironmentfilesresponse", - "DiffVersionResponse": ".getenvironmentfilesresponse", - "DiffVersionResponseTypedDict": ".getenvironmentfilesresponse", - "DownloadParameters": ".getenvironmentfilesresponse", - "DownloadParametersTypedDict": ".getenvironmentfilesresponse", - "GetEnvironmentFilesResponse": ".getenvironmentfilesresponse", - "GetEnvironmentFilesResponseBlobstore2Info": ".getenvironmentfilesresponse", - "GetEnvironmentFilesResponseBlobstore2InfoTypedDict": ".getenvironmentfilesresponse", - "GetEnvironmentFilesResponseObjectID": ".getenvironmentfilesresponse", - "GetEnvironmentFilesResponseObjectIDTypedDict": ".getenvironmentfilesresponse", - "GetEnvironmentFilesResponseReferenceType": ".getenvironmentfilesresponse", - "GetEnvironmentFilesResponseTypedDict": ".getenvironmentfilesresponse", - "ObjectInfo": ".getenvironmentfilesresponse", - "ObjectInfoBlobstore2Info": ".getenvironmentfilesresponse", - "ObjectInfoBlobstore2InfoTypedDict": ".getenvironmentfilesresponse", - "ObjectInfoObjectID": ".getenvironmentfilesresponse", - "ObjectInfoObjectIDTypedDict": ".getenvironmentfilesresponse", - "ObjectInfoReferenceType": ".getenvironmentfilesresponse", - "ObjectInfoTypedDict": ".getenvironmentfilesresponse", - "OriginalObject": ".getenvironmentfilesresponse", - "OriginalObjectBlobstore2Info": ".getenvironmentfilesresponse", - "OriginalObjectBlobstore2InfoTypedDict": ".getenvironmentfilesresponse", - "OriginalObjectObjectID": ".getenvironmentfilesresponse", - "OriginalObjectObjectIDTypedDict": ".getenvironmentfilesresponse", - "OriginalObjectReferenceType": ".getenvironmentfilesresponse", - "OriginalObjectTypedDict": ".getenvironmentfilesresponse", "GoogleMaps": ".googlemaps", "GoogleMapsParam": ".googlemaps", "GoogleMapsCallArguments": ".googlemapscallarguments", @@ -1222,8 +985,6 @@ "InteractionStatusUpdate": ".interactionstatusupdate", "InteractionStatusUpdateStatus": ".interactionstatusupdate", "InteractionStatusUpdateTypedDict": ".interactionstatusupdate", - "ListEnvironmentsResponse": ".listenvironmentsresponse", - "ListEnvironmentsResponseTypedDict": ".listenvironmentsresponse", "MCPServer": ".mcpserver", "MCPServerParam": ".mcpserver", "MCPServerToolCallDelta": ".mcpservertoolcalldelta", diff --git a/google/genai/_gaos/types/interactions/compositemedia.py b/google/genai/_gaos/types/interactions/compositemedia.py deleted file mode 100644 index 3b181b3e8..000000000 --- a/google/genai/_gaos/types/interactions/compositemedia.py +++ /dev/null @@ -1,339 +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 ...utils import serialize_int, validate_int -import pydantic -from pydantic import model_serializer -from pydantic.functional_serializers import PlainSerializer -from pydantic.functional_validators import BeforeValidator -from typing import Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypedDict - - -class CompositeMediaBlobstore2InfoTypedDict(TypedDict): - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - blob_generation: NotRequired[int] - r"""The blob generation id.""" - blob_id: NotRequired[str] - r"""The blob id, e.g., /blobstore/prod/playground/scotty""" - download_external_read_token: NotRequired[str] - r"""A serialized External Read Token passed from Bigstore -> Scotty for a GCS - download. This field must never be consumed outside of Bigstore, and is not - applicable to non-GCS media uploads. - """ - download_read_handle: NotRequired[str] - r"""Read handle passed from Bigstore -> Scotty for a GCS download. - This is a signed, serialized blobstore2.ReadHandle proto which must never - be set outside of Bigstore, and is not applicable to non-GCS media - downloads. - """ - read_token: NotRequired[str] - r"""The blob read token. Needed to read blobs that have not been - replicated. Might not be available until the final call. - """ - upload_fragment_list_creation_info: NotRequired[str] - r"""A serialized Object Fragment List Creation Info passed from Bigstore -> - Scotty for a GCS upload. This field must never be consumed outside of - Bigstore, and is not applicable to non-GCS media uploads. - """ - upload_metadata_container: NotRequired[str] - r"""Metadata passed from Blobstore -> Scotty for a new GCS upload. - This is a signed, serialized blobstore2.BlobMetadataContainer proto which - must never be consumed outside of Bigstore, and is not applicable to - non-GCS media uploads. - """ - - -class CompositeMediaBlobstore2Info(BaseModel): - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - blob_generation: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""The blob generation id.""" - - blob_id: Optional[str] = None - r"""The blob id, e.g., /blobstore/prod/playground/scotty""" - - download_external_read_token: Optional[str] = None - r"""A serialized External Read Token passed from Bigstore -> Scotty for a GCS - download. This field must never be consumed outside of Bigstore, and is not - applicable to non-GCS media uploads. - """ - - download_read_handle: Optional[str] = None - r"""Read handle passed from Bigstore -> Scotty for a GCS download. - This is a signed, serialized blobstore2.ReadHandle proto which must never - be set outside of Bigstore, and is not applicable to non-GCS media - downloads. - """ - - read_token: Optional[str] = None - r"""The blob read token. Needed to read blobs that have not been - replicated. Might not be available until the final call. - """ - - upload_fragment_list_creation_info: Optional[str] = None - r"""A serialized Object Fragment List Creation Info passed from Bigstore -> - Scotty for a GCS upload. This field must never be consumed outside of - Bigstore, and is not applicable to non-GCS media uploads. - """ - - upload_metadata_container: Optional[str] = None - r"""Metadata passed from Blobstore -> Scotty for a new GCS upload. - This is a signed, serialized blobstore2.BlobMetadataContainer proto which - must never be consumed outside of Bigstore, and is not applicable to - non-GCS media uploads. - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "blob_generation", - "blob_id", - "download_external_read_token", - "download_read_handle", - "read_token", - "upload_fragment_list_creation_info", - "upload_metadata_container", - ] - ) - 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 CompositeMediaObjectIDTypedDict(TypedDict): - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - bucket_name: NotRequired[str] - r"""The name of the bucket to which this object belongs.""" - generation: NotRequired[int] - r"""Generation of the object. Generations are monotonically increasing - across writes, allowing them to be be compared to determine which - generation is newer. If this is omitted in a request, then you are - requesting the live object. - See http://go/bigstore-versions - """ - object_name: NotRequired[str] - r"""The name of the object.""" - - -class CompositeMediaObjectID(BaseModel): - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - bucket_name: Optional[str] = None - r"""The name of the bucket to which this object belongs.""" - - generation: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Generation of the object. Generations are monotonically increasing - across writes, allowing them to be be compared to determine which - generation is newer. If this is omitted in a request, then you are - requesting the live object. - See http://go/bigstore-versions - """ - - object_name: Optional[str] = None - r"""The name of the object.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["bucket_name", "generation", "object_name"]) - 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 - - -CompositeMediaReferenceType = Union[ - Literal[ - "path", - "blob_ref", - "inline", - "bigstore_ref", - "cosmo_binary_reference", - ], - UnrecognizedStr, -] -r"""Describes what the field reference contains.""" - - -class CompositeMediaTypedDict(TypedDict): - r"""A sequence of media data references representing composite data. - Introduced to support Bigstore composite objects. For details, visit - http://go/bigstore-composites. - """ - - blob_ref: NotRequired[str] - r"""Blobstore v1 reference, set if reference_type is BLOBSTORE_REF - This should be the byte representation of a blobstore.BlobRef. - Since Blobstore is deprecating v1, use blobstore2_info instead. - For now, any v2 blob will also be represented in this field as - v1 BlobRef. - """ - blobstore2_info: NotRequired[CompositeMediaBlobstore2InfoTypedDict] - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - cosmo_binary_reference: NotRequired[str] - r"""A binary data reference for a media download. Serves as a - technology-agnostic binary reference in some Google infrastructure. - This value is a serialized storage_cosmo.BinaryReference proto. Storing - it as bytes is a hack to get around the fact that the cosmo proto - (as well as others it includes) doesn't support JavaScript. This - prevents us from including the actual type of this field. - """ - crc32c_hash: NotRequired[int] - r"""crc32.c hash for the payload.""" - inline: NotRequired[str] - r"""Media data, set if reference_type is INLINE""" - length: NotRequired[int] - r"""Size of the data, in bytes""" - md5_hash: NotRequired[str] - r"""MD5 hash for the payload.""" - object_id: NotRequired[CompositeMediaObjectIDTypedDict] - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - path: NotRequired[str] - r"""Path to the data, set if reference_type is PATH""" - reference_type: NotRequired[CompositeMediaReferenceType] - r"""Describes what the field reference contains.""" - sha1_hash: NotRequired[str] - r"""SHA-1 hash for the payload.""" - - -class CompositeMedia(BaseModel): - r"""A sequence of media data references representing composite data. - Introduced to support Bigstore composite objects. For details, visit - http://go/bigstore-composites. - """ - - blob_ref: Annotated[ - Optional[str], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." - ), - ] = None - r"""Blobstore v1 reference, set if reference_type is BLOBSTORE_REF - This should be the byte representation of a blobstore.BlobRef. - Since Blobstore is deprecating v1, use blobstore2_info instead. - For now, any v2 blob will also be represented in this field as - v1 BlobRef. - """ - - blobstore2_info: Optional[CompositeMediaBlobstore2Info] = None - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - cosmo_binary_reference: Optional[str] = None - r"""A binary data reference for a media download. Serves as a - technology-agnostic binary reference in some Google infrastructure. - This value is a serialized storage_cosmo.BinaryReference proto. Storing - it as bytes is a hack to get around the fact that the cosmo proto - (as well as others it includes) doesn't support JavaScript. This - prevents us from including the actual type of this field. - """ - - crc32c_hash: Optional[int] = None - r"""crc32.c hash for the payload.""" - - inline: Optional[str] = None - r"""Media data, set if reference_type is INLINE""" - - length: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Size of the data, in bytes""" - - md5_hash: Optional[str] = None - r"""MD5 hash for the payload.""" - - object_id: Optional[CompositeMediaObjectID] = None - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - path: Optional[str] = None - r"""Path to the data, set if reference_type is PATH""" - - reference_type: Optional[CompositeMediaReferenceType] = None - r"""Describes what the field reference contains.""" - - sha1_hash: Optional[str] = None - r"""SHA-1 hash for the payload.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "blob_ref", - "blobstore2_info", - "cosmo_binary_reference", - "crc32c_hash", - "inline", - "length", - "md5_hash", - "object_id", - "path", - "reference_type", - "sha1_hash", - ] - ) - 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/interactions/environmentfile.py b/google/genai/_gaos/types/interactions/environmentfile.py deleted file mode 100644 index 4d0a3987a..000000000 --- a/google/genai/_gaos/types/interactions/environmentfile.py +++ /dev/null @@ -1,98 +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 ...utils import serialize_int, validate_int -from pydantic import model_serializer -from pydantic.functional_serializers import PlainSerializer -from pydantic.functional_validators import BeforeValidator -from typing import Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypedDict - - -EnvironmentFileType = Union[ - Literal[ - "file", - "directory", - ], - UnrecognizedStr, -] -r"""Output only. The type of the entry.""" - - -class EnvironmentFileTypedDict(TypedDict): - r"""Metadata for a file or directory within an environment.""" - - mime_type: NotRequired[str] - r"""Output only. The MIME type of the file (e.g., \"text/python\", \"image/png\"). - Empty for directories. - """ - name: NotRequired[str] - r"""Output only. The name of the file or directory (e.g., \"main.py\" or \"src\").""" - path: NotRequired[str] - r"""Output only. The full relative path within the environment - (e.g., \"workspace/src/main.py\"). - """ - size_bytes: NotRequired[int] - r"""Output only. The size of the file/directory in bytes.""" - type: NotRequired[EnvironmentFileType] - r"""Output only. The type of the entry.""" - - -class EnvironmentFile(BaseModel): - r"""Metadata for a file or directory within an environment.""" - - mime_type: Optional[str] = None - r"""Output only. The MIME type of the file (e.g., \"text/python\", \"image/png\"). - Empty for directories. - """ - - name: Optional[str] = None - r"""Output only. The name of the file or directory (e.g., \"main.py\" or \"src\").""" - - path: Optional[str] = None - r"""Output only. The full relative path within the environment - (e.g., \"workspace/src/main.py\"). - """ - - size_bytes: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Output only. The size of the file/directory in bytes.""" - - type: Optional[EnvironmentFileType] = None - r"""Output only. The type of the entry.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["mime_type", "name", "path", "size_bytes", "type"]) - 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/interactions/getenvironmentfilesresponse.py b/google/genai/_gaos/types/interactions/getenvironmentfilesresponse.py deleted file mode 100644 index 6d411c1a3..000000000 --- a/google/genai/_gaos/types/interactions/getenvironmentfilesresponse.py +++ /dev/null @@ -1,2889 +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 ...utils import serialize_int, validate_int -from .compositemedia import CompositeMedia, CompositeMediaTypedDict -from .environmentfile import EnvironmentFile, EnvironmentFileTypedDict -import pydantic -from pydantic import model_serializer -from pydantic.functional_serializers import PlainSerializer -from pydantic.functional_validators import BeforeValidator -from typing import List, Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypedDict - - -class GetEnvironmentFilesResponseBlobstore2InfoTypedDict(TypedDict): - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - blob_generation: NotRequired[int] - r"""The blob generation id.""" - blob_id: NotRequired[str] - r"""The blob id, e.g., /blobstore/prod/playground/scotty""" - download_external_read_token: NotRequired[str] - r"""A serialized External Read Token passed from Bigstore -> Scotty for a GCS - download. This field must never be consumed outside of Bigstore, and is not - applicable to non-GCS media uploads. - """ - download_read_handle: NotRequired[str] - r"""Read handle passed from Bigstore -> Scotty for a GCS download. - This is a signed, serialized blobstore2.ReadHandle proto which must never - be set outside of Bigstore, and is not applicable to non-GCS media - downloads. - """ - read_token: NotRequired[str] - r"""The blob read token. Needed to read blobs that have not been - replicated. Might not be available until the final call. - """ - upload_fragment_list_creation_info: NotRequired[str] - r"""A serialized Object Fragment List Creation Info passed from Bigstore -> - Scotty for a GCS upload. This field must never be consumed outside of - Bigstore, and is not applicable to non-GCS media uploads. - """ - upload_metadata_container: NotRequired[str] - r"""Metadata passed from Blobstore -> Scotty for a new GCS upload. - This is a signed, serialized blobstore2.BlobMetadataContainer proto which - must never be consumed outside of Bigstore, and is not applicable to - non-GCS media uploads. - """ - - -class GetEnvironmentFilesResponseBlobstore2Info(BaseModel): - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - blob_generation: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""The blob generation id.""" - - blob_id: Optional[str] = None - r"""The blob id, e.g., /blobstore/prod/playground/scotty""" - - download_external_read_token: Optional[str] = None - r"""A serialized External Read Token passed from Bigstore -> Scotty for a GCS - download. This field must never be consumed outside of Bigstore, and is not - applicable to non-GCS media uploads. - """ - - download_read_handle: Optional[str] = None - r"""Read handle passed from Bigstore -> Scotty for a GCS download. - This is a signed, serialized blobstore2.ReadHandle proto which must never - be set outside of Bigstore, and is not applicable to non-GCS media - downloads. - """ - - read_token: Optional[str] = None - r"""The blob read token. Needed to read blobs that have not been - replicated. Might not be available until the final call. - """ - - upload_fragment_list_creation_info: Optional[str] = None - r"""A serialized Object Fragment List Creation Info passed from Bigstore -> - Scotty for a GCS upload. This field must never be consumed outside of - Bigstore, and is not applicable to non-GCS media uploads. - """ - - upload_metadata_container: Optional[str] = None - r"""Metadata passed from Blobstore -> Scotty for a new GCS upload. - This is a signed, serialized blobstore2.BlobMetadataContainer proto which - must never be consumed outside of Bigstore, and is not applicable to - non-GCS media uploads. - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "blob_generation", - "blob_id", - "download_external_read_token", - "download_read_handle", - "read_token", - "upload_fragment_list_creation_info", - "upload_metadata_container", - ] - ) - 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 ContentTypeInfoTypedDict(TypedDict): - r"""Extended content type information provided for Scotty uploads.""" - - best_guess: NotRequired[str] - r"""Scotty's best guess of what the content type of the file is.""" - from_bytes: NotRequired[str] - r"""The content type of the file derived by looking at specific - bytes (i.e. \"magic bytes\") of the actual file. - """ - from_file_name: NotRequired[str] - r"""The content type of the file derived from the file extension of - the original file name used by the client. - """ - from_fusion_id: NotRequired[str] - r"""The content type of the file detected by Fusion ID. go/fusionid""" - from_header: NotRequired[str] - r"""The content type of the file as specified in the request headers, - multipart headers, or RUPIO start request. - """ - from_url_path: NotRequired[str] - r"""The content type of the file derived from the file extension of the - URL path. The URL path is assumed to represent a file name (which - is typically only true for agents that are providing a REST API). - """ - fusion_id_detection_metadata: NotRequired[str] - r"""Metadata information from Fusion ID detection. Serialized - FusionIdDetectionMetadata proto. Only set if from_fusion_id is set. - """ - - -class ContentTypeInfo(BaseModel): - r"""Extended content type information provided for Scotty uploads.""" - - best_guess: Optional[str] = None - r"""Scotty's best guess of what the content type of the file is.""" - - from_bytes: Optional[str] = None - r"""The content type of the file derived by looking at specific - bytes (i.e. \"magic bytes\") of the actual file. - """ - - from_file_name: Optional[str] = None - r"""The content type of the file derived from the file extension of - the original file name used by the client. - """ - - from_fusion_id: Optional[str] = None - r"""The content type of the file detected by Fusion ID. go/fusionid""" - - from_header: Optional[str] = None - r"""The content type of the file as specified in the request headers, - multipart headers, or RUPIO start request. - """ - - from_url_path: Optional[str] = None - r"""The content type of the file derived from the file extension of the - URL path. The URL path is assumed to represent a file name (which - is typically only true for agents that are providing a REST API). - """ - - fusion_id_detection_metadata: Optional[str] = None - r"""Metadata information from Fusion ID detection. Serialized - FusionIdDetectionMetadata proto. Only set if from_fusion_id is set. - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "best_guess", - "from_bytes", - "from_file_name", - "from_fusion_id", - "from_header", - "from_url_path", - "fusion_id_detection_metadata", - ] - ) - 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 ChecksumsLocationBlobstore2InfoTypedDict(TypedDict): - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - blob_generation: NotRequired[int] - r"""The blob generation id.""" - blob_id: NotRequired[str] - r"""The blob id, e.g., /blobstore/prod/playground/scotty""" - download_external_read_token: NotRequired[str] - r"""A serialized External Read Token passed from Bigstore -> Scotty for a GCS - download. This field must never be consumed outside of Bigstore, and is not - applicable to non-GCS media uploads. - """ - download_read_handle: NotRequired[str] - r"""Read handle passed from Bigstore -> Scotty for a GCS download. - This is a signed, serialized blobstore2.ReadHandle proto which must never - be set outside of Bigstore, and is not applicable to non-GCS media - downloads. - """ - read_token: NotRequired[str] - r"""The blob read token. Needed to read blobs that have not been - replicated. Might not be available until the final call. - """ - upload_fragment_list_creation_info: NotRequired[str] - r"""A serialized Object Fragment List Creation Info passed from Bigstore -> - Scotty for a GCS upload. This field must never be consumed outside of - Bigstore, and is not applicable to non-GCS media uploads. - """ - upload_metadata_container: NotRequired[str] - r"""Metadata passed from Blobstore -> Scotty for a new GCS upload. - This is a signed, serialized blobstore2.BlobMetadataContainer proto which - must never be consumed outside of Bigstore, and is not applicable to - non-GCS media uploads. - """ - - -class ChecksumsLocationBlobstore2Info(BaseModel): - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - blob_generation: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""The blob generation id.""" - - blob_id: Optional[str] = None - r"""The blob id, e.g., /blobstore/prod/playground/scotty""" - - download_external_read_token: Optional[str] = None - r"""A serialized External Read Token passed from Bigstore -> Scotty for a GCS - download. This field must never be consumed outside of Bigstore, and is not - applicable to non-GCS media uploads. - """ - - download_read_handle: Optional[str] = None - r"""Read handle passed from Bigstore -> Scotty for a GCS download. - This is a signed, serialized blobstore2.ReadHandle proto which must never - be set outside of Bigstore, and is not applicable to non-GCS media - downloads. - """ - - read_token: Optional[str] = None - r"""The blob read token. Needed to read blobs that have not been - replicated. Might not be available until the final call. - """ - - upload_fragment_list_creation_info: Optional[str] = None - r"""A serialized Object Fragment List Creation Info passed from Bigstore -> - Scotty for a GCS upload. This field must never be consumed outside of - Bigstore, and is not applicable to non-GCS media uploads. - """ - - upload_metadata_container: Optional[str] = None - r"""Metadata passed from Blobstore -> Scotty for a new GCS upload. - This is a signed, serialized blobstore2.BlobMetadataContainer proto which - must never be consumed outside of Bigstore, and is not applicable to - non-GCS media uploads. - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "blob_generation", - "blob_id", - "download_external_read_token", - "download_read_handle", - "read_token", - "upload_fragment_list_creation_info", - "upload_metadata_container", - ] - ) - 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 ChecksumsLocationObjectIDTypedDict(TypedDict): - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - bucket_name: NotRequired[str] - r"""The name of the bucket to which this object belongs.""" - generation: NotRequired[int] - r"""Generation of the object. Generations are monotonically increasing - across writes, allowing them to be be compared to determine which - generation is newer. If this is omitted in a request, then you are - requesting the live object. - See http://go/bigstore-versions - """ - object_name: NotRequired[str] - r"""The name of the object.""" - - -class ChecksumsLocationObjectID(BaseModel): - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - bucket_name: Optional[str] = None - r"""The name of the bucket to which this object belongs.""" - - generation: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Generation of the object. Generations are monotonically increasing - across writes, allowing them to be be compared to determine which - generation is newer. If this is omitted in a request, then you are - requesting the live object. - See http://go/bigstore-versions - """ - - object_name: Optional[str] = None - r"""The name of the object.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["bucket_name", "generation", "object_name"]) - 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 - - -ChecksumsLocationReferenceType = Union[ - Literal[ - "path", - "blob_ref", - "inline", - "bigstore_ref", - "cosmo_binary_reference", - ], - UnrecognizedStr, -] -r"""Describes what the field reference contains.""" - - -class ChecksumsLocationTypedDict(TypedDict): - r"""Exactly one of these fields must be populated. - - If checksums_location is filled, the server will return the corresponding - contents to the user. If object_location is filled, the server will - calculate the checksums based on the content there and return that to the - user. - For details on the format of the checksums, - see http://go/scotty-diff-protocol. - """ - - blob_ref: NotRequired[str] - r"""Blobstore v1 reference, set if reference_type is BLOBSTORE_REF - This should be the byte representation of a blobstore.BlobRef. - Since Blobstore is deprecating v1, use blobstore2_info instead. - For now, any v2 blob will also be represented in this field as - v1 BlobRef. - """ - blobstore2_info: NotRequired[ChecksumsLocationBlobstore2InfoTypedDict] - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - cosmo_binary_reference: NotRequired[str] - r"""A binary data reference for a media download. Serves as a - technology-agnostic binary reference in some Google infrastructure. - This value is a serialized storage_cosmo.BinaryReference proto. Storing - it as bytes is a hack to get around the fact that the cosmo proto - (as well as others it includes) doesn't support JavaScript. This - prevents us from including the actual type of this field. - """ - crc32c_hash: NotRequired[int] - r"""crc32.c hash for the payload.""" - inline: NotRequired[str] - r"""Media data, set if reference_type is INLINE""" - length: NotRequired[int] - r"""Size of the data, in bytes""" - md5_hash: NotRequired[str] - r"""MD5 hash for the payload.""" - object_id: NotRequired[ChecksumsLocationObjectIDTypedDict] - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - path: NotRequired[str] - r"""Path to the data, set if reference_type is PATH""" - reference_type: NotRequired[ChecksumsLocationReferenceType] - r"""Describes what the field reference contains.""" - sha1_hash: NotRequired[str] - r"""SHA-1 hash for the payload.""" - - -class ChecksumsLocation(BaseModel): - r"""Exactly one of these fields must be populated. - - If checksums_location is filled, the server will return the corresponding - contents to the user. If object_location is filled, the server will - calculate the checksums based on the content there and return that to the - user. - For details on the format of the checksums, - see http://go/scotty-diff-protocol. - """ - - blob_ref: Annotated[ - Optional[str], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." - ), - ] = None - r"""Blobstore v1 reference, set if reference_type is BLOBSTORE_REF - This should be the byte representation of a blobstore.BlobRef. - Since Blobstore is deprecating v1, use blobstore2_info instead. - For now, any v2 blob will also be represented in this field as - v1 BlobRef. - """ - - blobstore2_info: Optional[ChecksumsLocationBlobstore2Info] = None - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - cosmo_binary_reference: Optional[str] = None - r"""A binary data reference for a media download. Serves as a - technology-agnostic binary reference in some Google infrastructure. - This value is a serialized storage_cosmo.BinaryReference proto. Storing - it as bytes is a hack to get around the fact that the cosmo proto - (as well as others it includes) doesn't support JavaScript. This - prevents us from including the actual type of this field. - """ - - crc32c_hash: Optional[int] = None - r"""crc32.c hash for the payload.""" - - inline: Optional[str] = None - r"""Media data, set if reference_type is INLINE""" - - length: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Size of the data, in bytes""" - - md5_hash: Optional[str] = None - r"""MD5 hash for the payload.""" - - object_id: Optional[ChecksumsLocationObjectID] = None - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - path: Optional[str] = None - r"""Path to the data, set if reference_type is PATH""" - - reference_type: Optional[ChecksumsLocationReferenceType] = None - r"""Describes what the field reference contains.""" - - sha1_hash: Optional[str] = None - r"""SHA-1 hash for the payload.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "blob_ref", - "blobstore2_info", - "cosmo_binary_reference", - "crc32c_hash", - "inline", - "length", - "md5_hash", - "object_id", - "path", - "reference_type", - "sha1_hash", - ] - ) - 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 DiffChecksumsResponseObjectLocationBlobstore2InfoTypedDict(TypedDict): - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - blob_generation: NotRequired[int] - r"""The blob generation id.""" - blob_id: NotRequired[str] - r"""The blob id, e.g., /blobstore/prod/playground/scotty""" - download_external_read_token: NotRequired[str] - r"""A serialized External Read Token passed from Bigstore -> Scotty for a GCS - download. This field must never be consumed outside of Bigstore, and is not - applicable to non-GCS media uploads. - """ - download_read_handle: NotRequired[str] - r"""Read handle passed from Bigstore -> Scotty for a GCS download. - This is a signed, serialized blobstore2.ReadHandle proto which must never - be set outside of Bigstore, and is not applicable to non-GCS media - downloads. - """ - read_token: NotRequired[str] - r"""The blob read token. Needed to read blobs that have not been - replicated. Might not be available until the final call. - """ - upload_fragment_list_creation_info: NotRequired[str] - r"""A serialized Object Fragment List Creation Info passed from Bigstore -> - Scotty for a GCS upload. This field must never be consumed outside of - Bigstore, and is not applicable to non-GCS media uploads. - """ - upload_metadata_container: NotRequired[str] - r"""Metadata passed from Blobstore -> Scotty for a new GCS upload. - This is a signed, serialized blobstore2.BlobMetadataContainer proto which - must never be consumed outside of Bigstore, and is not applicable to - non-GCS media uploads. - """ - - -class DiffChecksumsResponseObjectLocationBlobstore2Info(BaseModel): - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - blob_generation: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""The blob generation id.""" - - blob_id: Optional[str] = None - r"""The blob id, e.g., /blobstore/prod/playground/scotty""" - - download_external_read_token: Optional[str] = None - r"""A serialized External Read Token passed from Bigstore -> Scotty for a GCS - download. This field must never be consumed outside of Bigstore, and is not - applicable to non-GCS media uploads. - """ - - download_read_handle: Optional[str] = None - r"""Read handle passed from Bigstore -> Scotty for a GCS download. - This is a signed, serialized blobstore2.ReadHandle proto which must never - be set outside of Bigstore, and is not applicable to non-GCS media - downloads. - """ - - read_token: Optional[str] = None - r"""The blob read token. Needed to read blobs that have not been - replicated. Might not be available until the final call. - """ - - upload_fragment_list_creation_info: Optional[str] = None - r"""A serialized Object Fragment List Creation Info passed from Bigstore -> - Scotty for a GCS upload. This field must never be consumed outside of - Bigstore, and is not applicable to non-GCS media uploads. - """ - - upload_metadata_container: Optional[str] = None - r"""Metadata passed from Blobstore -> Scotty for a new GCS upload. - This is a signed, serialized blobstore2.BlobMetadataContainer proto which - must never be consumed outside of Bigstore, and is not applicable to - non-GCS media uploads. - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "blob_generation", - "blob_id", - "download_external_read_token", - "download_read_handle", - "read_token", - "upload_fragment_list_creation_info", - "upload_metadata_container", - ] - ) - 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 DiffChecksumsResponseObjectLocationObjectIDTypedDict(TypedDict): - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - bucket_name: NotRequired[str] - r"""The name of the bucket to which this object belongs.""" - generation: NotRequired[int] - r"""Generation of the object. Generations are monotonically increasing - across writes, allowing them to be be compared to determine which - generation is newer. If this is omitted in a request, then you are - requesting the live object. - See http://go/bigstore-versions - """ - object_name: NotRequired[str] - r"""The name of the object.""" - - -class DiffChecksumsResponseObjectLocationObjectID(BaseModel): - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - bucket_name: Optional[str] = None - r"""The name of the bucket to which this object belongs.""" - - generation: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Generation of the object. Generations are monotonically increasing - across writes, allowing them to be be compared to determine which - generation is newer. If this is omitted in a request, then you are - requesting the live object. - See http://go/bigstore-versions - """ - - object_name: Optional[str] = None - r"""The name of the object.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["bucket_name", "generation", "object_name"]) - 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 - - -DiffChecksumsResponseObjectLocationReferenceType = Union[ - Literal[ - "path", - "blob_ref", - "inline", - "bigstore_ref", - "cosmo_binary_reference", - ], - UnrecognizedStr, -] -r"""Describes what the field reference contains.""" - - -class DiffChecksumsResponseObjectLocationTypedDict(TypedDict): - r"""If set, calculate the checksums based on the contents and return them to - the caller. - """ - - blob_ref: NotRequired[str] - r"""Blobstore v1 reference, set if reference_type is BLOBSTORE_REF - This should be the byte representation of a blobstore.BlobRef. - Since Blobstore is deprecating v1, use blobstore2_info instead. - For now, any v2 blob will also be represented in this field as - v1 BlobRef. - """ - blobstore2_info: NotRequired[ - DiffChecksumsResponseObjectLocationBlobstore2InfoTypedDict - ] - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - cosmo_binary_reference: NotRequired[str] - r"""A binary data reference for a media download. Serves as a - technology-agnostic binary reference in some Google infrastructure. - This value is a serialized storage_cosmo.BinaryReference proto. Storing - it as bytes is a hack to get around the fact that the cosmo proto - (as well as others it includes) doesn't support JavaScript. This - prevents us from including the actual type of this field. - """ - crc32c_hash: NotRequired[int] - r"""crc32.c hash for the payload.""" - inline: NotRequired[str] - r"""Media data, set if reference_type is INLINE""" - length: NotRequired[int] - r"""Size of the data, in bytes""" - md5_hash: NotRequired[str] - r"""MD5 hash for the payload.""" - object_id: NotRequired[DiffChecksumsResponseObjectLocationObjectIDTypedDict] - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - path: NotRequired[str] - r"""Path to the data, set if reference_type is PATH""" - reference_type: NotRequired[DiffChecksumsResponseObjectLocationReferenceType] - r"""Describes what the field reference contains.""" - sha1_hash: NotRequired[str] - r"""SHA-1 hash for the payload.""" - - -class DiffChecksumsResponseObjectLocation(BaseModel): - r"""If set, calculate the checksums based on the contents and return them to - the caller. - """ - - blob_ref: Annotated[ - Optional[str], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." - ), - ] = None - r"""Blobstore v1 reference, set if reference_type is BLOBSTORE_REF - This should be the byte representation of a blobstore.BlobRef. - Since Blobstore is deprecating v1, use blobstore2_info instead. - For now, any v2 blob will also be represented in this field as - v1 BlobRef. - """ - - blobstore2_info: Optional[DiffChecksumsResponseObjectLocationBlobstore2Info] = None - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - cosmo_binary_reference: Optional[str] = None - r"""A binary data reference for a media download. Serves as a - technology-agnostic binary reference in some Google infrastructure. - This value is a serialized storage_cosmo.BinaryReference proto. Storing - it as bytes is a hack to get around the fact that the cosmo proto - (as well as others it includes) doesn't support JavaScript. This - prevents us from including the actual type of this field. - """ - - crc32c_hash: Optional[int] = None - r"""crc32.c hash for the payload.""" - - inline: Optional[str] = None - r"""Media data, set if reference_type is INLINE""" - - length: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Size of the data, in bytes""" - - md5_hash: Optional[str] = None - r"""MD5 hash for the payload.""" - - object_id: Optional[DiffChecksumsResponseObjectLocationObjectID] = None - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - path: Optional[str] = None - r"""Path to the data, set if reference_type is PATH""" - - reference_type: Optional[DiffChecksumsResponseObjectLocationReferenceType] = None - r"""Describes what the field reference contains.""" - - sha1_hash: Optional[str] = None - r"""SHA-1 hash for the payload.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "blob_ref", - "blobstore2_info", - "cosmo_binary_reference", - "crc32c_hash", - "inline", - "length", - "md5_hash", - "object_id", - "path", - "reference_type", - "sha1_hash", - ] - ) - 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 DiffChecksumsResponseTypedDict(TypedDict): - r"""Set if reference_type is DIFF_CHECKSUMS_RESPONSE.""" - - checksums_location: NotRequired[ChecksumsLocationTypedDict] - r"""Exactly one of these fields must be populated. - - If checksums_location is filled, the server will return the corresponding - contents to the user. If object_location is filled, the server will - calculate the checksums based on the content there and return that to the - user. - For details on the format of the checksums, - see http://go/scotty-diff-protocol. - """ - chunk_size_bytes: NotRequired[int] - r"""The chunk size of checksums. Must be a multiple of 256KB.""" - object_location: NotRequired[DiffChecksumsResponseObjectLocationTypedDict] - r"""If set, calculate the checksums based on the contents and return them to - the caller. - """ - object_size_bytes: NotRequired[int] - r"""The total size of the server object.""" - object_version: NotRequired[str] - r"""The object version of the object the checksums are being returned for.""" - - -class DiffChecksumsResponse(BaseModel): - r"""Set if reference_type is DIFF_CHECKSUMS_RESPONSE.""" - - checksums_location: Optional[ChecksumsLocation] = None - r"""Exactly one of these fields must be populated. - - If checksums_location is filled, the server will return the corresponding - contents to the user. If object_location is filled, the server will - calculate the checksums based on the content there and return that to the - user. - For details on the format of the checksums, - see http://go/scotty-diff-protocol. - """ - - chunk_size_bytes: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""The chunk size of checksums. Must be a multiple of 256KB.""" - - object_location: Optional[DiffChecksumsResponseObjectLocation] = None - r"""If set, calculate the checksums based on the contents and return them to - the caller. - """ - - object_size_bytes: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""The total size of the server object.""" - - object_version: Optional[str] = None - r"""The object version of the object the checksums are being returned for.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "checksums_location", - "chunk_size_bytes", - "object_location", - "object_size_bytes", - "object_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 DiffDownloadResponseBlobstore2InfoTypedDict(TypedDict): - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - blob_generation: NotRequired[int] - r"""The blob generation id.""" - blob_id: NotRequired[str] - r"""The blob id, e.g., /blobstore/prod/playground/scotty""" - download_external_read_token: NotRequired[str] - r"""A serialized External Read Token passed from Bigstore -> Scotty for a GCS - download. This field must never be consumed outside of Bigstore, and is not - applicable to non-GCS media uploads. - """ - download_read_handle: NotRequired[str] - r"""Read handle passed from Bigstore -> Scotty for a GCS download. - This is a signed, serialized blobstore2.ReadHandle proto which must never - be set outside of Bigstore, and is not applicable to non-GCS media - downloads. - """ - read_token: NotRequired[str] - r"""The blob read token. Needed to read blobs that have not been - replicated. Might not be available until the final call. - """ - upload_fragment_list_creation_info: NotRequired[str] - r"""A serialized Object Fragment List Creation Info passed from Bigstore -> - Scotty for a GCS upload. This field must never be consumed outside of - Bigstore, and is not applicable to non-GCS media uploads. - """ - upload_metadata_container: NotRequired[str] - r"""Metadata passed from Blobstore -> Scotty for a new GCS upload. - This is a signed, serialized blobstore2.BlobMetadataContainer proto which - must never be consumed outside of Bigstore, and is not applicable to - non-GCS media uploads. - """ - - -class DiffDownloadResponseBlobstore2Info(BaseModel): - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - blob_generation: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""The blob generation id.""" - - blob_id: Optional[str] = None - r"""The blob id, e.g., /blobstore/prod/playground/scotty""" - - download_external_read_token: Optional[str] = None - r"""A serialized External Read Token passed from Bigstore -> Scotty for a GCS - download. This field must never be consumed outside of Bigstore, and is not - applicable to non-GCS media uploads. - """ - - download_read_handle: Optional[str] = None - r"""Read handle passed from Bigstore -> Scotty for a GCS download. - This is a signed, serialized blobstore2.ReadHandle proto which must never - be set outside of Bigstore, and is not applicable to non-GCS media - downloads. - """ - - read_token: Optional[str] = None - r"""The blob read token. Needed to read blobs that have not been - replicated. Might not be available until the final call. - """ - - upload_fragment_list_creation_info: Optional[str] = None - r"""A serialized Object Fragment List Creation Info passed from Bigstore -> - Scotty for a GCS upload. This field must never be consumed outside of - Bigstore, and is not applicable to non-GCS media uploads. - """ - - upload_metadata_container: Optional[str] = None - r"""Metadata passed from Blobstore -> Scotty for a new GCS upload. - This is a signed, serialized blobstore2.BlobMetadataContainer proto which - must never be consumed outside of Bigstore, and is not applicable to - non-GCS media uploads. - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "blob_generation", - "blob_id", - "download_external_read_token", - "download_read_handle", - "read_token", - "upload_fragment_list_creation_info", - "upload_metadata_container", - ] - ) - 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 DiffDownloadResponseObjectIDTypedDict(TypedDict): - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - bucket_name: NotRequired[str] - r"""The name of the bucket to which this object belongs.""" - generation: NotRequired[int] - r"""Generation of the object. Generations are monotonically increasing - across writes, allowing them to be be compared to determine which - generation is newer. If this is omitted in a request, then you are - requesting the live object. - See http://go/bigstore-versions - """ - object_name: NotRequired[str] - r"""The name of the object.""" - - -class DiffDownloadResponseObjectID(BaseModel): - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - bucket_name: Optional[str] = None - r"""The name of the bucket to which this object belongs.""" - - generation: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Generation of the object. Generations are monotonically increasing - across writes, allowing them to be be compared to determine which - generation is newer. If this is omitted in a request, then you are - requesting the live object. - See http://go/bigstore-versions - """ - - object_name: Optional[str] = None - r"""The name of the object.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["bucket_name", "generation", "object_name"]) - 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 - - -DiffDownloadResponseReferenceType = Union[ - Literal[ - "path", - "blob_ref", - "inline", - "bigstore_ref", - "cosmo_binary_reference", - ], - UnrecognizedStr, -] -r"""Describes what the field reference contains.""" - - -class DiffDownloadResponseObjectLocationTypedDict(TypedDict): - r"""The original object location.""" - - blob_ref: NotRequired[str] - r"""Blobstore v1 reference, set if reference_type is BLOBSTORE_REF - This should be the byte representation of a blobstore.BlobRef. - Since Blobstore is deprecating v1, use blobstore2_info instead. - For now, any v2 blob will also be represented in this field as - v1 BlobRef. - """ - blobstore2_info: NotRequired[DiffDownloadResponseBlobstore2InfoTypedDict] - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - cosmo_binary_reference: NotRequired[str] - r"""A binary data reference for a media download. Serves as a - technology-agnostic binary reference in some Google infrastructure. - This value is a serialized storage_cosmo.BinaryReference proto. Storing - it as bytes is a hack to get around the fact that the cosmo proto - (as well as others it includes) doesn't support JavaScript. This - prevents us from including the actual type of this field. - """ - crc32c_hash: NotRequired[int] - r"""crc32.c hash for the payload.""" - inline: NotRequired[str] - r"""Media data, set if reference_type is INLINE""" - length: NotRequired[int] - r"""Size of the data, in bytes""" - md5_hash: NotRequired[str] - r"""MD5 hash for the payload.""" - object_id: NotRequired[DiffDownloadResponseObjectIDTypedDict] - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - path: NotRequired[str] - r"""Path to the data, set if reference_type is PATH""" - reference_type: NotRequired[DiffDownloadResponseReferenceType] - r"""Describes what the field reference contains.""" - sha1_hash: NotRequired[str] - r"""SHA-1 hash for the payload.""" - - -class DiffDownloadResponseObjectLocation(BaseModel): - r"""The original object location.""" - - blob_ref: Annotated[ - Optional[str], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." - ), - ] = None - r"""Blobstore v1 reference, set if reference_type is BLOBSTORE_REF - This should be the byte representation of a blobstore.BlobRef. - Since Blobstore is deprecating v1, use blobstore2_info instead. - For now, any v2 blob will also be represented in this field as - v1 BlobRef. - """ - - blobstore2_info: Optional[DiffDownloadResponseBlobstore2Info] = None - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - cosmo_binary_reference: Optional[str] = None - r"""A binary data reference for a media download. Serves as a - technology-agnostic binary reference in some Google infrastructure. - This value is a serialized storage_cosmo.BinaryReference proto. Storing - it as bytes is a hack to get around the fact that the cosmo proto - (as well as others it includes) doesn't support JavaScript. This - prevents us from including the actual type of this field. - """ - - crc32c_hash: Optional[int] = None - r"""crc32.c hash for the payload.""" - - inline: Optional[str] = None - r"""Media data, set if reference_type is INLINE""" - - length: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Size of the data, in bytes""" - - md5_hash: Optional[str] = None - r"""MD5 hash for the payload.""" - - object_id: Optional[DiffDownloadResponseObjectID] = None - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - path: Optional[str] = None - r"""Path to the data, set if reference_type is PATH""" - - reference_type: Optional[DiffDownloadResponseReferenceType] = None - r"""Describes what the field reference contains.""" - - sha1_hash: Optional[str] = None - r"""SHA-1 hash for the payload.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "blob_ref", - "blobstore2_info", - "cosmo_binary_reference", - "crc32c_hash", - "inline", - "length", - "md5_hash", - "object_id", - "path", - "reference_type", - "sha1_hash", - ] - ) - 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 DiffDownloadResponseTypedDict(TypedDict): - r"""Set if reference_type is DIFF_DOWNLOAD_RESPONSE.""" - - object_location: NotRequired[DiffDownloadResponseObjectLocationTypedDict] - r"""The original object location.""" - - -class DiffDownloadResponse(BaseModel): - r"""Set if reference_type is DIFF_DOWNLOAD_RESPONSE.""" - - object_location: Optional[DiffDownloadResponseObjectLocation] = None - r"""The original object location.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["object_location"]) - 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 ChecksumsInfoBlobstore2InfoTypedDict(TypedDict): - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - blob_generation: NotRequired[int] - r"""The blob generation id.""" - blob_id: NotRequired[str] - r"""The blob id, e.g., /blobstore/prod/playground/scotty""" - download_external_read_token: NotRequired[str] - r"""A serialized External Read Token passed from Bigstore -> Scotty for a GCS - download. This field must never be consumed outside of Bigstore, and is not - applicable to non-GCS media uploads. - """ - download_read_handle: NotRequired[str] - r"""Read handle passed from Bigstore -> Scotty for a GCS download. - This is a signed, serialized blobstore2.ReadHandle proto which must never - be set outside of Bigstore, and is not applicable to non-GCS media - downloads. - """ - read_token: NotRequired[str] - r"""The blob read token. Needed to read blobs that have not been - replicated. Might not be available until the final call. - """ - upload_fragment_list_creation_info: NotRequired[str] - r"""A serialized Object Fragment List Creation Info passed from Bigstore -> - Scotty for a GCS upload. This field must never be consumed outside of - Bigstore, and is not applicable to non-GCS media uploads. - """ - upload_metadata_container: NotRequired[str] - r"""Metadata passed from Blobstore -> Scotty for a new GCS upload. - This is a signed, serialized blobstore2.BlobMetadataContainer proto which - must never be consumed outside of Bigstore, and is not applicable to - non-GCS media uploads. - """ - - -class ChecksumsInfoBlobstore2Info(BaseModel): - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - blob_generation: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""The blob generation id.""" - - blob_id: Optional[str] = None - r"""The blob id, e.g., /blobstore/prod/playground/scotty""" - - download_external_read_token: Optional[str] = None - r"""A serialized External Read Token passed from Bigstore -> Scotty for a GCS - download. This field must never be consumed outside of Bigstore, and is not - applicable to non-GCS media uploads. - """ - - download_read_handle: Optional[str] = None - r"""Read handle passed from Bigstore -> Scotty for a GCS download. - This is a signed, serialized blobstore2.ReadHandle proto which must never - be set outside of Bigstore, and is not applicable to non-GCS media - downloads. - """ - - read_token: Optional[str] = None - r"""The blob read token. Needed to read blobs that have not been - replicated. Might not be available until the final call. - """ - - upload_fragment_list_creation_info: Optional[str] = None - r"""A serialized Object Fragment List Creation Info passed from Bigstore -> - Scotty for a GCS upload. This field must never be consumed outside of - Bigstore, and is not applicable to non-GCS media uploads. - """ - - upload_metadata_container: Optional[str] = None - r"""Metadata passed from Blobstore -> Scotty for a new GCS upload. - This is a signed, serialized blobstore2.BlobMetadataContainer proto which - must never be consumed outside of Bigstore, and is not applicable to - non-GCS media uploads. - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "blob_generation", - "blob_id", - "download_external_read_token", - "download_read_handle", - "read_token", - "upload_fragment_list_creation_info", - "upload_metadata_container", - ] - ) - 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 ChecksumsInfoObjectIDTypedDict(TypedDict): - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - bucket_name: NotRequired[str] - r"""The name of the bucket to which this object belongs.""" - generation: NotRequired[int] - r"""Generation of the object. Generations are monotonically increasing - across writes, allowing them to be be compared to determine which - generation is newer. If this is omitted in a request, then you are - requesting the live object. - See http://go/bigstore-versions - """ - object_name: NotRequired[str] - r"""The name of the object.""" - - -class ChecksumsInfoObjectID(BaseModel): - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - bucket_name: Optional[str] = None - r"""The name of the bucket to which this object belongs.""" - - generation: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Generation of the object. Generations are monotonically increasing - across writes, allowing them to be be compared to determine which - generation is newer. If this is omitted in a request, then you are - requesting the live object. - See http://go/bigstore-versions - """ - - object_name: Optional[str] = None - r"""The name of the object.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["bucket_name", "generation", "object_name"]) - 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 - - -ChecksumsInfoReferenceType = Union[ - Literal[ - "path", - "blob_ref", - "inline", - "bigstore_ref", - "cosmo_binary_reference", - ], - UnrecognizedStr, -] -r"""Describes what the field reference contains.""" - - -class ChecksumsInfoTypedDict(TypedDict): - r"""The location of the checksums for the new object. - Agents must clone the object located here, as the upload server will - delete the contents once a response is received. - For details on the format of the checksums, - see http://go/scotty-diff-protocol. - """ - - blob_ref: NotRequired[str] - r"""Blobstore v1 reference, set if reference_type is BLOBSTORE_REF - This should be the byte representation of a blobstore.BlobRef. - Since Blobstore is deprecating v1, use blobstore2_info instead. - For now, any v2 blob will also be represented in this field as - v1 BlobRef. - """ - blobstore2_info: NotRequired[ChecksumsInfoBlobstore2InfoTypedDict] - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - cosmo_binary_reference: NotRequired[str] - r"""A binary data reference for a media download. Serves as a - technology-agnostic binary reference in some Google infrastructure. - This value is a serialized storage_cosmo.BinaryReference proto. Storing - it as bytes is a hack to get around the fact that the cosmo proto - (as well as others it includes) doesn't support JavaScript. This - prevents us from including the actual type of this field. - """ - crc32c_hash: NotRequired[int] - r"""crc32.c hash for the payload.""" - inline: NotRequired[str] - r"""Media data, set if reference_type is INLINE""" - length: NotRequired[int] - r"""Size of the data, in bytes""" - md5_hash: NotRequired[str] - r"""MD5 hash for the payload.""" - object_id: NotRequired[ChecksumsInfoObjectIDTypedDict] - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - path: NotRequired[str] - r"""Path to the data, set if reference_type is PATH""" - reference_type: NotRequired[ChecksumsInfoReferenceType] - r"""Describes what the field reference contains.""" - sha1_hash: NotRequired[str] - r"""SHA-1 hash for the payload.""" - - -class ChecksumsInfo(BaseModel): - r"""The location of the checksums for the new object. - Agents must clone the object located here, as the upload server will - delete the contents once a response is received. - For details on the format of the checksums, - see http://go/scotty-diff-protocol. - """ - - blob_ref: Annotated[ - Optional[str], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." - ), - ] = None - r"""Blobstore v1 reference, set if reference_type is BLOBSTORE_REF - This should be the byte representation of a blobstore.BlobRef. - Since Blobstore is deprecating v1, use blobstore2_info instead. - For now, any v2 blob will also be represented in this field as - v1 BlobRef. - """ - - blobstore2_info: Optional[ChecksumsInfoBlobstore2Info] = None - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - cosmo_binary_reference: Optional[str] = None - r"""A binary data reference for a media download. Serves as a - technology-agnostic binary reference in some Google infrastructure. - This value is a serialized storage_cosmo.BinaryReference proto. Storing - it as bytes is a hack to get around the fact that the cosmo proto - (as well as others it includes) doesn't support JavaScript. This - prevents us from including the actual type of this field. - """ - - crc32c_hash: Optional[int] = None - r"""crc32.c hash for the payload.""" - - inline: Optional[str] = None - r"""Media data, set if reference_type is INLINE""" - - length: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Size of the data, in bytes""" - - md5_hash: Optional[str] = None - r"""MD5 hash for the payload.""" - - object_id: Optional[ChecksumsInfoObjectID] = None - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - path: Optional[str] = None - r"""Path to the data, set if reference_type is PATH""" - - reference_type: Optional[ChecksumsInfoReferenceType] = None - r"""Describes what the field reference contains.""" - - sha1_hash: Optional[str] = None - r"""SHA-1 hash for the payload.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "blob_ref", - "blobstore2_info", - "cosmo_binary_reference", - "crc32c_hash", - "inline", - "length", - "md5_hash", - "object_id", - "path", - "reference_type", - "sha1_hash", - ] - ) - 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 ObjectInfoBlobstore2InfoTypedDict(TypedDict): - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - blob_generation: NotRequired[int] - r"""The blob generation id.""" - blob_id: NotRequired[str] - r"""The blob id, e.g., /blobstore/prod/playground/scotty""" - download_external_read_token: NotRequired[str] - r"""A serialized External Read Token passed from Bigstore -> Scotty for a GCS - download. This field must never be consumed outside of Bigstore, and is not - applicable to non-GCS media uploads. - """ - download_read_handle: NotRequired[str] - r"""Read handle passed from Bigstore -> Scotty for a GCS download. - This is a signed, serialized blobstore2.ReadHandle proto which must never - be set outside of Bigstore, and is not applicable to non-GCS media - downloads. - """ - read_token: NotRequired[str] - r"""The blob read token. Needed to read blobs that have not been - replicated. Might not be available until the final call. - """ - upload_fragment_list_creation_info: NotRequired[str] - r"""A serialized Object Fragment List Creation Info passed from Bigstore -> - Scotty for a GCS upload. This field must never be consumed outside of - Bigstore, and is not applicable to non-GCS media uploads. - """ - upload_metadata_container: NotRequired[str] - r"""Metadata passed from Blobstore -> Scotty for a new GCS upload. - This is a signed, serialized blobstore2.BlobMetadataContainer proto which - must never be consumed outside of Bigstore, and is not applicable to - non-GCS media uploads. - """ - - -class ObjectInfoBlobstore2Info(BaseModel): - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - blob_generation: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""The blob generation id.""" - - blob_id: Optional[str] = None - r"""The blob id, e.g., /blobstore/prod/playground/scotty""" - - download_external_read_token: Optional[str] = None - r"""A serialized External Read Token passed from Bigstore -> Scotty for a GCS - download. This field must never be consumed outside of Bigstore, and is not - applicable to non-GCS media uploads. - """ - - download_read_handle: Optional[str] = None - r"""Read handle passed from Bigstore -> Scotty for a GCS download. - This is a signed, serialized blobstore2.ReadHandle proto which must never - be set outside of Bigstore, and is not applicable to non-GCS media - downloads. - """ - - read_token: Optional[str] = None - r"""The blob read token. Needed to read blobs that have not been - replicated. Might not be available until the final call. - """ - - upload_fragment_list_creation_info: Optional[str] = None - r"""A serialized Object Fragment List Creation Info passed from Bigstore -> - Scotty for a GCS upload. This field must never be consumed outside of - Bigstore, and is not applicable to non-GCS media uploads. - """ - - upload_metadata_container: Optional[str] = None - r"""Metadata passed from Blobstore -> Scotty for a new GCS upload. - This is a signed, serialized blobstore2.BlobMetadataContainer proto which - must never be consumed outside of Bigstore, and is not applicable to - non-GCS media uploads. - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "blob_generation", - "blob_id", - "download_external_read_token", - "download_read_handle", - "read_token", - "upload_fragment_list_creation_info", - "upload_metadata_container", - ] - ) - 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 ObjectInfoObjectIDTypedDict(TypedDict): - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - bucket_name: NotRequired[str] - r"""The name of the bucket to which this object belongs.""" - generation: NotRequired[int] - r"""Generation of the object. Generations are monotonically increasing - across writes, allowing them to be be compared to determine which - generation is newer. If this is omitted in a request, then you are - requesting the live object. - See http://go/bigstore-versions - """ - object_name: NotRequired[str] - r"""The name of the object.""" - - -class ObjectInfoObjectID(BaseModel): - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - bucket_name: Optional[str] = None - r"""The name of the bucket to which this object belongs.""" - - generation: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Generation of the object. Generations are monotonically increasing - across writes, allowing them to be be compared to determine which - generation is newer. If this is omitted in a request, then you are - requesting the live object. - See http://go/bigstore-versions - """ - - object_name: Optional[str] = None - r"""The name of the object.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["bucket_name", "generation", "object_name"]) - 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 - - -ObjectInfoReferenceType = Union[ - Literal[ - "path", - "blob_ref", - "inline", - "bigstore_ref", - "cosmo_binary_reference", - ], - UnrecognizedStr, -] -r"""Describes what the field reference contains.""" - - -class ObjectInfoTypedDict(TypedDict): - r"""The location of the new object. - Agents must clone the object located here, as the upload server will - delete the contents once a response is received. - """ - - blob_ref: NotRequired[str] - r"""Blobstore v1 reference, set if reference_type is BLOBSTORE_REF - This should be the byte representation of a blobstore.BlobRef. - Since Blobstore is deprecating v1, use blobstore2_info instead. - For now, any v2 blob will also be represented in this field as - v1 BlobRef. - """ - blobstore2_info: NotRequired[ObjectInfoBlobstore2InfoTypedDict] - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - cosmo_binary_reference: NotRequired[str] - r"""A binary data reference for a media download. Serves as a - technology-agnostic binary reference in some Google infrastructure. - This value is a serialized storage_cosmo.BinaryReference proto. Storing - it as bytes is a hack to get around the fact that the cosmo proto - (as well as others it includes) doesn't support JavaScript. This - prevents us from including the actual type of this field. - """ - crc32c_hash: NotRequired[int] - r"""crc32.c hash for the payload.""" - inline: NotRequired[str] - r"""Media data, set if reference_type is INLINE""" - length: NotRequired[int] - r"""Size of the data, in bytes""" - md5_hash: NotRequired[str] - r"""MD5 hash for the payload.""" - object_id: NotRequired[ObjectInfoObjectIDTypedDict] - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - path: NotRequired[str] - r"""Path to the data, set if reference_type is PATH""" - reference_type: NotRequired[ObjectInfoReferenceType] - r"""Describes what the field reference contains.""" - sha1_hash: NotRequired[str] - r"""SHA-1 hash for the payload.""" - - -class ObjectInfo(BaseModel): - r"""The location of the new object. - Agents must clone the object located here, as the upload server will - delete the contents once a response is received. - """ - - blob_ref: Annotated[ - Optional[str], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." - ), - ] = None - r"""Blobstore v1 reference, set if reference_type is BLOBSTORE_REF - This should be the byte representation of a blobstore.BlobRef. - Since Blobstore is deprecating v1, use blobstore2_info instead. - For now, any v2 blob will also be represented in this field as - v1 BlobRef. - """ - - blobstore2_info: Optional[ObjectInfoBlobstore2Info] = None - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - cosmo_binary_reference: Optional[str] = None - r"""A binary data reference for a media download. Serves as a - technology-agnostic binary reference in some Google infrastructure. - This value is a serialized storage_cosmo.BinaryReference proto. Storing - it as bytes is a hack to get around the fact that the cosmo proto - (as well as others it includes) doesn't support JavaScript. This - prevents us from including the actual type of this field. - """ - - crc32c_hash: Optional[int] = None - r"""crc32.c hash for the payload.""" - - inline: Optional[str] = None - r"""Media data, set if reference_type is INLINE""" - - length: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Size of the data, in bytes""" - - md5_hash: Optional[str] = None - r"""MD5 hash for the payload.""" - - object_id: Optional[ObjectInfoObjectID] = None - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - path: Optional[str] = None - r"""Path to the data, set if reference_type is PATH""" - - reference_type: Optional[ObjectInfoReferenceType] = None - r"""Describes what the field reference contains.""" - - sha1_hash: Optional[str] = None - r"""SHA-1 hash for the payload.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "blob_ref", - "blobstore2_info", - "cosmo_binary_reference", - "crc32c_hash", - "inline", - "length", - "md5_hash", - "object_id", - "path", - "reference_type", - "sha1_hash", - ] - ) - 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 DiffUploadRequestTypedDict(TypedDict): - r"""Set if reference_type is DIFF_UPLOAD_REQUEST.""" - - checksums_info: NotRequired[ChecksumsInfoTypedDict] - r"""The location of the checksums for the new object. - Agents must clone the object located here, as the upload server will - delete the contents once a response is received. - For details on the format of the checksums, - see http://go/scotty-diff-protocol. - """ - object_info: NotRequired[ObjectInfoTypedDict] - r"""The location of the new object. - Agents must clone the object located here, as the upload server will - delete the contents once a response is received. - """ - object_version: NotRequired[str] - r"""The object version of the object that is the base version the incoming - diff script will be applied to. - This field will always be filled in. - """ - - -class DiffUploadRequest(BaseModel): - r"""Set if reference_type is DIFF_UPLOAD_REQUEST.""" - - checksums_info: Optional[ChecksumsInfo] = None - r"""The location of the checksums for the new object. - Agents must clone the object located here, as the upload server will - delete the contents once a response is received. - For details on the format of the checksums, - see http://go/scotty-diff-protocol. - """ - - object_info: Optional[ObjectInfo] = None - r"""The location of the new object. - Agents must clone the object located here, as the upload server will - delete the contents once a response is received. - """ - - object_version: Optional[str] = None - r"""The object version of the object that is the base version the incoming - diff script will be applied to. - This field will always be filled in. - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["checksums_info", "object_info", "object_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 OriginalObjectBlobstore2InfoTypedDict(TypedDict): - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - blob_generation: NotRequired[int] - r"""The blob generation id.""" - blob_id: NotRequired[str] - r"""The blob id, e.g., /blobstore/prod/playground/scotty""" - download_external_read_token: NotRequired[str] - r"""A serialized External Read Token passed from Bigstore -> Scotty for a GCS - download. This field must never be consumed outside of Bigstore, and is not - applicable to non-GCS media uploads. - """ - download_read_handle: NotRequired[str] - r"""Read handle passed from Bigstore -> Scotty for a GCS download. - This is a signed, serialized blobstore2.ReadHandle proto which must never - be set outside of Bigstore, and is not applicable to non-GCS media - downloads. - """ - read_token: NotRequired[str] - r"""The blob read token. Needed to read blobs that have not been - replicated. Might not be available until the final call. - """ - upload_fragment_list_creation_info: NotRequired[str] - r"""A serialized Object Fragment List Creation Info passed from Bigstore -> - Scotty for a GCS upload. This field must never be consumed outside of - Bigstore, and is not applicable to non-GCS media uploads. - """ - upload_metadata_container: NotRequired[str] - r"""Metadata passed from Blobstore -> Scotty for a new GCS upload. - This is a signed, serialized blobstore2.BlobMetadataContainer proto which - must never be consumed outside of Bigstore, and is not applicable to - non-GCS media uploads. - """ - - -class OriginalObjectBlobstore2Info(BaseModel): - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - blob_generation: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""The blob generation id.""" - - blob_id: Optional[str] = None - r"""The blob id, e.g., /blobstore/prod/playground/scotty""" - - download_external_read_token: Optional[str] = None - r"""A serialized External Read Token passed from Bigstore -> Scotty for a GCS - download. This field must never be consumed outside of Bigstore, and is not - applicable to non-GCS media uploads. - """ - - download_read_handle: Optional[str] = None - r"""Read handle passed from Bigstore -> Scotty for a GCS download. - This is a signed, serialized blobstore2.ReadHandle proto which must never - be set outside of Bigstore, and is not applicable to non-GCS media - downloads. - """ - - read_token: Optional[str] = None - r"""The blob read token. Needed to read blobs that have not been - replicated. Might not be available until the final call. - """ - - upload_fragment_list_creation_info: Optional[str] = None - r"""A serialized Object Fragment List Creation Info passed from Bigstore -> - Scotty for a GCS upload. This field must never be consumed outside of - Bigstore, and is not applicable to non-GCS media uploads. - """ - - upload_metadata_container: Optional[str] = None - r"""Metadata passed from Blobstore -> Scotty for a new GCS upload. - This is a signed, serialized blobstore2.BlobMetadataContainer proto which - must never be consumed outside of Bigstore, and is not applicable to - non-GCS media uploads. - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "blob_generation", - "blob_id", - "download_external_read_token", - "download_read_handle", - "read_token", - "upload_fragment_list_creation_info", - "upload_metadata_container", - ] - ) - 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 OriginalObjectObjectIDTypedDict(TypedDict): - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - bucket_name: NotRequired[str] - r"""The name of the bucket to which this object belongs.""" - generation: NotRequired[int] - r"""Generation of the object. Generations are monotonically increasing - across writes, allowing them to be be compared to determine which - generation is newer. If this is omitted in a request, then you are - requesting the live object. - See http://go/bigstore-versions - """ - object_name: NotRequired[str] - r"""The name of the object.""" - - -class OriginalObjectObjectID(BaseModel): - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - bucket_name: Optional[str] = None - r"""The name of the bucket to which this object belongs.""" - - generation: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Generation of the object. Generations are monotonically increasing - across writes, allowing them to be be compared to determine which - generation is newer. If this is omitted in a request, then you are - requesting the live object. - See http://go/bigstore-versions - """ - - object_name: Optional[str] = None - r"""The name of the object.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["bucket_name", "generation", "object_name"]) - 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 - - -OriginalObjectReferenceType = Union[ - Literal[ - "path", - "blob_ref", - "inline", - "bigstore_ref", - "cosmo_binary_reference", - ], - UnrecognizedStr, -] -r"""Describes what the field reference contains.""" - - -class OriginalObjectTypedDict(TypedDict): - r"""The location of the original file for a diff upload request. Must be - filled in if responding to an upload start notification. - """ - - blob_ref: NotRequired[str] - r"""Blobstore v1 reference, set if reference_type is BLOBSTORE_REF - This should be the byte representation of a blobstore.BlobRef. - Since Blobstore is deprecating v1, use blobstore2_info instead. - For now, any v2 blob will also be represented in this field as - v1 BlobRef. - """ - blobstore2_info: NotRequired[OriginalObjectBlobstore2InfoTypedDict] - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - cosmo_binary_reference: NotRequired[str] - r"""A binary data reference for a media download. Serves as a - technology-agnostic binary reference in some Google infrastructure. - This value is a serialized storage_cosmo.BinaryReference proto. Storing - it as bytes is a hack to get around the fact that the cosmo proto - (as well as others it includes) doesn't support JavaScript. This - prevents us from including the actual type of this field. - """ - crc32c_hash: NotRequired[int] - r"""crc32.c hash for the payload.""" - inline: NotRequired[str] - r"""Media data, set if reference_type is INLINE""" - length: NotRequired[int] - r"""Size of the data, in bytes""" - md5_hash: NotRequired[str] - r"""MD5 hash for the payload.""" - object_id: NotRequired[OriginalObjectObjectIDTypedDict] - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - path: NotRequired[str] - r"""Path to the data, set if reference_type is PATH""" - reference_type: NotRequired[OriginalObjectReferenceType] - r"""Describes what the field reference contains.""" - sha1_hash: NotRequired[str] - r"""SHA-1 hash for the payload.""" - - -class OriginalObject(BaseModel): - r"""The location of the original file for a diff upload request. Must be - filled in if responding to an upload start notification. - """ - - blob_ref: Annotated[ - Optional[str], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." - ), - ] = None - r"""Blobstore v1 reference, set if reference_type is BLOBSTORE_REF - This should be the byte representation of a blobstore.BlobRef. - Since Blobstore is deprecating v1, use blobstore2_info instead. - For now, any v2 blob will also be represented in this field as - v1 BlobRef. - """ - - blobstore2_info: Optional[OriginalObjectBlobstore2Info] = None - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - cosmo_binary_reference: Optional[str] = None - r"""A binary data reference for a media download. Serves as a - technology-agnostic binary reference in some Google infrastructure. - This value is a serialized storage_cosmo.BinaryReference proto. Storing - it as bytes is a hack to get around the fact that the cosmo proto - (as well as others it includes) doesn't support JavaScript. This - prevents us from including the actual type of this field. - """ - - crc32c_hash: Optional[int] = None - r"""crc32.c hash for the payload.""" - - inline: Optional[str] = None - r"""Media data, set if reference_type is INLINE""" - - length: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Size of the data, in bytes""" - - md5_hash: Optional[str] = None - r"""MD5 hash for the payload.""" - - object_id: Optional[OriginalObjectObjectID] = None - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - path: Optional[str] = None - r"""Path to the data, set if reference_type is PATH""" - - reference_type: Optional[OriginalObjectReferenceType] = None - r"""Describes what the field reference contains.""" - - sha1_hash: Optional[str] = None - r"""SHA-1 hash for the payload.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "blob_ref", - "blobstore2_info", - "cosmo_binary_reference", - "crc32c_hash", - "inline", - "length", - "md5_hash", - "object_id", - "path", - "reference_type", - "sha1_hash", - ] - ) - 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 DiffUploadResponseTypedDict(TypedDict): - r"""Set if reference_type is DIFF_UPLOAD_RESPONSE.""" - - object_version: NotRequired[str] - r"""The object version of the object at the server. Must be included in the - end notification response. - The version in the end notification response must correspond to the new - version of the object that is now stored at the server, after the upload. - """ - original_object: NotRequired[OriginalObjectTypedDict] - r"""The location of the original file for a diff upload request. Must be - filled in if responding to an upload start notification. - """ - - -class DiffUploadResponse(BaseModel): - r"""Set if reference_type is DIFF_UPLOAD_RESPONSE.""" - - object_version: Optional[str] = None - r"""The object version of the object at the server. Must be included in the - end notification response. - The version in the end notification response must correspond to the new - version of the object that is now stored at the server, after the upload. - """ - - original_object: Optional[OriginalObject] = None - r"""The location of the original file for a diff upload request. Must be - filled in if responding to an upload start notification. - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["object_version", "original_object"]) - 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 DiffVersionResponseTypedDict(TypedDict): - r"""Set if reference_type is DIFF_VERSION_RESPONSE.""" - - object_size_bytes: NotRequired[int] - r"""The total size of the server object.""" - object_version: NotRequired[str] - r"""The version of the object stored at the server.""" - - -class DiffVersionResponse(BaseModel): - r"""Set if reference_type is DIFF_VERSION_RESPONSE.""" - - object_size_bytes: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""The total size of the server object.""" - - object_version: Optional[str] = None - r"""The version of the object stored at the server.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["object_size_bytes", "object_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 DownloadParametersTypedDict(TypedDict): - r"""Parameters for a media download.""" - - allow_gzip_compression: NotRequired[bool] - r"""A boolean to be returned in the response to Scotty. Allows/disallows gzip - encoding of the payload content when the server thinks it's - advantageous (hence, does not guarantee compression) which allows - Scotty to GZip the response to the client. - """ - ignore_range: NotRequired[bool] - r"""Determining whether or not Apiary should skip the inclusion - of any Content-Range header on its response to Scotty. - """ - - -class DownloadParameters(BaseModel): - r"""Parameters for a media download.""" - - allow_gzip_compression: Optional[bool] = None - r"""A boolean to be returned in the response to Scotty. Allows/disallows gzip - encoding of the payload content when the server thinks it's - advantageous (hence, does not guarantee compression) which allows - Scotty to GZip the response to the client. - """ - - ignore_range: Optional[bool] = None - r"""Determining whether or not Apiary should skip the inclusion - of any Content-Range header on its response to Scotty. - """ - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["allow_gzip_compression", "ignore_range"]) - 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 GetEnvironmentFilesResponseObjectIDTypedDict(TypedDict): - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - bucket_name: NotRequired[str] - r"""The name of the bucket to which this object belongs.""" - generation: NotRequired[int] - r"""Generation of the object. Generations are monotonically increasing - across writes, allowing them to be be compared to determine which - generation is newer. If this is omitted in a request, then you are - requesting the live object. - See http://go/bigstore-versions - """ - object_name: NotRequired[str] - r"""The name of the object.""" - - -class GetEnvironmentFilesResponseObjectID(BaseModel): - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - bucket_name: Optional[str] = None - r"""The name of the bucket to which this object belongs.""" - - generation: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Generation of the object. Generations are monotonically increasing - across writes, allowing them to be be compared to determine which - generation is newer. If this is omitted in a request, then you are - requesting the live object. - See http://go/bigstore-versions - """ - - object_name: Optional[str] = None - r"""The name of the object.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["bucket_name", "generation", "object_name"]) - 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 - - -GetEnvironmentFilesResponseReferenceType = Union[ - Literal[ - "path", - "blob_ref", - "inline", - "get_media", - "composite_media", - "bigstore_ref", - "diff_version_response", - "diff_checksums_response", - "diff_download_response", - "diff_upload_request", - "diff_upload_response", - "cosmo_binary_reference", - "arbitrary_bytes", - ], - UnrecognizedStr, -] -r"""Describes what the field reference contains.""" - - -class BlobTypedDict(TypedDict): - r"""Reference to the file content. Only populated and used by ESF/Scotty - during media downloads (alt=media). Hidden from public JSON API responses. - """ - - algorithm: NotRequired[str] - r"""Deprecated, use one of explicit hash type fields instead. - Algorithm used for calculating the hash. - As of 2011/01/21, \"MD5\" is the only possible value for this field. - New values may be added at any time. - """ - bigstore_object_ref: NotRequired[str] - r"""Use object_id instead.""" - blob_ref: NotRequired[str] - r"""Blobstore v1 reference, set if reference_type is BLOBSTORE_REF - This should be the byte representation of a blobstore.BlobRef. - Since Blobstore is deprecating v1, use blobstore2_info instead. - For now, any v2 blob will also be represented in this field as - v1 BlobRef. - """ - blobstore2_info: NotRequired[GetEnvironmentFilesResponseBlobstore2InfoTypedDict] - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - composite_media: NotRequired[List[CompositeMediaTypedDict]] - r"""A composite media composed of one or more media objects, set if - reference_type is COMPOSITE_MEDIA. The media length field must be set - to the sum of the lengths of all composite media objects. - - Note: All composite media must have length specified. - """ - content_type: NotRequired[str] - r"""MIME type of the data""" - content_type_info: NotRequired[ContentTypeInfoTypedDict] - r"""Extended content type information provided for Scotty uploads.""" - cosmo_binary_reference: NotRequired[str] - r"""A binary data reference for a media download. Serves as a - technology-agnostic binary reference in some Google infrastructure. - This value is a serialized storage_cosmo.BinaryReference proto. Storing - it as bytes is a hack to get around the fact that the cosmo proto - (as well as others it includes) doesn't support JavaScript. This - prevents us from including the actual type of this field. - """ - crc32c_hash: NotRequired[int] - r"""For Scotty Uploads: - Scotty-provided hashes for uploads - - For Scotty Downloads: - (WARNING: DO NOT USE WITHOUT PERMISSION FROM THE SCOTTY TEAM.) - A Hash provided by the agent to be used to verify the data being - downloaded. Currently only supported for inline payloads. - Further, only crc32c_hash is currently supported. - """ - diff_checksums_response: NotRequired[DiffChecksumsResponseTypedDict] - r"""Set if reference_type is DIFF_CHECKSUMS_RESPONSE.""" - diff_download_response: NotRequired[DiffDownloadResponseTypedDict] - r"""Set if reference_type is DIFF_DOWNLOAD_RESPONSE.""" - diff_upload_request: NotRequired[DiffUploadRequestTypedDict] - r"""Set if reference_type is DIFF_UPLOAD_REQUEST.""" - diff_upload_response: NotRequired[DiffUploadResponseTypedDict] - r"""Set if reference_type is DIFF_UPLOAD_RESPONSE.""" - diff_version_response: NotRequired[DiffVersionResponseTypedDict] - r"""Set if reference_type is DIFF_VERSION_RESPONSE.""" - download_parameters: NotRequired[DownloadParametersTypedDict] - r"""Parameters for a media download.""" - filename: NotRequired[str] - r"""Original file name""" - hash: NotRequired[str] - r"""Deprecated, use one of explicit hash type fields instead. - These two hash related fields will only be populated on Scotty based media - uploads and will contain the content of the hash group in the - NotificationRequest: - http://cs/#google3/blobstore2/api/scotty/service/proto/upload_listener.proto&q=class:Hash - Hex encoded hash value of the uploaded media. - """ - hash_verified: NotRequired[bool] - r"""For Scotty uploads only. If a user sends a hash code and the backend has - requested that Scotty verify the upload against the client hash, - Scotty will perform the check on behalf of the backend and will reject it - if the hashes don't match. This is set to true if Scotty performed - this verification. - """ - inline: NotRequired[str] - r"""Media data, set if reference_type is INLINE""" - is_potential_retry: NotRequired[bool] - r"""|is_potential_retry| is set false only when Scotty is - certain that it has not sent the request before. When a client resumes - an upload, this field must be set true in agent calls, because Scotty - cannot be certain that it has never sent the request before due - to potential failure in the session state persistence. - """ - length: NotRequired[int] - r"""Size of the data, in bytes""" - md5_hash: NotRequired[str] - r"""Scotty-provided MD5 hash for an upload.""" - media_id: NotRequired[str] - r"""Media id to forward to the operation GetMedia. - Can be set if reference_type is GET_MEDIA. - """ - object_id: NotRequired[GetEnvironmentFilesResponseObjectIDTypedDict] - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - path: NotRequired[str] - r"""Path to the data, set if reference_type is PATH""" - reference_type: NotRequired[GetEnvironmentFilesResponseReferenceType] - r"""Describes what the field reference contains.""" - sha1_hash: NotRequired[str] - r"""Scotty-provided SHA1 hash for an upload.""" - sha256_hash: NotRequired[str] - r"""Scotty-provided SHA256 hash for an upload.""" - sha512_hash: NotRequired[str] - r"""Scotty-provided SHA512 hash for an upload.""" - timestamp: NotRequired[str] - r"""Time at which the media data was last updated, - in milliseconds since UNIX epoch - """ - token: NotRequired[str] - r"""A unique fingerprint/version id for the media data""" - - -class Blob(BaseModel): - r"""Reference to the file content. Only populated and used by ESF/Scotty - during media downloads (alt=media). Hidden from public JSON API responses. - """ - - algorithm: Annotated[ - Optional[str], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." - ), - ] = None - r"""Deprecated, use one of explicit hash type fields instead. - Algorithm used for calculating the hash. - As of 2011/01/21, \"MD5\" is the only possible value for this field. - New values may be added at any time. - """ - - bigstore_object_ref: Annotated[ - Optional[str], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." - ), - ] = None - r"""Use object_id instead.""" - - blob_ref: Annotated[ - Optional[str], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." - ), - ] = None - r"""Blobstore v1 reference, set if reference_type is BLOBSTORE_REF - This should be the byte representation of a blobstore.BlobRef. - Since Blobstore is deprecating v1, use blobstore2_info instead. - For now, any v2 blob will also be represented in this field as - v1 BlobRef. - """ - - blobstore2_info: Optional[GetEnvironmentFilesResponseBlobstore2Info] = None - r"""Blobstore v2 info, set if reference_type is BLOBSTORE_REF and it refers - to a v2 blob. - """ - - composite_media: Optional[List[CompositeMedia]] = None - r"""A composite media composed of one or more media objects, set if - reference_type is COMPOSITE_MEDIA. The media length field must be set - to the sum of the lengths of all composite media objects. - - Note: All composite media must have length specified. - """ - - content_type: Optional[str] = None - r"""MIME type of the data""" - - content_type_info: Optional[ContentTypeInfo] = None - r"""Extended content type information provided for Scotty uploads.""" - - cosmo_binary_reference: Optional[str] = None - r"""A binary data reference for a media download. Serves as a - technology-agnostic binary reference in some Google infrastructure. - This value is a serialized storage_cosmo.BinaryReference proto. Storing - it as bytes is a hack to get around the fact that the cosmo proto - (as well as others it includes) doesn't support JavaScript. This - prevents us from including the actual type of this field. - """ - - crc32c_hash: Optional[int] = None - r"""For Scotty Uploads: - Scotty-provided hashes for uploads - - For Scotty Downloads: - (WARNING: DO NOT USE WITHOUT PERMISSION FROM THE SCOTTY TEAM.) - A Hash provided by the agent to be used to verify the data being - downloaded. Currently only supported for inline payloads. - Further, only crc32c_hash is currently supported. - """ - - diff_checksums_response: Optional[DiffChecksumsResponse] = None - r"""Set if reference_type is DIFF_CHECKSUMS_RESPONSE.""" - - diff_download_response: Optional[DiffDownloadResponse] = None - r"""Set if reference_type is DIFF_DOWNLOAD_RESPONSE.""" - - diff_upload_request: Optional[DiffUploadRequest] = None - r"""Set if reference_type is DIFF_UPLOAD_REQUEST.""" - - diff_upload_response: Optional[DiffUploadResponse] = None - r"""Set if reference_type is DIFF_UPLOAD_RESPONSE.""" - - diff_version_response: Optional[DiffVersionResponse] = None - r"""Set if reference_type is DIFF_VERSION_RESPONSE.""" - - download_parameters: Optional[DownloadParameters] = None - r"""Parameters for a media download.""" - - filename: Optional[str] = None - r"""Original file name""" - - hash: Annotated[ - Optional[str], - pydantic.Field( - deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." - ), - ] = None - r"""Deprecated, use one of explicit hash type fields instead. - These two hash related fields will only be populated on Scotty based media - uploads and will contain the content of the hash group in the - NotificationRequest: - http://cs/#google3/blobstore2/api/scotty/service/proto/upload_listener.proto&q=class:Hash - Hex encoded hash value of the uploaded media. - """ - - hash_verified: Optional[bool] = None - r"""For Scotty uploads only. If a user sends a hash code and the backend has - requested that Scotty verify the upload against the client hash, - Scotty will perform the check on behalf of the backend and will reject it - if the hashes don't match. This is set to true if Scotty performed - this verification. - """ - - inline: Optional[str] = None - r"""Media data, set if reference_type is INLINE""" - - is_potential_retry: Optional[bool] = None - r"""|is_potential_retry| is set false only when Scotty is - certain that it has not sent the request before. When a client resumes - an upload, this field must be set true in agent calls, because Scotty - cannot be certain that it has never sent the request before due - to potential failure in the session state persistence. - """ - - length: Annotated[ - Optional[int], - BeforeValidator(validate_int), - PlainSerializer(serialize_int(True)), - ] = None - r"""Size of the data, in bytes""" - - md5_hash: Optional[str] = None - r"""Scotty-provided MD5 hash for an upload.""" - - media_id: Optional[str] = None - r"""Media id to forward to the operation GetMedia. - Can be set if reference_type is GET_MEDIA. - """ - - object_id: Optional[GetEnvironmentFilesResponseObjectID] = None - r"""Reference to a TI Blob, set if reference_type is BIGSTORE_REF.""" - - path: Optional[str] = None - r"""Path to the data, set if reference_type is PATH""" - - reference_type: Optional[GetEnvironmentFilesResponseReferenceType] = None - r"""Describes what the field reference contains.""" - - sha1_hash: Optional[str] = None - r"""Scotty-provided SHA1 hash for an upload.""" - - sha256_hash: Optional[str] = None - r"""Scotty-provided SHA256 hash for an upload.""" - - sha512_hash: Optional[str] = None - r"""Scotty-provided SHA512 hash for an upload.""" - - timestamp: Optional[str] = None - r"""Time at which the media data was last updated, - in milliseconds since UNIX epoch - """ - - token: Optional[str] = None - r"""A unique fingerprint/version id for the media data""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set( - [ - "algorithm", - "bigstore_object_ref", - "blob_ref", - "blobstore2_info", - "composite_media", - "content_type", - "content_type_info", - "cosmo_binary_reference", - "crc32c_hash", - "diff_checksums_response", - "diff_download_response", - "diff_upload_request", - "diff_upload_response", - "diff_version_response", - "download_parameters", - "filename", - "hash", - "hash_verified", - "inline", - "is_potential_retry", - "length", - "md5_hash", - "media_id", - "object_id", - "path", - "reference_type", - "sha1_hash", - "sha256_hash", - "sha512_hash", - "timestamp", - "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 - - -class GetEnvironmentFilesResponseTypedDict(TypedDict): - r"""Response for `GetEnvironmentFiles`.""" - - blob: NotRequired[BlobTypedDict] - r"""Reference to the file content. Only populated and used by ESF/Scotty - during media downloads (alt=media). Hidden from public JSON API responses. - """ - files: NotRequired[List[EnvironmentFileTypedDict]] - r"""If the requested path is a directory, this contains its contents. - If the requested path is a file, this contains a single entry with the - file's metadata. - If alt=media was specified, this is empty (content is served via `blob`). - """ - next_page_token: NotRequired[str] - r"""Pagination token for directory listing.""" - - -class GetEnvironmentFilesResponse(BaseModel): - r"""Response for `GetEnvironmentFiles`.""" - - blob: Optional[Blob] = None - r"""Reference to the file content. Only populated and used by ESF/Scotty - during media downloads (alt=media). Hidden from public JSON API responses. - """ - - files: Optional[List[EnvironmentFile]] = None - r"""If the requested path is a directory, this contains its contents. - If the requested path is a file, this contains a single entry with the - file's metadata. - If alt=media was specified, this is empty (content is served via `blob`). - """ - - next_page_token: Optional[str] = None - r"""Pagination token for directory listing.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["blob", "files", "next_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/types/interactions/listenvironmentsresponse.py b/google/genai/_gaos/types/interactions/listenvironmentsresponse.py deleted file mode 100644 index c359cca11..000000000 --- a/google/genai/_gaos/types/interactions/listenvironmentsresponse.py +++ /dev/null @@ -1,59 +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 .environment import Environment, EnvironmentParam -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import NotRequired, TypedDict - - -class ListEnvironmentsResponseTypedDict(TypedDict): - r"""Response for `ListEnvironments`.""" - - environments: NotRequired[List[EnvironmentParam]] - r"""Environments belonging to the provided project.""" - next_page_token: NotRequired[str] - r"""Pagination token.""" - - -class ListEnvironmentsResponse(BaseModel): - r"""Response for `ListEnvironments`.""" - - environments: Optional[List[Environment]] = None - r"""Environments belonging to the provided project.""" - - next_page_token: Optional[str] = None - r"""Pagination token.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["environments", "next_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/client.py b/google/genai/client.py index d7e276b95..c6b2a0f0a 100644 --- a/google/genai/client.py +++ b/google/genai/client.py @@ -16,22 +16,35 @@ import asyncio import os from typing import Any, Optional, Union -import warnings import google.auth import pydantic -from . import _common from ._api_client import BaseApiClient from ._base_url import get_base_url +from ._replay_api_client import ReplayApiClient +from .batches import AsyncBatches, Batches +from .caches import AsyncCaches, Caches +from .chats import AsyncChats, Chats +from .file_search_stores import AsyncFileSearchStores, FileSearchStores +from .files import AsyncFiles, Files +from .live import AsyncLive +from .models import AsyncModels, Models +from .operations import AsyncOperations, Operations +from .tokens import AsyncTokens, Tokens +from .tunings import AsyncTunings, Tunings +from .types import HttpOptions, HttpOptionsDict, HttpRetryOptions + +import warnings + +from . import _common + from ._gaos.google_genai import ( AsyncGeminiNextGenAgents, - AsyncGeminiNextGenEnvironments, AsyncGeminiNextGenInteractions, AsyncGeminiNextGenTriggers, AsyncGeminiNextGenWebhooks, GeminiNextGenAgents, - GeminiNextGenEnvironments, GeminiNextGenInteractions, GeminiNextGenTriggers, GeminiNextGenWebhooks, @@ -40,18 +53,6 @@ ) from ._gaos.sdk import AsyncGenAI as AsyncGeminiNextGenAPI from ._gaos.sdk import GenAI as GeminiNextGenAPI -from ._replay_api_client import ReplayApiClient -from .batches import AsyncBatches, Batches -from .caches import AsyncCaches, Caches -from .chats import AsyncChats, Chats -from .file_search_stores import AsyncFileSearchStores, FileSearchStores -from .files import AsyncFiles, Files -from .live import AsyncLive -from .models import AsyncModels, Models -from .operations import AsyncOperations, Operations -from .tokens import AsyncTokens, Tokens -from .tunings import AsyncTunings, Tunings -from .types import HttpOptions, HttpOptionsDict, HttpRetryOptions _agent_experimental_warned = False _trigger_experimental_warned = False @@ -77,7 +78,6 @@ def __init__(self, api_client: BaseApiClient): self._interactions: Optional[AsyncGeminiNextGenInteractions] = None self._webhooks: Optional[AsyncGeminiNextGenWebhooks] = None self._triggers: Optional[AsyncGeminiNextGenTriggers] = None - self._environments: Optional[AsyncGeminiNextGenEnvironments] = None @property def _nextgen_client(self) -> AsyncGeminiNextGenAPI: @@ -99,12 +99,6 @@ def webhooks(self) -> AsyncGeminiNextGenWebhooks: self._webhooks = AsyncGeminiNextGenWebhooks(self._api_client) return self._webhooks - @property - def environments(self) -> AsyncGeminiNextGenEnvironments: - if self._environments is None: - self._environments = AsyncGeminiNextGenEnvironments(self._api_client) - return self._environments - @property def agents(self) -> AsyncGeminiNextGenAgents: global _agent_experimental_warned @@ -386,7 +380,6 @@ def __init__( self._interactions: Optional[GeminiNextGenInteractions] = None self._webhooks: Optional[GeminiNextGenWebhooks] = None self._triggers: Optional[GeminiNextGenTriggers] = None - self._environments: Optional[GeminiNextGenEnvironments] = None @staticmethod def _get_api_client( @@ -444,12 +437,6 @@ def webhooks(self) -> GeminiNextGenWebhooks: self._webhooks = GeminiNextGenWebhooks(self._api_client) return self._webhooks - @property - def environments(self) -> GeminiNextGenEnvironments: - if self._environments is None: - self._environments = GeminiNextGenEnvironments(self._api_client) - return self._environments - @property def agents(self) -> GeminiNextGenAgents: global _agent_experimental_warned