diff --git a/.flake8 b/.flake8 index 29227d4c..2e438749 100644 --- a/.flake8 +++ b/.flake8 @@ -16,7 +16,7 @@ # Generated by synthtool. DO NOT EDIT! [flake8] -ignore = E203, E266, E501, W503 +ignore = E203, E231, E266, E501, W503 exclude = # Exclude generated code. **/proto/** diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7c..64f82d6b 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd +# created: 2022-04-21T15:43:16.246106921Z diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 00000000..41bff0b5 --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,15 @@ +# Copyright 2022 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. +requestsize: + enabled: true diff --git a/.github/release-please.yml b/.github/release-please.yml index 466597e5..6def37a8 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,8 @@ releaseType: python handleGHRelease: true +# NOTE: this section is generated by synthtool.languages.python +# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py +branches: +- branch: v0 + handleGHRelease: true + releaseType: python diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 4e1b1fb8..238b87b9 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ubuntu:20.04 +from ubuntu:22.04 ENV DEBIAN_FRONTEND noninteractive @@ -60,8 +60,24 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb +###################### Install python 3.8.11 + +# Download python 3.8.11 +RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz + +# Extract files +RUN tar -xvf Python-3.8.11.tgz + +# Install python 3.8.11 +RUN ./Python-3.8.11/configure --enable-optimizations +RUN make altinstall + +###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.8 /tmp/get-pip.py \ + && python3 /tmp/get-pip.py \ && rm /tmp/get-pip.py +# Test pip +RUN python3 -m pip + CMD ["python3.8"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62eb5a77..46d23716 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 22.3.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 diff --git a/CHANGELOG.md b/CHANGELOG.md index 87e5001e..0a86bce1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Changelog +## [1.11.0](https://github.com/googleapis/python-dialogflow-cx/compare/v1.10.0...v1.11.0) (2022-05-03) + + +### Features + +* added data format specification for export agent ([1844193](https://github.com/googleapis/python-dialogflow-cx/commit/1844193788ce3d9f66f2822846b31f469f34f530)) +* **v3:** add support for locking an agent for changes ([#276](https://github.com/googleapis/python-dialogflow-cx/issues/276)) ([1844193](https://github.com/googleapis/python-dialogflow-cx/commit/1844193788ce3d9f66f2822846b31f469f34f530)) +* **v3:** added audio_export_settings ([#300](https://github.com/googleapis/python-dialogflow-cx/issues/300)) ([b225dfe](https://github.com/googleapis/python-dialogflow-cx/commit/b225dfe9371e89ee54e483888b7ed36d8374e011)) +* **v3beta1:** added data format specification for export agent ([72e624a](https://github.com/googleapis/python-dialogflow-cx/commit/72e624ae6430fd454380cdf6e348dbe763e56e6f)) +* **v3beta1:** added support for locking an agent for changes ([#281](https://github.com/googleapis/python-dialogflow-cx/issues/281)) ([72e624a](https://github.com/googleapis/python-dialogflow-cx/commit/72e624ae6430fd454380cdf6e348dbe763e56e6f)) + + +### Documentation + +* improved docs format ([#275](https://github.com/googleapis/python-dialogflow-cx/issues/275)) ([560e6a4](https://github.com/googleapis/python-dialogflow-cx/commit/560e6a478a7daaf1ac9fac23ca01390a6e7699a7)) +* minor wording update ([#294](https://github.com/googleapis/python-dialogflow-cx/issues/294)) ([f660888](https://github.com/googleapis/python-dialogflow-cx/commit/f660888d55f5aab2b40d5e7f0b214e3e8ba01864)) +* **samples:** Adds snippet for configuring a webhook to enable an agent response. ([#306](https://github.com/googleapis/python-dialogflow-cx/issues/306)) ([c0cc924](https://github.com/googleapis/python-dialogflow-cx/commit/c0cc924a257740e68d244c265c6406a8d6888cc5)) +* **samples:** Adds snippet for configuring optional or required form parameters ([#305](https://github.com/googleapis/python-dialogflow-cx/issues/305)) ([720c0bd](https://github.com/googleapis/python-dialogflow-cx/commit/720c0bdd0f5707a2c71c9d32a91f06f86c48a98e)) +* **samples:** Adds snippet for validating a form parameter. ([#302](https://github.com/googleapis/python-dialogflow-cx/issues/302)) ([8cfe6a1](https://github.com/googleapis/python-dialogflow-cx/commit/8cfe6a15b18b558faa2cd5ceb8dc7b291add4444)) +* **samples:** Configure session parameters snippet ([#303](https://github.com/googleapis/python-dialogflow-cx/issues/303)) ([ace3936](https://github.com/googleapis/python-dialogflow-cx/commit/ace393696fdec8040bd5b23daa09f80183ad9125)) +* **samples:** Configure session parameters trigger transition ([#304](https://github.com/googleapis/python-dialogflow-cx/issues/304)) ([d6cab9d](https://github.com/googleapis/python-dialogflow-cx/commit/d6cab9dd6db83aea15548795a0fc449f72a2b56f)) +* **v3beta1:** added explanation for uri fields in resources ([#273](https://github.com/googleapis/python-dialogflow-cx/issues/273)) ([01b0f8f](https://github.com/googleapis/python-dialogflow-cx/commit/01b0f8f795d06609b370ba7568db753152764d9b)) +* **v3beta1:** improved docs format ([01b0f8f](https://github.com/googleapis/python-dialogflow-cx/commit/01b0f8f795d06609b370ba7568db753152764d9b)) + ## [1.10.0](https://github.com/googleapis/python-dialogflow-cx/compare/v1.9.1...v1.10.0) (2022-03-10) diff --git a/dialogflow-cx-v3-py.tar.gz b/dialogflow-cx-v3-py.tar.gz index 659587c7..e69de29b 100644 Binary files a/dialogflow-cx-v3-py.tar.gz and b/dialogflow-cx-v3-py.tar.gz differ diff --git a/docs/conf.py b/docs/conf.py index fa2e8fb0..0b71edd0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -361,7 +361,10 @@ intersphinx_mapping = { "python": ("https://python.readthedocs.org/en/latest/", None), "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.github.io/grpc/python/", None), "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), diff --git a/google/cloud/dialogflowcx_v3/services/agents/async_client.py b/google/cloud/dialogflowcx_v3/services/agents/async_client.py index c3912488..297946cd 100644 --- a/google/cloud/dialogflowcx_v3/services/agents/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/agents/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -230,14 +230,13 @@ async def list_agents( r"""Returns the list of all agents in the specified location. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_list_agents(): + async def sample_list_agents(): # Create a client - client = dialogflowcx_v3.AgentsClient() + client = dialogflowcx_v3.AgentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListAgentsRequest( @@ -248,7 +247,7 @@ def sample_list_agents(): page_result = client.list_agents(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -309,12 +308,20 @@ def sample_list_agents(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListAgentsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -335,9 +342,9 @@ async def get_agent( from google.cloud import dialogflowcx_v3 - def sample_get_agent(): + async def sample_get_agent(): # Create a client - client = dialogflowcx_v3.AgentsClient() + client = dialogflowcx_v3.AgentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetAgentRequest( @@ -345,7 +352,7 @@ def sample_get_agent(): ) # Make the request - response = client.get_agent(request=request) + response = await client.get_agent(request=request) # Handle the response print(response) @@ -417,7 +424,12 @@ def sample_get_agent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -438,14 +450,13 @@ async def create_agent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_create_agent(): + async def sample_create_agent(): # Create a client - client = dialogflowcx_v3.AgentsClient() + client = dialogflowcx_v3.AgentsAsyncClient() # Initialize request argument(s) agent = dialogflowcx_v3.Agent() @@ -459,7 +470,7 @@ def sample_create_agent(): ) # Make the request - response = client.create_agent(request=request) + response = await client.create_agent(request=request) # Handle the response print(response) @@ -538,7 +549,12 @@ def sample_create_agent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -559,14 +575,13 @@ async def update_agent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_update_agent(): + async def sample_update_agent(): # Create a client - client = dialogflowcx_v3.AgentsClient() + client = dialogflowcx_v3.AgentsAsyncClient() # Initialize request argument(s) agent = dialogflowcx_v3.Agent() @@ -579,7 +594,7 @@ def sample_update_agent(): ) # Make the request - response = client.update_agent(request=request) + response = await client.update_agent(request=request) # Handle the response print(response) @@ -661,7 +676,12 @@ def sample_update_agent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -681,9 +701,9 @@ async def delete_agent( from google.cloud import dialogflowcx_v3 - def sample_delete_agent(): + async def sample_delete_agent(): # Create a client - client = dialogflowcx_v3.AgentsClient() + client = dialogflowcx_v3.AgentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.DeleteAgentRequest( @@ -691,7 +711,7 @@ def sample_delete_agent(): ) # Make the request - client.delete_agent(request=request) + await client.delete_agent(request=request) Args: request (Union[google.cloud.dialogflowcx_v3.types.DeleteAgentRequest, dict]): @@ -743,7 +763,10 @@ def sample_delete_agent(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def export_agent( @@ -766,14 +789,13 @@ async def export_agent( - ``response``: [ExportAgentResponse][google.cloud.dialogflow.cx.v3.ExportAgentResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_export_agent(): + async def sample_export_agent(): # Create a client - client = dialogflowcx_v3.AgentsClient() + client = dialogflowcx_v3.AgentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ExportAgentRequest( @@ -785,7 +807,7 @@ def sample_export_agent(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -828,7 +850,12 @@ def sample_export_agent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -869,14 +896,13 @@ async def restore_agent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_restore_agent(): + async def sample_restore_agent(): # Create a client - client = dialogflowcx_v3.AgentsClient() + client = dialogflowcx_v3.AgentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.RestoreAgentRequest( @@ -889,7 +915,7 @@ def sample_restore_agent(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -941,7 +967,12 @@ def sample_restore_agent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -967,14 +998,13 @@ async def validate_agent( validated. Please call this API after the training is completed to get the complete validation results. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_validate_agent(): + async def sample_validate_agent(): # Create a client - client = dialogflowcx_v3.AgentsClient() + client = dialogflowcx_v3.AgentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ValidateAgentRequest( @@ -982,7 +1012,7 @@ def sample_validate_agent(): ) # Make the request - response = client.validate_agent(request=request) + response = await client.validate_agent(request=request) # Handle the response print(response) @@ -1021,7 +1051,12 @@ def sample_validate_agent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1038,14 +1073,13 @@ async def get_agent_validation_result( r"""Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_get_agent_validation_result(): + async def sample_get_agent_validation_result(): # Create a client - client = dialogflowcx_v3.AgentsClient() + client = dialogflowcx_v3.AgentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetAgentValidationResultRequest( @@ -1053,7 +1087,7 @@ def sample_get_agent_validation_result(): ) # Make the request - response = client.get_agent_validation_result(request=request) + response = await client.get_agent_validation_result(request=request) # Handle the response print(response) @@ -1113,7 +1147,12 @@ def sample_get_agent_validation_result(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3/services/agents/client.py b/google/cloud/dialogflowcx_v3/services/agents/client.py index f4473ec4..362c4a59 100644 --- a/google/cloud/dialogflowcx_v3/services/agents/client.py +++ b/google/cloud/dialogflowcx_v3/services/agents/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -61,7 +61,10 @@ class AgentsClientMeta(type): _transport_registry["grpc"] = AgentsGrpcTransport _transport_registry["grpc_asyncio"] = AgentsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[AgentsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[AgentsTransport]: """Returns an appropriate transport class. Args: @@ -166,10 +169,16 @@ def transport(self) -> AgentsTransport: return self._transport @staticmethod - def agent_path(project: str, location: str, agent: str,) -> str: + def agent_path( + project: str, + location: str, + agent: str, + ) -> str: """Returns a fully-qualified agent string.""" return "projects/{project}/locations/{location}/agents/{agent}".format( - project=project, location=location, agent=agent, + project=project, + location=location, + agent=agent, ) @staticmethod @@ -182,10 +191,16 @@ def parse_agent_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def agent_validation_result_path(project: str, location: str, agent: str,) -> str: + def agent_validation_result_path( + project: str, + location: str, + agent: str, + ) -> str: """Returns a fully-qualified agent_validation_result string.""" return "projects/{project}/locations/{location}/agents/{agent}/validationResult".format( - project=project, location=location, agent=agent, + project=project, + location=location, + agent=agent, ) @staticmethod @@ -199,11 +214,17 @@ def parse_agent_validation_result_path(path: str) -> Dict[str, str]: @staticmethod def environment_path( - project: str, location: str, agent: str, environment: str, + project: str, + location: str, + agent: str, + environment: str, ) -> str: """Returns a fully-qualified environment string.""" return "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}".format( - project=project, location=location, agent=agent, environment=environment, + project=project, + location=location, + agent=agent, + environment=environment, ) @staticmethod @@ -216,10 +237,18 @@ def parse_environment_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def flow_path(project: str, location: str, agent: str, flow: str,) -> str: + def flow_path( + project: str, + location: str, + agent: str, + flow: str, + ) -> str: """Returns a fully-qualified flow string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) @staticmethod @@ -233,11 +262,17 @@ def parse_flow_path(path: str) -> Dict[str, str]: @staticmethod def flow_validation_result_path( - project: str, location: str, agent: str, flow: str, + project: str, + location: str, + agent: str, + flow: str, ) -> str: """Returns a fully-qualified flow_validation_result string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/validationResult".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) @staticmethod @@ -251,11 +286,15 @@ def parse_flow_validation_result_path(path: str) -> Dict[str, str]: @staticmethod def security_settings_path( - project: str, location: str, security_settings: str, + project: str, + location: str, + security_settings: str, ) -> str: """Returns a fully-qualified security_settings string.""" return "projects/{project}/locations/{location}/securitySettings/{security_settings}".format( - project=project, location=location, security_settings=security_settings, + project=project, + location=location, + security_settings=security_settings, ) @staticmethod @@ -268,7 +307,9 @@ def parse_security_settings_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -281,9 +322,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -292,9 +337,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -303,9 +352,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -314,10 +367,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -503,7 +560,6 @@ def list_agents( r"""Returns the list of all agents in the specified location. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -582,12 +638,20 @@ def sample_list_agents(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListAgentsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -690,7 +754,12 @@ def sample_get_agent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -711,7 +780,6 @@ def create_agent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -811,7 +879,12 @@ def sample_create_agent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -832,7 +905,6 @@ def update_agent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -934,7 +1006,12 @@ def sample_update_agent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1016,7 +1093,10 @@ def sample_delete_agent(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def export_agent( @@ -1039,7 +1119,6 @@ def export_agent( - ``response``: [ExportAgentResponse][google.cloud.dialogflow.cx.v3.ExportAgentResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1102,7 +1181,12 @@ def sample_export_agent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1143,7 +1227,6 @@ def restore_agent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1216,7 +1299,12 @@ def sample_restore_agent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1242,7 +1330,6 @@ def validate_agent( validated. Please call this API after the training is completed to get the complete validation results. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1297,7 +1384,12 @@ def sample_validate_agent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1314,7 +1406,6 @@ def get_agent_validation_result( r"""Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1391,7 +1482,12 @@ def sample_get_agent_validation_result(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3/services/agents/transports/base.py b/google/cloud/dialogflowcx_v3/services/agents/transports/base.py index b4046fe4..9c826ab7 100644 --- a/google/cloud/dialogflowcx_v3/services/agents/transports/base.py +++ b/google/cloud/dialogflowcx_v3/services/agents/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -128,28 +129,44 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_agents: gapic_v1.method.wrap_method( - self.list_agents, default_timeout=None, client_info=client_info, + self.list_agents, + default_timeout=None, + client_info=client_info, ), self.get_agent: gapic_v1.method.wrap_method( - self.get_agent, default_timeout=None, client_info=client_info, + self.get_agent, + default_timeout=None, + client_info=client_info, ), self.create_agent: gapic_v1.method.wrap_method( - self.create_agent, default_timeout=None, client_info=client_info, + self.create_agent, + default_timeout=None, + client_info=client_info, ), self.update_agent: gapic_v1.method.wrap_method( - self.update_agent, default_timeout=None, client_info=client_info, + self.update_agent, + default_timeout=None, + client_info=client_info, ), self.delete_agent: gapic_v1.method.wrap_method( - self.delete_agent, default_timeout=None, client_info=client_info, + self.delete_agent, + default_timeout=None, + client_info=client_info, ), self.export_agent: gapic_v1.method.wrap_method( - self.export_agent, default_timeout=None, client_info=client_info, + self.export_agent, + default_timeout=None, + client_info=client_info, ), self.restore_agent: gapic_v1.method.wrap_method( - self.restore_agent, default_timeout=None, client_info=client_info, + self.restore_agent, + default_timeout=None, + client_info=client_info, ), self.validate_agent: gapic_v1.method.wrap_method( - self.validate_agent, default_timeout=None, client_info=client_info, + self.validate_agent, + default_timeout=None, + client_info=client_info, ), self.get_agent_validation_result: gapic_v1.method.wrap_method( self.get_agent_validation_result, @@ -161,9 +178,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -249,5 +266,9 @@ def get_agent_validation_result( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("AgentsTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/agents/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/agents/transports/grpc.py index 947a04f5..c1e48e57 100644 --- a/google/cloud/dialogflowcx_v3/services/agents/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3/services/agents/transports/grpc.py @@ -229,8 +229,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -521,5 +520,9 @@ def get_agent_validation_result( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("AgentsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/changelogs/async_client.py b/google/cloud/dialogflowcx_v3/services/changelogs/async_client.py index d79be0ab..d0069f9d 100644 --- a/google/cloud/dialogflowcx_v3/services/changelogs/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/changelogs/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -214,9 +214,9 @@ async def list_changelogs( from google.cloud import dialogflowcx_v3 - def sample_list_changelogs(): + async def sample_list_changelogs(): # Create a client - client = dialogflowcx_v3.ChangelogsClient() + client = dialogflowcx_v3.ChangelogsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListChangelogsRequest( @@ -227,7 +227,7 @@ def sample_list_changelogs(): page_result = client.list_changelogs(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -288,12 +288,20 @@ def sample_list_changelogs(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListChangelogsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -314,9 +322,9 @@ async def get_changelog( from google.cloud import dialogflowcx_v3 - def sample_get_changelog(): + async def sample_get_changelog(): # Create a client - client = dialogflowcx_v3.ChangelogsClient() + client = dialogflowcx_v3.ChangelogsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetChangelogRequest( @@ -324,7 +332,7 @@ def sample_get_changelog(): ) # Make the request - response = client.get_changelog(request=request) + response = await client.get_changelog(request=request) # Handle the response print(response) @@ -384,7 +392,12 @@ def sample_get_changelog(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3/services/changelogs/client.py b/google/cloud/dialogflowcx_v3/services/changelogs/client.py index dd267db0..c850af8d 100644 --- a/google/cloud/dialogflowcx_v3/services/changelogs/client.py +++ b/google/cloud/dialogflowcx_v3/services/changelogs/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -54,7 +54,10 @@ class ChangelogsClientMeta(type): _transport_registry["grpc"] = ChangelogsGrpcTransport _transport_registry["grpc_asyncio"] = ChangelogsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ChangelogsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ChangelogsTransport]: """Returns an appropriate transport class. Args: @@ -161,10 +164,18 @@ def transport(self) -> ChangelogsTransport: return self._transport @staticmethod - def changelog_path(project: str, location: str, agent: str, changelog: str,) -> str: + def changelog_path( + project: str, + location: str, + agent: str, + changelog: str, + ) -> str: """Returns a fully-qualified changelog string.""" return "projects/{project}/locations/{location}/agents/{agent}/changelogs/{changelog}".format( - project=project, location=location, agent=agent, changelog=changelog, + project=project, + location=location, + agent=agent, + changelog=changelog, ) @staticmethod @@ -177,7 +188,9 @@ def parse_changelog_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -190,9 +203,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -201,9 +218,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -212,9 +233,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -223,10 +248,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -489,12 +518,20 @@ def sample_list_changelogs(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListChangelogsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -585,7 +622,12 @@ def sample_get_changelog(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3/services/changelogs/transports/base.py b/google/cloud/dialogflowcx_v3/services/changelogs/transports/base.py index 262021d6..3767a3c5 100644 --- a/google/cloud/dialogflowcx_v3/services/changelogs/transports/base.py +++ b/google/cloud/dialogflowcx_v3/services/changelogs/transports/base.py @@ -83,6 +83,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -124,19 +125,23 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_changelogs: gapic_v1.method.wrap_method( - self.list_changelogs, default_timeout=None, client_info=client_info, + self.list_changelogs, + default_timeout=None, + client_info=client_info, ), self.get_changelog: gapic_v1.method.wrap_method( - self.get_changelog, default_timeout=None, client_info=client_info, + self.get_changelog, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -161,5 +166,9 @@ def get_changelog( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ChangelogsTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/changelogs/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/changelogs/transports/grpc.py index 79c4ec16..33f33411 100644 --- a/google/cloud/dialogflowcx_v3/services/changelogs/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3/services/changelogs/transports/grpc.py @@ -225,8 +225,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -284,5 +283,9 @@ def get_changelog( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ChangelogsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/deployments/async_client.py b/google/cloud/dialogflowcx_v3/services/deployments/async_client.py index c001c373..8a5fac76 100644 --- a/google/cloud/dialogflowcx_v3/services/deployments/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/deployments/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -221,14 +221,13 @@ async def list_deployments( r"""Returns the list of all deployments in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_list_deployments(): + async def sample_list_deployments(): # Create a client - client = dialogflowcx_v3.DeploymentsClient() + client = dialogflowcx_v3.DeploymentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListDeploymentsRequest( @@ -239,7 +238,7 @@ def sample_list_deployments(): page_result = client.list_deployments(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -302,12 +301,20 @@ def sample_list_deployments(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListDeploymentsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -325,14 +332,13 @@ async def get_deployment( r"""Retrieves the specified [Deployment][google.cloud.dialogflow.cx.v3.Deployment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_get_deployment(): + async def sample_get_deployment(): # Create a client - client = dialogflowcx_v3.DeploymentsClient() + client = dialogflowcx_v3.DeploymentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetDeploymentRequest( @@ -340,7 +346,7 @@ def sample_get_deployment(): ) # Make the request - response = client.get_deployment(request=request) + response = await client.get_deployment(request=request) # Handle the response print(response) @@ -407,7 +413,12 @@ def sample_get_deployment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3/services/deployments/client.py b/google/cloud/dialogflowcx_v3/services/deployments/client.py index dadd5a28..4c8f51c3 100644 --- a/google/cloud/dialogflowcx_v3/services/deployments/client.py +++ b/google/cloud/dialogflowcx_v3/services/deployments/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -54,7 +54,10 @@ class DeploymentsClientMeta(type): _transport_registry["grpc"] = DeploymentsGrpcTransport _transport_registry["grpc_asyncio"] = DeploymentsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[DeploymentsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[DeploymentsTransport]: """Returns an appropriate transport class. Args: @@ -162,7 +165,11 @@ def transport(self) -> DeploymentsTransport: @staticmethod def deployment_path( - project: str, location: str, agent: str, environment: str, deployment: str, + project: str, + location: str, + agent: str, + environment: str, + deployment: str, ) -> str: """Returns a fully-qualified deployment string.""" return "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/deployments/{deployment}".format( @@ -184,7 +191,11 @@ def parse_deployment_path(path: str) -> Dict[str, str]: @staticmethod def experiment_path( - project: str, location: str, agent: str, environment: str, experiment: str, + project: str, + location: str, + agent: str, + environment: str, + experiment: str, ) -> str: """Returns a fully-qualified experiment string.""" return "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/experiments/{experiment}".format( @@ -206,7 +217,11 @@ def parse_experiment_path(path: str) -> Dict[str, str]: @staticmethod def test_case_result_path( - project: str, location: str, agent: str, test_case: str, result: str, + project: str, + location: str, + agent: str, + test_case: str, + result: str, ) -> str: """Returns a fully-qualified test_case_result string.""" return "projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}/results/{result}".format( @@ -228,11 +243,19 @@ def parse_test_case_result_path(path: str) -> Dict[str, str]: @staticmethod def version_path( - project: str, location: str, agent: str, flow: str, version: str, + project: str, + location: str, + agent: str, + flow: str, + version: str, ) -> str: """Returns a fully-qualified version string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) @staticmethod @@ -245,7 +268,9 @@ def parse_version_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -258,9 +283,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -269,9 +298,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -280,9 +313,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -291,10 +328,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -480,7 +521,6 @@ def list_deployments( r"""Returns the list of all deployments in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -561,12 +601,20 @@ def sample_list_deployments(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListDeploymentsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -584,7 +632,6 @@ def get_deployment( r"""Retrieves the specified [Deployment][google.cloud.dialogflow.cx.v3.Deployment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -666,7 +713,12 @@ def sample_get_deployment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3/services/deployments/transports/base.py b/google/cloud/dialogflowcx_v3/services/deployments/transports/base.py index d8359f19..4d1db5cf 100644 --- a/google/cloud/dialogflowcx_v3/services/deployments/transports/base.py +++ b/google/cloud/dialogflowcx_v3/services/deployments/transports/base.py @@ -83,6 +83,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -124,19 +125,23 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_deployments: gapic_v1.method.wrap_method( - self.list_deployments, default_timeout=None, client_info=client_info, + self.list_deployments, + default_timeout=None, + client_info=client_info, ), self.get_deployment: gapic_v1.method.wrap_method( - self.get_deployment, default_timeout=None, client_info=client_info, + self.get_deployment, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -161,5 +166,9 @@ def get_deployment( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("DeploymentsTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/deployments/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/deployments/transports/grpc.py index d1a280eb..f3e458bf 100644 --- a/google/cloud/dialogflowcx_v3/services/deployments/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3/services/deployments/transports/grpc.py @@ -225,8 +225,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -288,5 +287,9 @@ def get_deployment( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("DeploymentsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/entity_types/async_client.py b/google/cloud/dialogflowcx_v3/services/entity_types/async_client.py index b9674f6f..ab7447db 100644 --- a/google/cloud/dialogflowcx_v3/services/entity_types/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/entity_types/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -214,14 +214,13 @@ async def list_entity_types( r"""Returns the list of all entity types in the specified agent. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_list_entity_types(): + async def sample_list_entity_types(): # Create a client - client = dialogflowcx_v3.EntityTypesClient() + client = dialogflowcx_v3.EntityTypesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListEntityTypesRequest( @@ -232,7 +231,7 @@ def sample_list_entity_types(): page_result = client.list_entity_types(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -294,12 +293,20 @@ def sample_list_entity_types(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListEntityTypesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -320,9 +327,9 @@ async def get_entity_type( from google.cloud import dialogflowcx_v3 - def sample_get_entity_type(): + async def sample_get_entity_type(): # Create a client - client = dialogflowcx_v3.EntityTypesClient() + client = dialogflowcx_v3.EntityTypesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetEntityTypeRequest( @@ -330,7 +337,7 @@ def sample_get_entity_type(): ) # Make the request - response = client.get_entity_type(request=request) + response = await client.get_entity_type(request=request) # Handle the response print(response) @@ -422,7 +429,12 @@ def sample_get_entity_type(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -443,14 +455,13 @@ async def create_entity_type( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_create_entity_type(): + async def sample_create_entity_type(): # Create a client - client = dialogflowcx_v3.EntityTypesClient() + client = dialogflowcx_v3.EntityTypesAsyncClient() # Initialize request argument(s) entity_type = dialogflowcx_v3.EntityType() @@ -463,7 +474,7 @@ def sample_create_entity_type(): ) # Make the request - response = client.create_entity_type(request=request) + response = await client.create_entity_type(request=request) # Handle the response print(response) @@ -562,7 +573,12 @@ def sample_create_entity_type(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -583,14 +599,13 @@ async def update_entity_type( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_update_entity_type(): + async def sample_update_entity_type(): # Create a client - client = dialogflowcx_v3.EntityTypesClient() + client = dialogflowcx_v3.EntityTypesAsyncClient() # Initialize request argument(s) entity_type = dialogflowcx_v3.EntityType() @@ -602,7 +617,7 @@ def sample_update_entity_type(): ) # Make the request - response = client.update_entity_type(request=request) + response = await client.update_entity_type(request=request) # Handle the response print(response) @@ -703,7 +718,12 @@ def sample_update_entity_type(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -723,14 +743,13 @@ async def delete_entity_type( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_delete_entity_type(): + async def sample_delete_entity_type(): # Create a client - client = dialogflowcx_v3.EntityTypesClient() + client = dialogflowcx_v3.EntityTypesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.DeleteEntityTypeRequest( @@ -738,7 +757,7 @@ def sample_delete_entity_type(): ) # Make the request - client.delete_entity_type(request=request) + await client.delete_entity_type(request=request) Args: request (Union[google.cloud.dialogflowcx_v3.types.DeleteEntityTypeRequest, dict]): @@ -790,7 +809,10 @@ def sample_delete_entity_type(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/dialogflowcx_v3/services/entity_types/client.py b/google/cloud/dialogflowcx_v3/services/entity_types/client.py index 41d69d1b..e65714df 100644 --- a/google/cloud/dialogflowcx_v3/services/entity_types/client.py +++ b/google/cloud/dialogflowcx_v3/services/entity_types/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -55,7 +55,10 @@ class EntityTypesClientMeta(type): _transport_registry["grpc"] = EntityTypesGrpcTransport _transport_registry["grpc_asyncio"] = EntityTypesGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[EntityTypesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[EntityTypesTransport]: """Returns an appropriate transport class. Args: @@ -163,11 +166,17 @@ def transport(self) -> EntityTypesTransport: @staticmethod def entity_type_path( - project: str, location: str, agent: str, entity_type: str, + project: str, + location: str, + agent: str, + entity_type: str, ) -> str: """Returns a fully-qualified entity_type string.""" return "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) @staticmethod @@ -180,7 +189,9 @@ def parse_entity_type_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -193,9 +204,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -204,9 +219,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -215,9 +234,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -226,10 +249,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -415,7 +442,6 @@ def list_entity_types( r"""Returns the list of all entity types in the specified agent. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -495,12 +521,20 @@ def sample_list_entity_types(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListEntityTypesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -623,7 +657,12 @@ def sample_get_entity_type(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -644,7 +683,6 @@ def create_entity_type( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -763,7 +801,12 @@ def sample_create_entity_type(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -784,7 +827,6 @@ def update_entity_type( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -904,7 +946,12 @@ def sample_update_entity_type(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -924,7 +971,6 @@ def delete_entity_type( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -991,7 +1037,10 @@ def sample_delete_entity_type(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/dialogflowcx_v3/services/entity_types/transports/base.py b/google/cloud/dialogflowcx_v3/services/entity_types/transports/base.py index cbce6c86..f60cbc17 100644 --- a/google/cloud/dialogflowcx_v3/services/entity_types/transports/base.py +++ b/google/cloud/dialogflowcx_v3/services/entity_types/transports/base.py @@ -85,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -126,28 +127,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_entity_types: gapic_v1.method.wrap_method( - self.list_entity_types, default_timeout=None, client_info=client_info, + self.list_entity_types, + default_timeout=None, + client_info=client_info, ), self.get_entity_type: gapic_v1.method.wrap_method( - self.get_entity_type, default_timeout=None, client_info=client_info, + self.get_entity_type, + default_timeout=None, + client_info=client_info, ), self.create_entity_type: gapic_v1.method.wrap_method( - self.create_entity_type, default_timeout=None, client_info=client_info, + self.create_entity_type, + default_timeout=None, + client_info=client_info, ), self.update_entity_type: gapic_v1.method.wrap_method( - self.update_entity_type, default_timeout=None, client_info=client_info, + self.update_entity_type, + default_timeout=None, + client_info=client_info, ), self.delete_entity_type: gapic_v1.method.wrap_method( - self.delete_entity_type, default_timeout=None, client_info=client_info, + self.delete_entity_type, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -199,5 +210,9 @@ def delete_entity_type( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("EntityTypesTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/entity_types/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/entity_types/transports/grpc.py index 14920625..138f3625 100644 --- a/google/cloud/dialogflowcx_v3/services/entity_types/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3/services/entity_types/transports/grpc.py @@ -227,8 +227,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -383,5 +382,9 @@ def delete_entity_type( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("EntityTypesGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/environments/async_client.py b/google/cloud/dialogflowcx_v3/services/environments/async_client.py index 9bbba78a..35797efa 100644 --- a/google/cloud/dialogflowcx_v3/services/environments/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/environments/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -232,14 +232,13 @@ async def list_environments( r"""Returns the list of all environments in the specified [Agent][google.cloud.dialogflow.cx.v3.Agent]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_list_environments(): + async def sample_list_environments(): # Create a client - client = dialogflowcx_v3.EnvironmentsClient() + client = dialogflowcx_v3.EnvironmentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListEnvironmentsRequest( @@ -250,7 +249,7 @@ def sample_list_environments(): page_result = client.list_environments(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -313,12 +312,20 @@ def sample_list_environments(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListEnvironmentsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -336,14 +343,13 @@ async def get_environment( r"""Retrieves the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_get_environment(): + async def sample_get_environment(): # Create a client - client = dialogflowcx_v3.EnvironmentsClient() + client = dialogflowcx_v3.EnvironmentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetEnvironmentRequest( @@ -351,7 +357,7 @@ def sample_get_environment(): ) # Make the request - response = client.get_environment(request=request) + response = await client.get_environment(request=request) # Handle the response print(response) @@ -426,7 +432,12 @@ def sample_get_environment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -455,14 +466,13 @@ async def create_environment( - ``response``: [Environment][google.cloud.dialogflow.cx.v3.Environment] - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_create_environment(): + async def sample_create_environment(): # Create a client - client = dialogflowcx_v3.EnvironmentsClient() + client = dialogflowcx_v3.EnvironmentsAsyncClient() # Initialize request argument(s) environment = dialogflowcx_v3.Environment() @@ -479,7 +489,7 @@ def sample_create_environment(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -561,7 +571,12 @@ def sample_create_environment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -597,14 +612,13 @@ async def update_environment( - ``response``: [Environment][google.cloud.dialogflow.cx.v3.Environment] - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_update_environment(): + async def sample_update_environment(): # Create a client - client = dialogflowcx_v3.EnvironmentsClient() + client = dialogflowcx_v3.EnvironmentsAsyncClient() # Initialize request argument(s) environment = dialogflowcx_v3.Environment() @@ -620,7 +634,7 @@ def sample_update_environment(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -700,7 +714,12 @@ def sample_update_environment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -725,14 +744,13 @@ async def delete_environment( r"""Deletes the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_delete_environment(): + async def sample_delete_environment(): # Create a client - client = dialogflowcx_v3.EnvironmentsClient() + client = dialogflowcx_v3.EnvironmentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.DeleteEnvironmentRequest( @@ -740,7 +758,7 @@ def sample_delete_environment(): ) # Make the request - client.delete_environment(request=request) + await client.delete_environment(request=request) Args: request (Union[google.cloud.dialogflowcx_v3.types.DeleteEnvironmentRequest, dict]): @@ -794,7 +812,10 @@ def sample_delete_environment(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def lookup_environment_history( @@ -809,14 +830,13 @@ async def lookup_environment_history( r"""Looks up the history of the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_lookup_environment_history(): + async def sample_lookup_environment_history(): # Create a client - client = dialogflowcx_v3.EnvironmentsClient() + client = dialogflowcx_v3.EnvironmentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.LookupEnvironmentHistoryRequest( @@ -827,7 +847,7 @@ def sample_lookup_environment_history(): page_result = client.lookup_environment_history(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -889,12 +909,20 @@ def sample_lookup_environment_history(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.LookupEnvironmentHistoryAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -921,14 +949,13 @@ async def run_continuous_test( - ``response``: [RunContinuousTestResponse][google.cloud.dialogflow.cx.v3.RunContinuousTestResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_run_continuous_test(): + async def sample_run_continuous_test(): # Create a client - client = dialogflowcx_v3.EnvironmentsClient() + client = dialogflowcx_v3.EnvironmentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.RunContinuousTestRequest( @@ -940,7 +967,7 @@ def sample_run_continuous_test(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -985,7 +1012,12 @@ def sample_run_continuous_test(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1010,14 +1042,13 @@ async def list_continuous_test_results( r"""Fetches a list of continuous test results for a given environment. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_list_continuous_test_results(): + async def sample_list_continuous_test_results(): # Create a client - client = dialogflowcx_v3.EnvironmentsClient() + client = dialogflowcx_v3.EnvironmentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListContinuousTestResultsRequest( @@ -1028,7 +1059,7 @@ def sample_list_continuous_test_results(): page_result = client.list_continuous_test_results(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1089,12 +1120,20 @@ def sample_list_continuous_test_results(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListContinuousTestResultsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1121,14 +1160,13 @@ async def deploy_flow( - ``response``: [DeployFlowResponse][google.cloud.dialogflow.cx.v3.DeployFlowResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_deploy_flow(): + async def sample_deploy_flow(): # Create a client - client = dialogflowcx_v3.EnvironmentsClient() + client = dialogflowcx_v3.EnvironmentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.DeployFlowRequest( @@ -1141,7 +1179,7 @@ def sample_deploy_flow(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1186,7 +1224,12 @@ def sample_deploy_flow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( diff --git a/google/cloud/dialogflowcx_v3/services/environments/client.py b/google/cloud/dialogflowcx_v3/services/environments/client.py index da6eaa6a..14efa6ad 100644 --- a/google/cloud/dialogflowcx_v3/services/environments/client.py +++ b/google/cloud/dialogflowcx_v3/services/environments/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -59,7 +59,10 @@ class EnvironmentsClientMeta(type): _transport_registry["grpc"] = EnvironmentsGrpcTransport _transport_registry["grpc_asyncio"] = EnvironmentsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[EnvironmentsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[EnvironmentsTransport]: """Returns an appropriate transport class. Args: @@ -193,11 +196,17 @@ def parse_continuous_test_result_path(path: str) -> Dict[str, str]: @staticmethod def environment_path( - project: str, location: str, agent: str, environment: str, + project: str, + location: str, + agent: str, + environment: str, ) -> str: """Returns a fully-qualified environment string.""" return "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}".format( - project=project, location=location, agent=agent, environment=environment, + project=project, + location=location, + agent=agent, + environment=environment, ) @staticmethod @@ -210,10 +219,18 @@ def parse_environment_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def test_case_path(project: str, location: str, agent: str, test_case: str,) -> str: + def test_case_path( + project: str, + location: str, + agent: str, + test_case: str, + ) -> str: """Returns a fully-qualified test_case string.""" return "projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}".format( - project=project, location=location, agent=agent, test_case=test_case, + project=project, + location=location, + agent=agent, + test_case=test_case, ) @staticmethod @@ -227,7 +244,11 @@ def parse_test_case_path(path: str) -> Dict[str, str]: @staticmethod def test_case_result_path( - project: str, location: str, agent: str, test_case: str, result: str, + project: str, + location: str, + agent: str, + test_case: str, + result: str, ) -> str: """Returns a fully-qualified test_case_result string.""" return "projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}/results/{result}".format( @@ -249,11 +270,19 @@ def parse_test_case_result_path(path: str) -> Dict[str, str]: @staticmethod def version_path( - project: str, location: str, agent: str, flow: str, version: str, + project: str, + location: str, + agent: str, + flow: str, + version: str, ) -> str: """Returns a fully-qualified version string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) @staticmethod @@ -266,7 +295,9 @@ def parse_version_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -279,9 +310,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -290,9 +325,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -301,9 +340,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -312,10 +355,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -501,7 +548,6 @@ def list_environments( r"""Returns the list of all environments in the specified [Agent][google.cloud.dialogflow.cx.v3.Agent]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -582,12 +628,20 @@ def sample_list_environments(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListEnvironmentsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -605,7 +659,6 @@ def get_environment( r"""Retrieves the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -695,7 +748,12 @@ def sample_get_environment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -724,7 +782,6 @@ def create_environment( - ``response``: [Environment][google.cloud.dialogflow.cx.v3.Environment] - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -830,7 +887,12 @@ def sample_create_environment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -866,7 +928,6 @@ def update_environment( - ``response``: [Environment][google.cloud.dialogflow.cx.v3.Environment] - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -969,7 +1030,12 @@ def sample_update_environment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -994,7 +1060,6 @@ def delete_environment( r"""Deletes the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1063,7 +1128,10 @@ def sample_delete_environment(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def lookup_environment_history( @@ -1078,7 +1146,6 @@ def lookup_environment_history( r"""Looks up the history of the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1160,12 +1227,20 @@ def sample_lookup_environment_history(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.LookupEnvironmentHistoryPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1192,7 +1267,6 @@ def run_continuous_test( - ``response``: [RunContinuousTestResponse][google.cloud.dialogflow.cx.v3.RunContinuousTestResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1257,7 +1331,12 @@ def sample_run_continuous_test(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1282,7 +1361,6 @@ def list_continuous_test_results( r"""Fetches a list of continuous test results for a given environment. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1363,12 +1441,20 @@ def sample_list_continuous_test_results(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListContinuousTestResultsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1395,7 +1481,6 @@ def deploy_flow( - ``response``: [DeployFlowResponse][google.cloud.dialogflow.cx.v3.DeployFlowResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1461,7 +1546,12 @@ def sample_deploy_flow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( diff --git a/google/cloud/dialogflowcx_v3/services/environments/transports/base.py b/google/cloud/dialogflowcx_v3/services/environments/transports/base.py index 46b34e6d..6fcb90a6 100644 --- a/google/cloud/dialogflowcx_v3/services/environments/transports/base.py +++ b/google/cloud/dialogflowcx_v3/services/environments/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -128,19 +129,29 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_environments: gapic_v1.method.wrap_method( - self.list_environments, default_timeout=None, client_info=client_info, + self.list_environments, + default_timeout=None, + client_info=client_info, ), self.get_environment: gapic_v1.method.wrap_method( - self.get_environment, default_timeout=None, client_info=client_info, + self.get_environment, + default_timeout=None, + client_info=client_info, ), self.create_environment: gapic_v1.method.wrap_method( - self.create_environment, default_timeout=None, client_info=client_info, + self.create_environment, + default_timeout=None, + client_info=client_info, ), self.update_environment: gapic_v1.method.wrap_method( - self.update_environment, default_timeout=None, client_info=client_info, + self.update_environment, + default_timeout=None, + client_info=client_info, ), self.delete_environment: gapic_v1.method.wrap_method( - self.delete_environment, default_timeout=None, client_info=client_info, + self.delete_environment, + default_timeout=None, + client_info=client_info, ), self.lookup_environment_history: gapic_v1.method.wrap_method( self.lookup_environment_history, @@ -148,7 +159,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.run_continuous_test: gapic_v1.method.wrap_method( - self.run_continuous_test, default_timeout=None, client_info=client_info, + self.run_continuous_test, + default_timeout=None, + client_info=client_info, ), self.list_continuous_test_results: gapic_v1.method.wrap_method( self.list_continuous_test_results, @@ -156,16 +169,18 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.deploy_flow: gapic_v1.method.wrap_method( - self.deploy_flow, default_timeout=None, client_info=client_info, + self.deploy_flow, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -264,5 +279,9 @@ def deploy_flow( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("EnvironmentsTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/environments/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/environments/transports/grpc.py index 54b87880..6856743e 100644 --- a/google/cloud/dialogflowcx_v3/services/environments/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3/services/environments/transports/grpc.py @@ -230,8 +230,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -547,5 +546,9 @@ def deploy_flow( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("EnvironmentsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/experiments/async_client.py b/google/cloud/dialogflowcx_v3/services/experiments/async_client.py index 02af6496..27c66ec2 100644 --- a/google/cloud/dialogflowcx_v3/services/experiments/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/experiments/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -218,14 +218,13 @@ async def list_experiments( r"""Returns the list of all experiments in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_list_experiments(): + async def sample_list_experiments(): # Create a client - client = dialogflowcx_v3.ExperimentsClient() + client = dialogflowcx_v3.ExperimentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListExperimentsRequest( @@ -236,7 +235,7 @@ def sample_list_experiments(): page_result = client.list_experiments(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -299,12 +298,20 @@ def sample_list_experiments(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListExperimentsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -322,14 +329,13 @@ async def get_experiment( r"""Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_get_experiment(): + async def sample_get_experiment(): # Create a client - client = dialogflowcx_v3.ExperimentsClient() + client = dialogflowcx_v3.ExperimentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetExperimentRequest( @@ -337,7 +343,7 @@ def sample_get_experiment(): ) # Make the request - response = client.get_experiment(request=request) + response = await client.get_experiment(request=request) # Handle the response print(response) @@ -399,7 +405,12 @@ def sample_get_experiment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -419,14 +430,13 @@ async def create_experiment( specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_create_experiment(): + async def sample_create_experiment(): # Create a client - client = dialogflowcx_v3.ExperimentsClient() + client = dialogflowcx_v3.ExperimentsAsyncClient() # Initialize request argument(s) experiment = dialogflowcx_v3.Experiment() @@ -438,7 +448,7 @@ def sample_create_experiment(): ) # Make the request - response = client.create_experiment(request=request) + response = await client.create_experiment(request=request) # Handle the response print(response) @@ -509,7 +519,12 @@ def sample_create_experiment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -527,14 +542,13 @@ async def update_experiment( r"""Updates the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_update_experiment(): + async def sample_update_experiment(): # Create a client - client = dialogflowcx_v3.ExperimentsClient() + client = dialogflowcx_v3.ExperimentsAsyncClient() # Initialize request argument(s) experiment = dialogflowcx_v3.Experiment() @@ -545,7 +559,7 @@ def sample_update_experiment(): ) # Make the request - response = client.update_experiment(request=request) + response = await client.update_experiment(request=request) # Handle the response print(response) @@ -614,7 +628,12 @@ def sample_update_experiment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -631,14 +650,13 @@ async def delete_experiment( r"""Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_delete_experiment(): + async def sample_delete_experiment(): # Create a client - client = dialogflowcx_v3.ExperimentsClient() + client = dialogflowcx_v3.ExperimentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.DeleteExperimentRequest( @@ -646,7 +664,7 @@ def sample_delete_experiment(): ) # Make the request - client.delete_experiment(request=request) + await client.delete_experiment(request=request) Args: request (Union[google.cloud.dialogflowcx_v3.types.DeleteExperimentRequest, dict]): @@ -700,7 +718,10 @@ def sample_delete_experiment(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def start_experiment( @@ -716,14 +737,13 @@ async def start_experiment( [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only changes the state of experiment from PENDING to RUNNING. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_start_experiment(): + async def sample_start_experiment(): # Create a client - client = dialogflowcx_v3.ExperimentsClient() + client = dialogflowcx_v3.ExperimentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.StartExperimentRequest( @@ -731,7 +751,7 @@ def sample_start_experiment(): ) # Make the request - response = client.start_experiment(request=request) + response = await client.start_experiment(request=request) # Handle the response print(response) @@ -792,7 +812,12 @@ def sample_start_experiment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -810,14 +835,13 @@ async def stop_experiment( [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only changes the state of experiment from RUNNING to DONE. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_stop_experiment(): + async def sample_stop_experiment(): # Create a client - client = dialogflowcx_v3.ExperimentsClient() + client = dialogflowcx_v3.ExperimentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.StopExperimentRequest( @@ -825,7 +849,7 @@ def sample_stop_experiment(): ) # Make the request - response = client.stop_experiment(request=request) + response = await client.stop_experiment(request=request) # Handle the response print(response) @@ -886,7 +910,12 @@ def sample_stop_experiment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3/services/experiments/client.py b/google/cloud/dialogflowcx_v3/services/experiments/client.py index 616acadf..539ca32f 100644 --- a/google/cloud/dialogflowcx_v3/services/experiments/client.py +++ b/google/cloud/dialogflowcx_v3/services/experiments/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -57,7 +57,10 @@ class ExperimentsClientMeta(type): _transport_registry["grpc"] = ExperimentsGrpcTransport _transport_registry["grpc_asyncio"] = ExperimentsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ExperimentsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ExperimentsTransport]: """Returns an appropriate transport class. Args: @@ -165,7 +168,11 @@ def transport(self) -> ExperimentsTransport: @staticmethod def experiment_path( - project: str, location: str, agent: str, environment: str, experiment: str, + project: str, + location: str, + agent: str, + environment: str, + experiment: str, ) -> str: """Returns a fully-qualified experiment string.""" return "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/experiments/{experiment}".format( @@ -187,11 +194,19 @@ def parse_experiment_path(path: str) -> Dict[str, str]: @staticmethod def version_path( - project: str, location: str, agent: str, flow: str, version: str, + project: str, + location: str, + agent: str, + flow: str, + version: str, ) -> str: """Returns a fully-qualified version string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) @staticmethod @@ -204,7 +219,9 @@ def parse_version_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -217,9 +234,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -228,9 +249,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -239,9 +264,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -250,10 +279,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -439,7 +472,6 @@ def list_experiments( r"""Returns the list of all experiments in the specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -520,12 +552,20 @@ def sample_list_experiments(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListExperimentsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -543,7 +583,6 @@ def get_experiment( r"""Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -620,7 +659,12 @@ def sample_get_experiment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -640,7 +684,6 @@ def create_experiment( specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -730,7 +773,12 @@ def sample_create_experiment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -748,7 +796,6 @@ def update_experiment( r"""Updates the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -835,7 +882,12 @@ def sample_update_experiment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -852,7 +904,6 @@ def delete_experiment( r"""Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -921,7 +972,10 @@ def sample_delete_experiment(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def start_experiment( @@ -937,7 +991,6 @@ def start_experiment( [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only changes the state of experiment from PENDING to RUNNING. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1013,7 +1066,12 @@ def sample_start_experiment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1031,7 +1089,6 @@ def stop_experiment( [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only changes the state of experiment from RUNNING to DONE. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1107,7 +1164,12 @@ def sample_stop_experiment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3/services/experiments/transports/base.py b/google/cloud/dialogflowcx_v3/services/experiments/transports/base.py index 6d95ec78..7dc6fe46 100644 --- a/google/cloud/dialogflowcx_v3/services/experiments/transports/base.py +++ b/google/cloud/dialogflowcx_v3/services/experiments/transports/base.py @@ -85,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -126,34 +127,48 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_experiments: gapic_v1.method.wrap_method( - self.list_experiments, default_timeout=None, client_info=client_info, + self.list_experiments, + default_timeout=None, + client_info=client_info, ), self.get_experiment: gapic_v1.method.wrap_method( - self.get_experiment, default_timeout=None, client_info=client_info, + self.get_experiment, + default_timeout=None, + client_info=client_info, ), self.create_experiment: gapic_v1.method.wrap_method( - self.create_experiment, default_timeout=None, client_info=client_info, + self.create_experiment, + default_timeout=None, + client_info=client_info, ), self.update_experiment: gapic_v1.method.wrap_method( - self.update_experiment, default_timeout=None, client_info=client_info, + self.update_experiment, + default_timeout=None, + client_info=client_info, ), self.delete_experiment: gapic_v1.method.wrap_method( - self.delete_experiment, default_timeout=None, client_info=client_info, + self.delete_experiment, + default_timeout=None, + client_info=client_info, ), self.start_experiment: gapic_v1.method.wrap_method( - self.start_experiment, default_timeout=None, client_info=client_info, + self.start_experiment, + default_timeout=None, + client_info=client_info, ), self.stop_experiment: gapic_v1.method.wrap_method( - self.stop_experiment, default_timeout=None, client_info=client_info, + self.stop_experiment, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -223,5 +238,9 @@ def stop_experiment( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ExperimentsTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/experiments/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/experiments/transports/grpc.py index 28e39fbc..58f1541a 100644 --- a/google/cloud/dialogflowcx_v3/services/experiments/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3/services/experiments/transports/grpc.py @@ -227,8 +227,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -433,5 +432,9 @@ def stop_experiment( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ExperimentsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/flows/async_client.py b/google/cloud/dialogflowcx_v3/services/flows/async_client.py index 3c826bcc..6b9eba89 100644 --- a/google/cloud/dialogflowcx_v3/services/flows/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/flows/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -231,14 +231,13 @@ async def create_flow( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_create_flow(): + async def sample_create_flow(): # Create a client - client = dialogflowcx_v3.FlowsClient() + client = dialogflowcx_v3.FlowsAsyncClient() # Initialize request argument(s) flow = dialogflowcx_v3.Flow() @@ -250,7 +249,7 @@ def sample_create_flow(): ) # Make the request - response = client.create_flow(request=request) + response = await client.create_flow(request=request) # Handle the response print(response) @@ -338,7 +337,12 @@ def sample_create_flow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -358,9 +362,9 @@ async def delete_flow( from google.cloud import dialogflowcx_v3 - def sample_delete_flow(): + async def sample_delete_flow(): # Create a client - client = dialogflowcx_v3.FlowsClient() + client = dialogflowcx_v3.FlowsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.DeleteFlowRequest( @@ -368,7 +372,7 @@ def sample_delete_flow(): ) # Make the request - client.delete_flow(request=request) + await client.delete_flow(request=request) Args: request (Union[google.cloud.dialogflowcx_v3.types.DeleteFlowRequest, dict]): @@ -420,7 +424,10 @@ def sample_delete_flow(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def list_flows( @@ -438,9 +445,9 @@ async def list_flows( from google.cloud import dialogflowcx_v3 - def sample_list_flows(): + async def sample_list_flows(): # Create a client - client = dialogflowcx_v3.FlowsClient() + client = dialogflowcx_v3.FlowsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListFlowsRequest( @@ -451,7 +458,7 @@ def sample_list_flows(): page_result = client.list_flows(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -512,12 +519,20 @@ def sample_list_flows(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListFlowsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -538,9 +553,9 @@ async def get_flow( from google.cloud import dialogflowcx_v3 - def sample_get_flow(): + async def sample_get_flow(): # Create a client - client = dialogflowcx_v3.FlowsClient() + client = dialogflowcx_v3.FlowsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetFlowRequest( @@ -548,7 +563,7 @@ def sample_get_flow(): ) # Make the request - response = client.get_flow(request=request) + response = await client.get_flow(request=request) # Handle the response print(response) @@ -629,7 +644,12 @@ def sample_get_flow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -650,14 +670,13 @@ async def update_flow( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_update_flow(): + async def sample_update_flow(): # Create a client - client = dialogflowcx_v3.FlowsClient() + client = dialogflowcx_v3.FlowsAsyncClient() # Initialize request argument(s) flow = dialogflowcx_v3.Flow() @@ -668,7 +687,7 @@ def sample_update_flow(): ) # Make the request - response = client.update_flow(request=request) + response = await client.update_flow(request=request) # Handle the response print(response) @@ -759,7 +778,12 @@ def sample_update_flow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -790,14 +814,13 @@ async def train_flow( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_train_flow(): + async def sample_train_flow(): # Create a client - client = dialogflowcx_v3.FlowsClient() + client = dialogflowcx_v3.FlowsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.TrainFlowRequest( @@ -809,7 +832,7 @@ def sample_train_flow(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -882,7 +905,12 @@ def sample_train_flow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -908,14 +936,13 @@ async def validate_flow( training is completed to get the complete validation results. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_validate_flow(): + async def sample_validate_flow(): # Create a client - client = dialogflowcx_v3.FlowsClient() + client = dialogflowcx_v3.FlowsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ValidateFlowRequest( @@ -923,7 +950,7 @@ def sample_validate_flow(): ) # Make the request - response = client.validate_flow(request=request) + response = await client.validate_flow(request=request) # Handle the response print(response) @@ -962,7 +989,12 @@ def sample_validate_flow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -979,14 +1011,13 @@ async def get_flow_validation_result( r"""Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_get_flow_validation_result(): + async def sample_get_flow_validation_result(): # Create a client - client = dialogflowcx_v3.FlowsClient() + client = dialogflowcx_v3.FlowsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetFlowValidationResultRequest( @@ -994,7 +1025,7 @@ def sample_get_flow_validation_result(): ) # Make the request - response = client.get_flow_validation_result(request=request) + response = await client.get_flow_validation_result(request=request) # Handle the response print(response) @@ -1054,7 +1085,12 @@ def sample_get_flow_validation_result(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1084,14 +1120,13 @@ async def import_flow( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_import_flow(): + async def sample_import_flow(): # Create a client - client = dialogflowcx_v3.FlowsClient() + client = dialogflowcx_v3.FlowsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ImportFlowRequest( @@ -1104,7 +1139,7 @@ def sample_import_flow(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1147,7 +1182,12 @@ def sample_import_flow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1183,14 +1223,13 @@ async def export_flow( Note that resources (e.g. intents, entities, webhooks) that the flow references will also be exported. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_export_flow(): + async def sample_export_flow(): # Create a client - client = dialogflowcx_v3.FlowsClient() + client = dialogflowcx_v3.FlowsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ExportFlowRequest( @@ -1202,7 +1241,7 @@ def sample_export_flow(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1245,7 +1284,12 @@ def sample_export_flow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( diff --git a/google/cloud/dialogflowcx_v3/services/flows/client.py b/google/cloud/dialogflowcx_v3/services/flows/client.py index 8af6aa1a..69c8fbca 100644 --- a/google/cloud/dialogflowcx_v3/services/flows/client.py +++ b/google/cloud/dialogflowcx_v3/services/flows/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -62,7 +62,10 @@ class FlowsClientMeta(type): _transport_registry["grpc"] = FlowsGrpcTransport _transport_registry["grpc_asyncio"] = FlowsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[FlowsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[FlowsTransport]: """Returns an appropriate transport class. Args: @@ -167,10 +170,18 @@ def transport(self) -> FlowsTransport: return self._transport @staticmethod - def flow_path(project: str, location: str, agent: str, flow: str,) -> str: + def flow_path( + project: str, + location: str, + agent: str, + flow: str, + ) -> str: """Returns a fully-qualified flow string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) @staticmethod @@ -184,11 +195,17 @@ def parse_flow_path(path: str) -> Dict[str, str]: @staticmethod def flow_validation_result_path( - project: str, location: str, agent: str, flow: str, + project: str, + location: str, + agent: str, + flow: str, ) -> str: """Returns a fully-qualified flow_validation_result string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/validationResult".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) @staticmethod @@ -201,10 +218,18 @@ def parse_flow_validation_result_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def intent_path(project: str, location: str, agent: str, intent: str,) -> str: + def intent_path( + project: str, + location: str, + agent: str, + intent: str, + ) -> str: """Returns a fully-qualified intent string.""" return "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) @staticmethod @@ -218,11 +243,19 @@ def parse_intent_path(path: str) -> Dict[str, str]: @staticmethod def page_path( - project: str, location: str, agent: str, flow: str, page: str, + project: str, + location: str, + agent: str, + flow: str, + page: str, ) -> str: """Returns a fully-qualified page string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) @staticmethod @@ -236,7 +269,11 @@ def parse_page_path(path: str) -> Dict[str, str]: @staticmethod def transition_route_group_path( - project: str, location: str, agent: str, flow: str, transition_route_group: str, + project: str, + location: str, + agent: str, + flow: str, + transition_route_group: str, ) -> str: """Returns a fully-qualified transition_route_group string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}".format( @@ -257,10 +294,18 @@ def parse_transition_route_group_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def webhook_path(project: str, location: str, agent: str, webhook: str,) -> str: + def webhook_path( + project: str, + location: str, + agent: str, + webhook: str, + ) -> str: """Returns a fully-qualified webhook string.""" return "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) @staticmethod @@ -273,7 +318,9 @@ def parse_webhook_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -286,9 +333,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -297,9 +348,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -308,9 +363,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -319,10 +378,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -512,7 +575,6 @@ def create_flow( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -619,7 +681,12 @@ def sample_create_flow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -701,7 +768,10 @@ def sample_delete_flow(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def list_flows( @@ -793,12 +863,20 @@ def sample_list_flows(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListFlowsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -910,7 +988,12 @@ def sample_get_flow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -931,7 +1014,6 @@ def update_flow( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1040,7 +1122,12 @@ def sample_update_flow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1071,7 +1158,6 @@ def train_flow( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1163,7 +1249,12 @@ def sample_train_flow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1189,7 +1280,6 @@ def validate_flow( training is completed to get the complete validation results. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1244,7 +1334,12 @@ def sample_validate_flow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1261,7 +1356,6 @@ def get_flow_validation_result( r"""Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1338,7 +1432,12 @@ def sample_get_flow_validation_result(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1368,7 +1467,6 @@ def import_flow( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1432,7 +1530,12 @@ def sample_import_flow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1468,7 +1571,6 @@ def export_flow( Note that resources (e.g. intents, entities, webhooks) that the flow references will also be exported. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1531,7 +1633,12 @@ def sample_export_flow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( diff --git a/google/cloud/dialogflowcx_v3/services/flows/transports/base.py b/google/cloud/dialogflowcx_v3/services/flows/transports/base.py index 02a495dc..8940239a 100644 --- a/google/cloud/dialogflowcx_v3/services/flows/transports/base.py +++ b/google/cloud/dialogflowcx_v3/services/flows/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -128,25 +129,39 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.create_flow: gapic_v1.method.wrap_method( - self.create_flow, default_timeout=None, client_info=client_info, + self.create_flow, + default_timeout=None, + client_info=client_info, ), self.delete_flow: gapic_v1.method.wrap_method( - self.delete_flow, default_timeout=None, client_info=client_info, + self.delete_flow, + default_timeout=None, + client_info=client_info, ), self.list_flows: gapic_v1.method.wrap_method( - self.list_flows, default_timeout=None, client_info=client_info, + self.list_flows, + default_timeout=None, + client_info=client_info, ), self.get_flow: gapic_v1.method.wrap_method( - self.get_flow, default_timeout=None, client_info=client_info, + self.get_flow, + default_timeout=None, + client_info=client_info, ), self.update_flow: gapic_v1.method.wrap_method( - self.update_flow, default_timeout=None, client_info=client_info, + self.update_flow, + default_timeout=None, + client_info=client_info, ), self.train_flow: gapic_v1.method.wrap_method( - self.train_flow, default_timeout=None, client_info=client_info, + self.train_flow, + default_timeout=None, + client_info=client_info, ), self.validate_flow: gapic_v1.method.wrap_method( - self.validate_flow, default_timeout=None, client_info=client_info, + self.validate_flow, + default_timeout=None, + client_info=client_info, ), self.get_flow_validation_result: gapic_v1.method.wrap_method( self.get_flow_validation_result, @@ -154,19 +169,23 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.import_flow: gapic_v1.method.wrap_method( - self.import_flow, default_timeout=None, client_info=client_info, + self.import_flow, + default_timeout=None, + client_info=client_info, ), self.export_flow: gapic_v1.method.wrap_method( - self.export_flow, default_timeout=None, client_info=client_info, + self.export_flow, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -259,5 +278,9 @@ def export_flow( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("FlowsTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/flows/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/flows/transports/grpc.py index 30c83c57..15dac25c 100644 --- a/google/cloud/dialogflowcx_v3/services/flows/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3/services/flows/transports/grpc.py @@ -229,8 +229,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -553,5 +552,9 @@ def export_flow( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("FlowsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/intents/async_client.py b/google/cloud/dialogflowcx_v3/services/intents/async_client.py index 1b6120c7..faa5b838 100644 --- a/google/cloud/dialogflowcx_v3/services/intents/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/intents/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -212,14 +212,13 @@ async def list_intents( r"""Returns the list of all intents in the specified agent. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_list_intents(): + async def sample_list_intents(): # Create a client - client = dialogflowcx_v3.IntentsClient() + client = dialogflowcx_v3.IntentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListIntentsRequest( @@ -230,7 +229,7 @@ def sample_list_intents(): page_result = client.list_intents(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -291,12 +290,20 @@ def sample_list_intents(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListIntentsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -317,9 +324,9 @@ async def get_intent( from google.cloud import dialogflowcx_v3 - def sample_get_intent(): + async def sample_get_intent(): # Create a client - client = dialogflowcx_v3.IntentsClient() + client = dialogflowcx_v3.IntentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetIntentRequest( @@ -327,7 +334,7 @@ def sample_get_intent(): ) # Make the request - response = client.get_intent(request=request) + response = await client.get_intent(request=request) # Handle the response print(response) @@ -392,7 +399,12 @@ def sample_get_intent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -413,14 +425,13 @@ async def create_intent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_create_intent(): + async def sample_create_intent(): # Create a client - client = dialogflowcx_v3.IntentsClient() + client = dialogflowcx_v3.IntentsAsyncClient() # Initialize request argument(s) intent = dialogflowcx_v3.Intent() @@ -432,7 +443,7 @@ def sample_create_intent(): ) # Make the request - response = client.create_intent(request=request) + response = await client.create_intent(request=request) # Handle the response print(response) @@ -504,7 +515,12 @@ def sample_create_intent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -525,14 +541,13 @@ async def update_intent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_update_intent(): + async def sample_update_intent(): # Create a client - client = dialogflowcx_v3.IntentsClient() + client = dialogflowcx_v3.IntentsAsyncClient() # Initialize request argument(s) intent = dialogflowcx_v3.Intent() @@ -543,7 +558,7 @@ def sample_update_intent(): ) # Make the request - response = client.update_intent(request=request) + response = await client.update_intent(request=request) # Handle the response print(response) @@ -618,7 +633,12 @@ def sample_update_intent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -638,14 +658,13 @@ async def delete_intent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_delete_intent(): + async def sample_delete_intent(): # Create a client - client = dialogflowcx_v3.IntentsClient() + client = dialogflowcx_v3.IntentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.DeleteIntentRequest( @@ -653,7 +672,7 @@ def sample_delete_intent(): ) # Make the request - client.delete_intent(request=request) + await client.delete_intent(request=request) Args: request (Union[google.cloud.dialogflowcx_v3.types.DeleteIntentRequest, dict]): @@ -705,7 +724,10 @@ def sample_delete_intent(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/dialogflowcx_v3/services/intents/client.py b/google/cloud/dialogflowcx_v3/services/intents/client.py index 452e74ce..cb8fdc1b 100644 --- a/google/cloud/dialogflowcx_v3/services/intents/client.py +++ b/google/cloud/dialogflowcx_v3/services/intents/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -55,7 +55,10 @@ class IntentsClientMeta(type): _transport_registry["grpc"] = IntentsGrpcTransport _transport_registry["grpc_asyncio"] = IntentsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[IntentsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[IntentsTransport]: """Returns an appropriate transport class. Args: @@ -163,11 +166,17 @@ def transport(self) -> IntentsTransport: @staticmethod def entity_type_path( - project: str, location: str, agent: str, entity_type: str, + project: str, + location: str, + agent: str, + entity_type: str, ) -> str: """Returns a fully-qualified entity_type string.""" return "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) @staticmethod @@ -180,10 +189,18 @@ def parse_entity_type_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def intent_path(project: str, location: str, agent: str, intent: str,) -> str: + def intent_path( + project: str, + location: str, + agent: str, + intent: str, + ) -> str: """Returns a fully-qualified intent string.""" return "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) @staticmethod @@ -196,7 +213,9 @@ def parse_intent_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -209,9 +228,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -220,9 +243,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -231,9 +258,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -242,10 +273,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -431,7 +466,6 @@ def list_intents( r"""Returns the list of all intents in the specified agent. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -510,12 +544,20 @@ def sample_list_intents(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListIntentsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -611,7 +653,12 @@ def sample_get_intent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -632,7 +679,6 @@ def create_intent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -723,7 +769,12 @@ def sample_create_intent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -744,7 +795,6 @@ def update_intent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -837,7 +887,12 @@ def sample_update_intent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -857,7 +912,6 @@ def delete_intent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -924,7 +978,10 @@ def sample_delete_intent(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/dialogflowcx_v3/services/intents/transports/base.py b/google/cloud/dialogflowcx_v3/services/intents/transports/base.py index 2b524b52..7352495a 100644 --- a/google/cloud/dialogflowcx_v3/services/intents/transports/base.py +++ b/google/cloud/dialogflowcx_v3/services/intents/transports/base.py @@ -85,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -126,28 +127,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_intents: gapic_v1.method.wrap_method( - self.list_intents, default_timeout=None, client_info=client_info, + self.list_intents, + default_timeout=None, + client_info=client_info, ), self.get_intent: gapic_v1.method.wrap_method( - self.get_intent, default_timeout=None, client_info=client_info, + self.get_intent, + default_timeout=None, + client_info=client_info, ), self.create_intent: gapic_v1.method.wrap_method( - self.create_intent, default_timeout=None, client_info=client_info, + self.create_intent, + default_timeout=None, + client_info=client_info, ), self.update_intent: gapic_v1.method.wrap_method( - self.update_intent, default_timeout=None, client_info=client_info, + self.update_intent, + default_timeout=None, + client_info=client_info, ), self.delete_intent: gapic_v1.method.wrap_method( - self.delete_intent, default_timeout=None, client_info=client_info, + self.delete_intent, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -194,5 +205,9 @@ def delete_intent( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("IntentsTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/intents/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/intents/transports/grpc.py index fae445dc..fcf3edf2 100644 --- a/google/cloud/dialogflowcx_v3/services/intents/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3/services/intents/transports/grpc.py @@ -227,8 +227,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -373,5 +372,9 @@ def delete_intent(self) -> Callable[[intent.DeleteIntentRequest], empty_pb2.Empt def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("IntentsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/pages/async_client.py b/google/cloud/dialogflowcx_v3/services/pages/async_client.py index b010adc8..fbdc20ac 100644 --- a/google/cloud/dialogflowcx_v3/services/pages/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/pages/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -222,9 +222,9 @@ async def list_pages( from google.cloud import dialogflowcx_v3 - def sample_list_pages(): + async def sample_list_pages(): # Create a client - client = dialogflowcx_v3.PagesClient() + client = dialogflowcx_v3.PagesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListPagesRequest( @@ -235,7 +235,7 @@ def sample_list_pages(): page_result = client.list_pages(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -296,12 +296,20 @@ def sample_list_pages(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListPagesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -322,9 +330,9 @@ async def get_page( from google.cloud import dialogflowcx_v3 - def sample_get_page(): + async def sample_get_page(): # Create a client - client = dialogflowcx_v3.PagesClient() + client = dialogflowcx_v3.PagesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetPageRequest( @@ -332,7 +340,7 @@ def sample_get_page(): ) # Make the request - response = client.get_page(request=request) + response = await client.get_page(request=request) # Handle the response print(response) @@ -412,7 +420,12 @@ def sample_get_page(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -433,14 +446,13 @@ async def create_page( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_create_page(): + async def sample_create_page(): # Create a client - client = dialogflowcx_v3.PagesClient() + client = dialogflowcx_v3.PagesAsyncClient() # Initialize request argument(s) page = dialogflowcx_v3.Page() @@ -452,7 +464,7 @@ def sample_create_page(): ) # Make the request - response = client.create_page(request=request) + response = await client.create_page(request=request) # Handle the response print(response) @@ -539,7 +551,12 @@ def sample_create_page(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -560,14 +577,13 @@ async def update_page( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_update_page(): + async def sample_update_page(): # Create a client - client = dialogflowcx_v3.PagesClient() + client = dialogflowcx_v3.PagesAsyncClient() # Initialize request argument(s) page = dialogflowcx_v3.Page() @@ -578,7 +594,7 @@ def sample_update_page(): ) # Make the request - response = client.update_page(request=request) + response = await client.update_page(request=request) # Handle the response print(response) @@ -668,7 +684,12 @@ def sample_update_page(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -688,14 +709,13 @@ async def delete_page( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_delete_page(): + async def sample_delete_page(): # Create a client - client = dialogflowcx_v3.PagesClient() + client = dialogflowcx_v3.PagesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.DeletePageRequest( @@ -703,7 +723,7 @@ def sample_delete_page(): ) # Make the request - client.delete_page(request=request) + await client.delete_page(request=request) Args: request (Union[google.cloud.dialogflowcx_v3.types.DeletePageRequest, dict]): @@ -755,7 +775,10 @@ def sample_delete_page(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/dialogflowcx_v3/services/pages/client.py b/google/cloud/dialogflowcx_v3/services/pages/client.py index d2b709ba..d57a06bf 100644 --- a/google/cloud/dialogflowcx_v3/services/pages/client.py +++ b/google/cloud/dialogflowcx_v3/services/pages/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -56,7 +56,10 @@ class PagesClientMeta(type): _transport_registry["grpc"] = PagesGrpcTransport _transport_registry["grpc_asyncio"] = PagesGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[PagesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[PagesTransport]: """Returns an appropriate transport class. Args: @@ -162,11 +165,17 @@ def transport(self) -> PagesTransport: @staticmethod def entity_type_path( - project: str, location: str, agent: str, entity_type: str, + project: str, + location: str, + agent: str, + entity_type: str, ) -> str: """Returns a fully-qualified entity_type string.""" return "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) @staticmethod @@ -179,10 +188,18 @@ def parse_entity_type_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def flow_path(project: str, location: str, agent: str, flow: str,) -> str: + def flow_path( + project: str, + location: str, + agent: str, + flow: str, + ) -> str: """Returns a fully-qualified flow string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) @staticmethod @@ -195,10 +212,18 @@ def parse_flow_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def intent_path(project: str, location: str, agent: str, intent: str,) -> str: + def intent_path( + project: str, + location: str, + agent: str, + intent: str, + ) -> str: """Returns a fully-qualified intent string.""" return "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) @staticmethod @@ -212,11 +237,19 @@ def parse_intent_path(path: str) -> Dict[str, str]: @staticmethod def page_path( - project: str, location: str, agent: str, flow: str, page: str, + project: str, + location: str, + agent: str, + flow: str, + page: str, ) -> str: """Returns a fully-qualified page string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) @staticmethod @@ -230,7 +263,11 @@ def parse_page_path(path: str) -> Dict[str, str]: @staticmethod def transition_route_group_path( - project: str, location: str, agent: str, flow: str, transition_route_group: str, + project: str, + location: str, + agent: str, + flow: str, + transition_route_group: str, ) -> str: """Returns a fully-qualified transition_route_group string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}".format( @@ -251,10 +288,18 @@ def parse_transition_route_group_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def webhook_path(project: str, location: str, agent: str, webhook: str,) -> str: + def webhook_path( + project: str, + location: str, + agent: str, + webhook: str, + ) -> str: """Returns a fully-qualified webhook string.""" return "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) @staticmethod @@ -267,7 +312,9 @@ def parse_webhook_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -280,9 +327,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -291,9 +342,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -302,9 +357,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -313,10 +372,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -579,12 +642,20 @@ def sample_list_pages(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPagesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -695,7 +766,12 @@ def sample_get_page(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -716,7 +792,6 @@ def create_page( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -822,7 +897,12 @@ def sample_create_page(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -843,7 +923,6 @@ def update_page( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -951,7 +1030,12 @@ def sample_update_page(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -971,7 +1055,6 @@ def delete_page( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1038,7 +1121,10 @@ def sample_delete_page(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/dialogflowcx_v3/services/pages/transports/base.py b/google/cloud/dialogflowcx_v3/services/pages/transports/base.py index 6059ee9a..720ecb1b 100644 --- a/google/cloud/dialogflowcx_v3/services/pages/transports/base.py +++ b/google/cloud/dialogflowcx_v3/services/pages/transports/base.py @@ -85,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -126,28 +127,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_pages: gapic_v1.method.wrap_method( - self.list_pages, default_timeout=None, client_info=client_info, + self.list_pages, + default_timeout=None, + client_info=client_info, ), self.get_page: gapic_v1.method.wrap_method( - self.get_page, default_timeout=None, client_info=client_info, + self.get_page, + default_timeout=None, + client_info=client_info, ), self.create_page: gapic_v1.method.wrap_method( - self.create_page, default_timeout=None, client_info=client_info, + self.create_page, + default_timeout=None, + client_info=client_info, ), self.update_page: gapic_v1.method.wrap_method( - self.update_page, default_timeout=None, client_info=client_info, + self.update_page, + default_timeout=None, + client_info=client_info, ), self.delete_page: gapic_v1.method.wrap_method( - self.delete_page, default_timeout=None, client_info=client_info, + self.delete_page, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -190,5 +201,9 @@ def delete_page( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("PagesTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/pages/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/pages/transports/grpc.py index 7376b22f..ea672ff4 100644 --- a/google/cloud/dialogflowcx_v3/services/pages/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3/services/pages/transports/grpc.py @@ -226,8 +226,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -365,5 +364,9 @@ def delete_page(self) -> Callable[[page.DeletePageRequest], empty_pb2.Empty]: def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("PagesGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/security_settings_service/async_client.py b/google/cloud/dialogflowcx_v3/services/security_settings_service/async_client.py index 57442169..54a0f6e6 100644 --- a/google/cloud/dialogflowcx_v3/services/security_settings_service/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/security_settings_service/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -245,9 +245,9 @@ async def create_security_settings( from google.cloud import dialogflowcx_v3 - def sample_create_security_settings(): + async def sample_create_security_settings(): # Create a client - client = dialogflowcx_v3.SecuritySettingsServiceClient() + client = dialogflowcx_v3.SecuritySettingsServiceAsyncClient() # Initialize request argument(s) security_settings = dialogflowcx_v3.SecuritySettings() @@ -260,7 +260,7 @@ def sample_create_security_settings(): ) # Make the request - response = client.create_security_settings(request=request) + response = await client.create_security_settings(request=request) # Handle the response print(response) @@ -335,7 +335,12 @@ def sample_create_security_settings(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -353,14 +358,13 @@ async def get_security_settings( [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. The returned settings may be stale by up to 1 minute. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_get_security_settings(): + async def sample_get_security_settings(): # Create a client - client = dialogflowcx_v3.SecuritySettingsServiceClient() + client = dialogflowcx_v3.SecuritySettingsServiceAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetSecuritySettingsRequest( @@ -368,7 +372,7 @@ def sample_get_security_settings(): ) # Make the request - response = client.get_security_settings(request=request) + response = await client.get_security_settings(request=request) # Handle the response print(response) @@ -432,7 +436,12 @@ def sample_get_security_settings(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -452,14 +461,13 @@ async def update_security_settings( r"""Updates the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_update_security_settings(): + async def sample_update_security_settings(): # Create a client - client = dialogflowcx_v3.SecuritySettingsServiceClient() + client = dialogflowcx_v3.SecuritySettingsServiceAsyncClient() # Initialize request argument(s) security_settings = dialogflowcx_v3.SecuritySettings() @@ -471,7 +479,7 @@ def sample_update_security_settings(): ) # Make the request - response = client.update_security_settings(request=request) + response = await client.update_security_settings(request=request) # Handle the response print(response) @@ -547,7 +555,12 @@ def sample_update_security_settings(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -564,14 +577,13 @@ async def list_security_settings( r"""Returns the list of all security settings in the specified location. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_list_security_settings(): + async def sample_list_security_settings(): # Create a client - client = dialogflowcx_v3.SecuritySettingsServiceClient() + client = dialogflowcx_v3.SecuritySettingsServiceAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListSecuritySettingsRequest( @@ -582,7 +594,7 @@ def sample_list_security_settings(): page_result = client.list_security_settings(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -644,12 +656,20 @@ def sample_list_security_settings(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListSecuritySettingsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -667,14 +687,13 @@ async def delete_security_settings( r"""Deletes the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_delete_security_settings(): + async def sample_delete_security_settings(): # Create a client - client = dialogflowcx_v3.SecuritySettingsServiceClient() + client = dialogflowcx_v3.SecuritySettingsServiceAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.DeleteSecuritySettingsRequest( @@ -682,7 +701,7 @@ def sample_delete_security_settings(): ) # Make the request - client.delete_security_settings(request=request) + await client.delete_security_settings(request=request) Args: request (Union[google.cloud.dialogflowcx_v3.types.DeleteSecuritySettingsRequest, dict]): @@ -736,7 +755,10 @@ def sample_delete_security_settings(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/dialogflowcx_v3/services/security_settings_service/client.py b/google/cloud/dialogflowcx_v3/services/security_settings_service/client.py index c18f178e..cbe4e949 100644 --- a/google/cloud/dialogflowcx_v3/services/security_settings_service/client.py +++ b/google/cloud/dialogflowcx_v3/services/security_settings_service/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -60,7 +60,8 @@ class SecuritySettingsServiceClientMeta(type): _transport_registry["grpc_asyncio"] = SecuritySettingsServiceGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[SecuritySettingsServiceTransport]: """Returns an appropriate transport class. @@ -167,7 +168,9 @@ def transport(self) -> SecuritySettingsServiceTransport: @staticmethod def deidentify_template_path( - organization: str, location: str, deidentify_template: str, + organization: str, + location: str, + deidentify_template: str, ) -> str: """Returns a fully-qualified deidentify_template string.""" return "organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}".format( @@ -187,7 +190,9 @@ def parse_deidentify_template_path(path: str) -> Dict[str, str]: @staticmethod def inspect_template_path( - organization: str, location: str, inspect_template: str, + organization: str, + location: str, + inspect_template: str, ) -> str: """Returns a fully-qualified inspect_template string.""" return "organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}".format( @@ -207,11 +212,15 @@ def parse_inspect_template_path(path: str) -> Dict[str, str]: @staticmethod def security_settings_path( - project: str, location: str, security_settings: str, + project: str, + location: str, + security_settings: str, ) -> str: """Returns a fully-qualified security_settings string.""" return "projects/{project}/locations/{location}/securitySettings/{security_settings}".format( - project=project, location=location, security_settings=security_settings, + project=project, + location=location, + security_settings=security_settings, ) @staticmethod @@ -224,7 +233,9 @@ def parse_security_settings_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -237,9 +248,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -248,9 +263,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -259,9 +278,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -270,10 +293,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -557,7 +584,12 @@ def sample_create_security_settings(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -575,7 +607,6 @@ def get_security_settings( [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. The returned settings may be stale by up to 1 minute. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -654,7 +685,12 @@ def sample_get_security_settings(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -674,7 +710,6 @@ def update_security_settings( r"""Updates the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -771,7 +806,12 @@ def sample_update_security_settings(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -788,7 +828,6 @@ def list_security_settings( r"""Returns the list of all security settings in the specified location. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -868,12 +907,20 @@ def sample_list_security_settings(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListSecuritySettingsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -891,7 +938,6 @@ def delete_security_settings( r"""Deletes the specified [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -960,7 +1006,10 @@ def sample_delete_security_settings(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/dialogflowcx_v3/services/security_settings_service/transports/base.py b/google/cloud/dialogflowcx_v3/services/security_settings_service/transports/base.py index 6df0a8cd..05308596 100644 --- a/google/cloud/dialogflowcx_v3/services/security_settings_service/transports/base.py +++ b/google/cloud/dialogflowcx_v3/services/security_settings_service/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -157,9 +158,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -220,5 +221,9 @@ def delete_security_settings( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("SecuritySettingsServiceTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/security_settings_service/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/security_settings_service/transports/grpc.py index fcfb48b5..d8fbe7a3 100644 --- a/google/cloud/dialogflowcx_v3/services/security_settings_service/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3/services/security_settings_service/transports/grpc.py @@ -228,8 +228,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -382,5 +381,9 @@ def delete_security_settings( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("SecuritySettingsServiceGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/session_entity_types/async_client.py b/google/cloud/dialogflowcx_v3/services/session_entity_types/async_client.py index f8b9a830..e903bfab 100644 --- a/google/cloud/dialogflowcx_v3/services/session_entity_types/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/session_entity_types/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -226,14 +226,13 @@ async def list_session_entity_types( r"""Returns the list of all session entity types in the specified session. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_list_session_entity_types(): + async def sample_list_session_entity_types(): # Create a client - client = dialogflowcx_v3.SessionEntityTypesClient() + client = dialogflowcx_v3.SessionEntityTypesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListSessionEntityTypesRequest( @@ -244,7 +243,7 @@ def sample_list_session_entity_types(): page_result = client.list_session_entity_types(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -310,12 +309,20 @@ def sample_list_session_entity_types(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListSessionEntityTypesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -336,9 +343,9 @@ async def get_session_entity_type( from google.cloud import dialogflowcx_v3 - def sample_get_session_entity_type(): + async def sample_get_session_entity_type(): # Create a client - client = dialogflowcx_v3.SessionEntityTypesClient() + client = dialogflowcx_v3.SessionEntityTypesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetSessionEntityTypeRequest( @@ -346,7 +353,7 @@ def sample_get_session_entity_type(): ) # Make the request - response = client.get_session_entity_type(request=request) + response = await client.get_session_entity_type(request=request) # Handle the response print(response) @@ -424,7 +431,12 @@ def sample_get_session_entity_type(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -447,9 +459,9 @@ async def create_session_entity_type( from google.cloud import dialogflowcx_v3 - def sample_create_session_entity_type(): + async def sample_create_session_entity_type(): # Create a client - client = dialogflowcx_v3.SessionEntityTypesClient() + client = dialogflowcx_v3.SessionEntityTypesAsyncClient() # Initialize request argument(s) session_entity_type = dialogflowcx_v3.SessionEntityType() @@ -464,7 +476,7 @@ def sample_create_session_entity_type(): ) # Make the request - response = client.create_session_entity_type(request=request) + response = await client.create_session_entity_type(request=request) # Handle the response print(response) @@ -552,7 +564,12 @@ def sample_create_session_entity_type(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -575,9 +592,9 @@ async def update_session_entity_type( from google.cloud import dialogflowcx_v3 - def sample_update_session_entity_type(): + async def sample_update_session_entity_type(): # Create a client - client = dialogflowcx_v3.SessionEntityTypesClient() + client = dialogflowcx_v3.SessionEntityTypesAsyncClient() # Initialize request argument(s) session_entity_type = dialogflowcx_v3.SessionEntityType() @@ -591,7 +608,7 @@ def sample_update_session_entity_type(): ) # Make the request - response = client.update_session_entity_type(request=request) + response = await client.update_session_entity_type(request=request) # Handle the response print(response) @@ -680,7 +697,12 @@ def sample_update_session_entity_type(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -700,9 +722,9 @@ async def delete_session_entity_type( from google.cloud import dialogflowcx_v3 - def sample_delete_session_entity_type(): + async def sample_delete_session_entity_type(): # Create a client - client = dialogflowcx_v3.SessionEntityTypesClient() + client = dialogflowcx_v3.SessionEntityTypesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.DeleteSessionEntityTypeRequest( @@ -710,7 +732,7 @@ def sample_delete_session_entity_type(): ) # Make the request - client.delete_session_entity_type(request=request) + await client.delete_session_entity_type(request=request) Args: request (Union[google.cloud.dialogflowcx_v3.types.DeleteSessionEntityTypeRequest, dict]): @@ -767,7 +789,10 @@ def sample_delete_session_entity_type(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/dialogflowcx_v3/services/session_entity_types/client.py b/google/cloud/dialogflowcx_v3/services/session_entity_types/client.py index e8e6ff4d..d655773f 100644 --- a/google/cloud/dialogflowcx_v3/services/session_entity_types/client.py +++ b/google/cloud/dialogflowcx_v3/services/session_entity_types/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -61,7 +61,8 @@ class SessionEntityTypesClientMeta(type): _transport_registry["grpc_asyncio"] = SessionEntityTypesGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[SessionEntityTypesTransport]: """Returns an appropriate transport class. @@ -170,7 +171,11 @@ def transport(self) -> SessionEntityTypesTransport: @staticmethod def session_entity_type_path( - project: str, location: str, agent: str, session: str, entity_type: str, + project: str, + location: str, + agent: str, + session: str, + entity_type: str, ) -> str: """Returns a fully-qualified session_entity_type string.""" return "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}".format( @@ -191,7 +196,9 @@ def parse_session_entity_type_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -204,9 +211,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -215,9 +226,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -226,9 +241,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -237,10 +256,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -426,7 +449,6 @@ def list_session_entity_types( r"""Returns the list of all session entity types in the specified session. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -512,12 +534,20 @@ def sample_list_session_entity_types(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListSessionEntityTypesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -626,7 +656,12 @@ def sample_get_session_entity_type(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -758,7 +793,12 @@ def sample_create_session_entity_type(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -890,7 +930,12 @@ def sample_update_session_entity_type(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -979,7 +1024,10 @@ def sample_delete_session_entity_type(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/dialogflowcx_v3/services/session_entity_types/transports/base.py b/google/cloud/dialogflowcx_v3/services/session_entity_types/transports/base.py index 659fe3d6..2bbe4672 100644 --- a/google/cloud/dialogflowcx_v3/services/session_entity_types/transports/base.py +++ b/google/cloud/dialogflowcx_v3/services/session_entity_types/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -157,9 +158,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -220,5 +221,9 @@ def delete_session_entity_type( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("SessionEntityTypesTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/session_entity_types/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/session_entity_types/transports/grpc.py index 2ebaff13..48b18872 100644 --- a/google/cloud/dialogflowcx_v3/services/session_entity_types/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3/services/session_entity_types/transports/grpc.py @@ -229,8 +229,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -381,5 +380,9 @@ def delete_session_entity_type( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("SessionEntityTypesGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/sessions/async_client.py b/google/cloud/dialogflowcx_v3/services/sessions/async_client.py index 1e2b9873..d778a955 100644 --- a/google/cloud/dialogflowcx_v3/services/sessions/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/sessions/async_client.py @@ -18,6 +18,7 @@ import re from typing import ( Dict, + Mapping, Optional, AsyncIterable, Awaitable, @@ -248,14 +249,13 @@ async def detect_intent( `Versions and environments `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_detect_intent(): + async def sample_detect_intent(): # Create a client - client = dialogflowcx_v3.SessionsClient() + client = dialogflowcx_v3.SessionsAsyncClient() # Initialize request argument(s) query_input = dialogflowcx_v3.QueryInput() @@ -268,7 +268,7 @@ def sample_detect_intent(): ) # Make the request - response = client.detect_intent(request=request) + response = await client.detect_intent(request=request) # Handle the response print(response) @@ -315,7 +315,12 @@ def sample_detect_intent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -337,14 +342,13 @@ def streaming_detect_intent( `Versions and environments `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_streaming_detect_intent(): + async def sample_streaming_detect_intent(): # Create a client - client = dialogflowcx_v3.SessionsClient() + client = dialogflowcx_v3.SessionsAsyncClient() # Initialize request argument(s) query_input = dialogflowcx_v3.QueryInput() @@ -366,10 +370,10 @@ def request_generator(): yield request # Make the request - stream = client.streaming_detect_intent(requests=request_generator()) + stream = await client.streaming_detect_intent(requests=request_generator()) # Handle the response - for response in stream: + async for response in stream: print(response) Args: @@ -460,7 +464,12 @@ def request_generator(): ) # Send the request. - response = rpc(requests, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + requests, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -476,14 +485,13 @@ async def match_intent( r"""Returns preliminary intent match results, doesn't change the session status. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_match_intent(): + async def sample_match_intent(): # Create a client - client = dialogflowcx_v3.SessionsClient() + client = dialogflowcx_v3.SessionsAsyncClient() # Initialize request argument(s) query_input = dialogflowcx_v3.QueryInput() @@ -496,7 +504,7 @@ def sample_match_intent(): ) # Make the request - response = client.match_intent(request=request) + response = await client.match_intent(request=request) # Handle the response print(response) @@ -532,7 +540,12 @@ def sample_match_intent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -553,21 +566,20 @@ async def fulfill_intent( [MatchIntentResponse][google.cloud.dialogflow.cx.v3.MatchIntentResponse]. Otherwise, the behavior is undefined. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_fulfill_intent(): + async def sample_fulfill_intent(): # Create a client - client = dialogflowcx_v3.SessionsClient() + client = dialogflowcx_v3.SessionsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.FulfillIntentRequest( ) # Make the request - response = client.fulfill_intent(request=request) + response = await client.fulfill_intent(request=request) # Handle the response print(response) @@ -610,7 +622,12 @@ def sample_fulfill_intent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3/services/sessions/client.py b/google/cloud/dialogflowcx_v3/services/sessions/client.py index 563aacfb..33e91ef6 100644 --- a/google/cloud/dialogflowcx_v3/services/sessions/client.py +++ b/google/cloud/dialogflowcx_v3/services/sessions/client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Iterable, Iterator, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + Optional, + Iterable, + Iterator, + Sequence, + Tuple, + Type, + Union, +) import pkg_resources from google.api_core import client_options as client_options_lib @@ -54,7 +64,10 @@ class SessionsClientMeta(type): _transport_registry["grpc"] = SessionsGrpcTransport _transport_registry["grpc_asyncio"] = SessionsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[SessionsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[SessionsTransport]: """Returns an appropriate transport class. Args: @@ -164,11 +177,17 @@ def transport(self) -> SessionsTransport: @staticmethod def entity_type_path( - project: str, location: str, agent: str, entity_type: str, + project: str, + location: str, + agent: str, + entity_type: str, ) -> str: """Returns a fully-qualified entity_type string.""" return "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) @staticmethod @@ -181,10 +200,18 @@ def parse_entity_type_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def flow_path(project: str, location: str, agent: str, flow: str,) -> str: + def flow_path( + project: str, + location: str, + agent: str, + flow: str, + ) -> str: """Returns a fully-qualified flow string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) @staticmethod @@ -197,10 +224,18 @@ def parse_flow_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def intent_path(project: str, location: str, agent: str, intent: str,) -> str: + def intent_path( + project: str, + location: str, + agent: str, + intent: str, + ) -> str: """Returns a fully-qualified intent string.""" return "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) @staticmethod @@ -214,11 +249,19 @@ def parse_intent_path(path: str) -> Dict[str, str]: @staticmethod def page_path( - project: str, location: str, agent: str, flow: str, page: str, + project: str, + location: str, + agent: str, + flow: str, + page: str, ) -> str: """Returns a fully-qualified page string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) @staticmethod @@ -231,10 +274,18 @@ def parse_page_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def session_path(project: str, location: str, agent: str, session: str,) -> str: + def session_path( + project: str, + location: str, + agent: str, + session: str, + ) -> str: """Returns a fully-qualified session string.""" return "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}".format( - project=project, location=location, agent=agent, session=session, + project=project, + location=location, + agent=agent, + session=session, ) @staticmethod @@ -248,7 +299,11 @@ def parse_session_path(path: str) -> Dict[str, str]: @staticmethod def session_entity_type_path( - project: str, location: str, agent: str, session: str, entity_type: str, + project: str, + location: str, + agent: str, + session: str, + entity_type: str, ) -> str: """Returns a fully-qualified session_entity_type string.""" return "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}".format( @@ -270,7 +325,11 @@ def parse_session_entity_type_path(path: str) -> Dict[str, str]: @staticmethod def transition_route_group_path( - project: str, location: str, agent: str, flow: str, transition_route_group: str, + project: str, + location: str, + agent: str, + flow: str, + transition_route_group: str, ) -> str: """Returns a fully-qualified transition_route_group string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}".format( @@ -292,11 +351,19 @@ def parse_transition_route_group_path(path: str) -> Dict[str, str]: @staticmethod def version_path( - project: str, location: str, agent: str, flow: str, version: str, + project: str, + location: str, + agent: str, + flow: str, + version: str, ) -> str: """Returns a fully-qualified version string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) @staticmethod @@ -309,10 +376,18 @@ def parse_version_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def webhook_path(project: str, location: str, agent: str, webhook: str,) -> str: + def webhook_path( + project: str, + location: str, + agent: str, + webhook: str, + ) -> str: """Returns a fully-qualified webhook string.""" return "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) @staticmethod @@ -325,7 +400,9 @@ def parse_webhook_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -338,9 +415,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -349,9 +430,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -360,9 +445,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -371,10 +460,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -565,7 +658,6 @@ def detect_intent( `Versions and environments `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -624,7 +716,12 @@ def sample_detect_intent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -646,7 +743,6 @@ def streaming_detect_intent( `Versions and environments `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -765,7 +861,12 @@ def request_generator(): rpc = self._transport._wrapped_methods[self._transport.streaming_detect_intent] # Send the request. - response = rpc(requests, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + requests, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -781,7 +882,6 @@ def match_intent( r"""Returns preliminary intent match results, doesn't change the session status. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -838,7 +938,12 @@ def sample_match_intent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -859,7 +964,6 @@ def fulfill_intent( [MatchIntentResponse][google.cloud.dialogflow.cx.v3.MatchIntentResponse]. Otherwise, the behavior is undefined. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -917,7 +1021,12 @@ def sample_fulfill_intent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3/services/sessions/transports/base.py b/google/cloud/dialogflowcx_v3/services/sessions/transports/base.py index 7732b6b5..9b2c5366 100644 --- a/google/cloud/dialogflowcx_v3/services/sessions/transports/base.py +++ b/google/cloud/dialogflowcx_v3/services/sessions/transports/base.py @@ -83,6 +83,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -143,19 +144,23 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.match_intent: gapic_v1.method.wrap_method( - self.match_intent, default_timeout=None, client_info=client_info, + self.match_intent, + default_timeout=None, + client_info=client_info, ), self.fulfill_intent: gapic_v1.method.wrap_method( - self.fulfill_intent, default_timeout=None, client_info=client_info, + self.fulfill_intent, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -198,5 +203,9 @@ def fulfill_intent( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("SessionsTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/sessions/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/sessions/transports/grpc.py index 255c577a..9389b1a7 100644 --- a/google/cloud/dialogflowcx_v3/services/sessions/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3/services/sessions/transports/grpc.py @@ -227,8 +227,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -361,5 +360,9 @@ def fulfill_intent( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("SessionsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/test_cases/async_client.py b/google/cloud/dialogflowcx_v3/services/test_cases/async_client.py index 90f98f35..a8e7fc99 100644 --- a/google/cloud/dialogflowcx_v3/services/test_cases/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/test_cases/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -243,9 +243,9 @@ async def list_test_cases( from google.cloud import dialogflowcx_v3 - def sample_list_test_cases(): + async def sample_list_test_cases(): # Create a client - client = dialogflowcx_v3.TestCasesClient() + client = dialogflowcx_v3.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListTestCasesRequest( @@ -256,7 +256,7 @@ def sample_list_test_cases(): page_result = client.list_test_cases(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -317,12 +317,20 @@ def sample_list_test_cases(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListTestCasesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -343,9 +351,9 @@ async def batch_delete_test_cases( from google.cloud import dialogflowcx_v3 - def sample_batch_delete_test_cases(): + async def sample_batch_delete_test_cases(): # Create a client - client = dialogflowcx_v3.TestCasesClient() + client = dialogflowcx_v3.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.BatchDeleteTestCasesRequest( @@ -354,7 +362,7 @@ def sample_batch_delete_test_cases(): ) # Make the request - client.batch_delete_test_cases(request=request) + await client.batch_delete_test_cases(request=request) Args: request (Union[google.cloud.dialogflowcx_v3.types.BatchDeleteTestCasesRequest, dict]): @@ -406,7 +414,10 @@ def sample_batch_delete_test_cases(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def get_test_case( @@ -424,9 +435,9 @@ async def get_test_case( from google.cloud import dialogflowcx_v3 - def sample_get_test_case(): + async def sample_get_test_case(): # Create a client - client = dialogflowcx_v3.TestCasesClient() + client = dialogflowcx_v3.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetTestCaseRequest( @@ -434,7 +445,7 @@ def sample_get_test_case(): ) # Make the request - response = client.get_test_case(request=request) + response = await client.get_test_case(request=request) # Handle the response print(response) @@ -492,7 +503,12 @@ def sample_get_test_case(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -513,9 +529,9 @@ async def create_test_case( from google.cloud import dialogflowcx_v3 - def sample_create_test_case(): + async def sample_create_test_case(): # Create a client - client = dialogflowcx_v3.TestCasesClient() + client = dialogflowcx_v3.TestCasesAsyncClient() # Initialize request argument(s) test_case = dialogflowcx_v3.TestCase() @@ -527,7 +543,7 @@ def sample_create_test_case(): ) # Make the request - response = client.create_test_case(request=request) + response = await client.create_test_case(request=request) # Handle the response print(response) @@ -592,7 +608,12 @@ def sample_create_test_case(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -613,9 +634,9 @@ async def update_test_case( from google.cloud import dialogflowcx_v3 - def sample_update_test_case(): + async def sample_update_test_case(): # Create a client - client = dialogflowcx_v3.TestCasesClient() + client = dialogflowcx_v3.TestCasesAsyncClient() # Initialize request argument(s) test_case = dialogflowcx_v3.TestCase() @@ -626,7 +647,7 @@ def sample_update_test_case(): ) # Make the request - response = client.update_test_case(request=request) + response = await client.update_test_case(request=request) # Handle the response print(response) @@ -697,7 +718,12 @@ def sample_update_test_case(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -722,14 +748,13 @@ async def run_test_case( - ``response``: [RunTestCaseResponse][google.cloud.dialogflow.cx.v3.RunTestCaseResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_run_test_case(): + async def sample_run_test_case(): # Create a client - client = dialogflowcx_v3.TestCasesClient() + client = dialogflowcx_v3.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.RunTestCaseRequest( @@ -741,7 +766,7 @@ def sample_run_test_case(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -784,7 +809,12 @@ def sample_run_test_case(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -817,14 +847,13 @@ async def batch_run_test_cases( - ``response``: [BatchRunTestCasesResponse][google.cloud.dialogflow.cx.v3.BatchRunTestCasesResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_batch_run_test_cases(): + async def sample_batch_run_test_cases(): # Create a client - client = dialogflowcx_v3.TestCasesClient() + client = dialogflowcx_v3.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.BatchRunTestCasesRequest( @@ -837,7 +866,7 @@ def sample_batch_run_test_cases(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -880,7 +909,12 @@ def sample_batch_run_test_cases(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -907,9 +941,9 @@ async def calculate_coverage( from google.cloud import dialogflowcx_v3 - def sample_calculate_coverage(): + async def sample_calculate_coverage(): # Create a client - client = dialogflowcx_v3.TestCasesClient() + client = dialogflowcx_v3.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.CalculateCoverageRequest( @@ -918,7 +952,7 @@ def sample_calculate_coverage(): ) # Make the request - response = client.calculate_coverage(request=request) + response = await client.calculate_coverage(request=request) # Handle the response print(response) @@ -957,7 +991,12 @@ def sample_calculate_coverage(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -971,7 +1010,7 @@ async def import_test_cases( metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Imports the test cases from a Cloud Storage bucket or a local - file. It always creates new test cases and won't overwite any + file. It always creates new test cases and won't overwrite any existing ones. The provided ID in the imported test case is neglected. @@ -985,14 +1024,13 @@ async def import_test_cases( - ``response``: [ImportTestCasesResponse][google.cloud.dialogflow.cx.v3.ImportTestCasesResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_import_test_cases(): + async def sample_import_test_cases(): # Create a client - client = dialogflowcx_v3.TestCasesClient() + client = dialogflowcx_v3.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ImportTestCasesRequest( @@ -1005,7 +1043,7 @@ def sample_import_test_cases(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1048,7 +1086,12 @@ def sample_import_test_cases(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1083,14 +1126,13 @@ async def export_test_cases( - ``response``: [ExportTestCasesResponse][google.cloud.dialogflow.cx.v3.ExportTestCasesResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_export_test_cases(): + async def sample_export_test_cases(): # Create a client - client = dialogflowcx_v3.TestCasesClient() + client = dialogflowcx_v3.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ExportTestCasesRequest( @@ -1103,7 +1145,7 @@ def sample_export_test_cases(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1146,7 +1188,12 @@ def sample_export_test_cases(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1174,9 +1221,9 @@ async def list_test_case_results( from google.cloud import dialogflowcx_v3 - def sample_list_test_case_results(): + async def sample_list_test_case_results(): # Create a client - client = dialogflowcx_v3.TestCasesClient() + client = dialogflowcx_v3.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListTestCaseResultsRequest( @@ -1187,7 +1234,7 @@ def sample_list_test_case_results(): page_result = client.list_test_case_results(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1250,12 +1297,20 @@ def sample_list_test_case_results(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListTestCaseResultsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1276,9 +1331,9 @@ async def get_test_case_result( from google.cloud import dialogflowcx_v3 - def sample_get_test_case_result(): + async def sample_get_test_case_result(): # Create a client - client = dialogflowcx_v3.TestCasesClient() + client = dialogflowcx_v3.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetTestCaseResultRequest( @@ -1286,7 +1341,7 @@ def sample_get_test_case_result(): ) # Make the request - response = client.get_test_case_result(request=request) + response = await client.get_test_case_result(request=request) # Handle the response print(response) @@ -1346,7 +1401,12 @@ def sample_get_test_case_result(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3/services/test_cases/client.py b/google/cloud/dialogflowcx_v3/services/test_cases/client.py index 6ce90f7c..cf4486f0 100644 --- a/google/cloud/dialogflowcx_v3/services/test_cases/client.py +++ b/google/cloud/dialogflowcx_v3/services/test_cases/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -58,7 +58,10 @@ class TestCasesClientMeta(type): _transport_registry["grpc"] = TestCasesGrpcTransport _transport_registry["grpc_asyncio"] = TestCasesGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[TestCasesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[TestCasesTransport]: """Returns an appropriate transport class. Args: @@ -166,10 +169,16 @@ def transport(self) -> TestCasesTransport: return self._transport @staticmethod - def agent_path(project: str, location: str, agent: str,) -> str: + def agent_path( + project: str, + location: str, + agent: str, + ) -> str: """Returns a fully-qualified agent string.""" return "projects/{project}/locations/{location}/agents/{agent}".format( - project=project, location=location, agent=agent, + project=project, + location=location, + agent=agent, ) @staticmethod @@ -183,11 +192,17 @@ def parse_agent_path(path: str) -> Dict[str, str]: @staticmethod def entity_type_path( - project: str, location: str, agent: str, entity_type: str, + project: str, + location: str, + agent: str, + entity_type: str, ) -> str: """Returns a fully-qualified entity_type string.""" return "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) @staticmethod @@ -201,11 +216,17 @@ def parse_entity_type_path(path: str) -> Dict[str, str]: @staticmethod def environment_path( - project: str, location: str, agent: str, environment: str, + project: str, + location: str, + agent: str, + environment: str, ) -> str: """Returns a fully-qualified environment string.""" return "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}".format( - project=project, location=location, agent=agent, environment=environment, + project=project, + location=location, + agent=agent, + environment=environment, ) @staticmethod @@ -218,10 +239,18 @@ def parse_environment_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def flow_path(project: str, location: str, agent: str, flow: str,) -> str: + def flow_path( + project: str, + location: str, + agent: str, + flow: str, + ) -> str: """Returns a fully-qualified flow string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) @staticmethod @@ -234,10 +263,18 @@ def parse_flow_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def intent_path(project: str, location: str, agent: str, intent: str,) -> str: + def intent_path( + project: str, + location: str, + agent: str, + intent: str, + ) -> str: """Returns a fully-qualified intent string.""" return "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) @staticmethod @@ -251,11 +288,19 @@ def parse_intent_path(path: str) -> Dict[str, str]: @staticmethod def page_path( - project: str, location: str, agent: str, flow: str, page: str, + project: str, + location: str, + agent: str, + flow: str, + page: str, ) -> str: """Returns a fully-qualified page string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) @staticmethod @@ -268,10 +313,18 @@ def parse_page_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def test_case_path(project: str, location: str, agent: str, test_case: str,) -> str: + def test_case_path( + project: str, + location: str, + agent: str, + test_case: str, + ) -> str: """Returns a fully-qualified test_case string.""" return "projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}".format( - project=project, location=location, agent=agent, test_case=test_case, + project=project, + location=location, + agent=agent, + test_case=test_case, ) @staticmethod @@ -285,7 +338,11 @@ def parse_test_case_path(path: str) -> Dict[str, str]: @staticmethod def test_case_result_path( - project: str, location: str, agent: str, test_case: str, result: str, + project: str, + location: str, + agent: str, + test_case: str, + result: str, ) -> str: """Returns a fully-qualified test_case_result string.""" return "projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}/results/{result}".format( @@ -307,7 +364,11 @@ def parse_test_case_result_path(path: str) -> Dict[str, str]: @staticmethod def transition_route_group_path( - project: str, location: str, agent: str, flow: str, transition_route_group: str, + project: str, + location: str, + agent: str, + flow: str, + transition_route_group: str, ) -> str: """Returns a fully-qualified transition_route_group string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}".format( @@ -328,10 +389,18 @@ def parse_transition_route_group_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def webhook_path(project: str, location: str, agent: str, webhook: str,) -> str: + def webhook_path( + project: str, + location: str, + agent: str, + webhook: str, + ) -> str: """Returns a fully-qualified webhook string.""" return "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) @staticmethod @@ -344,7 +413,9 @@ def parse_webhook_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -357,9 +428,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -368,9 +443,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -379,9 +458,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -390,10 +473,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -656,12 +743,20 @@ def sample_list_test_cases(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListTestCasesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -745,7 +840,10 @@ def sample_batch_delete_test_cases(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def get_test_case( @@ -831,7 +929,12 @@ def sample_get_test_case(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -931,7 +1034,12 @@ def sample_create_test_case(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1036,7 +1144,12 @@ def sample_update_test_case(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1061,7 +1174,6 @@ def run_test_case( - ``response``: [RunTestCaseResponse][google.cloud.dialogflow.cx.v3.RunTestCaseResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1124,7 +1236,12 @@ def sample_run_test_case(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1157,7 +1274,6 @@ def batch_run_test_cases( - ``response``: [BatchRunTestCasesResponse][google.cloud.dialogflow.cx.v3.BatchRunTestCasesResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1221,7 +1337,12 @@ def sample_batch_run_test_cases(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1299,7 +1420,12 @@ def sample_calculate_coverage(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1313,7 +1439,7 @@ def import_test_cases( metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Imports the test cases from a Cloud Storage bucket or a local - file. It always creates new test cases and won't overwite any + file. It always creates new test cases and won't overwrite any existing ones. The provided ID in the imported test case is neglected. @@ -1327,7 +1453,6 @@ def import_test_cases( - ``response``: [ImportTestCasesResponse][google.cloud.dialogflow.cx.v3.ImportTestCasesResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1391,7 +1516,12 @@ def sample_import_test_cases(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1426,7 +1556,6 @@ def export_test_cases( - ``response``: [ExportTestCasesResponse][google.cloud.dialogflow.cx.v3.ExportTestCasesResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1490,7 +1619,12 @@ def sample_export_test_cases(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1594,12 +1728,20 @@ def sample_list_test_case_results(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListTestCaseResultsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1690,7 +1832,12 @@ def sample_get_test_case_result(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3/services/test_cases/transports/base.py b/google/cloud/dialogflowcx_v3/services/test_cases/transports/base.py index 053445b2..bd818979 100644 --- a/google/cloud/dialogflowcx_v3/services/test_cases/transports/base.py +++ b/google/cloud/dialogflowcx_v3/services/test_cases/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -128,7 +129,9 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_test_cases: gapic_v1.method.wrap_method( - self.list_test_cases, default_timeout=None, client_info=client_info, + self.list_test_cases, + default_timeout=None, + client_info=client_info, ), self.batch_delete_test_cases: gapic_v1.method.wrap_method( self.batch_delete_test_cases, @@ -136,16 +139,24 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.get_test_case: gapic_v1.method.wrap_method( - self.get_test_case, default_timeout=None, client_info=client_info, + self.get_test_case, + default_timeout=None, + client_info=client_info, ), self.create_test_case: gapic_v1.method.wrap_method( - self.create_test_case, default_timeout=None, client_info=client_info, + self.create_test_case, + default_timeout=None, + client_info=client_info, ), self.update_test_case: gapic_v1.method.wrap_method( - self.update_test_case, default_timeout=None, client_info=client_info, + self.update_test_case, + default_timeout=None, + client_info=client_info, ), self.run_test_case: gapic_v1.method.wrap_method( - self.run_test_case, default_timeout=None, client_info=client_info, + self.run_test_case, + default_timeout=None, + client_info=client_info, ), self.batch_run_test_cases: gapic_v1.method.wrap_method( self.batch_run_test_cases, @@ -153,13 +164,19 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.calculate_coverage: gapic_v1.method.wrap_method( - self.calculate_coverage, default_timeout=None, client_info=client_info, + self.calculate_coverage, + default_timeout=None, + client_info=client_info, ), self.import_test_cases: gapic_v1.method.wrap_method( - self.import_test_cases, default_timeout=None, client_info=client_info, + self.import_test_cases, + default_timeout=None, + client_info=client_info, ), self.export_test_cases: gapic_v1.method.wrap_method( - self.export_test_cases, default_timeout=None, client_info=client_info, + self.export_test_cases, + default_timeout=None, + client_info=client_info, ), self.list_test_case_results: gapic_v1.method.wrap_method( self.list_test_case_results, @@ -176,9 +193,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -303,5 +320,9 @@ def get_test_case_result( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("TestCasesTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/test_cases/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/test_cases/transports/grpc.py index 01528be7..d5d75cc3 100644 --- a/google/cloud/dialogflowcx_v3/services/test_cases/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3/services/test_cases/transports/grpc.py @@ -231,8 +231,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -486,7 +485,7 @@ def import_test_cases( r"""Return a callable for the import test cases method over gRPC. Imports the test cases from a Cloud Storage bucket or a local - file. It always creates new test cases and won't overwite any + file. It always creates new test cases and won't overwrite any existing ones. The provided ID in the imported test case is neglected. @@ -613,5 +612,9 @@ def get_test_case_result( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("TestCasesGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/test_cases/transports/grpc_asyncio.py b/google/cloud/dialogflowcx_v3/services/test_cases/transports/grpc_asyncio.py index f9140728..cdab7b2c 100644 --- a/google/cloud/dialogflowcx_v3/services/test_cases/transports/grpc_asyncio.py +++ b/google/cloud/dialogflowcx_v3/services/test_cases/transports/grpc_asyncio.py @@ -501,7 +501,7 @@ def import_test_cases( r"""Return a callable for the import test cases method over gRPC. Imports the test cases from a Cloud Storage bucket or a local - file. It always creates new test cases and won't overwite any + file. It always creates new test cases and won't overwrite any existing ones. The provided ID in the imported test case is neglected. diff --git a/google/cloud/dialogflowcx_v3/services/transition_route_groups/async_client.py b/google/cloud/dialogflowcx_v3/services/transition_route_groups/async_client.py index 0a3bea91..c2c5df15 100644 --- a/google/cloud/dialogflowcx_v3/services/transition_route_groups/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/transition_route_groups/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -238,14 +238,13 @@ async def list_transition_route_groups( r"""Returns the list of all transition route groups in the specified flow. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_list_transition_route_groups(): + async def sample_list_transition_route_groups(): # Create a client - client = dialogflowcx_v3.TransitionRouteGroupsClient() + client = dialogflowcx_v3.TransitionRouteGroupsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListTransitionRouteGroupsRequest( @@ -256,7 +255,7 @@ def sample_list_transition_route_groups(): page_result = client.list_transition_route_groups(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -318,12 +317,20 @@ def sample_list_transition_route_groups(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListTransitionRouteGroupsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -343,14 +350,13 @@ async def get_transition_route_group( r"""Retrieves the specified [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_get_transition_route_group(): + async def sample_get_transition_route_group(): # Create a client - client = dialogflowcx_v3.TransitionRouteGroupsClient() + client = dialogflowcx_v3.TransitionRouteGroupsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetTransitionRouteGroupRequest( @@ -358,7 +364,7 @@ def sample_get_transition_route_group(): ) # Make the request - response = client.get_transition_route_group(request=request) + response = await client.get_transition_route_group(request=request) # Handle the response print(response) @@ -422,7 +428,12 @@ def sample_get_transition_route_group(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -447,14 +458,13 @@ async def create_transition_route_group( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_create_transition_route_group(): + async def sample_create_transition_route_group(): # Create a client - client = dialogflowcx_v3.TransitionRouteGroupsClient() + client = dialogflowcx_v3.TransitionRouteGroupsAsyncClient() # Initialize request argument(s) transition_route_group = dialogflowcx_v3.TransitionRouteGroup() @@ -466,7 +476,7 @@ def sample_create_transition_route_group(): ) # Make the request - response = client.create_transition_route_group(request=request) + response = await client.create_transition_route_group(request=request) # Handle the response print(response) @@ -539,7 +549,12 @@ def sample_create_transition_route_group(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -563,14 +578,13 @@ async def update_transition_route_group( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_update_transition_route_group(): + async def sample_update_transition_route_group(): # Create a client - client = dialogflowcx_v3.TransitionRouteGroupsClient() + client = dialogflowcx_v3.TransitionRouteGroupsAsyncClient() # Initialize request argument(s) transition_route_group = dialogflowcx_v3.TransitionRouteGroup() @@ -581,7 +595,7 @@ def sample_update_transition_route_group(): ) # Make the request - response = client.update_transition_route_group(request=request) + response = await client.update_transition_route_group(request=request) # Handle the response print(response) @@ -654,7 +668,12 @@ def sample_update_transition_route_group(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -677,14 +696,13 @@ async def delete_transition_route_group( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_delete_transition_route_group(): + async def sample_delete_transition_route_group(): # Create a client - client = dialogflowcx_v3.TransitionRouteGroupsClient() + client = dialogflowcx_v3.TransitionRouteGroupsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.DeleteTransitionRouteGroupRequest( @@ -692,7 +710,7 @@ def sample_delete_transition_route_group(): ) # Make the request - client.delete_transition_route_group(request=request) + await client.delete_transition_route_group(request=request) Args: request (Union[google.cloud.dialogflowcx_v3.types.DeleteTransitionRouteGroupRequest, dict]): @@ -746,7 +764,10 @@ def sample_delete_transition_route_group(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/dialogflowcx_v3/services/transition_route_groups/client.py b/google/cloud/dialogflowcx_v3/services/transition_route_groups/client.py index 0c8b2a5d..03c5d46d 100644 --- a/google/cloud/dialogflowcx_v3/services/transition_route_groups/client.py +++ b/google/cloud/dialogflowcx_v3/services/transition_route_groups/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -61,7 +61,8 @@ class TransitionRouteGroupsClientMeta(type): _transport_registry["grpc_asyncio"] = TransitionRouteGroupsGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[TransitionRouteGroupsTransport]: """Returns an appropriate transport class. @@ -169,10 +170,18 @@ def transport(self) -> TransitionRouteGroupsTransport: return self._transport @staticmethod - def flow_path(project: str, location: str, agent: str, flow: str,) -> str: + def flow_path( + project: str, + location: str, + agent: str, + flow: str, + ) -> str: """Returns a fully-qualified flow string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) @staticmethod @@ -185,10 +194,18 @@ def parse_flow_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def intent_path(project: str, location: str, agent: str, intent: str,) -> str: + def intent_path( + project: str, + location: str, + agent: str, + intent: str, + ) -> str: """Returns a fully-qualified intent string.""" return "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) @staticmethod @@ -202,11 +219,19 @@ def parse_intent_path(path: str) -> Dict[str, str]: @staticmethod def page_path( - project: str, location: str, agent: str, flow: str, page: str, + project: str, + location: str, + agent: str, + flow: str, + page: str, ) -> str: """Returns a fully-qualified page string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) @staticmethod @@ -220,7 +245,11 @@ def parse_page_path(path: str) -> Dict[str, str]: @staticmethod def transition_route_group_path( - project: str, location: str, agent: str, flow: str, transition_route_group: str, + project: str, + location: str, + agent: str, + flow: str, + transition_route_group: str, ) -> str: """Returns a fully-qualified transition_route_group string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}".format( @@ -241,10 +270,18 @@ def parse_transition_route_group_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def webhook_path(project: str, location: str, agent: str, webhook: str,) -> str: + def webhook_path( + project: str, + location: str, + agent: str, + webhook: str, + ) -> str: """Returns a fully-qualified webhook string.""" return "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) @staticmethod @@ -257,7 +294,9 @@ def parse_webhook_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -270,9 +309,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -281,9 +324,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -292,9 +339,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -303,10 +354,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -494,7 +549,6 @@ def list_transition_route_groups( r"""Returns the list of all transition route groups in the specified flow. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -578,12 +632,20 @@ def sample_list_transition_route_groups(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListTransitionRouteGroupsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -603,7 +665,6 @@ def get_transition_route_group( r"""Retrieves the specified [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -686,7 +747,12 @@ def sample_get_transition_route_group(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -711,7 +777,6 @@ def create_transition_route_group( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -809,7 +874,12 @@ def sample_create_transition_route_group(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -833,7 +903,6 @@ def update_transition_route_group( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -930,7 +999,12 @@ def sample_update_transition_route_group(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -953,7 +1027,6 @@ def delete_transition_route_group( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1026,7 +1099,10 @@ def sample_delete_transition_route_group(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/dialogflowcx_v3/services/transition_route_groups/transports/base.py b/google/cloud/dialogflowcx_v3/services/transition_route_groups/transports/base.py index 34194e1f..99a88781 100644 --- a/google/cloud/dialogflowcx_v3/services/transition_route_groups/transports/base.py +++ b/google/cloud/dialogflowcx_v3/services/transition_route_groups/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -157,9 +158,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -220,5 +221,9 @@ def delete_transition_route_group( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("TransitionRouteGroupsTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/transition_route_groups/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/transition_route_groups/transports/grpc.py index 8e257254..a14e96f1 100644 --- a/google/cloud/dialogflowcx_v3/services/transition_route_groups/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3/services/transition_route_groups/transports/grpc.py @@ -229,8 +229,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -404,5 +403,9 @@ def delete_transition_route_group( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("TransitionRouteGroupsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/versions/async_client.py b/google/cloud/dialogflowcx_v3/services/versions/async_client.py index d18cbb02..bfa3c226 100644 --- a/google/cloud/dialogflowcx_v3/services/versions/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/versions/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -216,14 +216,13 @@ async def list_versions( r"""Returns the list of all versions in the specified [Flow][google.cloud.dialogflow.cx.v3.Flow]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_list_versions(): + async def sample_list_versions(): # Create a client - client = dialogflowcx_v3.VersionsClient() + client = dialogflowcx_v3.VersionsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListVersionsRequest( @@ -234,7 +233,7 @@ def sample_list_versions(): page_result = client.list_versions(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -296,12 +295,20 @@ def sample_list_versions(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListVersionsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -319,14 +326,13 @@ async def get_version( r"""Retrieves the specified [Version][google.cloud.dialogflow.cx.v3.Version]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_get_version(): + async def sample_get_version(): # Create a client - client = dialogflowcx_v3.VersionsClient() + client = dialogflowcx_v3.VersionsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetVersionRequest( @@ -334,7 +340,7 @@ def sample_get_version(): ) # Make the request - response = client.get_version(request=request) + response = await client.get_version(request=request) # Handle the response print(response) @@ -394,7 +400,12 @@ def sample_get_version(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -422,14 +433,13 @@ async def create_version( - ``response``: [Version][google.cloud.dialogflow.cx.v3.Version] - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_create_version(): + async def sample_create_version(): # Create a client - client = dialogflowcx_v3.VersionsClient() + client = dialogflowcx_v3.VersionsAsyncClient() # Initialize request argument(s) version = dialogflowcx_v3.Version() @@ -445,7 +455,7 @@ def sample_create_version(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -518,7 +528,12 @@ def sample_create_version(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -544,14 +559,13 @@ async def update_version( r"""Updates the specified [Version][google.cloud.dialogflow.cx.v3.Version]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_update_version(): + async def sample_update_version(): # Create a client - client = dialogflowcx_v3.VersionsClient() + client = dialogflowcx_v3.VersionsAsyncClient() # Initialize request argument(s) version = dialogflowcx_v3.Version() @@ -562,7 +576,7 @@ def sample_update_version(): ) # Make the request - response = client.update_version(request=request) + response = await client.update_version(request=request) # Handle the response print(response) @@ -630,7 +644,12 @@ def sample_update_version(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -647,14 +666,13 @@ async def delete_version( r"""Deletes the specified [Version][google.cloud.dialogflow.cx.v3.Version]. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_delete_version(): + async def sample_delete_version(): # Create a client - client = dialogflowcx_v3.VersionsClient() + client = dialogflowcx_v3.VersionsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.DeleteVersionRequest( @@ -662,7 +680,7 @@ def sample_delete_version(): ) # Make the request - client.delete_version(request=request) + await client.delete_version(request=request) Args: request (Union[google.cloud.dialogflowcx_v3.types.DeleteVersionRequest, dict]): @@ -716,7 +734,10 @@ def sample_delete_version(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def load_version( @@ -740,14 +761,13 @@ async def load_version( - ``response``: An `Empty message `__ - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_load_version(): + async def sample_load_version(): # Create a client - client = dialogflowcx_v3.VersionsClient() + client = dialogflowcx_v3.VersionsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.LoadVersionRequest( @@ -759,7 +779,7 @@ def sample_load_version(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -834,7 +854,12 @@ def sample_load_version(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -859,14 +884,13 @@ async def compare_versions( r"""Compares the specified base version with target version. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_compare_versions(): + async def sample_compare_versions(): # Create a client - client = dialogflowcx_v3.VersionsClient() + client = dialogflowcx_v3.VersionsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.CompareVersionsRequest( @@ -875,7 +899,7 @@ def sample_compare_versions(): ) # Make the request - response = client.compare_versions(request=request) + response = await client.compare_versions(request=request) # Handle the response print(response) @@ -941,7 +965,12 @@ def sample_compare_versions(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3/services/versions/client.py b/google/cloud/dialogflowcx_v3/services/versions/client.py index fca7c7f2..5127af54 100644 --- a/google/cloud/dialogflowcx_v3/services/versions/client.py +++ b/google/cloud/dialogflowcx_v3/services/versions/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -61,7 +61,10 @@ class VersionsClientMeta(type): _transport_registry["grpc"] = VersionsGrpcTransport _transport_registry["grpc_asyncio"] = VersionsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[VersionsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[VersionsTransport]: """Returns an appropriate transport class. Args: @@ -169,11 +172,19 @@ def transport(self) -> VersionsTransport: @staticmethod def version_path( - project: str, location: str, agent: str, flow: str, version: str, + project: str, + location: str, + agent: str, + flow: str, + version: str, ) -> str: """Returns a fully-qualified version string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) @staticmethod @@ -186,7 +197,9 @@ def parse_version_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -199,9 +212,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -210,9 +227,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -221,9 +242,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -232,10 +257,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -421,7 +450,6 @@ def list_versions( r"""Returns the list of all versions in the specified [Flow][google.cloud.dialogflow.cx.v3.Flow]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -501,12 +529,20 @@ def sample_list_versions(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListVersionsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -524,7 +560,6 @@ def get_version( r"""Retrieves the specified [Version][google.cloud.dialogflow.cx.v3.Version]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -599,7 +634,12 @@ def sample_get_version(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -627,7 +667,6 @@ def create_version( - ``response``: [Version][google.cloud.dialogflow.cx.v3.Version] - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -723,7 +762,12 @@ def sample_create_version(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -749,7 +793,6 @@ def update_version( r"""Updates the specified [Version][google.cloud.dialogflow.cx.v3.Version]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -835,7 +878,12 @@ def sample_update_version(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -852,7 +900,6 @@ def delete_version( r"""Deletes the specified [Version][google.cloud.dialogflow.cx.v3.Version]. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -921,7 +968,10 @@ def sample_delete_version(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def load_version( @@ -945,7 +995,6 @@ def load_version( - ``response``: An `Empty message `__ - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1039,7 +1088,12 @@ def sample_load_version(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1064,7 +1118,6 @@ def compare_versions( r"""Compares the specified base version with target version. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -1146,7 +1199,12 @@ def sample_compare_versions(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3/services/versions/transports/base.py b/google/cloud/dialogflowcx_v3/services/versions/transports/base.py index 8fd450c4..3c328bcf 100644 --- a/google/cloud/dialogflowcx_v3/services/versions/transports/base.py +++ b/google/cloud/dialogflowcx_v3/services/versions/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -128,34 +129,48 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_versions: gapic_v1.method.wrap_method( - self.list_versions, default_timeout=None, client_info=client_info, + self.list_versions, + default_timeout=None, + client_info=client_info, ), self.get_version: gapic_v1.method.wrap_method( - self.get_version, default_timeout=None, client_info=client_info, + self.get_version, + default_timeout=None, + client_info=client_info, ), self.create_version: gapic_v1.method.wrap_method( - self.create_version, default_timeout=None, client_info=client_info, + self.create_version, + default_timeout=None, + client_info=client_info, ), self.update_version: gapic_v1.method.wrap_method( - self.update_version, default_timeout=None, client_info=client_info, + self.update_version, + default_timeout=None, + client_info=client_info, ), self.delete_version: gapic_v1.method.wrap_method( - self.delete_version, default_timeout=None, client_info=client_info, + self.delete_version, + default_timeout=None, + client_info=client_info, ), self.load_version: gapic_v1.method.wrap_method( - self.load_version, default_timeout=None, client_info=client_info, + self.load_version, + default_timeout=None, + client_info=client_info, ), self.compare_versions: gapic_v1.method.wrap_method( - self.compare_versions, default_timeout=None, client_info=client_info, + self.compare_versions, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -228,5 +243,9 @@ def compare_versions( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("VersionsTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/versions/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/versions/transports/grpc.py index 4b331d7f..0c776d36 100644 --- a/google/cloud/dialogflowcx_v3/services/versions/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3/services/versions/transports/grpc.py @@ -230,8 +230,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -457,5 +456,9 @@ def compare_versions( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("VersionsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/webhooks/async_client.py b/google/cloud/dialogflowcx_v3/services/webhooks/async_client.py index 3f4fc97b..10c5d5a4 100644 --- a/google/cloud/dialogflowcx_v3/services/webhooks/async_client.py +++ b/google/cloud/dialogflowcx_v3/services/webhooks/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -213,14 +213,13 @@ async def list_webhooks( r"""Returns the list of all webhooks in the specified agent. - .. code-block:: python from google.cloud import dialogflowcx_v3 - def sample_list_webhooks(): + async def sample_list_webhooks(): # Create a client - client = dialogflowcx_v3.WebhooksClient() + client = dialogflowcx_v3.WebhooksAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.ListWebhooksRequest( @@ -231,7 +230,7 @@ def sample_list_webhooks(): page_result = client.list_webhooks(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -292,12 +291,20 @@ def sample_list_webhooks(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListWebhooksAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -318,9 +325,9 @@ async def get_webhook( from google.cloud import dialogflowcx_v3 - def sample_get_webhook(): + async def sample_get_webhook(): # Create a client - client = dialogflowcx_v3.WebhooksClient() + client = dialogflowcx_v3.WebhooksAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.GetWebhookRequest( @@ -328,7 +335,7 @@ def sample_get_webhook(): ) # Make the request - response = client.get_webhook(request=request) + response = await client.get_webhook(request=request) # Handle the response print(response) @@ -393,7 +400,12 @@ def sample_get_webhook(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -414,9 +426,9 @@ async def create_webhook( from google.cloud import dialogflowcx_v3 - def sample_create_webhook(): + async def sample_create_webhook(): # Create a client - client = dialogflowcx_v3.WebhooksClient() + client = dialogflowcx_v3.WebhooksAsyncClient() # Initialize request argument(s) webhook = dialogflowcx_v3.Webhook() @@ -429,7 +441,7 @@ def sample_create_webhook(): ) # Make the request - response = client.create_webhook(request=request) + response = await client.create_webhook(request=request) # Handle the response print(response) @@ -501,7 +513,12 @@ def sample_create_webhook(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -522,9 +539,9 @@ async def update_webhook( from google.cloud import dialogflowcx_v3 - def sample_update_webhook(): + async def sample_update_webhook(): # Create a client - client = dialogflowcx_v3.WebhooksClient() + client = dialogflowcx_v3.WebhooksAsyncClient() # Initialize request argument(s) webhook = dialogflowcx_v3.Webhook() @@ -536,7 +553,7 @@ def sample_update_webhook(): ) # Make the request - response = client.update_webhook(request=request) + response = await client.update_webhook(request=request) # Handle the response print(response) @@ -611,7 +628,12 @@ def sample_update_webhook(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -631,9 +653,9 @@ async def delete_webhook( from google.cloud import dialogflowcx_v3 - def sample_delete_webhook(): + async def sample_delete_webhook(): # Create a client - client = dialogflowcx_v3.WebhooksClient() + client = dialogflowcx_v3.WebhooksAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3.DeleteWebhookRequest( @@ -641,7 +663,7 @@ def sample_delete_webhook(): ) # Make the request - client.delete_webhook(request=request) + await client.delete_webhook(request=request) Args: request (Union[google.cloud.dialogflowcx_v3.types.DeleteWebhookRequest, dict]): @@ -693,7 +715,10 @@ def sample_delete_webhook(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/dialogflowcx_v3/services/webhooks/client.py b/google/cloud/dialogflowcx_v3/services/webhooks/client.py index 4538b75d..14399a55 100644 --- a/google/cloud/dialogflowcx_v3/services/webhooks/client.py +++ b/google/cloud/dialogflowcx_v3/services/webhooks/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -56,7 +56,10 @@ class WebhooksClientMeta(type): _transport_registry["grpc"] = WebhooksGrpcTransport _transport_registry["grpc_asyncio"] = WebhooksGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[WebhooksTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[WebhooksTransport]: """Returns an appropriate transport class. Args: @@ -163,10 +166,18 @@ def transport(self) -> WebhooksTransport: return self._transport @staticmethod - def service_path(project: str, location: str, namespace: str, service: str,) -> str: + def service_path( + project: str, + location: str, + namespace: str, + service: str, + ) -> str: """Returns a fully-qualified service string.""" return "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}".format( - project=project, location=location, namespace=namespace, service=service, + project=project, + location=location, + namespace=namespace, + service=service, ) @staticmethod @@ -179,10 +190,18 @@ def parse_service_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def webhook_path(project: str, location: str, agent: str, webhook: str,) -> str: + def webhook_path( + project: str, + location: str, + agent: str, + webhook: str, + ) -> str: """Returns a fully-qualified webhook string.""" return "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) @staticmethod @@ -195,7 +214,9 @@ def parse_webhook_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -208,9 +229,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -219,9 +244,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -230,9 +259,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -241,10 +274,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -430,7 +467,6 @@ def list_webhooks( r"""Returns the list of all webhooks in the specified agent. - .. code-block:: python from google.cloud import dialogflowcx_v3 @@ -509,12 +545,20 @@ def sample_list_webhooks(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListWebhooksPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -610,7 +654,12 @@ def sample_get_webhook(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -718,7 +767,12 @@ def sample_create_webhook(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -828,7 +882,12 @@ def sample_update_webhook(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -910,7 +969,10 @@ def sample_delete_webhook(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/dialogflowcx_v3/services/webhooks/transports/base.py b/google/cloud/dialogflowcx_v3/services/webhooks/transports/base.py index 85b7f7a6..d8e94fbf 100644 --- a/google/cloud/dialogflowcx_v3/services/webhooks/transports/base.py +++ b/google/cloud/dialogflowcx_v3/services/webhooks/transports/base.py @@ -85,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -126,28 +127,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_webhooks: gapic_v1.method.wrap_method( - self.list_webhooks, default_timeout=None, client_info=client_info, + self.list_webhooks, + default_timeout=None, + client_info=client_info, ), self.get_webhook: gapic_v1.method.wrap_method( - self.get_webhook, default_timeout=None, client_info=client_info, + self.get_webhook, + default_timeout=None, + client_info=client_info, ), self.create_webhook: gapic_v1.method.wrap_method( - self.create_webhook, default_timeout=None, client_info=client_info, + self.create_webhook, + default_timeout=None, + client_info=client_info, ), self.update_webhook: gapic_v1.method.wrap_method( - self.update_webhook, default_timeout=None, client_info=client_info, + self.update_webhook, + default_timeout=None, + client_info=client_info, ), self.delete_webhook: gapic_v1.method.wrap_method( - self.delete_webhook, default_timeout=None, client_info=client_info, + self.delete_webhook, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -195,5 +206,9 @@ def delete_webhook( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("WebhooksTransport",) diff --git a/google/cloud/dialogflowcx_v3/services/webhooks/transports/grpc.py b/google/cloud/dialogflowcx_v3/services/webhooks/transports/grpc.py index cec5b3e0..c2ebca3e 100644 --- a/google/cloud/dialogflowcx_v3/services/webhooks/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3/services/webhooks/transports/grpc.py @@ -227,8 +227,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -363,5 +362,9 @@ def delete_webhook( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("WebhooksGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3/types/__init__.py b/google/cloud/dialogflowcx_v3/types/__init__.py index f5baa497..fe4a75ea 100644 --- a/google/cloud/dialogflowcx_v3/types/__init__.py +++ b/google/cloud/dialogflowcx_v3/types/__init__.py @@ -13,7 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .advanced_settings import AdvancedSettings +from .advanced_settings import ( + AdvancedSettings, +) from .agent import ( Agent, AgentValidationResult, @@ -115,7 +117,9 @@ UpdateFlowRequest, ValidateFlowRequest, ) -from .fulfillment import Fulfillment +from .fulfillment import ( + Fulfillment, +) from .intent import ( CreateIntentRequest, DeleteIntentRequest, @@ -138,7 +142,9 @@ TransitionRoute, UpdatePageRequest, ) -from .response_message import ResponseMessage +from .response_message import ( + ResponseMessage, +) from .security_settings import ( CreateSecuritySettingsRequest, DeleteSecuritySettingsRequest, diff --git a/google/cloud/dialogflowcx_v3/types/advanced_settings.py b/google/cloud/dialogflowcx_v3/types/advanced_settings.py index c5f8ece2..f7a17a38 100644 --- a/google/cloud/dialogflowcx_v3/types/advanced_settings.py +++ b/google/cloud/dialogflowcx_v3/types/advanced_settings.py @@ -17,7 +17,10 @@ __protobuf__ = proto.module( - package="google.cloud.dialogflow.cx.v3", manifest={"AdvancedSettings",}, + package="google.cloud.dialogflow.cx.v3", + manifest={ + "AdvancedSettings", + }, ) @@ -49,10 +52,20 @@ class LoggingSettings(proto.Message): enabled. """ - enable_stackdriver_logging = proto.Field(proto.BOOL, number=2,) - enable_interaction_logging = proto.Field(proto.BOOL, number=3,) + enable_stackdriver_logging = proto.Field( + proto.BOOL, + number=2, + ) + enable_interaction_logging = proto.Field( + proto.BOOL, + number=3, + ) - logging_settings = proto.Field(proto.MESSAGE, number=6, message=LoggingSettings,) + logging_settings = proto.Field( + proto.MESSAGE, + number=6, + message=LoggingSettings, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3/types/agent.py b/google/cloud/dialogflowcx_v3/types/agent.py index 5d709fd6..65f9dfc2 100644 --- a/google/cloud/dialogflowcx_v3/types/agent.py +++ b/google/cloud/dialogflowcx_v3/types/agent.py @@ -52,7 +52,10 @@ class SpeechToTextSettings(proto.Message): recognition. """ - enable_speech_adaptation = proto.Field(proto.BOOL, number=1,) + enable_speech_adaptation = proto.Field( + proto.BOOL, + number=1, + ) class Agent(proto.Message): @@ -125,6 +128,10 @@ class Agent(proto.Message): enable_spell_correction (bool): Indicates if automatic spell correction is enabled in detect intent requests. + locked (bool): + Indiciates whether the agent is locked for changes. If the + agent is locked, modifications to the agent will be rejected + except for [RestoreAgent][]. advanced_settings (google.cloud.dialogflowcx_v3.types.AdvancedSettings): Hierarchical advanced settings for this agent. The settings exposed at the lower level @@ -132,22 +139,63 @@ class Agent(proto.Message): level. """ - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - default_language_code = proto.Field(proto.STRING, number=3,) - supported_language_codes = proto.RepeatedField(proto.STRING, number=4,) - time_zone = proto.Field(proto.STRING, number=5,) - description = proto.Field(proto.STRING, number=6,) - avatar_uri = proto.Field(proto.STRING, number=7,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + default_language_code = proto.Field( + proto.STRING, + number=3, + ) + supported_language_codes = proto.RepeatedField( + proto.STRING, + number=4, + ) + time_zone = proto.Field( + proto.STRING, + number=5, + ) + description = proto.Field( + proto.STRING, + number=6, + ) + avatar_uri = proto.Field( + proto.STRING, + number=7, + ) speech_to_text_settings = proto.Field( - proto.MESSAGE, number=13, message="SpeechToTextSettings", + proto.MESSAGE, + number=13, + message="SpeechToTextSettings", + ) + start_flow = proto.Field( + proto.STRING, + number=16, + ) + security_settings = proto.Field( + proto.STRING, + number=17, + ) + enable_stackdriver_logging = proto.Field( + proto.BOOL, + number=18, + ) + enable_spell_correction = proto.Field( + proto.BOOL, + number=20, + ) + locked = proto.Field( + proto.BOOL, + number=27, ) - start_flow = proto.Field(proto.STRING, number=16,) - security_settings = proto.Field(proto.STRING, number=17,) - enable_stackdriver_logging = proto.Field(proto.BOOL, number=18,) - enable_spell_correction = proto.Field(proto.BOOL, number=20,) advanced_settings = proto.Field( - proto.MESSAGE, number=22, message=gcdc_advanced_settings.AdvancedSettings, + proto.MESSAGE, + number=22, + message=gcdc_advanced_settings.AdvancedSettings, ) @@ -167,9 +215,18 @@ class ListAgentsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListAgentsResponse(proto.Message): @@ -190,8 +247,15 @@ class ListAgentsResponse(proto.Message): def raw_page(self): return self - agents = proto.RepeatedField(proto.MESSAGE, number=1, message="Agent",) - next_page_token = proto.Field(proto.STRING, number=2,) + agents = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Agent", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetAgentRequest(proto.Message): @@ -204,7 +268,10 @@ class GetAgentRequest(proto.Message): ``projects//locations//agents/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateAgentRequest(proto.Message): @@ -219,8 +286,15 @@ class CreateAgentRequest(proto.Message): Required. The agent to create. """ - parent = proto.Field(proto.STRING, number=1,) - agent = proto.Field(proto.MESSAGE, number=2, message="Agent",) + parent = proto.Field( + proto.STRING, + number=1, + ) + agent = proto.Field( + proto.MESSAGE, + number=2, + message="Agent", + ) class UpdateAgentRequest(proto.Message): @@ -236,9 +310,15 @@ class UpdateAgentRequest(proto.Message): updated. """ - agent = proto.Field(proto.MESSAGE, number=1, message="Agent",) + agent = proto.Field( + proto.MESSAGE, + number=1, + message="Agent", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -252,7 +332,10 @@ class DeleteAgentRequest(proto.Message): ``projects//locations//agents/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ExportAgentRequest(proto.Message): @@ -275,15 +358,37 @@ class ExportAgentRequest(proto.Message): authentication must have write permissions for the object. For more information, see `Dialogflow access control `__. + data_format (google.cloud.dialogflowcx_v3.types.ExportAgentRequest.DataFormat): + Optional. The data format of the exported agent. If not + specified, ``BLOB`` is assumed. environment (str): Optional. Environment name. If not set, draft environment is assumed. Format: ``projects//locations//agents//environments/``. """ - name = proto.Field(proto.STRING, number=1,) - agent_uri = proto.Field(proto.STRING, number=2,) - environment = proto.Field(proto.STRING, number=5,) + class DataFormat(proto.Enum): + r"""Data format of the exported agent.""" + DATA_FORMAT_UNSPECIFIED = 0 + BLOB = 1 + + name = proto.Field( + proto.STRING, + number=1, + ) + agent_uri = proto.Field( + proto.STRING, + number=2, + ) + data_format = proto.Field( + proto.ENUM, + number=3, + enum=DataFormat, + ) + environment = proto.Field( + proto.STRING, + number=5, + ) class ExportAgentResponse(proto.Message): @@ -310,8 +415,16 @@ class ExportAgentResponse(proto.Message): This field is a member of `oneof`_ ``agent``. """ - agent_uri = proto.Field(proto.STRING, number=1, oneof="agent",) - agent_content = proto.Field(proto.BYTES, number=2, oneof="agent",) + agent_uri = proto.Field( + proto.STRING, + number=1, + oneof="agent", + ) + agent_content = proto.Field( + proto.BYTES, + number=2, + oneof="agent", + ) class RestoreAgentRequest(proto.Message): @@ -356,10 +469,25 @@ class RestoreOption(proto.Enum): KEEP = 1 FALLBACK = 2 - name = proto.Field(proto.STRING, number=1,) - agent_uri = proto.Field(proto.STRING, number=2, oneof="agent",) - agent_content = proto.Field(proto.BYTES, number=3, oneof="agent",) - restore_option = proto.Field(proto.ENUM, number=5, enum=RestoreOption,) + name = proto.Field( + proto.STRING, + number=1, + ) + agent_uri = proto.Field( + proto.STRING, + number=2, + oneof="agent", + ) + agent_content = proto.Field( + proto.BYTES, + number=3, + oneof="agent", + ) + restore_option = proto.Field( + proto.ENUM, + number=5, + enum=RestoreOption, + ) class ValidateAgentRequest(proto.Message): @@ -375,8 +503,14 @@ class ValidateAgentRequest(proto.Message): language is used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class GetAgentValidationResultRequest(proto.Message): @@ -392,8 +526,14 @@ class GetAgentValidationResultRequest(proto.Message): language is used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class AgentValidationResult(proto.Message): @@ -409,9 +549,14 @@ class AgentValidationResult(proto.Message): Contains all flow validation results. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) flow_validation_results = proto.RepeatedField( - proto.MESSAGE, number=2, message=flow.FlowValidationResult, + proto.MESSAGE, + number=2, + message=flow.FlowValidationResult, ) diff --git a/google/cloud/dialogflowcx_v3/types/audio_config.py b/google/cloud/dialogflowcx_v3/types/audio_config.py index b80a0788..0963e098 100644 --- a/google/cloud/dialogflowcx_v3/types/audio_config.py +++ b/google/cloud/dialogflowcx_v3/types/audio_config.py @@ -116,10 +116,24 @@ class SpeechWordInfo(proto.Message): also not rely on it to always be provided. """ - word = proto.Field(proto.STRING, number=3,) - start_offset = proto.Field(proto.MESSAGE, number=1, message=duration_pb2.Duration,) - end_offset = proto.Field(proto.MESSAGE, number=2, message=duration_pb2.Duration,) - confidence = proto.Field(proto.FLOAT, number=4,) + word = proto.Field( + proto.STRING, + number=3, + ) + start_offset = proto.Field( + proto.MESSAGE, + number=1, + message=duration_pb2.Duration, + ) + end_offset = proto.Field( + proto.MESSAGE, + number=2, + message=duration_pb2.Duration, + ) + confidence = proto.Field( + proto.FLOAT, + number=4, + ) class InputAudioConfig(proto.Message): @@ -178,13 +192,36 @@ class InputAudioConfig(proto.Message): is relevant only for streaming methods. """ - audio_encoding = proto.Field(proto.ENUM, number=1, enum="AudioEncoding",) - sample_rate_hertz = proto.Field(proto.INT32, number=2,) - enable_word_info = proto.Field(proto.BOOL, number=13,) - phrase_hints = proto.RepeatedField(proto.STRING, number=4,) - model = proto.Field(proto.STRING, number=7,) - model_variant = proto.Field(proto.ENUM, number=10, enum="SpeechModelVariant",) - single_utterance = proto.Field(proto.BOOL, number=8,) + audio_encoding = proto.Field( + proto.ENUM, + number=1, + enum="AudioEncoding", + ) + sample_rate_hertz = proto.Field( + proto.INT32, + number=2, + ) + enable_word_info = proto.Field( + proto.BOOL, + number=13, + ) + phrase_hints = proto.RepeatedField( + proto.STRING, + number=4, + ) + model = proto.Field( + proto.STRING, + number=7, + ) + model_variant = proto.Field( + proto.ENUM, + number=10, + enum="SpeechModelVariant", + ) + single_utterance = proto.Field( + proto.BOOL, + number=8, + ) class VoiceSelectionParams(proto.Message): @@ -211,8 +248,15 @@ class VoiceSelectionParams(proto.Message): rather than failing the request. """ - name = proto.Field(proto.STRING, number=1,) - ssml_gender = proto.Field(proto.ENUM, number=2, enum="SsmlVoiceGender",) + name = proto.Field( + proto.STRING, + number=1, + ) + ssml_gender = proto.Field( + proto.ENUM, + number=2, + enum="SsmlVoiceGender", + ) class SynthesizeSpeechConfig(proto.Message): @@ -251,11 +295,27 @@ class SynthesizeSpeechConfig(proto.Message): synthesized audio. """ - speaking_rate = proto.Field(proto.DOUBLE, number=1,) - pitch = proto.Field(proto.DOUBLE, number=2,) - volume_gain_db = proto.Field(proto.DOUBLE, number=3,) - effects_profile_id = proto.RepeatedField(proto.STRING, number=5,) - voice = proto.Field(proto.MESSAGE, number=4, message="VoiceSelectionParams",) + speaking_rate = proto.Field( + proto.DOUBLE, + number=1, + ) + pitch = proto.Field( + proto.DOUBLE, + number=2, + ) + volume_gain_db = proto.Field( + proto.DOUBLE, + number=3, + ) + effects_profile_id = proto.RepeatedField( + proto.STRING, + number=5, + ) + voice = proto.Field( + proto.MESSAGE, + number=4, + message="VoiceSelectionParams", + ) class OutputAudioConfig(proto.Message): @@ -280,10 +340,19 @@ class OutputAudioConfig(proto.Message): be synthesized. """ - audio_encoding = proto.Field(proto.ENUM, number=1, enum="OutputAudioEncoding",) - sample_rate_hertz = proto.Field(proto.INT32, number=2,) + audio_encoding = proto.Field( + proto.ENUM, + number=1, + enum="OutputAudioEncoding", + ) + sample_rate_hertz = proto.Field( + proto.INT32, + number=2, + ) synthesize_speech_config = proto.Field( - proto.MESSAGE, number=3, message="SynthesizeSpeechConfig", + proto.MESSAGE, + number=3, + message="SynthesizeSpeechConfig", ) diff --git a/google/cloud/dialogflowcx_v3/types/changelog.py b/google/cloud/dialogflowcx_v3/types/changelog.py index cc7325bc..deaad346 100644 --- a/google/cloud/dialogflowcx_v3/types/changelog.py +++ b/google/cloud/dialogflowcx_v3/types/changelog.py @@ -63,10 +63,22 @@ class ListChangelogsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - filter = proto.Field(proto.STRING, number=2,) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + filter = proto.Field( + proto.STRING, + number=2, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class ListChangelogsResponse(proto.Message): @@ -88,8 +100,15 @@ class ListChangelogsResponse(proto.Message): def raw_page(self): return self - changelogs = proto.RepeatedField(proto.MESSAGE, number=1, message="Changelog",) - next_page_token = proto.Field(proto.STRING, number=2,) + changelogs = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Changelog", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetChangelogRequest(proto.Message): @@ -102,7 +121,10 @@ class GetChangelogRequest(proto.Message): ``projects//locations//agents//changelogs/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class Changelog(proto.Message): @@ -127,13 +149,35 @@ class Changelog(proto.Message): The timestamp of the change. """ - name = proto.Field(proto.STRING, number=1,) - user_email = proto.Field(proto.STRING, number=2,) - display_name = proto.Field(proto.STRING, number=7,) - action = proto.Field(proto.STRING, number=11,) - type_ = proto.Field(proto.STRING, number=8,) - resource = proto.Field(proto.STRING, number=3,) - create_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + user_email = proto.Field( + proto.STRING, + number=2, + ) + display_name = proto.Field( + proto.STRING, + number=7, + ) + action = proto.Field( + proto.STRING, + number=11, + ) + type_ = proto.Field( + proto.STRING, + number=8, + ) + resource = proto.Field( + proto.STRING, + number=3, + ) + create_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3/types/deployment.py b/google/cloud/dialogflowcx_v3/types/deployment.py index 61b38bdf..e0f75374 100644 --- a/google/cloud/dialogflowcx_v3/types/deployment.py +++ b/google/cloud/dialogflowcx_v3/types/deployment.py @@ -80,15 +80,43 @@ class Result(proto.Message): ID>/experiments/. """ - deployment_test_results = proto.RepeatedField(proto.STRING, number=1,) - experiment = proto.Field(proto.STRING, number=2,) - - name = proto.Field(proto.STRING, number=1,) - flow_version = proto.Field(proto.STRING, number=2,) - state = proto.Field(proto.ENUM, number=3, enum=State,) - result = proto.Field(proto.MESSAGE, number=4, message=Result,) - start_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) + deployment_test_results = proto.RepeatedField( + proto.STRING, + number=1, + ) + experiment = proto.Field( + proto.STRING, + number=2, + ) + + name = proto.Field( + proto.STRING, + number=1, + ) + flow_version = proto.Field( + proto.STRING, + number=2, + ) + state = proto.Field( + proto.ENUM, + number=3, + enum=State, + ) + result = proto.Field( + proto.MESSAGE, + number=4, + message=Result, + ) + start_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) class ListDeploymentsRequest(proto.Message): @@ -109,9 +137,18 @@ class ListDeploymentsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListDeploymentsResponse(proto.Message): @@ -134,8 +171,15 @@ class ListDeploymentsResponse(proto.Message): def raw_page(self): return self - deployments = proto.RepeatedField(proto.MESSAGE, number=1, message="Deployment",) - next_page_token = proto.Field(proto.STRING, number=2,) + deployments = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Deployment", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetDeploymentRequest(proto.Message): @@ -150,7 +194,10 @@ class GetDeploymentRequest(proto.Message): ``projects//locations//agents//environments//deployments/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3/types/entity_type.py b/google/cloud/dialogflowcx_v3/types/entity_type.py index ae91a7bf..b9c0cfc4 100644 --- a/google/cloud/dialogflowcx_v3/types/entity_type.py +++ b/google/cloud/dialogflowcx_v3/types/entity_type.py @@ -144,8 +144,14 @@ class Entity(proto.Message): ``value``. """ - value = proto.Field(proto.STRING, number=1,) - synonyms = proto.RepeatedField(proto.STRING, number=2,) + value = proto.Field( + proto.STRING, + number=1, + ) + synonyms = proto.RepeatedField( + proto.STRING, + number=2, + ) class ExcludedPhrase(proto.Message): r"""An excluded entity phrase that should not be matched. @@ -155,18 +161,47 @@ class ExcludedPhrase(proto.Message): Required. The word or phrase to be excluded. """ - value = proto.Field(proto.STRING, number=1,) + value = proto.Field( + proto.STRING, + number=1, + ) - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - kind = proto.Field(proto.ENUM, number=3, enum=Kind,) - auto_expansion_mode = proto.Field(proto.ENUM, number=4, enum=AutoExpansionMode,) - entities = proto.RepeatedField(proto.MESSAGE, number=5, message=Entity,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + kind = proto.Field( + proto.ENUM, + number=3, + enum=Kind, + ) + auto_expansion_mode = proto.Field( + proto.ENUM, + number=4, + enum=AutoExpansionMode, + ) + entities = proto.RepeatedField( + proto.MESSAGE, + number=5, + message=Entity, + ) excluded_phrases = proto.RepeatedField( - proto.MESSAGE, number=6, message=ExcludedPhrase, + proto.MESSAGE, + number=6, + message=ExcludedPhrase, + ) + enable_fuzzy_extraction = proto.Field( + proto.BOOL, + number=7, + ) + redact = proto.Field( + proto.BOOL, + number=9, ) - enable_fuzzy_extraction = proto.Field(proto.BOOL, number=7,) - redact = proto.Field(proto.BOOL, number=9,) class ListEntityTypesRequest(proto.Message): @@ -198,10 +233,22 @@ class ListEntityTypesRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class ListEntityTypesResponse(proto.Message): @@ -222,8 +269,15 @@ class ListEntityTypesResponse(proto.Message): def raw_page(self): return self - entity_types = proto.RepeatedField(proto.MESSAGE, number=1, message="EntityType",) - next_page_token = proto.Field(proto.STRING, number=2,) + entity_types = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="EntityType", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetEntityTypeRequest(proto.Message): @@ -249,8 +303,14 @@ class GetEntityTypeRequest(proto.Message): before they can be used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class CreateEntityTypeRequest(proto.Message): @@ -277,9 +337,19 @@ class CreateEntityTypeRequest(proto.Message): before they can be used. """ - parent = proto.Field(proto.STRING, number=1,) - entity_type = proto.Field(proto.MESSAGE, number=2, message="EntityType",) - language_code = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + entity_type = proto.Field( + proto.MESSAGE, + number=2, + message="EntityType", + ) + language_code = proto.Field( + proto.STRING, + number=3, + ) class UpdateEntityTypeRequest(proto.Message): @@ -305,10 +375,19 @@ class UpdateEntityTypeRequest(proto.Message): The mask to control which fields get updated. """ - entity_type = proto.Field(proto.MESSAGE, number=1, message="EntityType",) - language_code = proto.Field(proto.STRING, number=2,) + entity_type = proto.Field( + proto.MESSAGE, + number=1, + message="EntityType", + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) @@ -336,8 +415,14 @@ class DeleteEntityTypeRequest(proto.Message): of the entity type will be removed). """ - name = proto.Field(proto.STRING, number=1,) - force = proto.Field(proto.BOOL, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + force = proto.Field( + proto.BOOL, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3/types/environment.py b/google/cloud/dialogflowcx_v3/types/environment.py index 014d2d7e..07ea67fc 100644 --- a/google/cloud/dialogflowcx_v3/types/environment.py +++ b/google/cloud/dialogflowcx_v3/types/environment.py @@ -91,7 +91,10 @@ class VersionConfig(proto.Message): ID>/flows//versions/. """ - version = proto.Field(proto.STRING, number=1,) + version = proto.Field( + proto.STRING, + number=1, + ) class TestCasesConfig(proto.Message): r"""The configuration for continuous tests. @@ -112,18 +115,46 @@ class TestCasesConfig(proto.Message): false. """ - test_cases = proto.RepeatedField(proto.STRING, number=1,) - enable_continuous_run = proto.Field(proto.BOOL, number=2,) - enable_predeployment_run = proto.Field(proto.BOOL, number=3,) - - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) + test_cases = proto.RepeatedField( + proto.STRING, + number=1, + ) + enable_continuous_run = proto.Field( + proto.BOOL, + number=2, + ) + enable_predeployment_run = proto.Field( + proto.BOOL, + number=3, + ) + + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) version_configs = proto.RepeatedField( - proto.MESSAGE, number=6, message=VersionConfig, + proto.MESSAGE, + number=6, + message=VersionConfig, + ) + update_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + test_cases_config = proto.Field( + proto.MESSAGE, + number=7, + message=TestCasesConfig, ) - update_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - test_cases_config = proto.Field(proto.MESSAGE, number=7, message=TestCasesConfig,) class ListEnvironmentsRequest(proto.Message): @@ -143,9 +174,18 @@ class ListEnvironmentsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListEnvironmentsResponse(proto.Message): @@ -168,8 +208,15 @@ class ListEnvironmentsResponse(proto.Message): def raw_page(self): return self - environments = proto.RepeatedField(proto.MESSAGE, number=1, message="Environment",) - next_page_token = proto.Field(proto.STRING, number=2,) + environments = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Environment", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetEnvironmentRequest(proto.Message): @@ -184,7 +231,10 @@ class GetEnvironmentRequest(proto.Message): ``projects//locations//agents//environments/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateEnvironmentRequest(proto.Message): @@ -202,8 +252,15 @@ class CreateEnvironmentRequest(proto.Message): Required. The environment to create. """ - parent = proto.Field(proto.STRING, number=1,) - environment = proto.Field(proto.MESSAGE, number=2, message="Environment",) + parent = proto.Field( + proto.STRING, + number=1, + ) + environment = proto.Field( + proto.MESSAGE, + number=2, + message="Environment", + ) class UpdateEnvironmentRequest(proto.Message): @@ -218,9 +275,15 @@ class UpdateEnvironmentRequest(proto.Message): get updated. """ - environment = proto.Field(proto.MESSAGE, number=1, message="Environment",) + environment = proto.Field( + proto.MESSAGE, + number=1, + message="Environment", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -236,7 +299,10 @@ class DeleteEnvironmentRequest(proto.Message): ``projects//locations//agents//environments/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class LookupEnvironmentHistoryRequest(proto.Message): @@ -256,9 +322,18 @@ class LookupEnvironmentHistoryRequest(proto.Message): request. """ - name = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class LookupEnvironmentHistoryResponse(proto.Message): @@ -280,8 +355,15 @@ class LookupEnvironmentHistoryResponse(proto.Message): def raw_page(self): return self - environments = proto.RepeatedField(proto.MESSAGE, number=1, message="Environment",) - next_page_token = proto.Field(proto.STRING, number=2,) + environments = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Environment", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class ContinuousTestResult(proto.Message): @@ -311,10 +393,24 @@ class AggregatedTestResult(proto.Enum): PASSED = 1 FAILED = 2 - name = proto.Field(proto.STRING, number=1,) - result = proto.Field(proto.ENUM, number=2, enum=AggregatedTestResult,) - test_case_results = proto.RepeatedField(proto.STRING, number=3,) - run_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + result = proto.Field( + proto.ENUM, + number=2, + enum=AggregatedTestResult, + ) + test_case_results = proto.RepeatedField( + proto.STRING, + number=3, + ) + run_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) class RunContinuousTestRequest(proto.Message): @@ -327,7 +423,10 @@ class RunContinuousTestRequest(proto.Message): ``projects//locations//agents//environments/``. """ - environment = proto.Field(proto.STRING, number=1,) + environment = proto.Field( + proto.STRING, + number=1, + ) class RunContinuousTestResponse(proto.Message): @@ -340,7 +439,9 @@ class RunContinuousTestResponse(proto.Message): """ continuous_test_result = proto.Field( - proto.MESSAGE, number=1, message="ContinuousTestResult", + proto.MESSAGE, + number=1, + message="ContinuousTestResult", ) @@ -354,7 +455,11 @@ class RunContinuousTestMetadata(proto.Message): The test errors. """ - errors = proto.RepeatedField(proto.MESSAGE, number=1, message=test_case.TestError,) + errors = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=test_case.TestError, + ) class ListContinuousTestResultsRequest(proto.Message): @@ -373,9 +478,18 @@ class ListContinuousTestResultsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListContinuousTestResultsResponse(proto.Message): @@ -395,9 +509,14 @@ def raw_page(self): return self continuous_test_results = proto.RepeatedField( - proto.MESSAGE, number=1, message="ContinuousTestResult", + proto.MESSAGE, + number=1, + message="ContinuousTestResult", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class DeployFlowRequest(proto.Message): @@ -413,8 +532,14 @@ class DeployFlowRequest(proto.Message): ``projects//locations//agents// flows//versions/``. """ - environment = proto.Field(proto.STRING, number=1,) - flow_version = proto.Field(proto.STRING, number=2,) + environment = proto.Field( + proto.STRING, + number=1, + ) + flow_version = proto.Field( + proto.STRING, + number=2, + ) class DeployFlowResponse(proto.Message): @@ -432,8 +557,15 @@ class DeployFlowResponse(proto.Message): ``projects//locations//agents// environments//deployments/``. """ - environment = proto.Field(proto.MESSAGE, number=1, message="Environment",) - deployment = proto.Field(proto.STRING, number=2,) + environment = proto.Field( + proto.MESSAGE, + number=1, + message="Environment", + ) + deployment = proto.Field( + proto.STRING, + number=2, + ) class DeployFlowMetadata(proto.Message): @@ -447,7 +579,9 @@ class DeployFlowMetadata(proto.Message): """ test_errors = proto.RepeatedField( - proto.MESSAGE, number=1, message=test_case.TestError, + proto.MESSAGE, + number=1, + message=test_case.TestError, ) diff --git a/google/cloud/dialogflowcx_v3/types/experiment.py b/google/cloud/dialogflowcx_v3/types/experiment.py index f720d59d..e768153e 100644 --- a/google/cloud/dialogflowcx_v3/types/experiment.py +++ b/google/cloud/dialogflowcx_v3/types/experiment.py @@ -128,9 +128,15 @@ class Definition(proto.Message): This field is a member of `oneof`_ ``variants``. """ - condition = proto.Field(proto.STRING, number=1,) + condition = proto.Field( + proto.STRING, + number=1, + ) version_variants = proto.Field( - proto.MESSAGE, number=2, oneof="variants", message="VersionVariants", + proto.MESSAGE, + number=2, + oneof="variants", + message="VersionVariants", ) class Result(proto.Message): @@ -180,10 +186,22 @@ class ConfidenceInterval(proto.Message): Upper bound of the interval. """ - confidence_level = proto.Field(proto.DOUBLE, number=1,) - ratio = proto.Field(proto.DOUBLE, number=2,) - lower_bound = proto.Field(proto.DOUBLE, number=3,) - upper_bound = proto.Field(proto.DOUBLE, number=4,) + confidence_level = proto.Field( + proto.DOUBLE, + number=1, + ) + ratio = proto.Field( + proto.DOUBLE, + number=2, + ) + lower_bound = proto.Field( + proto.DOUBLE, + number=3, + ) + upper_bound = proto.Field( + proto.DOUBLE, + number=4, + ) class Metric(proto.Message): r"""Metric and corresponding confidence intervals. @@ -216,15 +234,29 @@ class Metric(proto.Message): """ type_ = proto.Field( - proto.ENUM, number=1, enum="Experiment.Result.MetricType", + proto.ENUM, + number=1, + enum="Experiment.Result.MetricType", ) count_type = proto.Field( - proto.ENUM, number=5, enum="Experiment.Result.CountType", + proto.ENUM, + number=5, + enum="Experiment.Result.CountType", + ) + ratio = proto.Field( + proto.DOUBLE, + number=2, + oneof="value", + ) + count = proto.Field( + proto.DOUBLE, + number=4, + oneof="value", ) - ratio = proto.Field(proto.DOUBLE, number=2, oneof="value",) - count = proto.Field(proto.DOUBLE, number=4, oneof="value",) confidence_interval = proto.Field( - proto.MESSAGE, number=3, message="Experiment.Result.ConfidenceInterval", + proto.MESSAGE, + number=3, + message="Experiment.Result.ConfidenceInterval", ) class VersionMetrics(proto.Message): @@ -243,39 +275,101 @@ class VersionMetrics(proto.Message): this version. """ - version = proto.Field(proto.STRING, number=1,) + version = proto.Field( + proto.STRING, + number=1, + ) metrics = proto.RepeatedField( - proto.MESSAGE, number=2, message="Experiment.Result.Metric", + proto.MESSAGE, + number=2, + message="Experiment.Result.Metric", + ) + session_count = proto.Field( + proto.INT32, + number=3, ) - session_count = proto.Field(proto.INT32, number=3,) version_metrics = proto.RepeatedField( - proto.MESSAGE, number=1, message="Experiment.Result.VersionMetrics", + proto.MESSAGE, + number=1, + message="Experiment.Result.VersionMetrics", ) last_update_time = proto.Field( - proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, ) - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) - state = proto.Field(proto.ENUM, number=4, enum=State,) - definition = proto.Field(proto.MESSAGE, number=5, message=Definition,) - rollout_config = proto.Field(proto.MESSAGE, number=14, message="RolloutConfig",) - rollout_state = proto.Field(proto.MESSAGE, number=15, message="RolloutState",) - rollout_failure_reason = proto.Field(proto.STRING, number=16,) - result = proto.Field(proto.MESSAGE, number=6, message=Result,) - create_time = proto.Field(proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,) - start_time = proto.Field(proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=9, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + state = proto.Field( + proto.ENUM, + number=4, + enum=State, + ) + definition = proto.Field( + proto.MESSAGE, + number=5, + message=Definition, + ) + rollout_config = proto.Field( + proto.MESSAGE, + number=14, + message="RolloutConfig", + ) + rollout_state = proto.Field( + proto.MESSAGE, + number=15, + message="RolloutState", + ) + rollout_failure_reason = proto.Field( + proto.STRING, + number=16, + ) + result = proto.Field( + proto.MESSAGE, + number=6, + message=Result, + ) + create_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + start_time = proto.Field( + proto.MESSAGE, + number=8, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=9, + message=timestamp_pb2.Timestamp, + ) last_update_time = proto.Field( - proto.MESSAGE, number=10, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=10, + message=timestamp_pb2.Timestamp, ) experiment_length = proto.Field( - proto.MESSAGE, number=11, message=duration_pb2.Duration, + proto.MESSAGE, + number=11, + message=duration_pb2.Duration, ) variants_history = proto.RepeatedField( - proto.MESSAGE, number=12, message="VariantsHistory", + proto.MESSAGE, + number=12, + message="VariantsHistory", ) @@ -302,11 +396,24 @@ class Variant(proto.Message): Whether the variant is for the control group. """ - version = proto.Field(proto.STRING, number=1,) - traffic_allocation = proto.Field(proto.FLOAT, number=2,) - is_control_group = proto.Field(proto.BOOL, number=3,) + version = proto.Field( + proto.STRING, + number=1, + ) + traffic_allocation = proto.Field( + proto.FLOAT, + number=2, + ) + is_control_group = proto.Field( + proto.BOOL, + number=3, + ) - variants = proto.RepeatedField(proto.MESSAGE, number=1, message=Variant,) + variants = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=Variant, + ) class VariantsHistory(proto.Message): @@ -324,9 +431,16 @@ class VariantsHistory(proto.Message): """ version_variants = proto.Field( - proto.MESSAGE, number=1, oneof="variants", message="VersionVariants", + proto.MESSAGE, + number=1, + oneof="variants", + message="VersionVariants", + ) + update_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, ) - update_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) class RolloutConfig(proto.Message): @@ -368,15 +482,33 @@ class RolloutStep(proto.Message): hour. """ - display_name = proto.Field(proto.STRING, number=1,) - traffic_percent = proto.Field(proto.INT32, number=2,) + display_name = proto.Field( + proto.STRING, + number=1, + ) + traffic_percent = proto.Field( + proto.INT32, + number=2, + ) min_duration = proto.Field( - proto.MESSAGE, number=3, message=duration_pb2.Duration, + proto.MESSAGE, + number=3, + message=duration_pb2.Duration, ) - rollout_steps = proto.RepeatedField(proto.MESSAGE, number=1, message=RolloutStep,) - rollout_condition = proto.Field(proto.STRING, number=2,) - failure_condition = proto.Field(proto.STRING, number=3,) + rollout_steps = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=RolloutStep, + ) + rollout_condition = proto.Field( + proto.STRING, + number=2, + ) + failure_condition = proto.Field( + proto.STRING, + number=3, + ) class RolloutState(proto.Message): @@ -393,9 +525,19 @@ class RolloutState(proto.Message): Start time of the current step. """ - step = proto.Field(proto.STRING, number=1,) - step_index = proto.Field(proto.INT32, number=3,) - start_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) + step = proto.Field( + proto.STRING, + number=1, + ) + step_index = proto.Field( + proto.INT32, + number=3, + ) + start_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) class ListExperimentsRequest(proto.Message): @@ -416,9 +558,18 @@ class ListExperimentsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListExperimentsResponse(proto.Message): @@ -441,8 +592,15 @@ class ListExperimentsResponse(proto.Message): def raw_page(self): return self - experiments = proto.RepeatedField(proto.MESSAGE, number=1, message="Experiment",) - next_page_token = proto.Field(proto.STRING, number=2,) + experiments = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Experiment", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetExperimentRequest(proto.Message): @@ -457,7 +615,10 @@ class GetExperimentRequest(proto.Message): ``projects//locations//agents//environments//experiments/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateExperimentRequest(proto.Message): @@ -475,8 +636,15 @@ class CreateExperimentRequest(proto.Message): Required. The experiment to create. """ - parent = proto.Field(proto.STRING, number=1,) - experiment = proto.Field(proto.MESSAGE, number=2, message="Experiment",) + parent = proto.Field( + proto.STRING, + number=1, + ) + experiment = proto.Field( + proto.MESSAGE, + number=2, + message="Experiment", + ) class UpdateExperimentRequest(proto.Message): @@ -491,9 +659,15 @@ class UpdateExperimentRequest(proto.Message): get updated. """ - experiment = proto.Field(proto.MESSAGE, number=1, message="Experiment",) + experiment = proto.Field( + proto.MESSAGE, + number=1, + message="Experiment", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -509,7 +683,10 @@ class DeleteExperimentRequest(proto.Message): ``projects//locations//agents//environments//experiments/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class StartExperimentRequest(proto.Message): @@ -522,7 +699,10 @@ class StartExperimentRequest(proto.Message): ``projects//locations//agents//environments//experiments/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class StopExperimentRequest(proto.Message): @@ -535,7 +715,10 @@ class StopExperimentRequest(proto.Message): ``projects//locations//agents//environments//experiments/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3/types/flow.py b/google/cloud/dialogflowcx_v3/types/flow.py index e2efeb74..1b0ea02c 100644 --- a/google/cloud/dialogflowcx_v3/types/flow.py +++ b/google/cloud/dialogflowcx_v3/types/flow.py @@ -76,9 +76,20 @@ class ModelTrainingMode(proto.Enum): MODEL_TRAINING_MODE_AUTOMATIC = 1 MODEL_TRAINING_MODE_MANUAL = 2 - model_type = proto.Field(proto.ENUM, number=1, enum=ModelType,) - classification_threshold = proto.Field(proto.FLOAT, number=3,) - model_training_mode = proto.Field(proto.ENUM, number=4, enum=ModelTrainingMode,) + model_type = proto.Field( + proto.ENUM, + number=1, + enum=ModelType, + ) + classification_threshold = proto.Field( + proto.FLOAT, + number=3, + ) + model_training_mode = proto.Field( + proto.ENUM, + number=4, + enum=ModelTrainingMode, + ) class Flow(proto.Message): @@ -124,7 +135,7 @@ class Flow(proto.Message): TransitionRoutes are evalauted in the following order: - - TransitionRoutes with intent specified.. + - TransitionRoutes with intent specified. - TransitionRoutes with only condition specified. TransitionRoutes with intent specified are inherited by @@ -160,17 +171,37 @@ class Flow(proto.Message): NLU related settings of the flow. """ - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) transition_routes = proto.RepeatedField( - proto.MESSAGE, number=4, message=page.TransitionRoute, + proto.MESSAGE, + number=4, + message=page.TransitionRoute, ) event_handlers = proto.RepeatedField( - proto.MESSAGE, number=10, message=page.EventHandler, + proto.MESSAGE, + number=10, + message=page.EventHandler, + ) + transition_route_groups = proto.RepeatedField( + proto.STRING, + number=15, + ) + nlu_settings = proto.Field( + proto.MESSAGE, + number=11, + message="NluSettings", ) - transition_route_groups = proto.RepeatedField(proto.STRING, number=15,) - nlu_settings = proto.Field(proto.MESSAGE, number=11, message="NluSettings",) class CreateFlowRequest(proto.Message): @@ -198,9 +229,19 @@ class CreateFlowRequest(proto.Message): before they can be used. """ - parent = proto.Field(proto.STRING, number=1,) - flow = proto.Field(proto.MESSAGE, number=2, message="Flow",) - language_code = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + flow = proto.Field( + proto.MESSAGE, + number=2, + message="Flow", + ) + language_code = proto.Field( + proto.STRING, + number=3, + ) class DeleteFlowRequest(proto.Message): @@ -225,8 +266,14 @@ class DeleteFlowRequest(proto.Message): cleared). """ - name = proto.Field(proto.STRING, number=1,) - force = proto.Field(proto.BOOL, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + force = proto.Field( + proto.BOOL, + number=2, + ) class ListFlowsRequest(proto.Message): @@ -259,10 +306,22 @@ class ListFlowsRequest(proto.Message): before they can be used. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - language_code = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + language_code = proto.Field( + proto.STRING, + number=4, + ) class ListFlowsResponse(proto.Message): @@ -283,8 +342,15 @@ class ListFlowsResponse(proto.Message): def raw_page(self): return self - flows = proto.RepeatedField(proto.MESSAGE, number=1, message="Flow",) - next_page_token = proto.Field(proto.STRING, number=2,) + flows = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Flow", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetFlowRequest(proto.Message): @@ -311,8 +377,14 @@ class GetFlowRequest(proto.Message): before they can be used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class UpdateFlowRequest(proto.Message): @@ -341,11 +413,20 @@ class UpdateFlowRequest(proto.Message): before they can be used. """ - flow = proto.Field(proto.MESSAGE, number=1, message="Flow",) + flow = proto.Field( + proto.MESSAGE, + number=1, + message="Flow", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + language_code = proto.Field( + proto.STRING, + number=3, ) - language_code = proto.Field(proto.STRING, number=3,) class TrainFlowRequest(proto.Message): @@ -358,7 +439,10 @@ class TrainFlowRequest(proto.Message): ``projects//locations//agents//flows/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ValidateFlowRequest(proto.Message): @@ -374,8 +458,14 @@ class ValidateFlowRequest(proto.Message): language is used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class GetFlowValidationResultRequest(proto.Message): @@ -391,8 +481,14 @@ class GetFlowValidationResultRequest(proto.Message): language is used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class FlowValidationResult(proto.Message): @@ -409,11 +505,20 @@ class FlowValidationResult(proto.Message): Last time the flow was validated. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) validation_messages = proto.RepeatedField( - proto.MESSAGE, number=2, message=validation_message.ValidationMessage, + proto.MESSAGE, + number=2, + message=validation_message.ValidationMessage, + ) + update_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, ) - update_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) class ImportFlowRequest(proto.Message): @@ -458,10 +563,25 @@ class ImportOption(proto.Enum): KEEP = 1 FALLBACK = 2 - parent = proto.Field(proto.STRING, number=1,) - flow_uri = proto.Field(proto.STRING, number=2, oneof="flow",) - flow_content = proto.Field(proto.BYTES, number=3, oneof="flow",) - import_option = proto.Field(proto.ENUM, number=4, enum=ImportOption,) + parent = proto.Field( + proto.STRING, + number=1, + ) + flow_uri = proto.Field( + proto.STRING, + number=2, + oneof="flow", + ) + flow_content = proto.Field( + proto.BYTES, + number=3, + oneof="flow", + ) + import_option = proto.Field( + proto.ENUM, + number=4, + enum=ImportOption, + ) class ImportFlowResponse(proto.Message): @@ -474,7 +594,10 @@ class ImportFlowResponse(proto.Message): ``projects//locations//agents//flows/``. """ - flow = proto.Field(proto.STRING, number=1,) + flow = proto.Field( + proto.STRING, + number=1, + ) class ExportFlowRequest(proto.Message): @@ -502,9 +625,18 @@ class ExportFlowRequest(proto.Message): by the specified flow. """ - name = proto.Field(proto.STRING, number=1,) - flow_uri = proto.Field(proto.STRING, number=2,) - include_referenced_flows = proto.Field(proto.BOOL, number=4,) + name = proto.Field( + proto.STRING, + number=1, + ) + flow_uri = proto.Field( + proto.STRING, + number=2, + ) + include_referenced_flows = proto.Field( + proto.BOOL, + number=4, + ) class ExportFlowResponse(proto.Message): @@ -531,8 +663,16 @@ class ExportFlowResponse(proto.Message): This field is a member of `oneof`_ ``flow``. """ - flow_uri = proto.Field(proto.STRING, number=1, oneof="flow",) - flow_content = proto.Field(proto.BYTES, number=2, oneof="flow",) + flow_uri = proto.Field( + proto.STRING, + number=1, + oneof="flow", + ) + flow_content = proto.Field( + proto.BYTES, + number=2, + oneof="flow", + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3/types/fulfillment.py b/google/cloud/dialogflowcx_v3/types/fulfillment.py index 7033027e..b7551a51 100644 --- a/google/cloud/dialogflowcx_v3/types/fulfillment.py +++ b/google/cloud/dialogflowcx_v3/types/fulfillment.py @@ -20,7 +20,10 @@ __protobuf__ = proto.module( - package="google.cloud.dialogflow.cx.v3", manifest={"Fulfillment",}, + package="google.cloud.dialogflow.cx.v3", + manifest={ + "Fulfillment", + }, ) @@ -66,9 +69,13 @@ class Fulfillment(proto.Message): returned. You may only want to apply it to fulfillments that have slow webhooks. tag (str): - The tag used by the webhook to identify which fulfillment is - being called. This field is required if ``webhook`` is - specified. + The value of this field will be populated in the + [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] + ``fulfillmentInfo.tag`` field by Dialogflow when the + associated webhook is called. The tag is typically used by + the webhook service to identify which fulfillment is being + called, but it could be used for other purposes. This field + is required if ``webhook`` is specified. set_parameter_actions (Sequence[google.cloud.dialogflowcx_v3.types.Fulfillment.SetParameterAction]): Set parameter values before executing the webhook. @@ -87,8 +94,15 @@ class SetParameterAction(proto.Message): clears the parameter. """ - parameter = proto.Field(proto.STRING, number=1,) - value = proto.Field(proto.MESSAGE, number=2, message=struct_pb2.Value,) + parameter = proto.Field( + proto.STRING, + number=1, + ) + value = proto.Field( + proto.MESSAGE, + number=2, + message=struct_pb2.Value, + ) class ConditionalCases(proto.Message): r"""A list of cascading if-else conditions. Cases are mutually @@ -153,7 +167,10 @@ class CaseContent(proto.Message): message="Fulfillment.ConditionalCases", ) - condition = proto.Field(proto.STRING, number=1,) + condition = proto.Field( + proto.STRING, + number=1, + ) case_content = proto.RepeatedField( proto.MESSAGE, number=2, @@ -161,20 +178,37 @@ class CaseContent(proto.Message): ) cases = proto.RepeatedField( - proto.MESSAGE, number=1, message="Fulfillment.ConditionalCases.Case", + proto.MESSAGE, + number=1, + message="Fulfillment.ConditionalCases.Case", ) messages = proto.RepeatedField( - proto.MESSAGE, number=1, message=response_message.ResponseMessage, + proto.MESSAGE, + number=1, + message=response_message.ResponseMessage, + ) + webhook = proto.Field( + proto.STRING, + number=2, + ) + return_partial_responses = proto.Field( + proto.BOOL, + number=8, + ) + tag = proto.Field( + proto.STRING, + number=3, ) - webhook = proto.Field(proto.STRING, number=2,) - return_partial_responses = proto.Field(proto.BOOL, number=8,) - tag = proto.Field(proto.STRING, number=3,) set_parameter_actions = proto.RepeatedField( - proto.MESSAGE, number=4, message=SetParameterAction, + proto.MESSAGE, + number=4, + message=SetParameterAction, ) conditional_cases = proto.RepeatedField( - proto.MESSAGE, number=5, message=ConditionalCases, + proto.MESSAGE, + number=5, + message=ConditionalCases, ) diff --git a/google/cloud/dialogflowcx_v3/types/intent.py b/google/cloud/dialogflowcx_v3/types/intent.py index 706e1dae..45a64043 100644 --- a/google/cloud/dialogflowcx_v3/types/intent.py +++ b/google/cloud/dialogflowcx_v3/types/intent.py @@ -87,7 +87,7 @@ class Intent(proto.Message): mistakenly matched, since training phrases assigned to fallback intents act as negative examples that triggers no-match event. - labels (Sequence[google.cloud.dialogflowcx_v3.types.Intent.LabelsEntry]): + labels (Mapping[str, str]): The key/value metadata to label an intent. Labels can contain lowercase letters, digits and the symbols '-' and '_'. International characters are allowed, including letters @@ -160,14 +160,28 @@ class Part(proto.Message): phrase. """ - text = proto.Field(proto.STRING, number=1,) - parameter_id = proto.Field(proto.STRING, number=2,) - - id = proto.Field(proto.STRING, number=1,) + text = proto.Field( + proto.STRING, + number=1, + ) + parameter_id = proto.Field( + proto.STRING, + number=2, + ) + + id = proto.Field( + proto.STRING, + number=1, + ) parts = proto.RepeatedField( - proto.MESSAGE, number=2, message="Intent.TrainingPhrase.Part", + proto.MESSAGE, + number=2, + message="Intent.TrainingPhrase.Part", + ) + repeat_count = proto.Field( + proto.INT32, + number=3, ) - repeat_count = proto.Field(proto.INT32, number=3,) class Parameter(proto.Message): r"""Represents an intent parameter. @@ -200,21 +214,58 @@ class Parameter(proto.Message): is enabled. """ - id = proto.Field(proto.STRING, number=1,) - entity_type = proto.Field(proto.STRING, number=2,) - is_list = proto.Field(proto.BOOL, number=3,) - redact = proto.Field(proto.BOOL, number=4,) + id = proto.Field( + proto.STRING, + number=1, + ) + entity_type = proto.Field( + proto.STRING, + number=2, + ) + is_list = proto.Field( + proto.BOOL, + number=3, + ) + redact = proto.Field( + proto.BOOL, + number=4, + ) - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) training_phrases = proto.RepeatedField( - proto.MESSAGE, number=3, message=TrainingPhrase, + proto.MESSAGE, + number=3, + message=TrainingPhrase, + ) + parameters = proto.RepeatedField( + proto.MESSAGE, + number=4, + message=Parameter, + ) + priority = proto.Field( + proto.INT32, + number=5, + ) + is_fallback = proto.Field( + proto.BOOL, + number=6, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=7, + ) + description = proto.Field( + proto.STRING, + number=8, ) - parameters = proto.RepeatedField(proto.MESSAGE, number=4, message=Parameter,) - priority = proto.Field(proto.INT32, number=5,) - is_fallback = proto.Field(proto.BOOL, number=6,) - labels = proto.MapField(proto.STRING, proto.STRING, number=7,) - description = proto.Field(proto.STRING, number=8,) class ListIntentsRequest(proto.Message): @@ -247,11 +298,27 @@ class ListIntentsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) - intent_view = proto.Field(proto.ENUM, number=5, enum="IntentView",) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) + intent_view = proto.Field( + proto.ENUM, + number=5, + enum="IntentView", + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class ListIntentsResponse(proto.Message): @@ -272,8 +339,15 @@ class ListIntentsResponse(proto.Message): def raw_page(self): return self - intents = proto.RepeatedField(proto.MESSAGE, number=1, message="Intent",) - next_page_token = proto.Field(proto.STRING, number=2,) + intents = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Intent", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetIntentRequest(proto.Message): @@ -297,8 +371,14 @@ class GetIntentRequest(proto.Message): before they can be used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class CreateIntentRequest(proto.Message): @@ -323,9 +403,19 @@ class CreateIntentRequest(proto.Message): before they can be used. """ - parent = proto.Field(proto.STRING, number=1,) - intent = proto.Field(proto.MESSAGE, number=2, message="Intent",) - language_code = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + intent = proto.Field( + proto.MESSAGE, + number=2, + message="Intent", + ) + language_code = proto.Field( + proto.STRING, + number=3, + ) class UpdateIntentRequest(proto.Message): @@ -351,10 +441,19 @@ class UpdateIntentRequest(proto.Message): updated. """ - intent = proto.Field(proto.MESSAGE, number=1, message="Intent",) - language_code = proto.Field(proto.STRING, number=2,) + intent = proto.Field( + proto.MESSAGE, + number=1, + message="Intent", + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) @@ -368,7 +467,10 @@ class DeleteIntentRequest(proto.Message): ``projects//locations//agents//intents/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3/types/page.py b/google/cloud/dialogflowcx_v3/types/page.py index fc5ec3fb..e0c1529a 100644 --- a/google/cloud/dialogflowcx_v3/types/page.py +++ b/google/cloud/dialogflowcx_v3/types/page.py @@ -68,7 +68,7 @@ class Page(proto.Message): ``projects//locations//agents//flows//pages/``. display_name (str): Required. The human-readable name of the - page, unique within the agent. + page, unique within the flow. entry_fulfillment (google.cloud.dialogflowcx_v3.types.Fulfillment): The fulfillment to call when the session is entering the page. @@ -119,18 +119,37 @@ class Page(proto.Message): input. """ - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) entry_fulfillment = proto.Field( - proto.MESSAGE, number=7, message=fulfillment.Fulfillment, + proto.MESSAGE, + number=7, + message=fulfillment.Fulfillment, + ) + form = proto.Field( + proto.MESSAGE, + number=4, + message="Form", + ) + transition_route_groups = proto.RepeatedField( + proto.STRING, + number=11, ) - form = proto.Field(proto.MESSAGE, number=4, message="Form",) - transition_route_groups = proto.RepeatedField(proto.STRING, number=11,) transition_routes = proto.RepeatedField( - proto.MESSAGE, number=9, message="TransitionRoute", + proto.MESSAGE, + number=9, + message="TransitionRoute", ) event_handlers = proto.RepeatedField( - proto.MESSAGE, number=10, message="EventHandler", + proto.MESSAGE, + number=10, + message="EventHandler", ) @@ -239,23 +258,52 @@ class FillBehavior(proto.Message): """ initial_prompt_fulfillment = proto.Field( - proto.MESSAGE, number=3, message=fulfillment.Fulfillment, + proto.MESSAGE, + number=3, + message=fulfillment.Fulfillment, ) reprompt_event_handlers = proto.RepeatedField( - proto.MESSAGE, number=5, message="EventHandler", + proto.MESSAGE, + number=5, + message="EventHandler", ) - display_name = proto.Field(proto.STRING, number=1,) - required = proto.Field(proto.BOOL, number=2,) - entity_type = proto.Field(proto.STRING, number=3,) - is_list = proto.Field(proto.BOOL, number=4,) + display_name = proto.Field( + proto.STRING, + number=1, + ) + required = proto.Field( + proto.BOOL, + number=2, + ) + entity_type = proto.Field( + proto.STRING, + number=3, + ) + is_list = proto.Field( + proto.BOOL, + number=4, + ) fill_behavior = proto.Field( - proto.MESSAGE, number=7, message="Form.Parameter.FillBehavior", + proto.MESSAGE, + number=7, + message="Form.Parameter.FillBehavior", + ) + default_value = proto.Field( + proto.MESSAGE, + number=9, + message=struct_pb2.Value, + ) + redact = proto.Field( + proto.BOOL, + number=11, ) - default_value = proto.Field(proto.MESSAGE, number=9, message=struct_pb2.Value,) - redact = proto.Field(proto.BOOL, number=11,) - parameters = proto.RepeatedField(proto.MESSAGE, number=1, message=Parameter,) + parameters = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=Parameter, + ) class EventHandler(proto.Message): @@ -307,13 +355,29 @@ class EventHandler(proto.Message): This field is a member of `oneof`_ ``target``. """ - name = proto.Field(proto.STRING, number=6,) - event = proto.Field(proto.STRING, number=4,) + name = proto.Field( + proto.STRING, + number=6, + ) + event = proto.Field( + proto.STRING, + number=4, + ) trigger_fulfillment = proto.Field( - proto.MESSAGE, number=5, message=fulfillment.Fulfillment, + proto.MESSAGE, + number=5, + message=fulfillment.Fulfillment, + ) + target_page = proto.Field( + proto.STRING, + number=2, + oneof="target", + ) + target_flow = proto.Field( + proto.STRING, + number=3, + oneof="target", ) - target_page = proto.Field(proto.STRING, number=2, oneof="target",) - target_flow = proto.Field(proto.STRING, number=3, oneof="target",) class TransitionRoute(proto.Message): @@ -384,14 +448,33 @@ class TransitionRoute(proto.Message): This field is a member of `oneof`_ ``target``. """ - name = proto.Field(proto.STRING, number=6,) - intent = proto.Field(proto.STRING, number=1,) - condition = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=6, + ) + intent = proto.Field( + proto.STRING, + number=1, + ) + condition = proto.Field( + proto.STRING, + number=2, + ) trigger_fulfillment = proto.Field( - proto.MESSAGE, number=3, message=fulfillment.Fulfillment, + proto.MESSAGE, + number=3, + message=fulfillment.Fulfillment, + ) + target_page = proto.Field( + proto.STRING, + number=4, + oneof="target", + ) + target_flow = proto.Field( + proto.STRING, + number=5, + oneof="target", ) - target_page = proto.Field(proto.STRING, number=4, oneof="target",) - target_flow = proto.Field(proto.STRING, number=5, oneof="target",) class ListPagesRequest(proto.Message): @@ -436,10 +519,22 @@ class ListPagesRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class ListPagesResponse(proto.Message): @@ -460,8 +555,15 @@ class ListPagesResponse(proto.Message): def raw_page(self): return self - pages = proto.RepeatedField(proto.MESSAGE, number=1, message="Page",) - next_page_token = proto.Field(proto.STRING, number=2,) + pages = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Page", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetPageRequest(proto.Message): @@ -500,8 +602,14 @@ class GetPageRequest(proto.Message): before they can be used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class CreatePageRequest(proto.Message): @@ -541,9 +649,19 @@ class CreatePageRequest(proto.Message): before they can be used. """ - parent = proto.Field(proto.STRING, number=1,) - page = proto.Field(proto.MESSAGE, number=2, message="Page",) - language_code = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page = proto.Field( + proto.MESSAGE, + number=2, + message="Page", + ) + language_code = proto.Field( + proto.STRING, + number=3, + ) class UpdatePageRequest(proto.Message): @@ -584,10 +702,19 @@ class UpdatePageRequest(proto.Message): updated. """ - page = proto.Field(proto.MESSAGE, number=1, message="Page",) - language_code = proto.Field(proto.STRING, number=2,) + page = proto.Field( + proto.MESSAGE, + number=1, + message="Page", + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) @@ -613,8 +740,14 @@ class DeletePageRequest(proto.Message): cleared). """ - name = proto.Field(proto.STRING, number=1,) - force = proto.Field(proto.BOOL, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + force = proto.Field( + proto.BOOL, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3/types/response_message.py b/google/cloud/dialogflowcx_v3/types/response_message.py index 8b4da716..3554ced6 100644 --- a/google/cloud/dialogflowcx_v3/types/response_message.py +++ b/google/cloud/dialogflowcx_v3/types/response_message.py @@ -19,7 +19,10 @@ __protobuf__ = proto.module( - package="google.cloud.dialogflow.cx.v3", manifest={"ResponseMessage",}, + package="google.cloud.dialogflow.cx.v3", + manifest={ + "ResponseMessage", + }, ) @@ -126,8 +129,14 @@ class Text(proto.Message): Dialogflow request. """ - text = proto.RepeatedField(proto.STRING, number=1,) - allow_playback_interruption = proto.Field(proto.BOOL, number=2,) + text = proto.RepeatedField( + proto.STRING, + number=1, + ) + allow_playback_interruption = proto.Field( + proto.BOOL, + number=2, + ) class LiveAgentHandoff(proto.Message): r"""Indicates that the conversation should be handed off to a live @@ -153,7 +162,11 @@ class LiveAgentHandoff(proto.Message): Dialogflow doesn't impose any structure on this. """ - metadata = proto.Field(proto.MESSAGE, number=1, message=struct_pb2.Struct,) + metadata = proto.Field( + proto.MESSAGE, + number=1, + message=struct_pb2.Struct, + ) class ConversationSuccess(proto.Message): r"""Indicates that the conversation succeeded, i.e., the bot handled the @@ -181,7 +194,11 @@ class ConversationSuccess(proto.Message): any structure on this. """ - metadata = proto.Field(proto.MESSAGE, number=1, message=struct_pb2.Struct,) + metadata = proto.Field( + proto.MESSAGE, + number=1, + message=struct_pb2.Struct, + ) class OutputAudioText(proto.Message): r"""A text or ssml response that is preferentially used for TTS @@ -212,9 +229,20 @@ class OutputAudioText(proto.Message): Dialogflow request. """ - text = proto.Field(proto.STRING, number=1, oneof="source",) - ssml = proto.Field(proto.STRING, number=2, oneof="source",) - allow_playback_interruption = proto.Field(proto.BOOL, number=3,) + text = proto.Field( + proto.STRING, + number=1, + oneof="source", + ) + ssml = proto.Field( + proto.STRING, + number=2, + oneof="source", + ) + allow_playback_interruption = proto.Field( + proto.BOOL, + number=3, + ) class EndInteraction(proto.Message): r"""Indicates that interaction with the Dialogflow agent has @@ -239,8 +267,14 @@ class PlayAudio(proto.Message): Dialogflow request. """ - audio_uri = proto.Field(proto.STRING, number=1,) - allow_playback_interruption = proto.Field(proto.BOOL, number=2,) + audio_uri = proto.Field( + proto.STRING, + number=1, + ) + allow_playback_interruption = proto.Field( + proto.BOOL, + number=2, + ) class MixedAudio(proto.Message): r"""Represents an audio message that is composed of both segments @@ -286,12 +320,25 @@ class Segment(proto.Message): Dialogflow request. """ - audio = proto.Field(proto.BYTES, number=1, oneof="content",) - uri = proto.Field(proto.STRING, number=2, oneof="content",) - allow_playback_interruption = proto.Field(proto.BOOL, number=3,) + audio = proto.Field( + proto.BYTES, + number=1, + oneof="content", + ) + uri = proto.Field( + proto.STRING, + number=2, + oneof="content", + ) + allow_playback_interruption = proto.Field( + proto.BOOL, + number=3, + ) segments = proto.RepeatedField( - proto.MESSAGE, number=1, message="ResponseMessage.MixedAudio.Segment", + proto.MESSAGE, + number=1, + message="ResponseMessage.MixedAudio.Segment", ) class TelephonyTransferCall(proto.Message): @@ -309,32 +356,65 @@ class TelephonyTransferCall(proto.Message): This field is a member of `oneof`_ ``endpoint``. """ - phone_number = proto.Field(proto.STRING, number=1, oneof="endpoint",) + phone_number = proto.Field( + proto.STRING, + number=1, + oneof="endpoint", + ) - text = proto.Field(proto.MESSAGE, number=1, oneof="message", message=Text,) + text = proto.Field( + proto.MESSAGE, + number=1, + oneof="message", + message=Text, + ) payload = proto.Field( - proto.MESSAGE, number=2, oneof="message", message=struct_pb2.Struct, + proto.MESSAGE, + number=2, + oneof="message", + message=struct_pb2.Struct, ) conversation_success = proto.Field( - proto.MESSAGE, number=9, oneof="message", message=ConversationSuccess, + proto.MESSAGE, + number=9, + oneof="message", + message=ConversationSuccess, ) output_audio_text = proto.Field( - proto.MESSAGE, number=8, oneof="message", message=OutputAudioText, + proto.MESSAGE, + number=8, + oneof="message", + message=OutputAudioText, ) live_agent_handoff = proto.Field( - proto.MESSAGE, number=10, oneof="message", message=LiveAgentHandoff, + proto.MESSAGE, + number=10, + oneof="message", + message=LiveAgentHandoff, ) end_interaction = proto.Field( - proto.MESSAGE, number=11, oneof="message", message=EndInteraction, + proto.MESSAGE, + number=11, + oneof="message", + message=EndInteraction, ) play_audio = proto.Field( - proto.MESSAGE, number=12, oneof="message", message=PlayAudio, + proto.MESSAGE, + number=12, + oneof="message", + message=PlayAudio, ) mixed_audio = proto.Field( - proto.MESSAGE, number=13, oneof="message", message=MixedAudio, + proto.MESSAGE, + number=13, + oneof="message", + message=MixedAudio, ) telephony_transfer_call = proto.Field( - proto.MESSAGE, number=18, oneof="message", message=TelephonyTransferCall, + proto.MESSAGE, + number=18, + oneof="message", + message=TelephonyTransferCall, ) diff --git a/google/cloud/dialogflowcx_v3/types/security_settings.py b/google/cloud/dialogflowcx_v3/types/security_settings.py index a0b50762..42ad6713 100644 --- a/google/cloud/dialogflowcx_v3/types/security_settings.py +++ b/google/cloud/dialogflowcx_v3/types/security_settings.py @@ -42,7 +42,10 @@ class GetSecuritySettingsRequest(proto.Message): ``projects//locations//securitySettings/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateSecuritySettingsRequest(proto.Message): @@ -60,10 +63,14 @@ class UpdateSecuritySettingsRequest(proto.Message): """ security_settings = proto.Field( - proto.MESSAGE, number=1, message="SecuritySettings", + proto.MESSAGE, + number=1, + message="SecuritySettings", ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -82,9 +89,18 @@ class ListSecuritySettingsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListSecuritySettingsResponse(proto.Message): @@ -104,9 +120,14 @@ def raw_page(self): return self security_settings = proto.RepeatedField( - proto.MESSAGE, number=1, message="SecuritySettings", + proto.MESSAGE, + number=1, + message="SecuritySettings", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class CreateSecuritySettingsRequest(proto.Message): @@ -122,9 +143,14 @@ class CreateSecuritySettingsRequest(proto.Message): Required. The security settings to create. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) security_settings = proto.Field( - proto.MESSAGE, number=2, message="SecuritySettings", + proto.MESSAGE, + number=2, + message="SecuritySettings", ) @@ -139,7 +165,10 @@ class DeleteSecuritySettingsRequest(proto.Message): ``projects//locations//securitySettings/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class SecuritySettings(proto.Message): @@ -226,6 +255,27 @@ class SecuritySettings(proto.Message): purge_data_types (Sequence[google.cloud.dialogflowcx_v3.types.SecuritySettings.PurgeDataType]): List of types of data to remove when retention settings triggers purge. + audio_export_settings (google.cloud.dialogflowcx_v3.types.SecuritySettings.AudioExportSettings): + Controls audio export settings for post-conversation + analytics when ingesting audio to conversations via + [Participants.AnalyzeContent][] or + [Participants.StreamingAnalyzeContent][]. + + If + [retention_strategy][google.cloud.dialogflow.cx.v3.SecuritySettings.retention_strategy] + is set to REMOVE_AFTER_CONVERSATION or + [audio_export_settings.gcs_bucket][] is empty, audio export + is disabled. + + If audio export is enabled, audio is recorded and saved to + [audio_export_settings.gcs_bucket][], subject to retention + policy of [audio_export_settings.gcs_bucket][]. + + This setting won't effect audio input for implicit sessions + via + [Sessions.DetectIntent][google.cloud.dialogflow.cx.v3.Sessions.DetectIntent] + or + [Sessions.StreamingDetectIntent][google.cloud.dialogflow.cx.v3.Sessions.StreamingDetectIntent]. insights_export_settings (google.cloud.dialogflowcx_v3.types.SecuritySettings.InsightsExportSettings): Controls conversation exporting settings to Insights after conversation is completed. @@ -253,6 +303,51 @@ class PurgeDataType(proto.Enum): PURGE_DATA_TYPE_UNSPECIFIED = 0 DIALOGFLOW_HISTORY = 1 + class AudioExportSettings(proto.Message): + r"""Settings for exporting audio. + + Attributes: + gcs_bucket (str): + Cloud Storage bucket to export audio record to. You need to + grant + ``service-@gcp-sa-dialogflow.iam.gserviceaccount.com`` + the ``Storage Object Admin`` role in this bucket. + audio_export_pattern (str): + Filename pattern for exported audio. + enable_audio_redaction (bool): + Enable audio redaction if it is true. + audio_format (google.cloud.dialogflowcx_v3.types.SecuritySettings.AudioExportSettings.AudioFormat): + File format for exported audio file. + Currently only in telephony recordings. + """ + + class AudioFormat(proto.Enum): + r"""File format for exported audio file. Currently only in + telephony recordings. + """ + AUDIO_FORMAT_UNSPECIFIED = 0 + MULAW = 1 + MP3 = 2 + OGG = 3 + + gcs_bucket = proto.Field( + proto.STRING, + number=1, + ) + audio_export_pattern = proto.Field( + proto.STRING, + number=2, + ) + enable_audio_redaction = proto.Field( + proto.BOOL, + number=3, + ) + audio_format = proto.Field( + proto.ENUM, + number=4, + enum="SecuritySettings.AudioExportSettings.AudioFormat", + ) + class InsightsExportSettings(proto.Message): r"""Settings for exporting conversations to `Insights `__. @@ -264,18 +359,56 @@ class InsightsExportSettings(proto.Message): analyzers. """ - enable_insights_export = proto.Field(proto.BOOL, number=1,) + enable_insights_export = proto.Field( + proto.BOOL, + number=1, + ) - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - redaction_strategy = proto.Field(proto.ENUM, number=3, enum=RedactionStrategy,) - redaction_scope = proto.Field(proto.ENUM, number=4, enum=RedactionScope,) - inspect_template = proto.Field(proto.STRING, number=9,) - deidentify_template = proto.Field(proto.STRING, number=17,) - retention_window_days = proto.Field(proto.INT32, number=6, oneof="data_retention",) - purge_data_types = proto.RepeatedField(proto.ENUM, number=8, enum=PurgeDataType,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + redaction_strategy = proto.Field( + proto.ENUM, + number=3, + enum=RedactionStrategy, + ) + redaction_scope = proto.Field( + proto.ENUM, + number=4, + enum=RedactionScope, + ) + inspect_template = proto.Field( + proto.STRING, + number=9, + ) + deidentify_template = proto.Field( + proto.STRING, + number=17, + ) + retention_window_days = proto.Field( + proto.INT32, + number=6, + oneof="data_retention", + ) + purge_data_types = proto.RepeatedField( + proto.ENUM, + number=8, + enum=PurgeDataType, + ) + audio_export_settings = proto.Field( + proto.MESSAGE, + number=12, + message=AudioExportSettings, + ) insights_export_settings = proto.Field( - proto.MESSAGE, number=13, message=InsightsExportSettings, + proto.MESSAGE, + number=13, + message=InsightsExportSettings, ) diff --git a/google/cloud/dialogflowcx_v3/types/session.py b/google/cloud/dialogflowcx_v3/types/session.py index 8fc20051..c13f5bc1 100644 --- a/google/cloud/dialogflowcx_v3/types/session.py +++ b/google/cloud/dialogflowcx_v3/types/session.py @@ -83,11 +83,24 @@ class DetectIntentRequest(proto.Message): generate the output audio. """ - session = proto.Field(proto.STRING, number=1,) - query_params = proto.Field(proto.MESSAGE, number=2, message="QueryParameters",) - query_input = proto.Field(proto.MESSAGE, number=3, message="QueryInput",) + session = proto.Field( + proto.STRING, + number=1, + ) + query_params = proto.Field( + proto.MESSAGE, + number=2, + message="QueryParameters", + ) + query_input = proto.Field( + proto.MESSAGE, + number=3, + message="QueryInput", + ) output_audio_config = proto.Field( - proto.MESSAGE, number=4, message=audio_config.OutputAudioConfig, + proto.MESSAGE, + number=4, + message=audio_config.OutputAudioConfig, ) @@ -133,14 +146,33 @@ class ResponseType(proto.Enum): PARTIAL = 1 FINAL = 2 - response_id = proto.Field(proto.STRING, number=1,) - query_result = proto.Field(proto.MESSAGE, number=2, message="QueryResult",) - output_audio = proto.Field(proto.BYTES, number=4,) + response_id = proto.Field( + proto.STRING, + number=1, + ) + query_result = proto.Field( + proto.MESSAGE, + number=2, + message="QueryResult", + ) + output_audio = proto.Field( + proto.BYTES, + number=4, + ) output_audio_config = proto.Field( - proto.MESSAGE, number=5, message=audio_config.OutputAudioConfig, + proto.MESSAGE, + number=5, + message=audio_config.OutputAudioConfig, + ) + response_type = proto.Field( + proto.ENUM, + number=6, + enum=ResponseType, + ) + allow_cancellation = proto.Field( + proto.BOOL, + number=7, ) - response_type = proto.Field(proto.ENUM, number=6, enum=ResponseType,) - allow_cancellation = proto.Field(proto.BOOL, number=7,) class StreamingDetectIntentRequest(proto.Message): @@ -213,13 +245,29 @@ class StreamingDetectIntentRequest(proto.Message): the agent have been configured to return partial responses. """ - session = proto.Field(proto.STRING, number=1,) - query_params = proto.Field(proto.MESSAGE, number=2, message="QueryParameters",) - query_input = proto.Field(proto.MESSAGE, number=3, message="QueryInput",) + session = proto.Field( + proto.STRING, + number=1, + ) + query_params = proto.Field( + proto.MESSAGE, + number=2, + message="QueryParameters", + ) + query_input = proto.Field( + proto.MESSAGE, + number=3, + message="QueryInput", + ) output_audio_config = proto.Field( - proto.MESSAGE, number=4, message=audio_config.OutputAudioConfig, + proto.MESSAGE, + number=4, + message=audio_config.OutputAudioConfig, + ) + enable_partial_response = proto.Field( + proto.BOOL, + number=5, ) - enable_partial_response = proto.Field(proto.BOOL, number=5,) class StreamingDetectIntentResponse(proto.Message): @@ -271,10 +319,16 @@ class StreamingDetectIntentResponse(proto.Message): """ recognition_result = proto.Field( - proto.MESSAGE, number=1, oneof="response", message="StreamingRecognitionResult", + proto.MESSAGE, + number=1, + oneof="response", + message="StreamingRecognitionResult", ) detect_intent_response = proto.Field( - proto.MESSAGE, number=2, oneof="response", message="DetectIntentResponse", + proto.MESSAGE, + number=2, + oneof="response", + message="DetectIntentResponse", ) @@ -373,18 +427,41 @@ class MessageType(proto.Enum): TRANSCRIPT = 1 END_OF_SINGLE_UTTERANCE = 2 - message_type = proto.Field(proto.ENUM, number=1, enum=MessageType,) - transcript = proto.Field(proto.STRING, number=2,) - is_final = proto.Field(proto.BOOL, number=3,) - confidence = proto.Field(proto.FLOAT, number=4,) - stability = proto.Field(proto.FLOAT, number=6,) + message_type = proto.Field( + proto.ENUM, + number=1, + enum=MessageType, + ) + transcript = proto.Field( + proto.STRING, + number=2, + ) + is_final = proto.Field( + proto.BOOL, + number=3, + ) + confidence = proto.Field( + proto.FLOAT, + number=4, + ) + stability = proto.Field( + proto.FLOAT, + number=6, + ) speech_word_info = proto.RepeatedField( - proto.MESSAGE, number=7, message=audio_config.SpeechWordInfo, + proto.MESSAGE, + number=7, + message=audio_config.SpeechWordInfo, ) speech_end_offset = proto.Field( - proto.MESSAGE, number=8, message=duration_pb2.Duration, + proto.MESSAGE, + number=8, + message=duration_pb2.Duration, + ) + language_code = proto.Field( + proto.STRING, + number=10, ) - language_code = proto.Field(proto.STRING, number=10,) class QueryParameters(proto.Message): @@ -435,18 +512,13 @@ class QueryParameters(proto.Message): - MapKey type: string - MapKey value: parameter name - - MapValue type: - - - If parameter's entity type is a composite entity: map - - Else: depending on parameter value type, could be one - of string, number, boolean, null, list or map - - - MapValue value: - - - If parameter's entity type is a composite entity: map - from composite entity property names to property - values - - Else: parameter value + - MapValue type: If parameter's entity type is a composite + entity then use map, otherwise, depending on the + parameter value type, it could be one of string, number, + boolean, null, list or map. + - MapValue value: If parameter's entity type is a composite + entity then use map from composite entity property names + to property values, otherwise, use parameter value. current_page (str): The unique identifier of the [page][google.cloud.dialogflow.cx.v3.Page] to override the @@ -470,7 +542,7 @@ class QueryParameters(proto.Message): Configures whether sentiment analysis should be performed. If not provided, sentiment analysis is not performed. - webhook_headers (Sequence[google.cloud.dialogflowcx_v3.types.QueryParameters.WebhookHeadersEntry]): + webhook_headers (Mapping[str, str]): This field can be used to pass HTTP headers for a webhook call. These headers will be sent to webhook along with the headers that have been @@ -494,18 +566,51 @@ class QueryParameters(proto.Message): at most one version specified in this list. """ - time_zone = proto.Field(proto.STRING, number=1,) - geo_location = proto.Field(proto.MESSAGE, number=2, message=latlng_pb2.LatLng,) + time_zone = proto.Field( + proto.STRING, + number=1, + ) + geo_location = proto.Field( + proto.MESSAGE, + number=2, + message=latlng_pb2.LatLng, + ) session_entity_types = proto.RepeatedField( - proto.MESSAGE, number=3, message=session_entity_type.SessionEntityType, + proto.MESSAGE, + number=3, + message=session_entity_type.SessionEntityType, + ) + payload = proto.Field( + proto.MESSAGE, + number=4, + message=struct_pb2.Struct, + ) + parameters = proto.Field( + proto.MESSAGE, + number=5, + message=struct_pb2.Struct, + ) + current_page = proto.Field( + proto.STRING, + number=6, + ) + disable_webhook = proto.Field( + proto.BOOL, + number=7, + ) + analyze_query_text_sentiment = proto.Field( + proto.BOOL, + number=8, + ) + webhook_headers = proto.MapField( + proto.STRING, + proto.STRING, + number=10, + ) + flow_versions = proto.RepeatedField( + proto.STRING, + number=14, ) - payload = proto.Field(proto.MESSAGE, number=4, message=struct_pb2.Struct,) - parameters = proto.Field(proto.MESSAGE, number=5, message=struct_pb2.Struct,) - current_page = proto.Field(proto.STRING, number=6,) - disable_webhook = proto.Field(proto.BOOL, number=7,) - analyze_query_text_sentiment = proto.Field(proto.BOOL, number=8,) - webhook_headers = proto.MapField(proto.STRING, proto.STRING, number=10,) - flow_versions = proto.RepeatedField(proto.STRING, number=14,) class QueryInput(proto.Message): @@ -554,12 +659,40 @@ class QueryInput(proto.Message): specify the same language. """ - text = proto.Field(proto.MESSAGE, number=2, oneof="input", message="TextInput",) - intent = proto.Field(proto.MESSAGE, number=3, oneof="input", message="IntentInput",) - audio = proto.Field(proto.MESSAGE, number=5, oneof="input", message="AudioInput",) - event = proto.Field(proto.MESSAGE, number=6, oneof="input", message="EventInput",) - dtmf = proto.Field(proto.MESSAGE, number=7, oneof="input", message="DtmfInput",) - language_code = proto.Field(proto.STRING, number=4,) + text = proto.Field( + proto.MESSAGE, + number=2, + oneof="input", + message="TextInput", + ) + intent = proto.Field( + proto.MESSAGE, + number=3, + oneof="input", + message="IntentInput", + ) + audio = proto.Field( + proto.MESSAGE, + number=5, + oneof="input", + message="AudioInput", + ) + event = proto.Field( + proto.MESSAGE, + number=6, + oneof="input", + message="EventInput", + ) + dtmf = proto.Field( + proto.MESSAGE, + number=7, + oneof="input", + message="DtmfInput", + ) + language_code = proto.Field( + proto.STRING, + number=4, + ) class QueryResult(proto.Message): @@ -620,18 +753,13 @@ class QueryResult(proto.Message): - MapKey type: string - MapKey value: parameter name - - MapValue type: - - - If parameter's entity type is a composite entity: map - - Else: depending on parameter value type, could be one - of string, number, boolean, null, list or map - - - MapValue value: - - - If parameter's entity type is a composite entity: map - from composite entity property names to property - values - - Else: parameter value + - MapValue type: If parameter's entity type is a composite + entity then use map, otherwise, depending on the + parameter value type, it could be one of string, number, + boolean, null, list or map. + - MapValue value: If parameter's entity type is a composite + entity then use map from composite entity property names + to property values, otherwise, use parameter value. response_messages (Sequence[google.cloud.dialogflowcx_v3.types.ResponseMessage]): The list of rich messages returned to the client. Responses vary from simple text messages @@ -683,29 +811,84 @@ class QueryResult(proto.Message): specified in the request. """ - text = proto.Field(proto.STRING, number=1, oneof="query",) - trigger_intent = proto.Field(proto.STRING, number=11, oneof="query",) - transcript = proto.Field(proto.STRING, number=12, oneof="query",) - trigger_event = proto.Field(proto.STRING, number=14, oneof="query",) - dtmf = proto.Field(proto.MESSAGE, number=23, oneof="query", message="DtmfInput",) - language_code = proto.Field(proto.STRING, number=2,) - parameters = proto.Field(proto.MESSAGE, number=3, message=struct_pb2.Struct,) + text = proto.Field( + proto.STRING, + number=1, + oneof="query", + ) + trigger_intent = proto.Field( + proto.STRING, + number=11, + oneof="query", + ) + transcript = proto.Field( + proto.STRING, + number=12, + oneof="query", + ) + trigger_event = proto.Field( + proto.STRING, + number=14, + oneof="query", + ) + dtmf = proto.Field( + proto.MESSAGE, + number=23, + oneof="query", + message="DtmfInput", + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) + parameters = proto.Field( + proto.MESSAGE, + number=3, + message=struct_pb2.Struct, + ) response_messages = proto.RepeatedField( - proto.MESSAGE, number=4, message=response_message.ResponseMessage, + proto.MESSAGE, + number=4, + message=response_message.ResponseMessage, ) webhook_statuses = proto.RepeatedField( - proto.MESSAGE, number=13, message=status_pb2.Status, + proto.MESSAGE, + number=13, + message=status_pb2.Status, ) webhook_payloads = proto.RepeatedField( - proto.MESSAGE, number=6, message=struct_pb2.Struct, + proto.MESSAGE, + number=6, + message=struct_pb2.Struct, + ) + current_page = proto.Field( + proto.MESSAGE, + number=7, + message=page.Page, + ) + intent = proto.Field( + proto.MESSAGE, + number=8, + message=gcdc_intent.Intent, + ) + intent_detection_confidence = proto.Field( + proto.FLOAT, + number=9, + ) + match = proto.Field( + proto.MESSAGE, + number=15, + message="Match", + ) + diagnostic_info = proto.Field( + proto.MESSAGE, + number=10, + message=struct_pb2.Struct, ) - current_page = proto.Field(proto.MESSAGE, number=7, message=page.Page,) - intent = proto.Field(proto.MESSAGE, number=8, message=gcdc_intent.Intent,) - intent_detection_confidence = proto.Field(proto.FLOAT, number=9,) - match = proto.Field(proto.MESSAGE, number=15, message="Match",) - diagnostic_info = proto.Field(proto.MESSAGE, number=10, message=struct_pb2.Struct,) sentiment_analysis_result = proto.Field( - proto.MESSAGE, number=17, message="SentimentAnalysisResult", + proto.MESSAGE, + number=17, + message="SentimentAnalysisResult", ) @@ -719,7 +902,10 @@ class TextInput(proto.Message): exceed 256 characters. """ - text = proto.Field(proto.STRING, number=1,) + text = proto.Field( + proto.STRING, + number=1, + ) class IntentInput(proto.Message): @@ -732,7 +918,10 @@ class IntentInput(proto.Message): ``projects//locations//agents//intents/``. """ - intent = proto.Field(proto.STRING, number=1,) + intent = proto.Field( + proto.STRING, + number=1, + ) class AudioInput(proto.Message): @@ -756,9 +945,14 @@ class AudioInput(proto.Message): """ config = proto.Field( - proto.MESSAGE, number=1, message=audio_config.InputAudioConfig, + proto.MESSAGE, + number=1, + message=audio_config.InputAudioConfig, + ) + audio = proto.Field( + proto.BYTES, + number=2, ) - audio = proto.Field(proto.BYTES, number=2,) class EventInput(proto.Message): @@ -769,7 +963,10 @@ class EventInput(proto.Message): Name of the event. """ - event = proto.Field(proto.STRING, number=1,) + event = proto.Field( + proto.STRING, + number=1, + ) class DtmfInput(proto.Message): @@ -782,8 +979,14 @@ class DtmfInput(proto.Message): The finish digit (if any). """ - digits = proto.Field(proto.STRING, number=1,) - finish_digit = proto.Field(proto.STRING, number=2,) + digits = proto.Field( + proto.STRING, + number=1, + ) + finish_digit = proto.Field( + proto.STRING, + number=2, + ) class Match(proto.Message): @@ -805,25 +1008,22 @@ class Match(proto.Message): [``NO_INPUT``][google.cloud.dialogflow.cx.v3.Match.MatchType] match types. parameters (google.protobuf.struct_pb2.Struct): - The collection of parameters extracted from - the query. - Depending on your protocol or client library - language, this is a map, associative array, - symbol table, dictionary, or JSON object - composed of a collection of (MapKey, MapValue) + The collection of parameters extracted from the query. + + Depending on your protocol or client library language, this + is a map, associative array, symbol table, dictionary, or + JSON object composed of a collection of (MapKey, MapValue) pairs: - - MapKey type: string - - MapKey value: parameter name - - MapValue type: - - If parameter's entity type is a - composite entity: map - Else: depending on - parameter value type, could be one of string, - number, boolean, null, list or map - - MapValue value: - - If parameter's entity type is a - composite entity: map from composite - entity property names to property values - - Else: parameter value + + - MapKey type: string + - MapKey value: parameter name + - MapValue type: If parameter's entity type is a composite + entity then use map, otherwise, depending on the + parameter value type, it could be one of string, number, + boolean, null, list or map. + - MapValue value: If parameter's entity type is a composite + entity then use map from composite entity property names + to property values, otherwise, use parameter value. resolved_input (str): Final text input which was matched during MatchIntent. This value can be different from @@ -853,12 +1053,33 @@ class MatchType(proto.Enum): NO_INPUT = 5 EVENT = 6 - intent = proto.Field(proto.MESSAGE, number=1, message=gcdc_intent.Intent,) - event = proto.Field(proto.STRING, number=6,) - parameters = proto.Field(proto.MESSAGE, number=2, message=struct_pb2.Struct,) - resolved_input = proto.Field(proto.STRING, number=3,) - match_type = proto.Field(proto.ENUM, number=4, enum=MatchType,) - confidence = proto.Field(proto.FLOAT, number=5,) + intent = proto.Field( + proto.MESSAGE, + number=1, + message=gcdc_intent.Intent, + ) + event = proto.Field( + proto.STRING, + number=6, + ) + parameters = proto.Field( + proto.MESSAGE, + number=2, + message=struct_pb2.Struct, + ) + resolved_input = proto.Field( + proto.STRING, + number=3, + ) + match_type = proto.Field( + proto.ENUM, + number=4, + enum=MatchType, + ) + confidence = proto.Field( + proto.FLOAT, + number=5, + ) class MatchIntentRequest(proto.Message): @@ -885,9 +1106,20 @@ class MatchIntentRequest(proto.Message): Required. The input specification. """ - session = proto.Field(proto.STRING, number=1,) - query_params = proto.Field(proto.MESSAGE, number=2, message="QueryParameters",) - query_input = proto.Field(proto.MESSAGE, number=3, message="QueryInput",) + session = proto.Field( + proto.STRING, + number=1, + ) + query_params = proto.Field( + proto.MESSAGE, + number=2, + message="QueryParameters", + ) + query_input = proto.Field( + proto.MESSAGE, + number=3, + message="QueryInput", + ) class MatchIntentResponse(proto.Message): @@ -937,12 +1169,36 @@ class MatchIntentResponse(proto.Message): but not limited to ``name`` and ``display_name``. """ - text = proto.Field(proto.STRING, number=1, oneof="query",) - trigger_intent = proto.Field(proto.STRING, number=2, oneof="query",) - transcript = proto.Field(proto.STRING, number=3, oneof="query",) - trigger_event = proto.Field(proto.STRING, number=6, oneof="query",) - matches = proto.RepeatedField(proto.MESSAGE, number=4, message="Match",) - current_page = proto.Field(proto.MESSAGE, number=5, message=page.Page,) + text = proto.Field( + proto.STRING, + number=1, + oneof="query", + ) + trigger_intent = proto.Field( + proto.STRING, + number=2, + oneof="query", + ) + transcript = proto.Field( + proto.STRING, + number=3, + oneof="query", + ) + trigger_event = proto.Field( + proto.STRING, + number=6, + oneof="query", + ) + matches = proto.RepeatedField( + proto.MESSAGE, + number=4, + message="Match", + ) + current_page = proto.Field( + proto.MESSAGE, + number=5, + message=page.Page, + ) class FulfillIntentRequest(proto.Message): @@ -960,11 +1216,19 @@ class FulfillIntentRequest(proto.Message): """ match_intent_request = proto.Field( - proto.MESSAGE, number=1, message="MatchIntentRequest", + proto.MESSAGE, + number=1, + message="MatchIntentRequest", + ) + match = proto.Field( + proto.MESSAGE, + number=2, + message="Match", ) - match = proto.Field(proto.MESSAGE, number=2, message="Match",) output_audio_config = proto.Field( - proto.MESSAGE, number=3, message=audio_config.OutputAudioConfig, + proto.MESSAGE, + number=3, + message=audio_config.OutputAudioConfig, ) @@ -997,11 +1261,23 @@ class FulfillIntentResponse(proto.Message): generate the output audio. """ - response_id = proto.Field(proto.STRING, number=1,) - query_result = proto.Field(proto.MESSAGE, number=2, message="QueryResult",) - output_audio = proto.Field(proto.BYTES, number=3,) + response_id = proto.Field( + proto.STRING, + number=1, + ) + query_result = proto.Field( + proto.MESSAGE, + number=2, + message="QueryResult", + ) + output_audio = proto.Field( + proto.BYTES, + number=3, + ) output_audio_config = proto.Field( - proto.MESSAGE, number=4, message=audio_config.OutputAudioConfig, + proto.MESSAGE, + number=4, + message=audio_config.OutputAudioConfig, ) @@ -1021,8 +1297,14 @@ class SentimentAnalysisResult(proto.Message): of score (positive or negative). """ - score = proto.Field(proto.FLOAT, number=1,) - magnitude = proto.Field(proto.FLOAT, number=2,) + score = proto.Field( + proto.FLOAT, + number=1, + ) + magnitude = proto.Field( + proto.FLOAT, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3/types/session_entity_type.py b/google/cloud/dialogflowcx_v3/types/session_entity_type.py index a06adb54..19f916b6 100644 --- a/google/cloud/dialogflowcx_v3/types/session_entity_type.py +++ b/google/cloud/dialogflowcx_v3/types/session_entity_type.py @@ -74,10 +74,19 @@ class EntityOverrideMode(proto.Enum): ENTITY_OVERRIDE_MODE_OVERRIDE = 1 ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2 - name = proto.Field(proto.STRING, number=1,) - entity_override_mode = proto.Field(proto.ENUM, number=3, enum=EntityOverrideMode,) + name = proto.Field( + proto.STRING, + number=1, + ) + entity_override_mode = proto.Field( + proto.ENUM, + number=3, + enum=EntityOverrideMode, + ) entities = proto.RepeatedField( - proto.MESSAGE, number=4, message=entity_type.EntityType.Entity, + proto.MESSAGE, + number=4, + message=entity_type.EntityType.Entity, ) @@ -102,9 +111,18 @@ class ListSessionEntityTypesRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListSessionEntityTypesResponse(proto.Message): @@ -127,9 +145,14 @@ def raw_page(self): return self session_entity_types = proto.RepeatedField( - proto.MESSAGE, number=1, message="SessionEntityType", + proto.MESSAGE, + number=1, + message="SessionEntityType", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class GetSessionEntityTypeRequest(proto.Message): @@ -146,7 +169,10 @@ class GetSessionEntityTypeRequest(proto.Message): 'draft' environment. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateSessionEntityTypeRequest(proto.Message): @@ -166,9 +192,14 @@ class CreateSessionEntityTypeRequest(proto.Message): Required. The session entity type to create. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) session_entity_type = proto.Field( - proto.MESSAGE, number=2, message="SessionEntityType", + proto.MESSAGE, + number=2, + message="SessionEntityType", ) @@ -189,10 +220,14 @@ class UpdateSessionEntityTypeRequest(proto.Message): """ session_entity_type = proto.Field( - proto.MESSAGE, number=1, message="SessionEntityType", + proto.MESSAGE, + number=1, + message="SessionEntityType", ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -211,7 +246,10 @@ class DeleteSessionEntityTypeRequest(proto.Message): 'draft' environment. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3/types/test_case.py b/google/cloud/dialogflowcx_v3/types/test_case.py index 020edbfe..f86875cc 100644 --- a/google/cloud/dialogflowcx_v3/types/test_case.py +++ b/google/cloud/dialogflowcx_v3/types/test_case.py @@ -110,18 +110,42 @@ class TestCase(proto.Message): The latest test result. """ - name = proto.Field(proto.STRING, number=1,) - tags = proto.RepeatedField(proto.STRING, number=2,) - display_name = proto.Field(proto.STRING, number=3,) - notes = proto.Field(proto.STRING, number=4,) - test_config = proto.Field(proto.MESSAGE, number=13, message="TestConfig",) + name = proto.Field( + proto.STRING, + number=1, + ) + tags = proto.RepeatedField( + proto.STRING, + number=2, + ) + display_name = proto.Field( + proto.STRING, + number=3, + ) + notes = proto.Field( + proto.STRING, + number=4, + ) + test_config = proto.Field( + proto.MESSAGE, + number=13, + message="TestConfig", + ) test_case_conversation_turns = proto.RepeatedField( - proto.MESSAGE, number=5, message="ConversationTurn", + proto.MESSAGE, + number=5, + message="ConversationTurn", ) creation_time = proto.Field( - proto.MESSAGE, number=10, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=10, + message=timestamp_pb2.Timestamp, + ) + last_test_result = proto.Field( + proto.MESSAGE, + number=12, + message="TestCaseResult", ) - last_test_result = proto.Field(proto.MESSAGE, number=12, message="TestCaseResult",) class TestCaseResult(proto.Message): @@ -145,13 +169,29 @@ class TestCaseResult(proto.Message): The time that the test was run. """ - name = proto.Field(proto.STRING, number=1,) - environment = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + environment = proto.Field( + proto.STRING, + number=2, + ) conversation_turns = proto.RepeatedField( - proto.MESSAGE, number=3, message="ConversationTurn", + proto.MESSAGE, + number=3, + message="ConversationTurn", + ) + test_result = proto.Field( + proto.ENUM, + number=4, + enum="TestResult", + ) + test_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, ) - test_result = proto.Field(proto.ENUM, number=4, enum="TestResult",) - test_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) class TestConfig(proto.Message): @@ -182,9 +222,18 @@ class TestConfig(proto.Message): start flow. """ - tracking_parameters = proto.RepeatedField(proto.STRING, number=1,) - flow = proto.Field(proto.STRING, number=2,) - page = proto.Field(proto.STRING, number=3,) + tracking_parameters = proto.RepeatedField( + proto.STRING, + number=1, + ) + flow = proto.Field( + proto.STRING, + number=2, + ) + page = proto.Field( + proto.STRING, + number=3, + ) class ConversationTurn(proto.Message): @@ -221,12 +270,24 @@ class UserInput(proto.Message): Whether sentiment analysis is enabled. """ - input = proto.Field(proto.MESSAGE, number=5, message=session.QueryInput,) + input = proto.Field( + proto.MESSAGE, + number=5, + message=session.QueryInput, + ) injected_parameters = proto.Field( - proto.MESSAGE, number=2, message=struct_pb2.Struct, + proto.MESSAGE, + number=2, + message=struct_pb2.Struct, + ) + is_webhook_enabled = proto.Field( + proto.BOOL, + number=3, + ) + enable_sentiment_analysis = proto.Field( + proto.BOOL, + number=7, ) - is_webhook_enabled = proto.Field(proto.BOOL, number=3,) - enable_sentiment_analysis = proto.Field(proto.BOOL, number=7,) class VirtualAgentOutput(proto.Message): r"""The output from the virtual agent. @@ -262,26 +323,50 @@ class VirtualAgentOutput(proto.Message): """ session_parameters = proto.Field( - proto.MESSAGE, number=4, message=struct_pb2.Struct, + proto.MESSAGE, + number=4, + message=struct_pb2.Struct, ) differences = proto.RepeatedField( - proto.MESSAGE, number=5, message="TestRunDifference", + proto.MESSAGE, + number=5, + message="TestRunDifference", ) diagnostic_info = proto.Field( - proto.MESSAGE, number=6, message=struct_pb2.Struct, + proto.MESSAGE, + number=6, + message=struct_pb2.Struct, ) triggered_intent = proto.Field( - proto.MESSAGE, number=7, message=gcdc_intent.Intent, + proto.MESSAGE, + number=7, + message=gcdc_intent.Intent, + ) + current_page = proto.Field( + proto.MESSAGE, + number=8, + message=gcdc_page.Page, ) - current_page = proto.Field(proto.MESSAGE, number=8, message=gcdc_page.Page,) text_responses = proto.RepeatedField( - proto.MESSAGE, number=9, message=response_message.ResponseMessage.Text, + proto.MESSAGE, + number=9, + message=response_message.ResponseMessage.Text, + ) + status = proto.Field( + proto.MESSAGE, + number=10, + message=status_pb2.Status, ) - status = proto.Field(proto.MESSAGE, number=10, message=status_pb2.Status,) - user_input = proto.Field(proto.MESSAGE, number=1, message=UserInput,) + user_input = proto.Field( + proto.MESSAGE, + number=1, + message=UserInput, + ) virtual_agent_output = proto.Field( - proto.MESSAGE, number=2, message=VirtualAgentOutput, + proto.MESSAGE, + number=2, + message=VirtualAgentOutput, ) @@ -305,8 +390,15 @@ class DiffType(proto.Enum): PARAMETERS = 3 UTTERANCE = 4 - type_ = proto.Field(proto.ENUM, number=1, enum=DiffType,) - description = proto.Field(proto.STRING, number=2,) + type_ = proto.Field( + proto.ENUM, + number=1, + enum=DiffType, + ) + description = proto.Field( + proto.STRING, + number=2, + ) class TransitionCoverage(proto.Message): @@ -349,10 +441,16 @@ class TransitionNode(proto.Message): """ page = proto.Field( - proto.MESSAGE, number=1, oneof="kind", message=gcdc_page.Page, + proto.MESSAGE, + number=1, + oneof="kind", + message=gcdc_page.Page, ) flow = proto.Field( - proto.MESSAGE, number=2, oneof="kind", message=gcdc_flow.Flow, + proto.MESSAGE, + number=2, + oneof="kind", + message=gcdc_flow.Flow, ) class Transition(proto.Message): @@ -387,22 +485,45 @@ class Transition(proto.Message): """ source = proto.Field( - proto.MESSAGE, number=1, message="TransitionCoverage.TransitionNode", + proto.MESSAGE, + number=1, + message="TransitionCoverage.TransitionNode", + ) + index = proto.Field( + proto.INT32, + number=4, ) - index = proto.Field(proto.INT32, number=4,) target = proto.Field( - proto.MESSAGE, number=2, message="TransitionCoverage.TransitionNode", + proto.MESSAGE, + number=2, + message="TransitionCoverage.TransitionNode", + ) + covered = proto.Field( + proto.BOOL, + number=3, ) - covered = proto.Field(proto.BOOL, number=3,) transition_route = proto.Field( - proto.MESSAGE, number=5, oneof="detail", message=gcdc_page.TransitionRoute, + proto.MESSAGE, + number=5, + oneof="detail", + message=gcdc_page.TransitionRoute, ) event_handler = proto.Field( - proto.MESSAGE, number=6, oneof="detail", message=gcdc_page.EventHandler, + proto.MESSAGE, + number=6, + oneof="detail", + message=gcdc_page.EventHandler, ) - transitions = proto.RepeatedField(proto.MESSAGE, number=1, message=Transition,) - coverage_score = proto.Field(proto.FLOAT, number=2,) + transitions = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=Transition, + ) + coverage_score = proto.Field( + proto.FLOAT, + number=2, + ) class TransitionRouteGroupCoverage(proto.Message): @@ -447,9 +568,14 @@ class Transition(proto.Message): """ transition_route = proto.Field( - proto.MESSAGE, number=1, message=gcdc_page.TransitionRoute, + proto.MESSAGE, + number=1, + message=gcdc_page.TransitionRoute, + ) + covered = proto.Field( + proto.BOOL, + number=2, ) - covered = proto.Field(proto.BOOL, number=2,) route_group = proto.Field( proto.MESSAGE, @@ -461,10 +587,20 @@ class Transition(proto.Message): number=2, message="TransitionRouteGroupCoverage.Coverage.Transition", ) - coverage_score = proto.Field(proto.FLOAT, number=3,) + coverage_score = proto.Field( + proto.FLOAT, + number=3, + ) - coverages = proto.RepeatedField(proto.MESSAGE, number=1, message=Coverage,) - coverage_score = proto.Field(proto.FLOAT, number=2,) + coverages = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=Coverage, + ) + coverage_score = proto.Field( + proto.FLOAT, + number=2, + ) class IntentCoverage(proto.Message): @@ -491,11 +627,24 @@ class Intent(proto.Message): least one of the agent's test cases. """ - intent = proto.Field(proto.STRING, number=1,) - covered = proto.Field(proto.BOOL, number=2,) + intent = proto.Field( + proto.STRING, + number=1, + ) + covered = proto.Field( + proto.BOOL, + number=2, + ) - intents = proto.RepeatedField(proto.MESSAGE, number=1, message=Intent,) - coverage_score = proto.Field(proto.FLOAT, number=2,) + intents = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=Intent, + ) + coverage_score = proto.Field( + proto.FLOAT, + number=2, + ) class CalculateCoverageRequest(proto.Message): @@ -517,8 +666,15 @@ class CoverageType(proto.Enum): PAGE_TRANSITION = 2 TRANSITION_ROUTE_GROUP = 3 - agent = proto.Field(proto.STRING, number=3,) - type_ = proto.Field(proto.ENUM, number=2, enum=CoverageType,) + agent = proto.Field( + proto.STRING, + number=3, + ) + type_ = proto.Field( + proto.ENUM, + number=2, + enum=CoverageType, + ) class CalculateCoverageResponse(proto.Message): @@ -551,12 +707,21 @@ class CalculateCoverageResponse(proto.Message): This field is a member of `oneof`_ ``coverage_type``. """ - agent = proto.Field(proto.STRING, number=5,) + agent = proto.Field( + proto.STRING, + number=5, + ) intent_coverage = proto.Field( - proto.MESSAGE, number=2, oneof="coverage_type", message="IntentCoverage", + proto.MESSAGE, + number=2, + oneof="coverage_type", + message="IntentCoverage", ) transition_coverage = proto.Field( - proto.MESSAGE, number=4, oneof="coverage_type", message="TransitionCoverage", + proto.MESSAGE, + number=4, + oneof="coverage_type", + message="TransitionCoverage", ) route_group_coverage = proto.Field( proto.MESSAGE, @@ -596,10 +761,23 @@ class TestCaseView(proto.Enum): BASIC = 1 FULL = 2 - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - view = proto.Field(proto.ENUM, number=4, enum=TestCaseView,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + view = proto.Field( + proto.ENUM, + number=4, + enum=TestCaseView, + ) class ListTestCasesResponse(proto.Message): @@ -620,8 +798,15 @@ class ListTestCasesResponse(proto.Message): def raw_page(self): return self - test_cases = proto.RepeatedField(proto.MESSAGE, number=1, message="TestCase",) - next_page_token = proto.Field(proto.STRING, number=2,) + test_cases = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="TestCase", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class BatchDeleteTestCasesRequest(proto.Message): @@ -637,8 +822,14 @@ class BatchDeleteTestCasesRequest(proto.Message): ``projects//locations/ /agents//testCases/``. """ - parent = proto.Field(proto.STRING, number=1,) - names = proto.RepeatedField(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + names = proto.RepeatedField( + proto.STRING, + number=3, + ) class CreateTestCaseRequest(proto.Message): @@ -653,8 +844,15 @@ class CreateTestCaseRequest(proto.Message): Required. The test case to create. """ - parent = proto.Field(proto.STRING, number=1,) - test_case = proto.Field(proto.MESSAGE, number=2, message="TestCase",) + parent = proto.Field( + proto.STRING, + number=1, + ) + test_case = proto.Field( + proto.MESSAGE, + number=2, + message="TestCase", + ) class UpdateTestCaseRequest(proto.Message): @@ -673,9 +871,15 @@ class UpdateTestCaseRequest(proto.Message): cannot be updated. """ - test_case = proto.Field(proto.MESSAGE, number=1, message="TestCase",) + test_case = proto.Field( + proto.MESSAGE, + number=1, + message="TestCase", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -689,7 +893,10 @@ class GetTestCaseRequest(proto.Message): ``projects//locations//agents//testCases/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class RunTestCaseRequest(proto.Message): @@ -706,8 +913,14 @@ class RunTestCaseRequest(proto.Message): ``projects//locations//agents//environments/``. """ - name = proto.Field(proto.STRING, number=1,) - environment = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + environment = proto.Field( + proto.STRING, + number=2, + ) class RunTestCaseResponse(proto.Message): @@ -719,7 +932,11 @@ class RunTestCaseResponse(proto.Message): The result. """ - result = proto.Field(proto.MESSAGE, number=2, message="TestCaseResult",) + result = proto.Field( + proto.MESSAGE, + number=2, + message="TestCaseResult", + ) class RunTestCaseMetadata(proto.Message): @@ -746,9 +963,18 @@ class BatchRunTestCasesRequest(proto.Message): ``projects//locations//agents//testCases/``. """ - parent = proto.Field(proto.STRING, number=1,) - environment = proto.Field(proto.STRING, number=2,) - test_cases = proto.RepeatedField(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + environment = proto.Field( + proto.STRING, + number=2, + ) + test_cases = proto.RepeatedField( + proto.STRING, + number=3, + ) class BatchRunTestCasesResponse(proto.Message): @@ -762,7 +988,11 @@ class BatchRunTestCasesResponse(proto.Message): are empty in this response. """ - results = proto.RepeatedField(proto.MESSAGE, number=1, message="TestCaseResult",) + results = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="TestCaseResult", + ) class BatchRunTestCasesMetadata(proto.Message): @@ -775,7 +1005,11 @@ class BatchRunTestCasesMetadata(proto.Message): The test errors. """ - errors = proto.RepeatedField(proto.MESSAGE, number=1, message="TestError",) + errors = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="TestError", + ) class TestError(proto.Message): @@ -790,9 +1024,20 @@ class TestError(proto.Message): The timestamp when the test was completed. """ - test_case = proto.Field(proto.STRING, number=1,) - status = proto.Field(proto.MESSAGE, number=2, message=status_pb2.Status,) - test_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) + test_case = proto.Field( + proto.STRING, + number=1, + ) + status = proto.Field( + proto.MESSAGE, + number=2, + message=status_pb2.Status, + ) + test_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) class ImportTestCasesRequest(proto.Message): @@ -829,9 +1074,20 @@ class ImportTestCasesRequest(proto.Message): This field is a member of `oneof`_ ``source``. """ - parent = proto.Field(proto.STRING, number=1,) - gcs_uri = proto.Field(proto.STRING, number=2, oneof="source",) - content = proto.Field(proto.BYTES, number=3, oneof="source",) + parent = proto.Field( + proto.STRING, + number=1, + ) + gcs_uri = proto.Field( + proto.STRING, + number=2, + oneof="source", + ) + content = proto.Field( + proto.BYTES, + number=3, + oneof="source", + ) class ImportTestCasesResponse(proto.Message): @@ -844,7 +1100,10 @@ class ImportTestCasesResponse(proto.Message): ``projects//locations//agents//testCases/``. """ - names = proto.RepeatedField(proto.STRING, number=1,) + names = proto.RepeatedField( + proto.STRING, + number=1, + ) class ImportTestCasesMetadata(proto.Message): @@ -857,7 +1116,11 @@ class ImportTestCasesMetadata(proto.Message): Errors for failed test cases. """ - errors = proto.RepeatedField(proto.MESSAGE, number=1, message="TestCaseError",) + errors = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="TestCaseError", + ) class TestCaseError(proto.Message): @@ -870,8 +1133,16 @@ class TestCaseError(proto.Message): The status associated with the test case. """ - test_case = proto.Field(proto.MESSAGE, number=1, message="TestCase",) - status = proto.Field(proto.MESSAGE, number=2, message=status_pb2.Status,) + test_case = proto.Field( + proto.MESSAGE, + number=1, + message="TestCase", + ) + status = proto.Field( + proto.MESSAGE, + number=2, + message=status_pb2.Status, + ) class ExportTestCasesRequest(proto.Message): @@ -921,10 +1192,24 @@ class DataFormat(proto.Enum): BLOB = 1 JSON = 2 - parent = proto.Field(proto.STRING, number=1,) - gcs_uri = proto.Field(proto.STRING, number=2, oneof="destination",) - data_format = proto.Field(proto.ENUM, number=3, enum=DataFormat,) - filter = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + gcs_uri = proto.Field( + proto.STRING, + number=2, + oneof="destination", + ) + data_format = proto.Field( + proto.ENUM, + number=3, + enum=DataFormat, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) class ExportTestCasesResponse(proto.Message): @@ -951,8 +1236,16 @@ class ExportTestCasesResponse(proto.Message): This field is a member of `oneof`_ ``destination``. """ - gcs_uri = proto.Field(proto.STRING, number=1, oneof="destination",) - content = proto.Field(proto.BYTES, number=2, oneof="destination",) + gcs_uri = proto.Field( + proto.STRING, + number=1, + oneof="destination", + ) + content = proto.Field( + proto.BYTES, + number=2, + oneof="destination", + ) class ExportTestCasesMetadata(proto.Message): @@ -1007,10 +1300,22 @@ class ListTestCaseResultsRequest(proto.Message): 1602540713. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) class ListTestCaseResultsResponse(proto.Message): @@ -1031,9 +1336,14 @@ def raw_page(self): return self test_case_results = proto.RepeatedField( - proto.MESSAGE, number=1, message="TestCaseResult", + proto.MESSAGE, + number=1, + message="TestCaseResult", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class GetTestCaseResultRequest(proto.Message): @@ -1046,7 +1356,10 @@ class GetTestCaseResultRequest(proto.Message): ``projects//locations//agents//testCases//results/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3/types/transition_route_group.py b/google/cloud/dialogflowcx_v3/types/transition_route_group.py index 7ba1230c..05f05e58 100644 --- a/google/cloud/dialogflowcx_v3/types/transition_route_group.py +++ b/google/cloud/dialogflowcx_v3/types/transition_route_group.py @@ -45,19 +45,27 @@ class TransitionRouteGroup(proto.Message): populates the name automatically. Format: ``projects//locations//agents//flows//transitionRouteGroups/``. display_name (str): - Required. The human-readable name of the transition route - group, unique within the - [Agent][google.cloud.dialogflow.cx.v3.Agent]. The display - name can be no longer than 30 characters. + Required. The human-readable name of the + transition route group, unique within the flow. + The display name can be no longer than 30 + characters. transition_routes (Sequence[google.cloud.dialogflowcx_v3.types.TransitionRoute]): Transition routes associated with the [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. """ - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) transition_routes = proto.RepeatedField( - proto.MESSAGE, number=5, message=page.TransitionRoute, + proto.MESSAGE, + number=5, + message=page.TransitionRoute, ) @@ -92,10 +100,22 @@ class ListTransitionRouteGroupsRequest(proto.Message): before they can be used. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - language_code = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + language_code = proto.Field( + proto.STRING, + number=4, + ) class ListTransitionRouteGroupsResponse(proto.Message): @@ -120,9 +140,14 @@ def raw_page(self): return self transition_route_groups = proto.RepeatedField( - proto.MESSAGE, number=1, message="TransitionRouteGroup", + proto.MESSAGE, + number=1, + message="TransitionRouteGroup", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class GetTransitionRouteGroupRequest(proto.Message): @@ -151,8 +176,14 @@ class GetTransitionRouteGroupRequest(proto.Message): before they can be used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class CreateTransitionRouteGroupRequest(proto.Message): @@ -184,11 +215,19 @@ class CreateTransitionRouteGroupRequest(proto.Message): before they can be used. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) transition_route_group = proto.Field( - proto.MESSAGE, number=2, message="TransitionRouteGroup", + proto.MESSAGE, + number=2, + message="TransitionRouteGroup", + ) + language_code = proto.Field( + proto.STRING, + number=3, ) - language_code = proto.Field(proto.STRING, number=3,) class UpdateTransitionRouteGroupRequest(proto.Message): @@ -218,12 +257,19 @@ class UpdateTransitionRouteGroupRequest(proto.Message): """ transition_route_group = proto.Field( - proto.MESSAGE, number=1, message="TransitionRouteGroup", + proto.MESSAGE, + number=1, + message="TransitionRouteGroup", ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + language_code = proto.Field( + proto.STRING, + number=3, ) - language_code = proto.Field(proto.STRING, number=3,) class DeleteTransitionRouteGroupRequest(proto.Message): @@ -248,8 +294,14 @@ class DeleteTransitionRouteGroupRequest(proto.Message): transition route group, as well as any reference to it. """ - name = proto.Field(proto.STRING, number=1,) - force = proto.Field(proto.BOOL, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + force = proto.Field( + proto.BOOL, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3/types/validation_message.py b/google/cloud/dialogflowcx_v3/types/validation_message.py index 588c5117..9ae972eb 100644 --- a/google/cloud/dialogflowcx_v3/types/validation_message.py +++ b/google/cloud/dialogflowcx_v3/types/validation_message.py @@ -18,7 +18,10 @@ __protobuf__ = proto.module( package="google.cloud.dialogflow.cx.v3", - manifest={"ValidationMessage", "ResourceName",}, + manifest={ + "ValidationMessage", + "ResourceName", + }, ) @@ -65,13 +68,29 @@ class Severity(proto.Enum): WARNING = 2 ERROR = 3 - resource_type = proto.Field(proto.ENUM, number=1, enum=ResourceType,) - resources = proto.RepeatedField(proto.STRING, number=2,) + resource_type = proto.Field( + proto.ENUM, + number=1, + enum=ResourceType, + ) + resources = proto.RepeatedField( + proto.STRING, + number=2, + ) resource_names = proto.RepeatedField( - proto.MESSAGE, number=6, message="ResourceName", + proto.MESSAGE, + number=6, + message="ResourceName", + ) + severity = proto.Field( + proto.ENUM, + number=3, + enum=Severity, + ) + detail = proto.Field( + proto.STRING, + number=4, ) - severity = proto.Field(proto.ENUM, number=3, enum=Severity,) - detail = proto.Field(proto.STRING, number=4,) class ResourceName(proto.Message): @@ -84,8 +103,14 @@ class ResourceName(proto.Message): Display name. """ - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3/types/version.py b/google/cloud/dialogflowcx_v3/types/version.py index 7a81890a..c62f091f 100644 --- a/google/cloud/dialogflowcx_v3/types/version.py +++ b/google/cloud/dialogflowcx_v3/types/version.py @@ -48,7 +48,10 @@ class CreateVersionOperationMetadata(proto.Message): ``projects//locations//agents//flows//versions/``. """ - version = proto.Field(proto.STRING, number=1,) + version = proto.Field( + proto.STRING, + number=1, + ) class Version(proto.Message): @@ -86,12 +89,33 @@ class State(proto.Enum): SUCCEEDED = 2 FAILED = 3 - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) - nlu_settings = proto.Field(proto.MESSAGE, number=4, message=flow.NluSettings,) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - state = proto.Field(proto.ENUM, number=6, enum=State,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + nlu_settings = proto.Field( + proto.MESSAGE, + number=4, + message=flow.NluSettings, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + state = proto.Field( + proto.ENUM, + number=6, + enum=State, + ) class ListVersionsRequest(proto.Message): @@ -111,9 +135,18 @@ class ListVersionsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListVersionsResponse(proto.Message): @@ -136,8 +169,15 @@ class ListVersionsResponse(proto.Message): def raw_page(self): return self - versions = proto.RepeatedField(proto.MESSAGE, number=1, message="Version",) - next_page_token = proto.Field(proto.STRING, number=2,) + versions = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Version", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetVersionRequest(proto.Message): @@ -151,7 +191,10 @@ class GetVersionRequest(proto.Message): ``projects//locations//agents//flows//versions/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateVersionRequest(proto.Message): @@ -168,8 +211,15 @@ class CreateVersionRequest(proto.Message): Required. The version to create. """ - parent = proto.Field(proto.STRING, number=1,) - version = proto.Field(proto.MESSAGE, number=2, message="Version",) + parent = proto.Field( + proto.STRING, + number=1, + ) + version = proto.Field( + proto.MESSAGE, + number=2, + message="Version", + ) class UpdateVersionRequest(proto.Message): @@ -185,9 +235,15 @@ class UpdateVersionRequest(proto.Message): updated. """ - version = proto.Field(proto.MESSAGE, number=1, message="Version",) + version = proto.Field( + proto.MESSAGE, + number=1, + message="Version", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -203,7 +259,10 @@ class DeleteVersionRequest(proto.Message): ``projects//locations//agents//flows//versions/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class LoadVersionRequest(proto.Message): @@ -224,8 +283,14 @@ class LoadVersionRequest(proto.Message): (i.e. intents, entities, webhooks). """ - name = proto.Field(proto.STRING, number=1,) - allow_override_agent_resources = proto.Field(proto.BOOL, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + allow_override_agent_resources = proto.Field( + proto.BOOL, + number=2, + ) class CompareVersionsRequest(proto.Message): @@ -255,9 +320,18 @@ class CompareVersionsRequest(proto.Message): before they can be used. """ - base_version = proto.Field(proto.STRING, number=1,) - target_version = proto.Field(proto.STRING, number=2,) - language_code = proto.Field(proto.STRING, number=3,) + base_version = proto.Field( + proto.STRING, + number=1, + ) + target_version = proto.Field( + proto.STRING, + number=2, + ) + language_code = proto.Field( + proto.STRING, + number=3, + ) class CompareVersionsResponse(proto.Message): @@ -275,10 +349,18 @@ class CompareVersionsResponse(proto.Message): The timestamp when the two version compares. """ - base_version_content_json = proto.Field(proto.STRING, number=1,) - target_version_content_json = proto.Field(proto.STRING, number=2,) + base_version_content_json = proto.Field( + proto.STRING, + number=1, + ) + target_version_content_json = proto.Field( + proto.STRING, + number=2, + ) compare_time = proto.Field( - proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, ) diff --git a/google/cloud/dialogflowcx_v3/types/webhook.py b/google/cloud/dialogflowcx_v3/types/webhook.py index 6405a98c..a72ea78e 100644 --- a/google/cloud/dialogflowcx_v3/types/webhook.py +++ b/google/cloud/dialogflowcx_v3/types/webhook.py @@ -95,33 +95,47 @@ class GenericWebService(proto.Message): The user name for HTTP Basic authentication. password (str): The password for HTTP Basic authentication. - request_headers (Sequence[google.cloud.dialogflowcx_v3.types.Webhook.GenericWebService.RequestHeadersEntry]): + request_headers (Mapping[str, str]): The HTTP request headers to send together with webhook requests. allowed_ca_certs (Sequence[bytes]): - Optional. Specifies a list of allowed custom - CA certificates (in DER format) for HTTPS - verification. This overrides the default SSL - trust store. If this is empty or unspecified, - Dialogflow will use Google's default trust store - to verify certificates. - N.B. Make sure the HTTPS server certificates are - signed with "subject alt name". For instance a - certificate can be self-signed using the - following command, - openssl x509 -req -days 200 -in - example.com.csr \ -signkey example.com.key - \ - -out example.com.crt \ - -extfile <(printf - "\nsubjectAltName='DNS:www.example.com'") + Optional. Specifies a list of allowed custom CA certificates + (in DER format) for HTTPS verification. This overrides the + default SSL trust store. If this is empty or unspecified, + Dialogflow will use Google's default trust store to verify + certificates. N.B. Make sure the HTTPS server certificates + are signed with "subject alt name". For instance a + certificate can be self-signed using the following command, + + :: + + openssl x509 -req -days 200 -in example.com.csr \ + -signkey example.com.key \ + -out example.com.crt \ + -extfile <(printf "\nsubjectAltName='DNS:www.example.com'") """ - uri = proto.Field(proto.STRING, number=1,) - username = proto.Field(proto.STRING, number=2,) - password = proto.Field(proto.STRING, number=3,) - request_headers = proto.MapField(proto.STRING, proto.STRING, number=4,) - allowed_ca_certs = proto.RepeatedField(proto.BYTES, number=5,) + uri = proto.Field( + proto.STRING, + number=1, + ) + username = proto.Field( + proto.STRING, + number=2, + ) + password = proto.Field( + proto.STRING, + number=3, + ) + request_headers = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + allowed_ca_certs = proto.RepeatedField( + proto.BYTES, + number=5, + ) class ServiceDirectoryConfig(proto.Message): r"""Represents configuration for a `Service @@ -140,21 +154,45 @@ class ServiceDirectoryConfig(proto.Message): webhook. """ - service = proto.Field(proto.STRING, number=1,) + service = proto.Field( + proto.STRING, + number=1, + ) generic_web_service = proto.Field( - proto.MESSAGE, number=2, message="Webhook.GenericWebService", + proto.MESSAGE, + number=2, + message="Webhook.GenericWebService", ) - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) generic_web_service = proto.Field( - proto.MESSAGE, number=4, oneof="webhook", message=GenericWebService, + proto.MESSAGE, + number=4, + oneof="webhook", + message=GenericWebService, ) service_directory = proto.Field( - proto.MESSAGE, number=7, oneof="webhook", message=ServiceDirectoryConfig, + proto.MESSAGE, + number=7, + oneof="webhook", + message=ServiceDirectoryConfig, + ) + timeout = proto.Field( + proto.MESSAGE, + number=6, + message=duration_pb2.Duration, + ) + disabled = proto.Field( + proto.BOOL, + number=5, ) - timeout = proto.Field(proto.MESSAGE, number=6, message=duration_pb2.Duration,) - disabled = proto.Field(proto.BOOL, number=5,) class ListWebhooksRequest(proto.Message): @@ -173,9 +211,18 @@ class ListWebhooksRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListWebhooksResponse(proto.Message): @@ -196,8 +243,15 @@ class ListWebhooksResponse(proto.Message): def raw_page(self): return self - webhooks = proto.RepeatedField(proto.MESSAGE, number=1, message="Webhook",) - next_page_token = proto.Field(proto.STRING, number=2,) + webhooks = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Webhook", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetWebhookRequest(proto.Message): @@ -210,7 +264,10 @@ class GetWebhookRequest(proto.Message): ``projects//locations//agents//webhooks/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateWebhookRequest(proto.Message): @@ -225,8 +282,15 @@ class CreateWebhookRequest(proto.Message): Required. The webhook to create. """ - parent = proto.Field(proto.STRING, number=1,) - webhook = proto.Field(proto.MESSAGE, number=2, message="Webhook",) + parent = proto.Field( + proto.STRING, + number=1, + ) + webhook = proto.Field( + proto.MESSAGE, + number=2, + message="Webhook", + ) class UpdateWebhookRequest(proto.Message): @@ -242,9 +306,15 @@ class UpdateWebhookRequest(proto.Message): updated. """ - webhook = proto.Field(proto.MESSAGE, number=1, message="Webhook",) + webhook = proto.Field( + proto.MESSAGE, + number=1, + message="Webhook", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -271,8 +341,14 @@ class DeleteWebhookRequest(proto.Message): fulfillments that point to this webhook will be removed). """ - name = proto.Field(proto.STRING, number=1,) - force = proto.Field(proto.BOOL, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + force = proto.Field( + proto.BOOL, + number=2, + ) class WebhookRequest(proto.Message): @@ -350,11 +426,18 @@ class FulfillmentInfo(proto.Message): Attributes: tag (str): - Always present. The tag used to identify - which fulfillment is being called. + Always present. The value of the + [Fulfillment.tag][google.cloud.dialogflow.cx.v3.Fulfillment.tag] + field will be populated in this field by Dialogflow when the + associated webhook is called. The tag is typically used by + the webhook service to identify which fulfillment is being + called, but it could be used for other purposes. """ - tag = proto.Field(proto.STRING, number=1,) + tag = proto.Field( + proto.STRING, + number=1, + ) class IntentInfo(proto.Message): r"""Represents intent information communicated to the webhook. @@ -367,7 +450,7 @@ class IntentInfo(proto.Message): display_name (str): Always present. The display name of the last matched [intent][google.cloud.dialogflow.cx.v3.Intent]. - parameters (Sequence[google.cloud.dialogflowcx_v3.types.WebhookRequest.IntentInfo.ParametersEntry]): + parameters (Mapping[str, google.cloud.dialogflowcx_v3.types.WebhookRequest.IntentInfo.IntentParameterValue]): Parameters identified as a result of intent matching. This is a map of the name of the identified parameter to the value of the @@ -392,20 +475,34 @@ class IntentParameterValue(proto.Message): parameter extracted from user utterance. """ - original_value = proto.Field(proto.STRING, number=1,) + original_value = proto.Field( + proto.STRING, + number=1, + ) resolved_value = proto.Field( - proto.MESSAGE, number=2, message=struct_pb2.Value, + proto.MESSAGE, + number=2, + message=struct_pb2.Value, ) - last_matched_intent = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=3,) + last_matched_intent = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=3, + ) parameters = proto.MapField( proto.STRING, proto.MESSAGE, number=2, message="WebhookRequest.IntentInfo.IntentParameterValue", ) - confidence = proto.Field(proto.FLOAT, number=4,) + confidence = proto.Field( + proto.FLOAT, + number=4, + ) class SentimentAnalysisResult(proto.Message): r"""Represents the result of sentiment analysis. @@ -420,25 +517,77 @@ class SentimentAnalysisResult(proto.Message): of score (positive or negative). """ - score = proto.Field(proto.FLOAT, number=1,) - magnitude = proto.Field(proto.FLOAT, number=2,) - - detect_intent_response_id = proto.Field(proto.STRING, number=1,) - text = proto.Field(proto.STRING, number=10, oneof="query",) - trigger_intent = proto.Field(proto.STRING, number=11, oneof="query",) - transcript = proto.Field(proto.STRING, number=12, oneof="query",) - trigger_event = proto.Field(proto.STRING, number=14, oneof="query",) - language_code = proto.Field(proto.STRING, number=15,) - fulfillment_info = proto.Field(proto.MESSAGE, number=6, message=FulfillmentInfo,) - intent_info = proto.Field(proto.MESSAGE, number=3, message=IntentInfo,) - page_info = proto.Field(proto.MESSAGE, number=4, message="PageInfo",) - session_info = proto.Field(proto.MESSAGE, number=5, message="SessionInfo",) + score = proto.Field( + proto.FLOAT, + number=1, + ) + magnitude = proto.Field( + proto.FLOAT, + number=2, + ) + + detect_intent_response_id = proto.Field( + proto.STRING, + number=1, + ) + text = proto.Field( + proto.STRING, + number=10, + oneof="query", + ) + trigger_intent = proto.Field( + proto.STRING, + number=11, + oneof="query", + ) + transcript = proto.Field( + proto.STRING, + number=12, + oneof="query", + ) + trigger_event = proto.Field( + proto.STRING, + number=14, + oneof="query", + ) + language_code = proto.Field( + proto.STRING, + number=15, + ) + fulfillment_info = proto.Field( + proto.MESSAGE, + number=6, + message=FulfillmentInfo, + ) + intent_info = proto.Field( + proto.MESSAGE, + number=3, + message=IntentInfo, + ) + page_info = proto.Field( + proto.MESSAGE, + number=4, + message="PageInfo", + ) + session_info = proto.Field( + proto.MESSAGE, + number=5, + message="SessionInfo", + ) messages = proto.RepeatedField( - proto.MESSAGE, number=7, message=response_message.ResponseMessage, + proto.MESSAGE, + number=7, + message=response_message.ResponseMessage, + ) + payload = proto.Field( + proto.MESSAGE, + number=8, + message=struct_pb2.Struct, ) - payload = proto.Field(proto.MESSAGE, number=8, message=struct_pb2.Struct,) sentiment_analysis_result = proto.Field( - proto.MESSAGE, number=9, message=SentimentAnalysisResult, + proto.MESSAGE, + number=9, + message=SentimentAnalysisResult, ) @@ -499,7 +648,9 @@ class MergeBehavior(proto.Enum): REPLACE = 2 messages = proto.RepeatedField( - proto.MESSAGE, number=1, message=response_message.ResponseMessage, + proto.MESSAGE, + number=1, + message=response_message.ResponseMessage, ) merge_behavior = proto.Field( proto.ENUM, @@ -508,13 +659,35 @@ class MergeBehavior(proto.Enum): ) fulfillment_response = proto.Field( - proto.MESSAGE, number=1, message=FulfillmentResponse, + proto.MESSAGE, + number=1, + message=FulfillmentResponse, + ) + page_info = proto.Field( + proto.MESSAGE, + number=2, + message="PageInfo", + ) + session_info = proto.Field( + proto.MESSAGE, + number=3, + message="SessionInfo", + ) + payload = proto.Field( + proto.MESSAGE, + number=4, + message=struct_pb2.Struct, + ) + target_page = proto.Field( + proto.STRING, + number=5, + oneof="transition", + ) + target_flow = proto.Field( + proto.STRING, + number=6, + oneof="transition", ) - page_info = proto.Field(proto.MESSAGE, number=2, message="PageInfo",) - session_info = proto.Field(proto.MESSAGE, number=3, message="SessionInfo",) - payload = proto.Field(proto.MESSAGE, number=4, message=struct_pb2.Struct,) - target_page = proto.Field(proto.STRING, number=5, oneof="transition",) - target_flow = proto.Field(proto.STRING, number=6, oneof="transition",) class PageInfo(proto.Message): @@ -608,23 +781,48 @@ class ParameterState(proto.Enum): INVALID = 2 FILLED = 3 - display_name = proto.Field(proto.STRING, number=1,) - required = proto.Field(proto.BOOL, number=2,) + display_name = proto.Field( + proto.STRING, + number=1, + ) + required = proto.Field( + proto.BOOL, + number=2, + ) state = proto.Field( proto.ENUM, number=3, enum="PageInfo.FormInfo.ParameterInfo.ParameterState", ) - value = proto.Field(proto.MESSAGE, number=4, message=struct_pb2.Value,) - just_collected = proto.Field(proto.BOOL, number=5,) + value = proto.Field( + proto.MESSAGE, + number=4, + message=struct_pb2.Value, + ) + just_collected = proto.Field( + proto.BOOL, + number=5, + ) parameter_info = proto.RepeatedField( - proto.MESSAGE, number=2, message="PageInfo.FormInfo.ParameterInfo", + proto.MESSAGE, + number=2, + message="PageInfo.FormInfo.ParameterInfo", ) - current_page = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=4,) - form_info = proto.Field(proto.MESSAGE, number=3, message=FormInfo,) + current_page = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=4, + ) + form_info = proto.Field( + proto.MESSAGE, + number=3, + message=FormInfo, + ) class SessionInfo(proto.Message): @@ -645,7 +843,7 @@ class SessionInfo(proto.Message): or ``projects//locations//agents//environments//sessions/`` if environment is specified. - parameters (Sequence[google.cloud.dialogflowcx_v3.types.SessionInfo.ParametersEntry]): + parameters (Mapping[str, google.protobuf.struct_pb2.Value]): Optional for [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Optional for @@ -658,9 +856,15 @@ class SessionInfo(proto.Message): The map is keyed by parameters' display names. """ - session = proto.Field(proto.STRING, number=1,) + session = proto.Field( + proto.STRING, + number=1, + ) parameters = proto.MapField( - proto.STRING, proto.MESSAGE, number=2, message=struct_pb2.Value, + proto.STRING, + proto.MESSAGE, + number=2, + message=struct_pb2.Value, ) diff --git a/google/cloud/dialogflowcx_v3beta1/services/agents/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/agents/async_client.py index 75d0eff0..56392849 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/agents/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/agents/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -232,14 +232,13 @@ async def list_agents( r"""Returns the list of all agents in the specified location. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_list_agents(): + async def sample_list_agents(): # Create a client - client = dialogflowcx_v3beta1.AgentsClient() + client = dialogflowcx_v3beta1.AgentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListAgentsRequest( @@ -250,7 +249,7 @@ def sample_list_agents(): page_result = client.list_agents(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -311,12 +310,20 @@ def sample_list_agents(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListAgentsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -337,9 +344,9 @@ async def get_agent( from google.cloud import dialogflowcx_v3beta1 - def sample_get_agent(): + async def sample_get_agent(): # Create a client - client = dialogflowcx_v3beta1.AgentsClient() + client = dialogflowcx_v3beta1.AgentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetAgentRequest( @@ -347,7 +354,7 @@ def sample_get_agent(): ) # Make the request - response = client.get_agent(request=request) + response = await client.get_agent(request=request) # Handle the response print(response) @@ -419,7 +426,12 @@ def sample_get_agent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -440,14 +452,13 @@ async def create_agent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_create_agent(): + async def sample_create_agent(): # Create a client - client = dialogflowcx_v3beta1.AgentsClient() + client = dialogflowcx_v3beta1.AgentsAsyncClient() # Initialize request argument(s) agent = dialogflowcx_v3beta1.Agent() @@ -461,7 +472,7 @@ def sample_create_agent(): ) # Make the request - response = client.create_agent(request=request) + response = await client.create_agent(request=request) # Handle the response print(response) @@ -540,7 +551,12 @@ def sample_create_agent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -561,14 +577,13 @@ async def update_agent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_update_agent(): + async def sample_update_agent(): # Create a client - client = dialogflowcx_v3beta1.AgentsClient() + client = dialogflowcx_v3beta1.AgentsAsyncClient() # Initialize request argument(s) agent = dialogflowcx_v3beta1.Agent() @@ -581,7 +596,7 @@ def sample_update_agent(): ) # Make the request - response = client.update_agent(request=request) + response = await client.update_agent(request=request) # Handle the response print(response) @@ -663,7 +678,12 @@ def sample_update_agent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -683,9 +703,9 @@ async def delete_agent( from google.cloud import dialogflowcx_v3beta1 - def sample_delete_agent(): + async def sample_delete_agent(): # Create a client - client = dialogflowcx_v3beta1.AgentsClient() + client = dialogflowcx_v3beta1.AgentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.DeleteAgentRequest( @@ -693,7 +713,7 @@ def sample_delete_agent(): ) # Make the request - client.delete_agent(request=request) + await client.delete_agent(request=request) Args: request (Union[google.cloud.dialogflowcx_v3beta1.types.DeleteAgentRequest, dict]): @@ -745,7 +765,10 @@ def sample_delete_agent(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def export_agent( @@ -768,14 +791,13 @@ async def export_agent( - ``response``: [ExportAgentResponse][google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_export_agent(): + async def sample_export_agent(): # Create a client - client = dialogflowcx_v3beta1.AgentsClient() + client = dialogflowcx_v3beta1.AgentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ExportAgentRequest( @@ -787,7 +809,7 @@ def sample_export_agent(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -830,7 +852,12 @@ def sample_export_agent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -871,14 +898,13 @@ async def restore_agent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_restore_agent(): + async def sample_restore_agent(): # Create a client - client = dialogflowcx_v3beta1.AgentsClient() + client = dialogflowcx_v3beta1.AgentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.RestoreAgentRequest( @@ -891,7 +917,7 @@ def sample_restore_agent(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -943,7 +969,12 @@ def sample_restore_agent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -969,14 +1000,13 @@ async def validate_agent( validated. Please call this API after the training is completed to get the complete validation results. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_validate_agent(): + async def sample_validate_agent(): # Create a client - client = dialogflowcx_v3beta1.AgentsClient() + client = dialogflowcx_v3beta1.AgentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ValidateAgentRequest( @@ -984,7 +1014,7 @@ def sample_validate_agent(): ) # Make the request - response = client.validate_agent(request=request) + response = await client.validate_agent(request=request) # Handle the response print(response) @@ -1023,7 +1053,12 @@ def sample_validate_agent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1040,14 +1075,13 @@ async def get_agent_validation_result( r"""Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_get_agent_validation_result(): + async def sample_get_agent_validation_result(): # Create a client - client = dialogflowcx_v3beta1.AgentsClient() + client = dialogflowcx_v3beta1.AgentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetAgentValidationResultRequest( @@ -1055,7 +1089,7 @@ def sample_get_agent_validation_result(): ) # Make the request - response = client.get_agent_validation_result(request=request) + response = await client.get_agent_validation_result(request=request) # Handle the response print(response) @@ -1115,7 +1149,12 @@ def sample_get_agent_validation_result(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3beta1/services/agents/client.py b/google/cloud/dialogflowcx_v3beta1/services/agents/client.py index 82fd5c19..ecc3c8ab 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/agents/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/agents/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -61,7 +61,10 @@ class AgentsClientMeta(type): _transport_registry["grpc"] = AgentsGrpcTransport _transport_registry["grpc_asyncio"] = AgentsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[AgentsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[AgentsTransport]: """Returns an appropriate transport class. Args: @@ -168,10 +171,16 @@ def transport(self) -> AgentsTransport: return self._transport @staticmethod - def agent_path(project: str, location: str, agent: str,) -> str: + def agent_path( + project: str, + location: str, + agent: str, + ) -> str: """Returns a fully-qualified agent string.""" return "projects/{project}/locations/{location}/agents/{agent}".format( - project=project, location=location, agent=agent, + project=project, + location=location, + agent=agent, ) @staticmethod @@ -184,10 +193,16 @@ def parse_agent_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def agent_validation_result_path(project: str, location: str, agent: str,) -> str: + def agent_validation_result_path( + project: str, + location: str, + agent: str, + ) -> str: """Returns a fully-qualified agent_validation_result string.""" return "projects/{project}/locations/{location}/agents/{agent}/validationResult".format( - project=project, location=location, agent=agent, + project=project, + location=location, + agent=agent, ) @staticmethod @@ -201,11 +216,17 @@ def parse_agent_validation_result_path(path: str) -> Dict[str, str]: @staticmethod def environment_path( - project: str, location: str, agent: str, environment: str, + project: str, + location: str, + agent: str, + environment: str, ) -> str: """Returns a fully-qualified environment string.""" return "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}".format( - project=project, location=location, agent=agent, environment=environment, + project=project, + location=location, + agent=agent, + environment=environment, ) @staticmethod @@ -218,10 +239,18 @@ def parse_environment_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def flow_path(project: str, location: str, agent: str, flow: str,) -> str: + def flow_path( + project: str, + location: str, + agent: str, + flow: str, + ) -> str: """Returns a fully-qualified flow string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) @staticmethod @@ -235,11 +264,17 @@ def parse_flow_path(path: str) -> Dict[str, str]: @staticmethod def flow_validation_result_path( - project: str, location: str, agent: str, flow: str, + project: str, + location: str, + agent: str, + flow: str, ) -> str: """Returns a fully-qualified flow_validation_result string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/validationResult".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) @staticmethod @@ -253,11 +288,15 @@ def parse_flow_validation_result_path(path: str) -> Dict[str, str]: @staticmethod def security_settings_path( - project: str, location: str, security_settings: str, + project: str, + location: str, + security_settings: str, ) -> str: """Returns a fully-qualified security_settings string.""" return "projects/{project}/locations/{location}/securitySettings/{security_settings}".format( - project=project, location=location, security_settings=security_settings, + project=project, + location=location, + security_settings=security_settings, ) @staticmethod @@ -270,7 +309,9 @@ def parse_security_settings_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -283,9 +324,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -294,9 +339,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -305,9 +354,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -316,10 +369,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -505,7 +562,6 @@ def list_agents( r"""Returns the list of all agents in the specified location. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -584,12 +640,20 @@ def sample_list_agents(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListAgentsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -692,7 +756,12 @@ def sample_get_agent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -713,7 +782,6 @@ def create_agent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -813,7 +881,12 @@ def sample_create_agent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -834,7 +907,6 @@ def update_agent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -936,7 +1008,12 @@ def sample_update_agent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1018,7 +1095,10 @@ def sample_delete_agent(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def export_agent( @@ -1041,7 +1121,6 @@ def export_agent( - ``response``: [ExportAgentResponse][google.cloud.dialogflow.cx.v3beta1.ExportAgentResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1104,7 +1183,12 @@ def sample_export_agent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1145,7 +1229,6 @@ def restore_agent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1218,7 +1301,12 @@ def sample_restore_agent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1244,7 +1332,6 @@ def validate_agent( validated. Please call this API after the training is completed to get the complete validation results. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1299,7 +1386,12 @@ def sample_validate_agent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1316,7 +1408,6 @@ def get_agent_validation_result( r"""Gets the latest agent validation result. Agent validation is performed when ValidateAgent is called. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1393,7 +1484,12 @@ def sample_get_agent_validation_result(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3beta1/services/agents/transports/base.py b/google/cloud/dialogflowcx_v3beta1/services/agents/transports/base.py index 4d41a167..3a1ba9e2 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/agents/transports/base.py +++ b/google/cloud/dialogflowcx_v3beta1/services/agents/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -128,28 +129,44 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_agents: gapic_v1.method.wrap_method( - self.list_agents, default_timeout=None, client_info=client_info, + self.list_agents, + default_timeout=None, + client_info=client_info, ), self.get_agent: gapic_v1.method.wrap_method( - self.get_agent, default_timeout=None, client_info=client_info, + self.get_agent, + default_timeout=None, + client_info=client_info, ), self.create_agent: gapic_v1.method.wrap_method( - self.create_agent, default_timeout=None, client_info=client_info, + self.create_agent, + default_timeout=None, + client_info=client_info, ), self.update_agent: gapic_v1.method.wrap_method( - self.update_agent, default_timeout=None, client_info=client_info, + self.update_agent, + default_timeout=None, + client_info=client_info, ), self.delete_agent: gapic_v1.method.wrap_method( - self.delete_agent, default_timeout=None, client_info=client_info, + self.delete_agent, + default_timeout=None, + client_info=client_info, ), self.export_agent: gapic_v1.method.wrap_method( - self.export_agent, default_timeout=None, client_info=client_info, + self.export_agent, + default_timeout=None, + client_info=client_info, ), self.restore_agent: gapic_v1.method.wrap_method( - self.restore_agent, default_timeout=None, client_info=client_info, + self.restore_agent, + default_timeout=None, + client_info=client_info, ), self.validate_agent: gapic_v1.method.wrap_method( - self.validate_agent, default_timeout=None, client_info=client_info, + self.validate_agent, + default_timeout=None, + client_info=client_info, ), self.get_agent_validation_result: gapic_v1.method.wrap_method( self.get_agent_validation_result, @@ -161,9 +178,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -249,5 +266,9 @@ def get_agent_validation_result( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("AgentsTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/agents/transports/grpc.py b/google/cloud/dialogflowcx_v3beta1/services/agents/transports/grpc.py index 856a3a05..cec4d4dc 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/agents/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3beta1/services/agents/transports/grpc.py @@ -230,8 +230,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -522,5 +521,9 @@ def get_agent_validation_result( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("AgentsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/changelogs/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/changelogs/async_client.py index b0e1e72f..49e324de 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/changelogs/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/changelogs/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -214,9 +214,9 @@ async def list_changelogs( from google.cloud import dialogflowcx_v3beta1 - def sample_list_changelogs(): + async def sample_list_changelogs(): # Create a client - client = dialogflowcx_v3beta1.ChangelogsClient() + client = dialogflowcx_v3beta1.ChangelogsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListChangelogsRequest( @@ -227,7 +227,7 @@ def sample_list_changelogs(): page_result = client.list_changelogs(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -288,12 +288,20 @@ def sample_list_changelogs(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListChangelogsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -314,9 +322,9 @@ async def get_changelog( from google.cloud import dialogflowcx_v3beta1 - def sample_get_changelog(): + async def sample_get_changelog(): # Create a client - client = dialogflowcx_v3beta1.ChangelogsClient() + client = dialogflowcx_v3beta1.ChangelogsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetChangelogRequest( @@ -324,7 +332,7 @@ def sample_get_changelog(): ) # Make the request - response = client.get_changelog(request=request) + response = await client.get_changelog(request=request) # Handle the response print(response) @@ -384,7 +392,12 @@ def sample_get_changelog(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3beta1/services/changelogs/client.py b/google/cloud/dialogflowcx_v3beta1/services/changelogs/client.py index 15a598cd..2bfbad69 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/changelogs/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/changelogs/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -54,7 +54,10 @@ class ChangelogsClientMeta(type): _transport_registry["grpc"] = ChangelogsGrpcTransport _transport_registry["grpc_asyncio"] = ChangelogsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ChangelogsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ChangelogsTransport]: """Returns an appropriate transport class. Args: @@ -161,10 +164,18 @@ def transport(self) -> ChangelogsTransport: return self._transport @staticmethod - def changelog_path(project: str, location: str, agent: str, changelog: str,) -> str: + def changelog_path( + project: str, + location: str, + agent: str, + changelog: str, + ) -> str: """Returns a fully-qualified changelog string.""" return "projects/{project}/locations/{location}/agents/{agent}/changelogs/{changelog}".format( - project=project, location=location, agent=agent, changelog=changelog, + project=project, + location=location, + agent=agent, + changelog=changelog, ) @staticmethod @@ -177,7 +188,9 @@ def parse_changelog_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -190,9 +203,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -201,9 +218,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -212,9 +233,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -223,10 +248,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -489,12 +518,20 @@ def sample_list_changelogs(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListChangelogsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -585,7 +622,12 @@ def sample_get_changelog(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3beta1/services/changelogs/transports/base.py b/google/cloud/dialogflowcx_v3beta1/services/changelogs/transports/base.py index 31c58485..ff439a76 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/changelogs/transports/base.py +++ b/google/cloud/dialogflowcx_v3beta1/services/changelogs/transports/base.py @@ -83,6 +83,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -124,19 +125,23 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_changelogs: gapic_v1.method.wrap_method( - self.list_changelogs, default_timeout=None, client_info=client_info, + self.list_changelogs, + default_timeout=None, + client_info=client_info, ), self.get_changelog: gapic_v1.method.wrap_method( - self.get_changelog, default_timeout=None, client_info=client_info, + self.get_changelog, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -161,5 +166,9 @@ def get_changelog( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ChangelogsTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/changelogs/transports/grpc.py b/google/cloud/dialogflowcx_v3beta1/services/changelogs/transports/grpc.py index 59b41013..3659a165 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/changelogs/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3beta1/services/changelogs/transports/grpc.py @@ -225,8 +225,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -284,5 +283,9 @@ def get_changelog( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ChangelogsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/deployments/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/deployments/async_client.py index 519ac94d..00a07c15 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/deployments/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/deployments/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -221,14 +221,13 @@ async def list_deployments( r"""Returns the list of all deployments in the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_list_deployments(): + async def sample_list_deployments(): # Create a client - client = dialogflowcx_v3beta1.DeploymentsClient() + client = dialogflowcx_v3beta1.DeploymentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListDeploymentsRequest( @@ -239,7 +238,7 @@ def sample_list_deployments(): page_result = client.list_deployments(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -302,12 +301,20 @@ def sample_list_deployments(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListDeploymentsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -325,14 +332,13 @@ async def get_deployment( r"""Retrieves the specified [Deployment][google.cloud.dialogflow.cx.v3beta1.Deployment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_get_deployment(): + async def sample_get_deployment(): # Create a client - client = dialogflowcx_v3beta1.DeploymentsClient() + client = dialogflowcx_v3beta1.DeploymentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetDeploymentRequest( @@ -340,7 +346,7 @@ def sample_get_deployment(): ) # Make the request - response = client.get_deployment(request=request) + response = await client.get_deployment(request=request) # Handle the response print(response) @@ -407,7 +413,12 @@ def sample_get_deployment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3beta1/services/deployments/client.py b/google/cloud/dialogflowcx_v3beta1/services/deployments/client.py index 3ebc7fde..ded23741 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/deployments/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/deployments/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -54,7 +54,10 @@ class DeploymentsClientMeta(type): _transport_registry["grpc"] = DeploymentsGrpcTransport _transport_registry["grpc_asyncio"] = DeploymentsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[DeploymentsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[DeploymentsTransport]: """Returns an appropriate transport class. Args: @@ -162,7 +165,11 @@ def transport(self) -> DeploymentsTransport: @staticmethod def deployment_path( - project: str, location: str, agent: str, environment: str, deployment: str, + project: str, + location: str, + agent: str, + environment: str, + deployment: str, ) -> str: """Returns a fully-qualified deployment string.""" return "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/deployments/{deployment}".format( @@ -184,7 +191,11 @@ def parse_deployment_path(path: str) -> Dict[str, str]: @staticmethod def experiment_path( - project: str, location: str, agent: str, environment: str, experiment: str, + project: str, + location: str, + agent: str, + environment: str, + experiment: str, ) -> str: """Returns a fully-qualified experiment string.""" return "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/experiments/{experiment}".format( @@ -206,7 +217,11 @@ def parse_experiment_path(path: str) -> Dict[str, str]: @staticmethod def test_case_result_path( - project: str, location: str, agent: str, test_case: str, result: str, + project: str, + location: str, + agent: str, + test_case: str, + result: str, ) -> str: """Returns a fully-qualified test_case_result string.""" return "projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}/results/{result}".format( @@ -228,11 +243,19 @@ def parse_test_case_result_path(path: str) -> Dict[str, str]: @staticmethod def version_path( - project: str, location: str, agent: str, flow: str, version: str, + project: str, + location: str, + agent: str, + flow: str, + version: str, ) -> str: """Returns a fully-qualified version string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) @staticmethod @@ -245,7 +268,9 @@ def parse_version_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -258,9 +283,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -269,9 +298,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -280,9 +313,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -291,10 +328,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -480,7 +521,6 @@ def list_deployments( r"""Returns the list of all deployments in the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -561,12 +601,20 @@ def sample_list_deployments(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListDeploymentsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -584,7 +632,6 @@ def get_deployment( r"""Retrieves the specified [Deployment][google.cloud.dialogflow.cx.v3beta1.Deployment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -666,7 +713,12 @@ def sample_get_deployment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3beta1/services/deployments/transports/base.py b/google/cloud/dialogflowcx_v3beta1/services/deployments/transports/base.py index 4e071a91..13bdadb5 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/deployments/transports/base.py +++ b/google/cloud/dialogflowcx_v3beta1/services/deployments/transports/base.py @@ -83,6 +83,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -124,19 +125,23 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_deployments: gapic_v1.method.wrap_method( - self.list_deployments, default_timeout=None, client_info=client_info, + self.list_deployments, + default_timeout=None, + client_info=client_info, ), self.get_deployment: gapic_v1.method.wrap_method( - self.get_deployment, default_timeout=None, client_info=client_info, + self.get_deployment, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -161,5 +166,9 @@ def get_deployment( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("DeploymentsTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/deployments/transports/grpc.py b/google/cloud/dialogflowcx_v3beta1/services/deployments/transports/grpc.py index d8fc9cef..bc161bb7 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/deployments/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3beta1/services/deployments/transports/grpc.py @@ -225,8 +225,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -288,5 +287,9 @@ def get_deployment( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("DeploymentsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/entity_types/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/entity_types/async_client.py index bf7eca9d..e221dab0 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/entity_types/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/entity_types/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -214,14 +214,13 @@ async def list_entity_types( r"""Returns the list of all entity types in the specified agent. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_list_entity_types(): + async def sample_list_entity_types(): # Create a client - client = dialogflowcx_v3beta1.EntityTypesClient() + client = dialogflowcx_v3beta1.EntityTypesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListEntityTypesRequest( @@ -232,7 +231,7 @@ def sample_list_entity_types(): page_result = client.list_entity_types(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -294,12 +293,20 @@ def sample_list_entity_types(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListEntityTypesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -320,9 +327,9 @@ async def get_entity_type( from google.cloud import dialogflowcx_v3beta1 - def sample_get_entity_type(): + async def sample_get_entity_type(): # Create a client - client = dialogflowcx_v3beta1.EntityTypesClient() + client = dialogflowcx_v3beta1.EntityTypesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetEntityTypeRequest( @@ -330,7 +337,7 @@ def sample_get_entity_type(): ) # Make the request - response = client.get_entity_type(request=request) + response = await client.get_entity_type(request=request) # Handle the response print(response) @@ -422,7 +429,12 @@ def sample_get_entity_type(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -443,9 +455,9 @@ async def create_entity_type( from google.cloud import dialogflowcx_v3beta1 - def sample_create_entity_type(): + async def sample_create_entity_type(): # Create a client - client = dialogflowcx_v3beta1.EntityTypesClient() + client = dialogflowcx_v3beta1.EntityTypesAsyncClient() # Initialize request argument(s) entity_type = dialogflowcx_v3beta1.EntityType() @@ -458,7 +470,7 @@ def sample_create_entity_type(): ) # Make the request - response = client.create_entity_type(request=request) + response = await client.create_entity_type(request=request) # Handle the response print(response) @@ -557,7 +569,12 @@ def sample_create_entity_type(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -578,14 +595,13 @@ async def update_entity_type( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_update_entity_type(): + async def sample_update_entity_type(): # Create a client - client = dialogflowcx_v3beta1.EntityTypesClient() + client = dialogflowcx_v3beta1.EntityTypesAsyncClient() # Initialize request argument(s) entity_type = dialogflowcx_v3beta1.EntityType() @@ -597,7 +613,7 @@ def sample_update_entity_type(): ) # Make the request - response = client.update_entity_type(request=request) + response = await client.update_entity_type(request=request) # Handle the response print(response) @@ -698,7 +714,12 @@ def sample_update_entity_type(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -718,14 +739,13 @@ async def delete_entity_type( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_delete_entity_type(): + async def sample_delete_entity_type(): # Create a client - client = dialogflowcx_v3beta1.EntityTypesClient() + client = dialogflowcx_v3beta1.EntityTypesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.DeleteEntityTypeRequest( @@ -733,7 +753,7 @@ def sample_delete_entity_type(): ) # Make the request - client.delete_entity_type(request=request) + await client.delete_entity_type(request=request) Args: request (Union[google.cloud.dialogflowcx_v3beta1.types.DeleteEntityTypeRequest, dict]): @@ -785,7 +805,10 @@ def sample_delete_entity_type(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/dialogflowcx_v3beta1/services/entity_types/client.py b/google/cloud/dialogflowcx_v3beta1/services/entity_types/client.py index dc3fc6b9..5739d88c 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/entity_types/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/entity_types/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -55,7 +55,10 @@ class EntityTypesClientMeta(type): _transport_registry["grpc"] = EntityTypesGrpcTransport _transport_registry["grpc_asyncio"] = EntityTypesGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[EntityTypesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[EntityTypesTransport]: """Returns an appropriate transport class. Args: @@ -163,11 +166,17 @@ def transport(self) -> EntityTypesTransport: @staticmethod def entity_type_path( - project: str, location: str, agent: str, entity_type: str, + project: str, + location: str, + agent: str, + entity_type: str, ) -> str: """Returns a fully-qualified entity_type string.""" return "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) @staticmethod @@ -180,7 +189,9 @@ def parse_entity_type_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -193,9 +204,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -204,9 +219,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -215,9 +234,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -226,10 +249,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -415,7 +442,6 @@ def list_entity_types( r"""Returns the list of all entity types in the specified agent. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -495,12 +521,20 @@ def sample_list_entity_types(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListEntityTypesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -623,7 +657,12 @@ def sample_get_entity_type(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -758,7 +797,12 @@ def sample_create_entity_type(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -779,7 +823,6 @@ def update_entity_type( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -899,7 +942,12 @@ def sample_update_entity_type(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -919,7 +967,6 @@ def delete_entity_type( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -986,7 +1033,10 @@ def sample_delete_entity_type(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/dialogflowcx_v3beta1/services/entity_types/transports/base.py b/google/cloud/dialogflowcx_v3beta1/services/entity_types/transports/base.py index 3222f088..23ae7c56 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/entity_types/transports/base.py +++ b/google/cloud/dialogflowcx_v3beta1/services/entity_types/transports/base.py @@ -85,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -126,28 +127,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_entity_types: gapic_v1.method.wrap_method( - self.list_entity_types, default_timeout=None, client_info=client_info, + self.list_entity_types, + default_timeout=None, + client_info=client_info, ), self.get_entity_type: gapic_v1.method.wrap_method( - self.get_entity_type, default_timeout=None, client_info=client_info, + self.get_entity_type, + default_timeout=None, + client_info=client_info, ), self.create_entity_type: gapic_v1.method.wrap_method( - self.create_entity_type, default_timeout=None, client_info=client_info, + self.create_entity_type, + default_timeout=None, + client_info=client_info, ), self.update_entity_type: gapic_v1.method.wrap_method( - self.update_entity_type, default_timeout=None, client_info=client_info, + self.update_entity_type, + default_timeout=None, + client_info=client_info, ), self.delete_entity_type: gapic_v1.method.wrap_method( - self.delete_entity_type, default_timeout=None, client_info=client_info, + self.delete_entity_type, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -199,5 +210,9 @@ def delete_entity_type( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("EntityTypesTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/entity_types/transports/grpc.py b/google/cloud/dialogflowcx_v3beta1/services/entity_types/transports/grpc.py index bfadbb6e..c2a6de59 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/entity_types/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3beta1/services/entity_types/transports/grpc.py @@ -227,8 +227,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -379,5 +378,9 @@ def delete_entity_type( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("EntityTypesGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/environments/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/environments/async_client.py index 7c561990..879f40cb 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/environments/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/environments/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -232,14 +232,13 @@ async def list_environments( r"""Returns the list of all environments in the specified [Agent][google.cloud.dialogflow.cx.v3beta1.Agent]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_list_environments(): + async def sample_list_environments(): # Create a client - client = dialogflowcx_v3beta1.EnvironmentsClient() + client = dialogflowcx_v3beta1.EnvironmentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListEnvironmentsRequest( @@ -250,7 +249,7 @@ def sample_list_environments(): page_result = client.list_environments(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -313,12 +312,20 @@ def sample_list_environments(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListEnvironmentsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -336,14 +343,13 @@ async def get_environment( r"""Retrieves the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_get_environment(): + async def sample_get_environment(): # Create a client - client = dialogflowcx_v3beta1.EnvironmentsClient() + client = dialogflowcx_v3beta1.EnvironmentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetEnvironmentRequest( @@ -351,7 +357,7 @@ def sample_get_environment(): ) # Make the request - response = client.get_environment(request=request) + response = await client.get_environment(request=request) # Handle the response print(response) @@ -426,7 +432,12 @@ def sample_get_environment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -455,14 +466,13 @@ async def create_environment( - ``response``: [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_create_environment(): + async def sample_create_environment(): # Create a client - client = dialogflowcx_v3beta1.EnvironmentsClient() + client = dialogflowcx_v3beta1.EnvironmentsAsyncClient() # Initialize request argument(s) environment = dialogflowcx_v3beta1.Environment() @@ -479,7 +489,7 @@ def sample_create_environment(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -561,7 +571,12 @@ def sample_create_environment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -597,14 +612,13 @@ async def update_environment( - ``response``: [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_update_environment(): + async def sample_update_environment(): # Create a client - client = dialogflowcx_v3beta1.EnvironmentsClient() + client = dialogflowcx_v3beta1.EnvironmentsAsyncClient() # Initialize request argument(s) environment = dialogflowcx_v3beta1.Environment() @@ -620,7 +634,7 @@ def sample_update_environment(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -700,7 +714,12 @@ def sample_update_environment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -725,14 +744,13 @@ async def delete_environment( r"""Deletes the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_delete_environment(): + async def sample_delete_environment(): # Create a client - client = dialogflowcx_v3beta1.EnvironmentsClient() + client = dialogflowcx_v3beta1.EnvironmentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.DeleteEnvironmentRequest( @@ -740,7 +758,7 @@ def sample_delete_environment(): ) # Make the request - client.delete_environment(request=request) + await client.delete_environment(request=request) Args: request (Union[google.cloud.dialogflowcx_v3beta1.types.DeleteEnvironmentRequest, dict]): @@ -794,7 +812,10 @@ def sample_delete_environment(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def lookup_environment_history( @@ -809,14 +830,13 @@ async def lookup_environment_history( r"""Looks up the history of the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_lookup_environment_history(): + async def sample_lookup_environment_history(): # Create a client - client = dialogflowcx_v3beta1.EnvironmentsClient() + client = dialogflowcx_v3beta1.EnvironmentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.LookupEnvironmentHistoryRequest( @@ -827,7 +847,7 @@ def sample_lookup_environment_history(): page_result = client.lookup_environment_history(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -889,12 +909,20 @@ def sample_lookup_environment_history(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.LookupEnvironmentHistoryAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -921,14 +949,13 @@ async def run_continuous_test( - ``response``: [RunContinuousTestResponse][google.cloud.dialogflow.cx.v3beta1.RunContinuousTestResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_run_continuous_test(): + async def sample_run_continuous_test(): # Create a client - client = dialogflowcx_v3beta1.EnvironmentsClient() + client = dialogflowcx_v3beta1.EnvironmentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.RunContinuousTestRequest( @@ -940,7 +967,7 @@ def sample_run_continuous_test(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -985,7 +1012,12 @@ def sample_run_continuous_test(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1010,14 +1042,13 @@ async def list_continuous_test_results( r"""Fetches a list of continuous test results for a given environment. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_list_continuous_test_results(): + async def sample_list_continuous_test_results(): # Create a client - client = dialogflowcx_v3beta1.EnvironmentsClient() + client = dialogflowcx_v3beta1.EnvironmentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListContinuousTestResultsRequest( @@ -1028,7 +1059,7 @@ def sample_list_continuous_test_results(): page_result = client.list_continuous_test_results(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1089,12 +1120,20 @@ def sample_list_continuous_test_results(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListContinuousTestResultsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1121,14 +1160,13 @@ async def deploy_flow( - ``response``: [DeployFlowResponse][google.cloud.dialogflow.cx.v3beta1.DeployFlowResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_deploy_flow(): + async def sample_deploy_flow(): # Create a client - client = dialogflowcx_v3beta1.EnvironmentsClient() + client = dialogflowcx_v3beta1.EnvironmentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.DeployFlowRequest( @@ -1141,7 +1179,7 @@ def sample_deploy_flow(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1186,7 +1224,12 @@ def sample_deploy_flow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( diff --git a/google/cloud/dialogflowcx_v3beta1/services/environments/client.py b/google/cloud/dialogflowcx_v3beta1/services/environments/client.py index 5cda85d1..5eaf10d3 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/environments/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/environments/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -59,7 +59,10 @@ class EnvironmentsClientMeta(type): _transport_registry["grpc"] = EnvironmentsGrpcTransport _transport_registry["grpc_asyncio"] = EnvironmentsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[EnvironmentsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[EnvironmentsTransport]: """Returns an appropriate transport class. Args: @@ -193,11 +196,17 @@ def parse_continuous_test_result_path(path: str) -> Dict[str, str]: @staticmethod def environment_path( - project: str, location: str, agent: str, environment: str, + project: str, + location: str, + agent: str, + environment: str, ) -> str: """Returns a fully-qualified environment string.""" return "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}".format( - project=project, location=location, agent=agent, environment=environment, + project=project, + location=location, + agent=agent, + environment=environment, ) @staticmethod @@ -210,10 +219,18 @@ def parse_environment_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def test_case_path(project: str, location: str, agent: str, test_case: str,) -> str: + def test_case_path( + project: str, + location: str, + agent: str, + test_case: str, + ) -> str: """Returns a fully-qualified test_case string.""" return "projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}".format( - project=project, location=location, agent=agent, test_case=test_case, + project=project, + location=location, + agent=agent, + test_case=test_case, ) @staticmethod @@ -227,7 +244,11 @@ def parse_test_case_path(path: str) -> Dict[str, str]: @staticmethod def test_case_result_path( - project: str, location: str, agent: str, test_case: str, result: str, + project: str, + location: str, + agent: str, + test_case: str, + result: str, ) -> str: """Returns a fully-qualified test_case_result string.""" return "projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}/results/{result}".format( @@ -249,11 +270,19 @@ def parse_test_case_result_path(path: str) -> Dict[str, str]: @staticmethod def version_path( - project: str, location: str, agent: str, flow: str, version: str, + project: str, + location: str, + agent: str, + flow: str, + version: str, ) -> str: """Returns a fully-qualified version string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) @staticmethod @@ -266,7 +295,9 @@ def parse_version_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -279,9 +310,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -290,9 +325,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -301,9 +340,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -312,10 +355,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -501,7 +548,6 @@ def list_environments( r"""Returns the list of all environments in the specified [Agent][google.cloud.dialogflow.cx.v3beta1.Agent]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -582,12 +628,20 @@ def sample_list_environments(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListEnvironmentsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -605,7 +659,6 @@ def get_environment( r"""Retrieves the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -695,7 +748,12 @@ def sample_get_environment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -724,7 +782,6 @@ def create_environment( - ``response``: [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -830,7 +887,12 @@ def sample_create_environment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -866,7 +928,6 @@ def update_environment( - ``response``: [Environment][google.cloud.dialogflow.cx.v3beta1.Environment] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -969,7 +1030,12 @@ def sample_update_environment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -994,7 +1060,6 @@ def delete_environment( r"""Deletes the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1063,7 +1128,10 @@ def sample_delete_environment(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def lookup_environment_history( @@ -1078,7 +1146,6 @@ def lookup_environment_history( r"""Looks up the history of the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1160,12 +1227,20 @@ def sample_lookup_environment_history(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.LookupEnvironmentHistoryPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1192,7 +1267,6 @@ def run_continuous_test( - ``response``: [RunContinuousTestResponse][google.cloud.dialogflow.cx.v3beta1.RunContinuousTestResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1257,7 +1331,12 @@ def sample_run_continuous_test(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1282,7 +1361,6 @@ def list_continuous_test_results( r"""Fetches a list of continuous test results for a given environment. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1363,12 +1441,20 @@ def sample_list_continuous_test_results(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListContinuousTestResultsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1395,7 +1481,6 @@ def deploy_flow( - ``response``: [DeployFlowResponse][google.cloud.dialogflow.cx.v3beta1.DeployFlowResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1461,7 +1546,12 @@ def sample_deploy_flow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( diff --git a/google/cloud/dialogflowcx_v3beta1/services/environments/transports/base.py b/google/cloud/dialogflowcx_v3beta1/services/environments/transports/base.py index 2fd2371d..adaa312e 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/environments/transports/base.py +++ b/google/cloud/dialogflowcx_v3beta1/services/environments/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -128,19 +129,29 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_environments: gapic_v1.method.wrap_method( - self.list_environments, default_timeout=None, client_info=client_info, + self.list_environments, + default_timeout=None, + client_info=client_info, ), self.get_environment: gapic_v1.method.wrap_method( - self.get_environment, default_timeout=None, client_info=client_info, + self.get_environment, + default_timeout=None, + client_info=client_info, ), self.create_environment: gapic_v1.method.wrap_method( - self.create_environment, default_timeout=None, client_info=client_info, + self.create_environment, + default_timeout=None, + client_info=client_info, ), self.update_environment: gapic_v1.method.wrap_method( - self.update_environment, default_timeout=None, client_info=client_info, + self.update_environment, + default_timeout=None, + client_info=client_info, ), self.delete_environment: gapic_v1.method.wrap_method( - self.delete_environment, default_timeout=None, client_info=client_info, + self.delete_environment, + default_timeout=None, + client_info=client_info, ), self.lookup_environment_history: gapic_v1.method.wrap_method( self.lookup_environment_history, @@ -148,7 +159,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.run_continuous_test: gapic_v1.method.wrap_method( - self.run_continuous_test, default_timeout=None, client_info=client_info, + self.run_continuous_test, + default_timeout=None, + client_info=client_info, ), self.list_continuous_test_results: gapic_v1.method.wrap_method( self.list_continuous_test_results, @@ -156,16 +169,18 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.deploy_flow: gapic_v1.method.wrap_method( - self.deploy_flow, default_timeout=None, client_info=client_info, + self.deploy_flow, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -264,5 +279,9 @@ def deploy_flow( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("EnvironmentsTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/environments/transports/grpc.py b/google/cloud/dialogflowcx_v3beta1/services/environments/transports/grpc.py index f0f46a74..dec6f0a8 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/environments/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3beta1/services/environments/transports/grpc.py @@ -230,8 +230,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -547,5 +546,9 @@ def deploy_flow( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("EnvironmentsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/experiments/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/experiments/async_client.py index e34c1a83..3e32167e 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/experiments/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/experiments/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -218,14 +218,13 @@ async def list_experiments( r"""Returns the list of all experiments in the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_list_experiments(): + async def sample_list_experiments(): # Create a client - client = dialogflowcx_v3beta1.ExperimentsClient() + client = dialogflowcx_v3beta1.ExperimentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListExperimentsRequest( @@ -236,7 +235,7 @@ def sample_list_experiments(): page_result = client.list_experiments(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -299,12 +298,20 @@ def sample_list_experiments(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListExperimentsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -322,14 +329,13 @@ async def get_experiment( r"""Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_get_experiment(): + async def sample_get_experiment(): # Create a client - client = dialogflowcx_v3beta1.ExperimentsClient() + client = dialogflowcx_v3beta1.ExperimentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetExperimentRequest( @@ -337,7 +343,7 @@ def sample_get_experiment(): ) # Make the request - response = client.get_experiment(request=request) + response = await client.get_experiment(request=request) # Handle the response print(response) @@ -399,7 +405,12 @@ def sample_get_experiment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -419,14 +430,13 @@ async def create_experiment( the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_create_experiment(): + async def sample_create_experiment(): # Create a client - client = dialogflowcx_v3beta1.ExperimentsClient() + client = dialogflowcx_v3beta1.ExperimentsAsyncClient() # Initialize request argument(s) experiment = dialogflowcx_v3beta1.Experiment() @@ -438,7 +448,7 @@ def sample_create_experiment(): ) # Make the request - response = client.create_experiment(request=request) + response = await client.create_experiment(request=request) # Handle the response print(response) @@ -509,7 +519,12 @@ def sample_create_experiment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -527,14 +542,13 @@ async def update_experiment( r"""Updates the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_update_experiment(): + async def sample_update_experiment(): # Create a client - client = dialogflowcx_v3beta1.ExperimentsClient() + client = dialogflowcx_v3beta1.ExperimentsAsyncClient() # Initialize request argument(s) experiment = dialogflowcx_v3beta1.Experiment() @@ -545,7 +559,7 @@ def sample_update_experiment(): ) # Make the request - response = client.update_experiment(request=request) + response = await client.update_experiment(request=request) # Handle the response print(response) @@ -614,7 +628,12 @@ def sample_update_experiment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -631,14 +650,13 @@ async def delete_experiment( r"""Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_delete_experiment(): + async def sample_delete_experiment(): # Create a client - client = dialogflowcx_v3beta1.ExperimentsClient() + client = dialogflowcx_v3beta1.ExperimentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.DeleteExperimentRequest( @@ -646,7 +664,7 @@ def sample_delete_experiment(): ) # Make the request - client.delete_experiment(request=request) + await client.delete_experiment(request=request) Args: request (Union[google.cloud.dialogflowcx_v3beta1.types.DeleteExperimentRequest, dict]): @@ -700,7 +718,10 @@ def sample_delete_experiment(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def start_experiment( @@ -717,14 +738,13 @@ async def start_experiment( This rpc only changes the state of experiment from PENDING to RUNNING. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_start_experiment(): + async def sample_start_experiment(): # Create a client - client = dialogflowcx_v3beta1.ExperimentsClient() + client = dialogflowcx_v3beta1.ExperimentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.StartExperimentRequest( @@ -732,7 +752,7 @@ def sample_start_experiment(): ) # Make the request - response = client.start_experiment(request=request) + response = await client.start_experiment(request=request) # Handle the response print(response) @@ -793,7 +813,12 @@ def sample_start_experiment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -812,14 +837,13 @@ async def stop_experiment( This rpc only changes the state of experiment from RUNNING to DONE. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_stop_experiment(): + async def sample_stop_experiment(): # Create a client - client = dialogflowcx_v3beta1.ExperimentsClient() + client = dialogflowcx_v3beta1.ExperimentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.StopExperimentRequest( @@ -827,7 +851,7 @@ def sample_stop_experiment(): ) # Make the request - response = client.stop_experiment(request=request) + response = await client.stop_experiment(request=request) # Handle the response print(response) @@ -888,7 +912,12 @@ def sample_stop_experiment(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3beta1/services/experiments/client.py b/google/cloud/dialogflowcx_v3beta1/services/experiments/client.py index 6cccc6b8..f7c74ad3 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/experiments/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/experiments/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -57,7 +57,10 @@ class ExperimentsClientMeta(type): _transport_registry["grpc"] = ExperimentsGrpcTransport _transport_registry["grpc_asyncio"] = ExperimentsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ExperimentsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ExperimentsTransport]: """Returns an appropriate transport class. Args: @@ -165,7 +168,11 @@ def transport(self) -> ExperimentsTransport: @staticmethod def experiment_path( - project: str, location: str, agent: str, environment: str, experiment: str, + project: str, + location: str, + agent: str, + environment: str, + experiment: str, ) -> str: """Returns a fully-qualified experiment string.""" return "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/experiments/{experiment}".format( @@ -187,11 +194,19 @@ def parse_experiment_path(path: str) -> Dict[str, str]: @staticmethod def version_path( - project: str, location: str, agent: str, flow: str, version: str, + project: str, + location: str, + agent: str, + flow: str, + version: str, ) -> str: """Returns a fully-qualified version string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) @staticmethod @@ -204,7 +219,9 @@ def parse_version_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -217,9 +234,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -228,9 +249,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -239,9 +264,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -250,10 +279,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -439,7 +472,6 @@ def list_experiments( r"""Returns the list of all experiments in the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -520,12 +552,20 @@ def sample_list_experiments(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListExperimentsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -543,7 +583,6 @@ def get_experiment( r"""Retrieves the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -620,7 +659,12 @@ def sample_get_experiment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -640,7 +684,6 @@ def create_experiment( the specified [Environment][google.cloud.dialogflow.cx.v3beta1.Environment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -730,7 +773,12 @@ def sample_create_experiment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -748,7 +796,6 @@ def update_experiment( r"""Updates the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -835,7 +882,12 @@ def sample_update_experiment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -852,7 +904,6 @@ def delete_experiment( r"""Deletes the specified [Experiment][google.cloud.dialogflow.cx.v3beta1.Experiment]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -921,7 +972,10 @@ def sample_delete_experiment(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def start_experiment( @@ -938,7 +992,6 @@ def start_experiment( This rpc only changes the state of experiment from PENDING to RUNNING. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1014,7 +1067,12 @@ def sample_start_experiment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1033,7 +1091,6 @@ def stop_experiment( This rpc only changes the state of experiment from RUNNING to DONE. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1109,7 +1166,12 @@ def sample_stop_experiment(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3beta1/services/experiments/transports/base.py b/google/cloud/dialogflowcx_v3beta1/services/experiments/transports/base.py index 971a8c85..b4c2347f 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/experiments/transports/base.py +++ b/google/cloud/dialogflowcx_v3beta1/services/experiments/transports/base.py @@ -85,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -126,34 +127,48 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_experiments: gapic_v1.method.wrap_method( - self.list_experiments, default_timeout=None, client_info=client_info, + self.list_experiments, + default_timeout=None, + client_info=client_info, ), self.get_experiment: gapic_v1.method.wrap_method( - self.get_experiment, default_timeout=None, client_info=client_info, + self.get_experiment, + default_timeout=None, + client_info=client_info, ), self.create_experiment: gapic_v1.method.wrap_method( - self.create_experiment, default_timeout=None, client_info=client_info, + self.create_experiment, + default_timeout=None, + client_info=client_info, ), self.update_experiment: gapic_v1.method.wrap_method( - self.update_experiment, default_timeout=None, client_info=client_info, + self.update_experiment, + default_timeout=None, + client_info=client_info, ), self.delete_experiment: gapic_v1.method.wrap_method( - self.delete_experiment, default_timeout=None, client_info=client_info, + self.delete_experiment, + default_timeout=None, + client_info=client_info, ), self.start_experiment: gapic_v1.method.wrap_method( - self.start_experiment, default_timeout=None, client_info=client_info, + self.start_experiment, + default_timeout=None, + client_info=client_info, ), self.stop_experiment: gapic_v1.method.wrap_method( - self.stop_experiment, default_timeout=None, client_info=client_info, + self.stop_experiment, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -223,5 +238,9 @@ def stop_experiment( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ExperimentsTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/experiments/transports/grpc.py b/google/cloud/dialogflowcx_v3beta1/services/experiments/transports/grpc.py index e4745477..c09a6428 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/experiments/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3beta1/services/experiments/transports/grpc.py @@ -227,8 +227,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -435,5 +434,9 @@ def stop_experiment( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ExperimentsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/flows/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/flows/async_client.py index 8631b3ab..8b8c961d 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/flows/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/flows/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -233,14 +233,13 @@ async def create_flow( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_create_flow(): + async def sample_create_flow(): # Create a client - client = dialogflowcx_v3beta1.FlowsClient() + client = dialogflowcx_v3beta1.FlowsAsyncClient() # Initialize request argument(s) flow = dialogflowcx_v3beta1.Flow() @@ -252,7 +251,7 @@ def sample_create_flow(): ) # Make the request - response = client.create_flow(request=request) + response = await client.create_flow(request=request) # Handle the response print(response) @@ -340,7 +339,12 @@ def sample_create_flow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -360,9 +364,9 @@ async def delete_flow( from google.cloud import dialogflowcx_v3beta1 - def sample_delete_flow(): + async def sample_delete_flow(): # Create a client - client = dialogflowcx_v3beta1.FlowsClient() + client = dialogflowcx_v3beta1.FlowsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.DeleteFlowRequest( @@ -370,7 +374,7 @@ def sample_delete_flow(): ) # Make the request - client.delete_flow(request=request) + await client.delete_flow(request=request) Args: request (Union[google.cloud.dialogflowcx_v3beta1.types.DeleteFlowRequest, dict]): @@ -422,7 +426,10 @@ def sample_delete_flow(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def list_flows( @@ -440,9 +447,9 @@ async def list_flows( from google.cloud import dialogflowcx_v3beta1 - def sample_list_flows(): + async def sample_list_flows(): # Create a client - client = dialogflowcx_v3beta1.FlowsClient() + client = dialogflowcx_v3beta1.FlowsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListFlowsRequest( @@ -453,7 +460,7 @@ def sample_list_flows(): page_result = client.list_flows(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -514,12 +521,20 @@ def sample_list_flows(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListFlowsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -540,9 +555,9 @@ async def get_flow( from google.cloud import dialogflowcx_v3beta1 - def sample_get_flow(): + async def sample_get_flow(): # Create a client - client = dialogflowcx_v3beta1.FlowsClient() + client = dialogflowcx_v3beta1.FlowsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetFlowRequest( @@ -550,7 +565,7 @@ def sample_get_flow(): ) # Make the request - response = client.get_flow(request=request) + response = await client.get_flow(request=request) # Handle the response print(response) @@ -631,7 +646,12 @@ def sample_get_flow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -652,14 +672,13 @@ async def update_flow( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_update_flow(): + async def sample_update_flow(): # Create a client - client = dialogflowcx_v3beta1.FlowsClient() + client = dialogflowcx_v3beta1.FlowsAsyncClient() # Initialize request argument(s) flow = dialogflowcx_v3beta1.Flow() @@ -670,7 +689,7 @@ def sample_update_flow(): ) # Make the request - response = client.update_flow(request=request) + response = await client.update_flow(request=request) # Handle the response print(response) @@ -761,7 +780,12 @@ def sample_update_flow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -792,14 +816,13 @@ async def train_flow( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_train_flow(): + async def sample_train_flow(): # Create a client - client = dialogflowcx_v3beta1.FlowsClient() + client = dialogflowcx_v3beta1.FlowsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.TrainFlowRequest( @@ -811,7 +834,7 @@ def sample_train_flow(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -884,7 +907,12 @@ def sample_train_flow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -910,14 +938,13 @@ async def validate_flow( training is completed to get the complete validation results. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_validate_flow(): + async def sample_validate_flow(): # Create a client - client = dialogflowcx_v3beta1.FlowsClient() + client = dialogflowcx_v3beta1.FlowsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ValidateFlowRequest( @@ -925,7 +952,7 @@ def sample_validate_flow(): ) # Make the request - response = client.validate_flow(request=request) + response = await client.validate_flow(request=request) # Handle the response print(response) @@ -964,7 +991,12 @@ def sample_validate_flow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -981,14 +1013,13 @@ async def get_flow_validation_result( r"""Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_get_flow_validation_result(): + async def sample_get_flow_validation_result(): # Create a client - client = dialogflowcx_v3beta1.FlowsClient() + client = dialogflowcx_v3beta1.FlowsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetFlowValidationResultRequest( @@ -996,7 +1027,7 @@ def sample_get_flow_validation_result(): ) # Make the request - response = client.get_flow_validation_result(request=request) + response = await client.get_flow_validation_result(request=request) # Handle the response print(response) @@ -1056,7 +1087,12 @@ def sample_get_flow_validation_result(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1086,14 +1122,13 @@ async def import_flow( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_import_flow(): + async def sample_import_flow(): # Create a client - client = dialogflowcx_v3beta1.FlowsClient() + client = dialogflowcx_v3beta1.FlowsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ImportFlowRequest( @@ -1106,7 +1141,7 @@ def sample_import_flow(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1149,7 +1184,12 @@ def sample_import_flow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1185,14 +1225,13 @@ async def export_flow( Note that resources (e.g. intents, entities, webhooks) that the flow references will also be exported. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_export_flow(): + async def sample_export_flow(): # Create a client - client = dialogflowcx_v3beta1.FlowsClient() + client = dialogflowcx_v3beta1.FlowsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ExportFlowRequest( @@ -1204,7 +1243,7 @@ def sample_export_flow(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1247,7 +1286,12 @@ def sample_export_flow(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( diff --git a/google/cloud/dialogflowcx_v3beta1/services/flows/client.py b/google/cloud/dialogflowcx_v3beta1/services/flows/client.py index 11351155..9bb862d0 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/flows/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/flows/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -62,7 +62,10 @@ class FlowsClientMeta(type): _transport_registry["grpc"] = FlowsGrpcTransport _transport_registry["grpc_asyncio"] = FlowsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[FlowsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[FlowsTransport]: """Returns an appropriate transport class. Args: @@ -169,10 +172,18 @@ def transport(self) -> FlowsTransport: return self._transport @staticmethod - def flow_path(project: str, location: str, agent: str, flow: str,) -> str: + def flow_path( + project: str, + location: str, + agent: str, + flow: str, + ) -> str: """Returns a fully-qualified flow string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) @staticmethod @@ -186,11 +197,17 @@ def parse_flow_path(path: str) -> Dict[str, str]: @staticmethod def flow_validation_result_path( - project: str, location: str, agent: str, flow: str, + project: str, + location: str, + agent: str, + flow: str, ) -> str: """Returns a fully-qualified flow_validation_result string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/validationResult".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) @staticmethod @@ -203,10 +220,18 @@ def parse_flow_validation_result_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def intent_path(project: str, location: str, agent: str, intent: str,) -> str: + def intent_path( + project: str, + location: str, + agent: str, + intent: str, + ) -> str: """Returns a fully-qualified intent string.""" return "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) @staticmethod @@ -220,11 +245,19 @@ def parse_intent_path(path: str) -> Dict[str, str]: @staticmethod def page_path( - project: str, location: str, agent: str, flow: str, page: str, + project: str, + location: str, + agent: str, + flow: str, + page: str, ) -> str: """Returns a fully-qualified page string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) @staticmethod @@ -238,7 +271,11 @@ def parse_page_path(path: str) -> Dict[str, str]: @staticmethod def transition_route_group_path( - project: str, location: str, agent: str, flow: str, transition_route_group: str, + project: str, + location: str, + agent: str, + flow: str, + transition_route_group: str, ) -> str: """Returns a fully-qualified transition_route_group string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}".format( @@ -259,10 +296,18 @@ def parse_transition_route_group_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def webhook_path(project: str, location: str, agent: str, webhook: str,) -> str: + def webhook_path( + project: str, + location: str, + agent: str, + webhook: str, + ) -> str: """Returns a fully-qualified webhook string.""" return "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) @staticmethod @@ -275,7 +320,9 @@ def parse_webhook_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -288,9 +335,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -299,9 +350,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -310,9 +365,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -321,10 +380,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -514,7 +577,6 @@ def create_flow( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -621,7 +683,12 @@ def sample_create_flow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -703,7 +770,10 @@ def sample_delete_flow(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def list_flows( @@ -795,12 +865,20 @@ def sample_list_flows(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListFlowsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -912,7 +990,12 @@ def sample_get_flow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -933,7 +1016,6 @@ def update_flow( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1042,7 +1124,12 @@ def sample_update_flow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1073,7 +1160,6 @@ def train_flow( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1165,7 +1251,12 @@ def sample_train_flow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1191,7 +1282,6 @@ def validate_flow( training is completed to get the complete validation results. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1246,7 +1336,12 @@ def sample_validate_flow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1263,7 +1358,6 @@ def get_flow_validation_result( r"""Gets the latest flow validation result. Flow validation is performed when ValidateFlow is called. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1340,7 +1434,12 @@ def sample_get_flow_validation_result(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1370,7 +1469,6 @@ def import_flow( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1434,7 +1532,12 @@ def sample_import_flow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1470,7 +1573,6 @@ def export_flow( Note that resources (e.g. intents, entities, webhooks) that the flow references will also be exported. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1533,7 +1635,12 @@ def sample_export_flow(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( diff --git a/google/cloud/dialogflowcx_v3beta1/services/flows/transports/base.py b/google/cloud/dialogflowcx_v3beta1/services/flows/transports/base.py index 3056b278..67ecfd8b 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/flows/transports/base.py +++ b/google/cloud/dialogflowcx_v3beta1/services/flows/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -128,25 +129,39 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.create_flow: gapic_v1.method.wrap_method( - self.create_flow, default_timeout=None, client_info=client_info, + self.create_flow, + default_timeout=None, + client_info=client_info, ), self.delete_flow: gapic_v1.method.wrap_method( - self.delete_flow, default_timeout=None, client_info=client_info, + self.delete_flow, + default_timeout=None, + client_info=client_info, ), self.list_flows: gapic_v1.method.wrap_method( - self.list_flows, default_timeout=None, client_info=client_info, + self.list_flows, + default_timeout=None, + client_info=client_info, ), self.get_flow: gapic_v1.method.wrap_method( - self.get_flow, default_timeout=None, client_info=client_info, + self.get_flow, + default_timeout=None, + client_info=client_info, ), self.update_flow: gapic_v1.method.wrap_method( - self.update_flow, default_timeout=None, client_info=client_info, + self.update_flow, + default_timeout=None, + client_info=client_info, ), self.train_flow: gapic_v1.method.wrap_method( - self.train_flow, default_timeout=None, client_info=client_info, + self.train_flow, + default_timeout=None, + client_info=client_info, ), self.validate_flow: gapic_v1.method.wrap_method( - self.validate_flow, default_timeout=None, client_info=client_info, + self.validate_flow, + default_timeout=None, + client_info=client_info, ), self.get_flow_validation_result: gapic_v1.method.wrap_method( self.get_flow_validation_result, @@ -154,19 +169,23 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.import_flow: gapic_v1.method.wrap_method( - self.import_flow, default_timeout=None, client_info=client_info, + self.import_flow, + default_timeout=None, + client_info=client_info, ), self.export_flow: gapic_v1.method.wrap_method( - self.export_flow, default_timeout=None, client_info=client_info, + self.export_flow, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -259,5 +278,9 @@ def export_flow( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("FlowsTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/flows/transports/grpc.py b/google/cloud/dialogflowcx_v3beta1/services/flows/transports/grpc.py index 45f775f3..d302d7de 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/flows/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3beta1/services/flows/transports/grpc.py @@ -230,8 +230,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -554,5 +553,9 @@ def export_flow( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("FlowsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/intents/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/intents/async_client.py index 32b6fb5c..d8041b7f 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/intents/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/intents/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -212,14 +212,13 @@ async def list_intents( r"""Returns the list of all intents in the specified agent. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_list_intents(): + async def sample_list_intents(): # Create a client - client = dialogflowcx_v3beta1.IntentsClient() + client = dialogflowcx_v3beta1.IntentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListIntentsRequest( @@ -230,7 +229,7 @@ def sample_list_intents(): page_result = client.list_intents(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -291,12 +290,20 @@ def sample_list_intents(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListIntentsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -317,9 +324,9 @@ async def get_intent( from google.cloud import dialogflowcx_v3beta1 - def sample_get_intent(): + async def sample_get_intent(): # Create a client - client = dialogflowcx_v3beta1.IntentsClient() + client = dialogflowcx_v3beta1.IntentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetIntentRequest( @@ -327,7 +334,7 @@ def sample_get_intent(): ) # Make the request - response = client.get_intent(request=request) + response = await client.get_intent(request=request) # Handle the response print(response) @@ -392,7 +399,12 @@ def sample_get_intent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -413,14 +425,13 @@ async def create_intent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_create_intent(): + async def sample_create_intent(): # Create a client - client = dialogflowcx_v3beta1.IntentsClient() + client = dialogflowcx_v3beta1.IntentsAsyncClient() # Initialize request argument(s) intent = dialogflowcx_v3beta1.Intent() @@ -432,7 +443,7 @@ def sample_create_intent(): ) # Make the request - response = client.create_intent(request=request) + response = await client.create_intent(request=request) # Handle the response print(response) @@ -504,7 +515,12 @@ def sample_create_intent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -525,14 +541,13 @@ async def update_intent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_update_intent(): + async def sample_update_intent(): # Create a client - client = dialogflowcx_v3beta1.IntentsClient() + client = dialogflowcx_v3beta1.IntentsAsyncClient() # Initialize request argument(s) intent = dialogflowcx_v3beta1.Intent() @@ -543,7 +558,7 @@ def sample_update_intent(): ) # Make the request - response = client.update_intent(request=request) + response = await client.update_intent(request=request) # Handle the response print(response) @@ -618,7 +633,12 @@ def sample_update_intent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -638,14 +658,13 @@ async def delete_intent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_delete_intent(): + async def sample_delete_intent(): # Create a client - client = dialogflowcx_v3beta1.IntentsClient() + client = dialogflowcx_v3beta1.IntentsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.DeleteIntentRequest( @@ -653,7 +672,7 @@ def sample_delete_intent(): ) # Make the request - client.delete_intent(request=request) + await client.delete_intent(request=request) Args: request (Union[google.cloud.dialogflowcx_v3beta1.types.DeleteIntentRequest, dict]): @@ -705,7 +724,10 @@ def sample_delete_intent(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/dialogflowcx_v3beta1/services/intents/client.py b/google/cloud/dialogflowcx_v3beta1/services/intents/client.py index 82092f1f..4604837b 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/intents/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/intents/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -55,7 +55,10 @@ class IntentsClientMeta(type): _transport_registry["grpc"] = IntentsGrpcTransport _transport_registry["grpc_asyncio"] = IntentsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[IntentsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[IntentsTransport]: """Returns an appropriate transport class. Args: @@ -163,11 +166,17 @@ def transport(self) -> IntentsTransport: @staticmethod def entity_type_path( - project: str, location: str, agent: str, entity_type: str, + project: str, + location: str, + agent: str, + entity_type: str, ) -> str: """Returns a fully-qualified entity_type string.""" return "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) @staticmethod @@ -180,10 +189,18 @@ def parse_entity_type_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def intent_path(project: str, location: str, agent: str, intent: str,) -> str: + def intent_path( + project: str, + location: str, + agent: str, + intent: str, + ) -> str: """Returns a fully-qualified intent string.""" return "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) @staticmethod @@ -196,7 +213,9 @@ def parse_intent_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -209,9 +228,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -220,9 +243,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -231,9 +258,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -242,10 +273,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -431,7 +466,6 @@ def list_intents( r"""Returns the list of all intents in the specified agent. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -510,12 +544,20 @@ def sample_list_intents(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListIntentsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -611,7 +653,12 @@ def sample_get_intent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -632,7 +679,6 @@ def create_intent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -723,7 +769,12 @@ def sample_create_intent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -744,7 +795,6 @@ def update_intent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -837,7 +887,12 @@ def sample_update_intent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -857,7 +912,6 @@ def delete_intent( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -924,7 +978,10 @@ def sample_delete_intent(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/dialogflowcx_v3beta1/services/intents/transports/base.py b/google/cloud/dialogflowcx_v3beta1/services/intents/transports/base.py index e3d8d90a..d173d211 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/intents/transports/base.py +++ b/google/cloud/dialogflowcx_v3beta1/services/intents/transports/base.py @@ -85,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -126,28 +127,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_intents: gapic_v1.method.wrap_method( - self.list_intents, default_timeout=None, client_info=client_info, + self.list_intents, + default_timeout=None, + client_info=client_info, ), self.get_intent: gapic_v1.method.wrap_method( - self.get_intent, default_timeout=None, client_info=client_info, + self.get_intent, + default_timeout=None, + client_info=client_info, ), self.create_intent: gapic_v1.method.wrap_method( - self.create_intent, default_timeout=None, client_info=client_info, + self.create_intent, + default_timeout=None, + client_info=client_info, ), self.update_intent: gapic_v1.method.wrap_method( - self.update_intent, default_timeout=None, client_info=client_info, + self.update_intent, + default_timeout=None, + client_info=client_info, ), self.delete_intent: gapic_v1.method.wrap_method( - self.delete_intent, default_timeout=None, client_info=client_info, + self.delete_intent, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -194,5 +205,9 @@ def delete_intent( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("IntentsTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/intents/transports/grpc.py b/google/cloud/dialogflowcx_v3beta1/services/intents/transports/grpc.py index 4820a66e..8b064f61 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/intents/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3beta1/services/intents/transports/grpc.py @@ -227,8 +227,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -373,5 +372,9 @@ def delete_intent(self) -> Callable[[intent.DeleteIntentRequest], empty_pb2.Empt def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("IntentsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/pages/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/pages/async_client.py index e23420c5..b6e49807 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/pages/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/pages/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -224,9 +224,9 @@ async def list_pages( from google.cloud import dialogflowcx_v3beta1 - def sample_list_pages(): + async def sample_list_pages(): # Create a client - client = dialogflowcx_v3beta1.PagesClient() + client = dialogflowcx_v3beta1.PagesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListPagesRequest( @@ -237,7 +237,7 @@ def sample_list_pages(): page_result = client.list_pages(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -298,12 +298,20 @@ def sample_list_pages(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListPagesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -324,9 +332,9 @@ async def get_page( from google.cloud import dialogflowcx_v3beta1 - def sample_get_page(): + async def sample_get_page(): # Create a client - client = dialogflowcx_v3beta1.PagesClient() + client = dialogflowcx_v3beta1.PagesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetPageRequest( @@ -334,7 +342,7 @@ def sample_get_page(): ) # Make the request - response = client.get_page(request=request) + response = await client.get_page(request=request) # Handle the response print(response) @@ -414,7 +422,12 @@ def sample_get_page(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -435,9 +448,9 @@ async def create_page( from google.cloud import dialogflowcx_v3beta1 - def sample_create_page(): + async def sample_create_page(): # Create a client - client = dialogflowcx_v3beta1.PagesClient() + client = dialogflowcx_v3beta1.PagesAsyncClient() # Initialize request argument(s) page = dialogflowcx_v3beta1.Page() @@ -449,7 +462,7 @@ def sample_create_page(): ) # Make the request - response = client.create_page(request=request) + response = await client.create_page(request=request) # Handle the response print(response) @@ -536,7 +549,12 @@ def sample_create_page(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -557,9 +575,9 @@ async def update_page( from google.cloud import dialogflowcx_v3beta1 - def sample_update_page(): + async def sample_update_page(): # Create a client - client = dialogflowcx_v3beta1.PagesClient() + client = dialogflowcx_v3beta1.PagesAsyncClient() # Initialize request argument(s) page = dialogflowcx_v3beta1.Page() @@ -570,7 +588,7 @@ def sample_update_page(): ) # Make the request - response = client.update_page(request=request) + response = await client.update_page(request=request) # Handle the response print(response) @@ -660,7 +678,12 @@ def sample_update_page(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -680,9 +703,9 @@ async def delete_page( from google.cloud import dialogflowcx_v3beta1 - def sample_delete_page(): + async def sample_delete_page(): # Create a client - client = dialogflowcx_v3beta1.PagesClient() + client = dialogflowcx_v3beta1.PagesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.DeletePageRequest( @@ -690,7 +713,7 @@ def sample_delete_page(): ) # Make the request - client.delete_page(request=request) + await client.delete_page(request=request) Args: request (Union[google.cloud.dialogflowcx_v3beta1.types.DeletePageRequest, dict]): @@ -742,7 +765,10 @@ def sample_delete_page(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/dialogflowcx_v3beta1/services/pages/client.py b/google/cloud/dialogflowcx_v3beta1/services/pages/client.py index 4992a8a1..2e67c80a 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/pages/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/pages/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -56,7 +56,10 @@ class PagesClientMeta(type): _transport_registry["grpc"] = PagesGrpcTransport _transport_registry["grpc_asyncio"] = PagesGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[PagesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[PagesTransport]: """Returns an appropriate transport class. Args: @@ -164,11 +167,17 @@ def transport(self) -> PagesTransport: @staticmethod def entity_type_path( - project: str, location: str, agent: str, entity_type: str, + project: str, + location: str, + agent: str, + entity_type: str, ) -> str: """Returns a fully-qualified entity_type string.""" return "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) @staticmethod @@ -181,10 +190,18 @@ def parse_entity_type_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def flow_path(project: str, location: str, agent: str, flow: str,) -> str: + def flow_path( + project: str, + location: str, + agent: str, + flow: str, + ) -> str: """Returns a fully-qualified flow string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) @staticmethod @@ -197,10 +214,18 @@ def parse_flow_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def intent_path(project: str, location: str, agent: str, intent: str,) -> str: + def intent_path( + project: str, + location: str, + agent: str, + intent: str, + ) -> str: """Returns a fully-qualified intent string.""" return "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) @staticmethod @@ -214,11 +239,19 @@ def parse_intent_path(path: str) -> Dict[str, str]: @staticmethod def page_path( - project: str, location: str, agent: str, flow: str, page: str, + project: str, + location: str, + agent: str, + flow: str, + page: str, ) -> str: """Returns a fully-qualified page string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) @staticmethod @@ -232,7 +265,11 @@ def parse_page_path(path: str) -> Dict[str, str]: @staticmethod def transition_route_group_path( - project: str, location: str, agent: str, flow: str, transition_route_group: str, + project: str, + location: str, + agent: str, + flow: str, + transition_route_group: str, ) -> str: """Returns a fully-qualified transition_route_group string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}".format( @@ -253,10 +290,18 @@ def parse_transition_route_group_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def webhook_path(project: str, location: str, agent: str, webhook: str,) -> str: + def webhook_path( + project: str, + location: str, + agent: str, + webhook: str, + ) -> str: """Returns a fully-qualified webhook string.""" return "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) @staticmethod @@ -269,7 +314,9 @@ def parse_webhook_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -282,9 +329,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -293,9 +344,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -304,9 +359,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -315,10 +374,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -581,12 +644,20 @@ def sample_list_pages(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListPagesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -697,7 +768,12 @@ def sample_get_page(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -819,7 +895,12 @@ def sample_create_page(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -943,7 +1024,12 @@ def sample_update_page(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1025,7 +1111,10 @@ def sample_delete_page(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/dialogflowcx_v3beta1/services/pages/transports/base.py b/google/cloud/dialogflowcx_v3beta1/services/pages/transports/base.py index fdb0d617..0f3eb7de 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/pages/transports/base.py +++ b/google/cloud/dialogflowcx_v3beta1/services/pages/transports/base.py @@ -85,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -126,28 +127,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_pages: gapic_v1.method.wrap_method( - self.list_pages, default_timeout=None, client_info=client_info, + self.list_pages, + default_timeout=None, + client_info=client_info, ), self.get_page: gapic_v1.method.wrap_method( - self.get_page, default_timeout=None, client_info=client_info, + self.get_page, + default_timeout=None, + client_info=client_info, ), self.create_page: gapic_v1.method.wrap_method( - self.create_page, default_timeout=None, client_info=client_info, + self.create_page, + default_timeout=None, + client_info=client_info, ), self.update_page: gapic_v1.method.wrap_method( - self.update_page, default_timeout=None, client_info=client_info, + self.update_page, + default_timeout=None, + client_info=client_info, ), self.delete_page: gapic_v1.method.wrap_method( - self.delete_page, default_timeout=None, client_info=client_info, + self.delete_page, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -190,5 +201,9 @@ def delete_page( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("PagesTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/pages/transports/grpc.py b/google/cloud/dialogflowcx_v3beta1/services/pages/transports/grpc.py index b17e9122..6739be9f 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/pages/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3beta1/services/pages/transports/grpc.py @@ -227,8 +227,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -354,5 +353,9 @@ def delete_page(self) -> Callable[[page.DeletePageRequest], empty_pb2.Empty]: def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("PagesGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/async_client.py index 02913f88..c967a52c 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -245,9 +245,9 @@ async def create_security_settings( from google.cloud import dialogflowcx_v3beta1 - def sample_create_security_settings(): + async def sample_create_security_settings(): # Create a client - client = dialogflowcx_v3beta1.SecuritySettingsServiceClient() + client = dialogflowcx_v3beta1.SecuritySettingsServiceAsyncClient() # Initialize request argument(s) security_settings = dialogflowcx_v3beta1.SecuritySettings() @@ -260,7 +260,7 @@ def sample_create_security_settings(): ) # Make the request - response = client.create_security_settings(request=request) + response = await client.create_security_settings(request=request) # Handle the response print(response) @@ -335,7 +335,12 @@ def sample_create_security_settings(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -353,14 +358,13 @@ async def get_security_settings( [SecuritySettings][google.cloud.dialogflow.cx.v3beta1.SecuritySettings]. The returned settings may be stale by up to 1 minute. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_get_security_settings(): + async def sample_get_security_settings(): # Create a client - client = dialogflowcx_v3beta1.SecuritySettingsServiceClient() + client = dialogflowcx_v3beta1.SecuritySettingsServiceAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetSecuritySettingsRequest( @@ -368,7 +372,7 @@ def sample_get_security_settings(): ) # Make the request - response = client.get_security_settings(request=request) + response = await client.get_security_settings(request=request) # Handle the response print(response) @@ -432,7 +436,12 @@ def sample_get_security_settings(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -452,14 +461,13 @@ async def update_security_settings( r"""Updates the specified [SecuritySettings][google.cloud.dialogflow.cx.v3beta1.SecuritySettings]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_update_security_settings(): + async def sample_update_security_settings(): # Create a client - client = dialogflowcx_v3beta1.SecuritySettingsServiceClient() + client = dialogflowcx_v3beta1.SecuritySettingsServiceAsyncClient() # Initialize request argument(s) security_settings = dialogflowcx_v3beta1.SecuritySettings() @@ -471,7 +479,7 @@ def sample_update_security_settings(): ) # Make the request - response = client.update_security_settings(request=request) + response = await client.update_security_settings(request=request) # Handle the response print(response) @@ -547,7 +555,12 @@ def sample_update_security_settings(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -564,14 +577,13 @@ async def list_security_settings( r"""Returns the list of all security settings in the specified location. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_list_security_settings(): + async def sample_list_security_settings(): # Create a client - client = dialogflowcx_v3beta1.SecuritySettingsServiceClient() + client = dialogflowcx_v3beta1.SecuritySettingsServiceAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListSecuritySettingsRequest( @@ -582,7 +594,7 @@ def sample_list_security_settings(): page_result = client.list_security_settings(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -644,12 +656,20 @@ def sample_list_security_settings(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListSecuritySettingsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -667,14 +687,13 @@ async def delete_security_settings( r"""Deletes the specified [SecuritySettings][google.cloud.dialogflow.cx.v3beta1.SecuritySettings]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_delete_security_settings(): + async def sample_delete_security_settings(): # Create a client - client = dialogflowcx_v3beta1.SecuritySettingsServiceClient() + client = dialogflowcx_v3beta1.SecuritySettingsServiceAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.DeleteSecuritySettingsRequest( @@ -682,7 +701,7 @@ def sample_delete_security_settings(): ) # Make the request - client.delete_security_settings(request=request) + await client.delete_security_settings(request=request) Args: request (Union[google.cloud.dialogflowcx_v3beta1.types.DeleteSecuritySettingsRequest, dict]): @@ -736,7 +755,10 @@ def sample_delete_security_settings(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/client.py b/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/client.py index f63e9060..2884b0f6 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -60,7 +60,8 @@ class SecuritySettingsServiceClientMeta(type): _transport_registry["grpc_asyncio"] = SecuritySettingsServiceGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[SecuritySettingsServiceTransport]: """Returns an appropriate transport class. @@ -167,7 +168,9 @@ def transport(self) -> SecuritySettingsServiceTransport: @staticmethod def deidentify_template_path( - organization: str, location: str, deidentify_template: str, + organization: str, + location: str, + deidentify_template: str, ) -> str: """Returns a fully-qualified deidentify_template string.""" return "organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}".format( @@ -187,7 +190,9 @@ def parse_deidentify_template_path(path: str) -> Dict[str, str]: @staticmethod def inspect_template_path( - organization: str, location: str, inspect_template: str, + organization: str, + location: str, + inspect_template: str, ) -> str: """Returns a fully-qualified inspect_template string.""" return "organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}".format( @@ -207,11 +212,15 @@ def parse_inspect_template_path(path: str) -> Dict[str, str]: @staticmethod def security_settings_path( - project: str, location: str, security_settings: str, + project: str, + location: str, + security_settings: str, ) -> str: """Returns a fully-qualified security_settings string.""" return "projects/{project}/locations/{location}/securitySettings/{security_settings}".format( - project=project, location=location, security_settings=security_settings, + project=project, + location=location, + security_settings=security_settings, ) @staticmethod @@ -224,7 +233,9 @@ def parse_security_settings_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -237,9 +248,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -248,9 +263,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -259,9 +278,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -270,10 +293,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -557,7 +584,12 @@ def sample_create_security_settings(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -575,7 +607,6 @@ def get_security_settings( [SecuritySettings][google.cloud.dialogflow.cx.v3beta1.SecuritySettings]. The returned settings may be stale by up to 1 minute. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -654,7 +685,12 @@ def sample_get_security_settings(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -674,7 +710,6 @@ def update_security_settings( r"""Updates the specified [SecuritySettings][google.cloud.dialogflow.cx.v3beta1.SecuritySettings]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -771,7 +806,12 @@ def sample_update_security_settings(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -788,7 +828,6 @@ def list_security_settings( r"""Returns the list of all security settings in the specified location. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -868,12 +907,20 @@ def sample_list_security_settings(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListSecuritySettingsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -891,7 +938,6 @@ def delete_security_settings( r"""Deletes the specified [SecuritySettings][google.cloud.dialogflow.cx.v3beta1.SecuritySettings]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -960,7 +1006,10 @@ def sample_delete_security_settings(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/transports/base.py b/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/transports/base.py index 918f166b..9ad4527b 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/transports/base.py +++ b/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -157,9 +158,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -220,5 +221,9 @@ def delete_security_settings( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("SecuritySettingsServiceTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/transports/grpc.py b/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/transports/grpc.py index fe896ffd..b0bc975e 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3beta1/services/security_settings_service/transports/grpc.py @@ -228,8 +228,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -382,5 +381,9 @@ def delete_security_settings( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("SecuritySettingsServiceGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/session_entity_types/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/session_entity_types/async_client.py index a692d9af..9b2d0f0b 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/session_entity_types/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/session_entity_types/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -226,14 +226,13 @@ async def list_session_entity_types( r"""Returns the list of all session entity types in the specified session. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_list_session_entity_types(): + async def sample_list_session_entity_types(): # Create a client - client = dialogflowcx_v3beta1.SessionEntityTypesClient() + client = dialogflowcx_v3beta1.SessionEntityTypesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListSessionEntityTypesRequest( @@ -244,7 +243,7 @@ def sample_list_session_entity_types(): page_result = client.list_session_entity_types(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -310,12 +309,20 @@ def sample_list_session_entity_types(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListSessionEntityTypesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -336,9 +343,9 @@ async def get_session_entity_type( from google.cloud import dialogflowcx_v3beta1 - def sample_get_session_entity_type(): + async def sample_get_session_entity_type(): # Create a client - client = dialogflowcx_v3beta1.SessionEntityTypesClient() + client = dialogflowcx_v3beta1.SessionEntityTypesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetSessionEntityTypeRequest( @@ -346,7 +353,7 @@ def sample_get_session_entity_type(): ) # Make the request - response = client.get_session_entity_type(request=request) + response = await client.get_session_entity_type(request=request) # Handle the response print(response) @@ -425,7 +432,12 @@ def sample_get_session_entity_type(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -448,9 +460,9 @@ async def create_session_entity_type( from google.cloud import dialogflowcx_v3beta1 - def sample_create_session_entity_type(): + async def sample_create_session_entity_type(): # Create a client - client = dialogflowcx_v3beta1.SessionEntityTypesClient() + client = dialogflowcx_v3beta1.SessionEntityTypesAsyncClient() # Initialize request argument(s) session_entity_type = dialogflowcx_v3beta1.SessionEntityType() @@ -465,7 +477,7 @@ def sample_create_session_entity_type(): ) # Make the request - response = client.create_session_entity_type(request=request) + response = await client.create_session_entity_type(request=request) # Handle the response print(response) @@ -554,7 +566,12 @@ def sample_create_session_entity_type(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -577,9 +594,9 @@ async def update_session_entity_type( from google.cloud import dialogflowcx_v3beta1 - def sample_update_session_entity_type(): + async def sample_update_session_entity_type(): # Create a client - client = dialogflowcx_v3beta1.SessionEntityTypesClient() + client = dialogflowcx_v3beta1.SessionEntityTypesAsyncClient() # Initialize request argument(s) session_entity_type = dialogflowcx_v3beta1.SessionEntityType() @@ -593,7 +610,7 @@ def sample_update_session_entity_type(): ) # Make the request - response = client.update_session_entity_type(request=request) + response = await client.update_session_entity_type(request=request) # Handle the response print(response) @@ -683,7 +700,12 @@ def sample_update_session_entity_type(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -703,9 +725,9 @@ async def delete_session_entity_type( from google.cloud import dialogflowcx_v3beta1 - def sample_delete_session_entity_type(): + async def sample_delete_session_entity_type(): # Create a client - client = dialogflowcx_v3beta1.SessionEntityTypesClient() + client = dialogflowcx_v3beta1.SessionEntityTypesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.DeleteSessionEntityTypeRequest( @@ -713,7 +735,7 @@ def sample_delete_session_entity_type(): ) # Make the request - client.delete_session_entity_type(request=request) + await client.delete_session_entity_type(request=request) Args: request (Union[google.cloud.dialogflowcx_v3beta1.types.DeleteSessionEntityTypeRequest, dict]): @@ -770,7 +792,10 @@ def sample_delete_session_entity_type(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/dialogflowcx_v3beta1/services/session_entity_types/client.py b/google/cloud/dialogflowcx_v3beta1/services/session_entity_types/client.py index d19c9d0e..6c5b79d5 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/session_entity_types/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/session_entity_types/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -61,7 +61,8 @@ class SessionEntityTypesClientMeta(type): _transport_registry["grpc_asyncio"] = SessionEntityTypesGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[SessionEntityTypesTransport]: """Returns an appropriate transport class. @@ -170,7 +171,11 @@ def transport(self) -> SessionEntityTypesTransport: @staticmethod def session_entity_type_path( - project: str, location: str, agent: str, session: str, entity_type: str, + project: str, + location: str, + agent: str, + session: str, + entity_type: str, ) -> str: """Returns a fully-qualified session_entity_type string.""" return "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}".format( @@ -191,7 +196,9 @@ def parse_session_entity_type_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -204,9 +211,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -215,9 +226,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -226,9 +241,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -237,10 +256,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -426,7 +449,6 @@ def list_session_entity_types( r"""Returns the list of all session entity types in the specified session. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -512,12 +534,20 @@ def sample_list_session_entity_types(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListSessionEntityTypesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -627,7 +657,12 @@ def sample_get_session_entity_type(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -760,7 +795,12 @@ def sample_create_session_entity_type(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -893,7 +933,12 @@ def sample_update_session_entity_type(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -982,7 +1027,10 @@ def sample_delete_session_entity_type(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/dialogflowcx_v3beta1/services/session_entity_types/transports/base.py b/google/cloud/dialogflowcx_v3beta1/services/session_entity_types/transports/base.py index 3d817be8..e3f5b179 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/session_entity_types/transports/base.py +++ b/google/cloud/dialogflowcx_v3beta1/services/session_entity_types/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -157,9 +158,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -220,5 +221,9 @@ def delete_session_entity_type( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("SessionEntityTypesTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/session_entity_types/transports/grpc.py b/google/cloud/dialogflowcx_v3beta1/services/session_entity_types/transports/grpc.py index ae607e60..a3019dd7 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/session_entity_types/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3beta1/services/session_entity_types/transports/grpc.py @@ -229,8 +229,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -381,5 +380,9 @@ def delete_session_entity_type( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("SessionEntityTypesGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/sessions/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/sessions/async_client.py index 8fe223b3..157a8a24 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/sessions/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/sessions/async_client.py @@ -18,6 +18,7 @@ import re from typing import ( Dict, + Mapping, Optional, AsyncIterable, Awaitable, @@ -248,14 +249,13 @@ async def detect_intent( `Versions and environments `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_detect_intent(): + async def sample_detect_intent(): # Create a client - client = dialogflowcx_v3beta1.SessionsClient() + client = dialogflowcx_v3beta1.SessionsAsyncClient() # Initialize request argument(s) query_input = dialogflowcx_v3beta1.QueryInput() @@ -268,7 +268,7 @@ def sample_detect_intent(): ) # Make the request - response = client.detect_intent(request=request) + response = await client.detect_intent(request=request) # Handle the response print(response) @@ -315,7 +315,12 @@ def sample_detect_intent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -337,14 +342,13 @@ def streaming_detect_intent( `Versions and environments `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_streaming_detect_intent(): + async def sample_streaming_detect_intent(): # Create a client - client = dialogflowcx_v3beta1.SessionsClient() + client = dialogflowcx_v3beta1.SessionsAsyncClient() # Initialize request argument(s) query_input = dialogflowcx_v3beta1.QueryInput() @@ -366,10 +370,10 @@ def request_generator(): yield request # Make the request - stream = client.streaming_detect_intent(requests=request_generator()) + stream = await client.streaming_detect_intent(requests=request_generator()) # Handle the response - for response in stream: + async for response in stream: print(response) Args: @@ -460,7 +464,12 @@ def request_generator(): ) # Send the request. - response = rpc(requests, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + requests, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -476,14 +485,13 @@ async def match_intent( r"""Returns preliminary intent match results, doesn't change the session status. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_match_intent(): + async def sample_match_intent(): # Create a client - client = dialogflowcx_v3beta1.SessionsClient() + client = dialogflowcx_v3beta1.SessionsAsyncClient() # Initialize request argument(s) query_input = dialogflowcx_v3beta1.QueryInput() @@ -496,7 +504,7 @@ def sample_match_intent(): ) # Make the request - response = client.match_intent(request=request) + response = await client.match_intent(request=request) # Handle the response print(response) @@ -532,7 +540,12 @@ def sample_match_intent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -553,21 +566,20 @@ async def fulfill_intent( [MatchIntentResponse][google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse]. Otherwise, the behavior is undefined. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_fulfill_intent(): + async def sample_fulfill_intent(): # Create a client - client = dialogflowcx_v3beta1.SessionsClient() + client = dialogflowcx_v3beta1.SessionsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.FulfillIntentRequest( ) # Make the request - response = client.fulfill_intent(request=request) + response = await client.fulfill_intent(request=request) # Handle the response print(response) @@ -610,7 +622,12 @@ def sample_fulfill_intent(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3beta1/services/sessions/client.py b/google/cloud/dialogflowcx_v3beta1/services/sessions/client.py index 0391eb7a..7c3c820e 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/sessions/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/sessions/client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Iterable, Iterator, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + Optional, + Iterable, + Iterator, + Sequence, + Tuple, + Type, + Union, +) import pkg_resources from google.api_core import client_options as client_options_lib @@ -54,7 +64,10 @@ class SessionsClientMeta(type): _transport_registry["grpc"] = SessionsGrpcTransport _transport_registry["grpc_asyncio"] = SessionsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[SessionsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[SessionsTransport]: """Returns an appropriate transport class. Args: @@ -164,11 +177,17 @@ def transport(self) -> SessionsTransport: @staticmethod def entity_type_path( - project: str, location: str, agent: str, entity_type: str, + project: str, + location: str, + agent: str, + entity_type: str, ) -> str: """Returns a fully-qualified entity_type string.""" return "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) @staticmethod @@ -181,10 +200,18 @@ def parse_entity_type_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def flow_path(project: str, location: str, agent: str, flow: str,) -> str: + def flow_path( + project: str, + location: str, + agent: str, + flow: str, + ) -> str: """Returns a fully-qualified flow string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) @staticmethod @@ -197,10 +224,18 @@ def parse_flow_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def intent_path(project: str, location: str, agent: str, intent: str,) -> str: + def intent_path( + project: str, + location: str, + agent: str, + intent: str, + ) -> str: """Returns a fully-qualified intent string.""" return "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) @staticmethod @@ -214,11 +249,19 @@ def parse_intent_path(path: str) -> Dict[str, str]: @staticmethod def page_path( - project: str, location: str, agent: str, flow: str, page: str, + project: str, + location: str, + agent: str, + flow: str, + page: str, ) -> str: """Returns a fully-qualified page string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) @staticmethod @@ -231,10 +274,18 @@ def parse_page_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def session_path(project: str, location: str, agent: str, session: str,) -> str: + def session_path( + project: str, + location: str, + agent: str, + session: str, + ) -> str: """Returns a fully-qualified session string.""" return "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}".format( - project=project, location=location, agent=agent, session=session, + project=project, + location=location, + agent=agent, + session=session, ) @staticmethod @@ -248,7 +299,11 @@ def parse_session_path(path: str) -> Dict[str, str]: @staticmethod def session_entity_type_path( - project: str, location: str, agent: str, session: str, entity_type: str, + project: str, + location: str, + agent: str, + session: str, + entity_type: str, ) -> str: """Returns a fully-qualified session_entity_type string.""" return "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}".format( @@ -270,7 +325,11 @@ def parse_session_entity_type_path(path: str) -> Dict[str, str]: @staticmethod def transition_route_group_path( - project: str, location: str, agent: str, flow: str, transition_route_group: str, + project: str, + location: str, + agent: str, + flow: str, + transition_route_group: str, ) -> str: """Returns a fully-qualified transition_route_group string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}".format( @@ -292,11 +351,19 @@ def parse_transition_route_group_path(path: str) -> Dict[str, str]: @staticmethod def version_path( - project: str, location: str, agent: str, flow: str, version: str, + project: str, + location: str, + agent: str, + flow: str, + version: str, ) -> str: """Returns a fully-qualified version string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) @staticmethod @@ -309,10 +376,18 @@ def parse_version_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def webhook_path(project: str, location: str, agent: str, webhook: str,) -> str: + def webhook_path( + project: str, + location: str, + agent: str, + webhook: str, + ) -> str: """Returns a fully-qualified webhook string.""" return "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) @staticmethod @@ -325,7 +400,9 @@ def parse_webhook_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -338,9 +415,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -349,9 +430,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -360,9 +445,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -371,10 +460,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -565,7 +658,6 @@ def detect_intent( `Versions and environments `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -624,7 +716,12 @@ def sample_detect_intent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -646,7 +743,6 @@ def streaming_detect_intent( `Versions and environments `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -765,7 +861,12 @@ def request_generator(): rpc = self._transport._wrapped_methods[self._transport.streaming_detect_intent] # Send the request. - response = rpc(requests, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + requests, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -781,7 +882,6 @@ def match_intent( r"""Returns preliminary intent match results, doesn't change the session status. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -838,7 +938,12 @@ def sample_match_intent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -859,7 +964,6 @@ def fulfill_intent( [MatchIntentResponse][google.cloud.dialogflow.cx.v3beta1.MatchIntentResponse]. Otherwise, the behavior is undefined. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -917,7 +1021,12 @@ def sample_fulfill_intent(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3beta1/services/sessions/transports/base.py b/google/cloud/dialogflowcx_v3beta1/services/sessions/transports/base.py index d3c2c3d1..e4abf67c 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/sessions/transports/base.py +++ b/google/cloud/dialogflowcx_v3beta1/services/sessions/transports/base.py @@ -83,6 +83,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -143,19 +144,23 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.match_intent: gapic_v1.method.wrap_method( - self.match_intent, default_timeout=None, client_info=client_info, + self.match_intent, + default_timeout=None, + client_info=client_info, ), self.fulfill_intent: gapic_v1.method.wrap_method( - self.fulfill_intent, default_timeout=None, client_info=client_info, + self.fulfill_intent, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -198,5 +203,9 @@ def fulfill_intent( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("SessionsTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/sessions/transports/grpc.py b/google/cloud/dialogflowcx_v3beta1/services/sessions/transports/grpc.py index f2a3e39b..55fee772 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/sessions/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3beta1/services/sessions/transports/grpc.py @@ -227,8 +227,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -361,5 +360,9 @@ def fulfill_intent( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("SessionsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/test_cases/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/test_cases/async_client.py index 961d1d6d..80cb8326 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/test_cases/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/test_cases/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -243,9 +243,9 @@ async def list_test_cases( from google.cloud import dialogflowcx_v3beta1 - def sample_list_test_cases(): + async def sample_list_test_cases(): # Create a client - client = dialogflowcx_v3beta1.TestCasesClient() + client = dialogflowcx_v3beta1.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListTestCasesRequest( @@ -256,7 +256,7 @@ def sample_list_test_cases(): page_result = client.list_test_cases(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -317,12 +317,20 @@ def sample_list_test_cases(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListTestCasesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -343,9 +351,9 @@ async def batch_delete_test_cases( from google.cloud import dialogflowcx_v3beta1 - def sample_batch_delete_test_cases(): + async def sample_batch_delete_test_cases(): # Create a client - client = dialogflowcx_v3beta1.TestCasesClient() + client = dialogflowcx_v3beta1.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.BatchDeleteTestCasesRequest( @@ -354,7 +362,7 @@ def sample_batch_delete_test_cases(): ) # Make the request - client.batch_delete_test_cases(request=request) + await client.batch_delete_test_cases(request=request) Args: request (Union[google.cloud.dialogflowcx_v3beta1.types.BatchDeleteTestCasesRequest, dict]): @@ -406,7 +414,10 @@ def sample_batch_delete_test_cases(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def get_test_case( @@ -424,9 +435,9 @@ async def get_test_case( from google.cloud import dialogflowcx_v3beta1 - def sample_get_test_case(): + async def sample_get_test_case(): # Create a client - client = dialogflowcx_v3beta1.TestCasesClient() + client = dialogflowcx_v3beta1.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetTestCaseRequest( @@ -434,7 +445,7 @@ def sample_get_test_case(): ) # Make the request - response = client.get_test_case(request=request) + response = await client.get_test_case(request=request) # Handle the response print(response) @@ -492,7 +503,12 @@ def sample_get_test_case(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -513,9 +529,9 @@ async def create_test_case( from google.cloud import dialogflowcx_v3beta1 - def sample_create_test_case(): + async def sample_create_test_case(): # Create a client - client = dialogflowcx_v3beta1.TestCasesClient() + client = dialogflowcx_v3beta1.TestCasesAsyncClient() # Initialize request argument(s) test_case = dialogflowcx_v3beta1.TestCase() @@ -527,7 +543,7 @@ def sample_create_test_case(): ) # Make the request - response = client.create_test_case(request=request) + response = await client.create_test_case(request=request) # Handle the response print(response) @@ -592,7 +608,12 @@ def sample_create_test_case(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -613,9 +634,9 @@ async def update_test_case( from google.cloud import dialogflowcx_v3beta1 - def sample_update_test_case(): + async def sample_update_test_case(): # Create a client - client = dialogflowcx_v3beta1.TestCasesClient() + client = dialogflowcx_v3beta1.TestCasesAsyncClient() # Initialize request argument(s) test_case = dialogflowcx_v3beta1.TestCase() @@ -626,7 +647,7 @@ def sample_update_test_case(): ) # Make the request - response = client.update_test_case(request=request) + response = await client.update_test_case(request=request) # Handle the response print(response) @@ -697,7 +718,12 @@ def sample_update_test_case(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -722,14 +748,13 @@ async def run_test_case( - ``response``: [RunTestCaseResponse][google.cloud.dialogflow.cx.v3beta1.RunTestCaseResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_run_test_case(): + async def sample_run_test_case(): # Create a client - client = dialogflowcx_v3beta1.TestCasesClient() + client = dialogflowcx_v3beta1.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.RunTestCaseRequest( @@ -741,7 +766,7 @@ def sample_run_test_case(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -784,7 +809,12 @@ def sample_run_test_case(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -817,14 +847,13 @@ async def batch_run_test_cases( - ``response``: [BatchRunTestCasesResponse][google.cloud.dialogflow.cx.v3beta1.BatchRunTestCasesResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_batch_run_test_cases(): + async def sample_batch_run_test_cases(): # Create a client - client = dialogflowcx_v3beta1.TestCasesClient() + client = dialogflowcx_v3beta1.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.BatchRunTestCasesRequest( @@ -837,7 +866,7 @@ def sample_batch_run_test_cases(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -880,7 +909,12 @@ def sample_batch_run_test_cases(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -907,9 +941,9 @@ async def calculate_coverage( from google.cloud import dialogflowcx_v3beta1 - def sample_calculate_coverage(): + async def sample_calculate_coverage(): # Create a client - client = dialogflowcx_v3beta1.TestCasesClient() + client = dialogflowcx_v3beta1.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.CalculateCoverageRequest( @@ -918,7 +952,7 @@ def sample_calculate_coverage(): ) # Make the request - response = client.calculate_coverage(request=request) + response = await client.calculate_coverage(request=request) # Handle the response print(response) @@ -957,7 +991,12 @@ def sample_calculate_coverage(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -971,7 +1010,7 @@ async def import_test_cases( metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Imports the test cases from a Cloud Storage bucket or a local - file. It always creates new test cases and won't overwite any + file. It always creates new test cases and won't overwrite any existing ones. The provided ID in the imported test case is neglected. @@ -985,14 +1024,13 @@ async def import_test_cases( - ``response``: [ImportTestCasesResponse][google.cloud.dialogflow.cx.v3beta1.ImportTestCasesResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_import_test_cases(): + async def sample_import_test_cases(): # Create a client - client = dialogflowcx_v3beta1.TestCasesClient() + client = dialogflowcx_v3beta1.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ImportTestCasesRequest( @@ -1005,7 +1043,7 @@ def sample_import_test_cases(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1048,7 +1086,12 @@ def sample_import_test_cases(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1083,14 +1126,13 @@ async def export_test_cases( - ``response``: [ExportTestCasesResponse][google.cloud.dialogflow.cx.v3beta1.ExportTestCasesResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_export_test_cases(): + async def sample_export_test_cases(): # Create a client - client = dialogflowcx_v3beta1.TestCasesClient() + client = dialogflowcx_v3beta1.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ExportTestCasesRequest( @@ -1103,7 +1145,7 @@ def sample_export_test_cases(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1146,7 +1188,12 @@ def sample_export_test_cases(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1174,9 +1221,9 @@ async def list_test_case_results( from google.cloud import dialogflowcx_v3beta1 - def sample_list_test_case_results(): + async def sample_list_test_case_results(): # Create a client - client = dialogflowcx_v3beta1.TestCasesClient() + client = dialogflowcx_v3beta1.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListTestCaseResultsRequest( @@ -1187,7 +1234,7 @@ def sample_list_test_case_results(): page_result = client.list_test_case_results(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1250,12 +1297,20 @@ def sample_list_test_case_results(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListTestCaseResultsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1276,9 +1331,9 @@ async def get_test_case_result( from google.cloud import dialogflowcx_v3beta1 - def sample_get_test_case_result(): + async def sample_get_test_case_result(): # Create a client - client = dialogflowcx_v3beta1.TestCasesClient() + client = dialogflowcx_v3beta1.TestCasesAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetTestCaseResultRequest( @@ -1286,7 +1341,7 @@ def sample_get_test_case_result(): ) # Make the request - response = client.get_test_case_result(request=request) + response = await client.get_test_case_result(request=request) # Handle the response print(response) @@ -1346,7 +1401,12 @@ def sample_get_test_case_result(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3beta1/services/test_cases/client.py b/google/cloud/dialogflowcx_v3beta1/services/test_cases/client.py index f252dc7d..a71ba00a 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/test_cases/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/test_cases/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -58,7 +58,10 @@ class TestCasesClientMeta(type): _transport_registry["grpc"] = TestCasesGrpcTransport _transport_registry["grpc_asyncio"] = TestCasesGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[TestCasesTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[TestCasesTransport]: """Returns an appropriate transport class. Args: @@ -166,10 +169,16 @@ def transport(self) -> TestCasesTransport: return self._transport @staticmethod - def agent_path(project: str, location: str, agent: str,) -> str: + def agent_path( + project: str, + location: str, + agent: str, + ) -> str: """Returns a fully-qualified agent string.""" return "projects/{project}/locations/{location}/agents/{agent}".format( - project=project, location=location, agent=agent, + project=project, + location=location, + agent=agent, ) @staticmethod @@ -183,11 +192,17 @@ def parse_agent_path(path: str) -> Dict[str, str]: @staticmethod def entity_type_path( - project: str, location: str, agent: str, entity_type: str, + project: str, + location: str, + agent: str, + entity_type: str, ) -> str: """Returns a fully-qualified entity_type string.""" return "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) @staticmethod @@ -201,11 +216,17 @@ def parse_entity_type_path(path: str) -> Dict[str, str]: @staticmethod def environment_path( - project: str, location: str, agent: str, environment: str, + project: str, + location: str, + agent: str, + environment: str, ) -> str: """Returns a fully-qualified environment string.""" return "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}".format( - project=project, location=location, agent=agent, environment=environment, + project=project, + location=location, + agent=agent, + environment=environment, ) @staticmethod @@ -218,10 +239,18 @@ def parse_environment_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def flow_path(project: str, location: str, agent: str, flow: str,) -> str: + def flow_path( + project: str, + location: str, + agent: str, + flow: str, + ) -> str: """Returns a fully-qualified flow string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) @staticmethod @@ -234,10 +263,18 @@ def parse_flow_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def intent_path(project: str, location: str, agent: str, intent: str,) -> str: + def intent_path( + project: str, + location: str, + agent: str, + intent: str, + ) -> str: """Returns a fully-qualified intent string.""" return "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) @staticmethod @@ -251,11 +288,19 @@ def parse_intent_path(path: str) -> Dict[str, str]: @staticmethod def page_path( - project: str, location: str, agent: str, flow: str, page: str, + project: str, + location: str, + agent: str, + flow: str, + page: str, ) -> str: """Returns a fully-qualified page string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) @staticmethod @@ -268,10 +313,18 @@ def parse_page_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def test_case_path(project: str, location: str, agent: str, test_case: str,) -> str: + def test_case_path( + project: str, + location: str, + agent: str, + test_case: str, + ) -> str: """Returns a fully-qualified test_case string.""" return "projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}".format( - project=project, location=location, agent=agent, test_case=test_case, + project=project, + location=location, + agent=agent, + test_case=test_case, ) @staticmethod @@ -285,7 +338,11 @@ def parse_test_case_path(path: str) -> Dict[str, str]: @staticmethod def test_case_result_path( - project: str, location: str, agent: str, test_case: str, result: str, + project: str, + location: str, + agent: str, + test_case: str, + result: str, ) -> str: """Returns a fully-qualified test_case_result string.""" return "projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}/results/{result}".format( @@ -307,7 +364,11 @@ def parse_test_case_result_path(path: str) -> Dict[str, str]: @staticmethod def transition_route_group_path( - project: str, location: str, agent: str, flow: str, transition_route_group: str, + project: str, + location: str, + agent: str, + flow: str, + transition_route_group: str, ) -> str: """Returns a fully-qualified transition_route_group string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}".format( @@ -328,10 +389,18 @@ def parse_transition_route_group_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def webhook_path(project: str, location: str, agent: str, webhook: str,) -> str: + def webhook_path( + project: str, + location: str, + agent: str, + webhook: str, + ) -> str: """Returns a fully-qualified webhook string.""" return "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) @staticmethod @@ -344,7 +413,9 @@ def parse_webhook_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -357,9 +428,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -368,9 +443,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -379,9 +458,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -390,10 +473,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -656,12 +743,20 @@ def sample_list_test_cases(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListTestCasesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -745,7 +840,10 @@ def sample_batch_delete_test_cases(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def get_test_case( @@ -831,7 +929,12 @@ def sample_get_test_case(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -931,7 +1034,12 @@ def sample_create_test_case(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1036,7 +1144,12 @@ def sample_update_test_case(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1061,7 +1174,6 @@ def run_test_case( - ``response``: [RunTestCaseResponse][google.cloud.dialogflow.cx.v3beta1.RunTestCaseResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1124,7 +1236,12 @@ def sample_run_test_case(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1157,7 +1274,6 @@ def batch_run_test_cases( - ``response``: [BatchRunTestCasesResponse][google.cloud.dialogflow.cx.v3beta1.BatchRunTestCasesResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1221,7 +1337,12 @@ def sample_batch_run_test_cases(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1299,7 +1420,12 @@ def sample_calculate_coverage(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1313,7 +1439,7 @@ def import_test_cases( metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Imports the test cases from a Cloud Storage bucket or a local - file. It always creates new test cases and won't overwite any + file. It always creates new test cases and won't overwrite any existing ones. The provided ID in the imported test case is neglected. @@ -1327,7 +1453,6 @@ def import_test_cases( - ``response``: [ImportTestCasesResponse][google.cloud.dialogflow.cx.v3beta1.ImportTestCasesResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1391,7 +1516,12 @@ def sample_import_test_cases(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1426,7 +1556,6 @@ def export_test_cases( - ``response``: [ExportTestCasesResponse][google.cloud.dialogflow.cx.v3beta1.ExportTestCasesResponse] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1490,7 +1619,12 @@ def sample_export_test_cases(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1594,12 +1728,20 @@ def sample_list_test_case_results(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListTestCaseResultsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1690,7 +1832,12 @@ def sample_get_test_case_result(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3beta1/services/test_cases/transports/base.py b/google/cloud/dialogflowcx_v3beta1/services/test_cases/transports/base.py index fbde19fb..c1b994a9 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/test_cases/transports/base.py +++ b/google/cloud/dialogflowcx_v3beta1/services/test_cases/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -128,7 +129,9 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_test_cases: gapic_v1.method.wrap_method( - self.list_test_cases, default_timeout=None, client_info=client_info, + self.list_test_cases, + default_timeout=None, + client_info=client_info, ), self.batch_delete_test_cases: gapic_v1.method.wrap_method( self.batch_delete_test_cases, @@ -136,16 +139,24 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.get_test_case: gapic_v1.method.wrap_method( - self.get_test_case, default_timeout=None, client_info=client_info, + self.get_test_case, + default_timeout=None, + client_info=client_info, ), self.create_test_case: gapic_v1.method.wrap_method( - self.create_test_case, default_timeout=None, client_info=client_info, + self.create_test_case, + default_timeout=None, + client_info=client_info, ), self.update_test_case: gapic_v1.method.wrap_method( - self.update_test_case, default_timeout=None, client_info=client_info, + self.update_test_case, + default_timeout=None, + client_info=client_info, ), self.run_test_case: gapic_v1.method.wrap_method( - self.run_test_case, default_timeout=None, client_info=client_info, + self.run_test_case, + default_timeout=None, + client_info=client_info, ), self.batch_run_test_cases: gapic_v1.method.wrap_method( self.batch_run_test_cases, @@ -153,13 +164,19 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.calculate_coverage: gapic_v1.method.wrap_method( - self.calculate_coverage, default_timeout=None, client_info=client_info, + self.calculate_coverage, + default_timeout=None, + client_info=client_info, ), self.import_test_cases: gapic_v1.method.wrap_method( - self.import_test_cases, default_timeout=None, client_info=client_info, + self.import_test_cases, + default_timeout=None, + client_info=client_info, ), self.export_test_cases: gapic_v1.method.wrap_method( - self.export_test_cases, default_timeout=None, client_info=client_info, + self.export_test_cases, + default_timeout=None, + client_info=client_info, ), self.list_test_case_results: gapic_v1.method.wrap_method( self.list_test_case_results, @@ -176,9 +193,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -303,5 +320,9 @@ def get_test_case_result( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("TestCasesTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/test_cases/transports/grpc.py b/google/cloud/dialogflowcx_v3beta1/services/test_cases/transports/grpc.py index 2ca83e62..a99e4bd7 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/test_cases/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3beta1/services/test_cases/transports/grpc.py @@ -231,8 +231,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -486,7 +485,7 @@ def import_test_cases( r"""Return a callable for the import test cases method over gRPC. Imports the test cases from a Cloud Storage bucket or a local - file. It always creates new test cases and won't overwite any + file. It always creates new test cases and won't overwrite any existing ones. The provided ID in the imported test case is neglected. @@ -613,5 +612,9 @@ def get_test_case_result( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("TestCasesGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/test_cases/transports/grpc_asyncio.py b/google/cloud/dialogflowcx_v3beta1/services/test_cases/transports/grpc_asyncio.py index e812fb76..cd34f6d0 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/test_cases/transports/grpc_asyncio.py +++ b/google/cloud/dialogflowcx_v3beta1/services/test_cases/transports/grpc_asyncio.py @@ -501,7 +501,7 @@ def import_test_cases( r"""Return a callable for the import test cases method over gRPC. Imports the test cases from a Cloud Storage bucket or a local - file. It always creates new test cases and won't overwite any + file. It always creates new test cases and won't overwrite any existing ones. The provided ID in the imported test case is neglected. diff --git a/google/cloud/dialogflowcx_v3beta1/services/transition_route_groups/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/transition_route_groups/async_client.py index 8a7695ed..3364965e 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/transition_route_groups/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/transition_route_groups/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -238,14 +238,13 @@ async def list_transition_route_groups( r"""Returns the list of all transition route groups in the specified flow. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_list_transition_route_groups(): + async def sample_list_transition_route_groups(): # Create a client - client = dialogflowcx_v3beta1.TransitionRouteGroupsClient() + client = dialogflowcx_v3beta1.TransitionRouteGroupsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListTransitionRouteGroupsRequest( @@ -256,7 +255,7 @@ def sample_list_transition_route_groups(): page_result = client.list_transition_route_groups(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -318,12 +317,20 @@ def sample_list_transition_route_groups(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListTransitionRouteGroupsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -343,14 +350,13 @@ async def get_transition_route_group( r"""Retrieves the specified [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_get_transition_route_group(): + async def sample_get_transition_route_group(): # Create a client - client = dialogflowcx_v3beta1.TransitionRouteGroupsClient() + client = dialogflowcx_v3beta1.TransitionRouteGroupsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetTransitionRouteGroupRequest( @@ -358,7 +364,7 @@ def sample_get_transition_route_group(): ) # Make the request - response = client.get_transition_route_group(request=request) + response = await client.get_transition_route_group(request=request) # Handle the response print(response) @@ -422,7 +428,12 @@ def sample_get_transition_route_group(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -447,14 +458,13 @@ async def create_transition_route_group( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_create_transition_route_group(): + async def sample_create_transition_route_group(): # Create a client - client = dialogflowcx_v3beta1.TransitionRouteGroupsClient() + client = dialogflowcx_v3beta1.TransitionRouteGroupsAsyncClient() # Initialize request argument(s) transition_route_group = dialogflowcx_v3beta1.TransitionRouteGroup() @@ -466,7 +476,7 @@ def sample_create_transition_route_group(): ) # Make the request - response = client.create_transition_route_group(request=request) + response = await client.create_transition_route_group(request=request) # Handle the response print(response) @@ -539,7 +549,12 @@ def sample_create_transition_route_group(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -563,14 +578,13 @@ async def update_transition_route_group( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_update_transition_route_group(): + async def sample_update_transition_route_group(): # Create a client - client = dialogflowcx_v3beta1.TransitionRouteGroupsClient() + client = dialogflowcx_v3beta1.TransitionRouteGroupsAsyncClient() # Initialize request argument(s) transition_route_group = dialogflowcx_v3beta1.TransitionRouteGroup() @@ -581,7 +595,7 @@ def sample_update_transition_route_group(): ) # Make the request - response = client.update_transition_route_group(request=request) + response = await client.update_transition_route_group(request=request) # Handle the response print(response) @@ -654,7 +668,12 @@ def sample_update_transition_route_group(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -677,14 +696,13 @@ async def delete_transition_route_group( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_delete_transition_route_group(): + async def sample_delete_transition_route_group(): # Create a client - client = dialogflowcx_v3beta1.TransitionRouteGroupsClient() + client = dialogflowcx_v3beta1.TransitionRouteGroupsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.DeleteTransitionRouteGroupRequest( @@ -692,7 +710,7 @@ def sample_delete_transition_route_group(): ) # Make the request - client.delete_transition_route_group(request=request) + await client.delete_transition_route_group(request=request) Args: request (Union[google.cloud.dialogflowcx_v3beta1.types.DeleteTransitionRouteGroupRequest, dict]): @@ -746,7 +764,10 @@ def sample_delete_transition_route_group(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/dialogflowcx_v3beta1/services/transition_route_groups/client.py b/google/cloud/dialogflowcx_v3beta1/services/transition_route_groups/client.py index 0a4d133f..9a498d8b 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/transition_route_groups/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/transition_route_groups/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -61,7 +61,8 @@ class TransitionRouteGroupsClientMeta(type): _transport_registry["grpc_asyncio"] = TransitionRouteGroupsGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[TransitionRouteGroupsTransport]: """Returns an appropriate transport class. @@ -169,10 +170,18 @@ def transport(self) -> TransitionRouteGroupsTransport: return self._transport @staticmethod - def flow_path(project: str, location: str, agent: str, flow: str,) -> str: + def flow_path( + project: str, + location: str, + agent: str, + flow: str, + ) -> str: """Returns a fully-qualified flow string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) @staticmethod @@ -185,10 +194,18 @@ def parse_flow_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def intent_path(project: str, location: str, agent: str, intent: str,) -> str: + def intent_path( + project: str, + location: str, + agent: str, + intent: str, + ) -> str: """Returns a fully-qualified intent string.""" return "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) @staticmethod @@ -202,11 +219,19 @@ def parse_intent_path(path: str) -> Dict[str, str]: @staticmethod def page_path( - project: str, location: str, agent: str, flow: str, page: str, + project: str, + location: str, + agent: str, + flow: str, + page: str, ) -> str: """Returns a fully-qualified page string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) @staticmethod @@ -220,7 +245,11 @@ def parse_page_path(path: str) -> Dict[str, str]: @staticmethod def transition_route_group_path( - project: str, location: str, agent: str, flow: str, transition_route_group: str, + project: str, + location: str, + agent: str, + flow: str, + transition_route_group: str, ) -> str: """Returns a fully-qualified transition_route_group string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}".format( @@ -241,10 +270,18 @@ def parse_transition_route_group_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def webhook_path(project: str, location: str, agent: str, webhook: str,) -> str: + def webhook_path( + project: str, + location: str, + agent: str, + webhook: str, + ) -> str: """Returns a fully-qualified webhook string.""" return "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) @staticmethod @@ -257,7 +294,9 @@ def parse_webhook_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -270,9 +309,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -281,9 +324,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -292,9 +339,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -303,10 +354,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -494,7 +549,6 @@ def list_transition_route_groups( r"""Returns the list of all transition route groups in the specified flow. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -578,12 +632,20 @@ def sample_list_transition_route_groups(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListTransitionRouteGroupsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -603,7 +665,6 @@ def get_transition_route_group( r"""Retrieves the specified [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -686,7 +747,12 @@ def sample_get_transition_route_group(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -711,7 +777,6 @@ def create_transition_route_group( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -809,7 +874,12 @@ def sample_create_transition_route_group(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -833,7 +903,6 @@ def update_transition_route_group( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -930,7 +999,12 @@ def sample_update_transition_route_group(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -953,7 +1027,6 @@ def delete_transition_route_group( queries. See the `training documentation `__. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1026,7 +1099,10 @@ def sample_delete_transition_route_group(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/dialogflowcx_v3beta1/services/transition_route_groups/transports/base.py b/google/cloud/dialogflowcx_v3beta1/services/transition_route_groups/transports/base.py index 03a81824..b931cd15 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/transition_route_groups/transports/base.py +++ b/google/cloud/dialogflowcx_v3beta1/services/transition_route_groups/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -157,9 +158,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -220,5 +221,9 @@ def delete_transition_route_group( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("TransitionRouteGroupsTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/transition_route_groups/transports/grpc.py b/google/cloud/dialogflowcx_v3beta1/services/transition_route_groups/transports/grpc.py index fc31f26f..52427219 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/transition_route_groups/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3beta1/services/transition_route_groups/transports/grpc.py @@ -229,8 +229,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -404,5 +403,9 @@ def delete_transition_route_group( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("TransitionRouteGroupsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/versions/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/versions/async_client.py index 14155659..62123892 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/versions/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/versions/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -216,14 +216,13 @@ async def list_versions( r"""Returns the list of all versions in the specified [Flow][google.cloud.dialogflow.cx.v3beta1.Flow]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_list_versions(): + async def sample_list_versions(): # Create a client - client = dialogflowcx_v3beta1.VersionsClient() + client = dialogflowcx_v3beta1.VersionsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListVersionsRequest( @@ -234,7 +233,7 @@ def sample_list_versions(): page_result = client.list_versions(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -297,12 +296,20 @@ def sample_list_versions(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListVersionsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -320,14 +327,13 @@ async def get_version( r"""Retrieves the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_get_version(): + async def sample_get_version(): # Create a client - client = dialogflowcx_v3beta1.VersionsClient() + client = dialogflowcx_v3beta1.VersionsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetVersionRequest( @@ -335,7 +341,7 @@ def sample_get_version(): ) # Make the request - response = client.get_version(request=request) + response = await client.get_version(request=request) # Handle the response print(response) @@ -395,7 +401,12 @@ def sample_get_version(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -424,14 +435,13 @@ async def create_version( - ``response``: [Version][google.cloud.dialogflow.cx.v3beta1.Version] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_create_version(): + async def sample_create_version(): # Create a client - client = dialogflowcx_v3beta1.VersionsClient() + client = dialogflowcx_v3beta1.VersionsAsyncClient() # Initialize request argument(s) version = dialogflowcx_v3beta1.Version() @@ -447,7 +457,7 @@ def sample_create_version(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -521,7 +531,12 @@ def sample_create_version(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -547,14 +562,13 @@ async def update_version( r"""Updates the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_update_version(): + async def sample_update_version(): # Create a client - client = dialogflowcx_v3beta1.VersionsClient() + client = dialogflowcx_v3beta1.VersionsAsyncClient() # Initialize request argument(s) version = dialogflowcx_v3beta1.Version() @@ -565,7 +579,7 @@ def sample_update_version(): ) # Make the request - response = client.update_version(request=request) + response = await client.update_version(request=request) # Handle the response print(response) @@ -633,7 +647,12 @@ def sample_update_version(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -650,14 +669,13 @@ async def delete_version( r"""Deletes the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_delete_version(): + async def sample_delete_version(): # Create a client - client = dialogflowcx_v3beta1.VersionsClient() + client = dialogflowcx_v3beta1.VersionsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.DeleteVersionRequest( @@ -665,7 +683,7 @@ def sample_delete_version(): ) # Make the request - client.delete_version(request=request) + await client.delete_version(request=request) Args: request (Union[google.cloud.dialogflowcx_v3beta1.types.DeleteVersionRequest, dict]): @@ -719,7 +737,10 @@ def sample_delete_version(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def load_version( @@ -743,14 +764,13 @@ async def load_version( - ``response``: An `Empty message `__ - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_load_version(): + async def sample_load_version(): # Create a client - client = dialogflowcx_v3beta1.VersionsClient() + client = dialogflowcx_v3beta1.VersionsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.LoadVersionRequest( @@ -762,7 +782,7 @@ def sample_load_version(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -837,7 +857,12 @@ def sample_load_version(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -862,14 +887,13 @@ async def compare_versions( r"""Compares the specified base version with target version. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_compare_versions(): + async def sample_compare_versions(): # Create a client - client = dialogflowcx_v3beta1.VersionsClient() + client = dialogflowcx_v3beta1.VersionsAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.CompareVersionsRequest( @@ -878,7 +902,7 @@ def sample_compare_versions(): ) # Make the request - response = client.compare_versions(request=request) + response = await client.compare_versions(request=request) # Handle the response print(response) @@ -944,7 +968,12 @@ def sample_compare_versions(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3beta1/services/versions/client.py b/google/cloud/dialogflowcx_v3beta1/services/versions/client.py index acf8b942..69e53f9e 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/versions/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/versions/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -61,7 +61,10 @@ class VersionsClientMeta(type): _transport_registry["grpc"] = VersionsGrpcTransport _transport_registry["grpc_asyncio"] = VersionsGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[VersionsTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[VersionsTransport]: """Returns an appropriate transport class. Args: @@ -169,11 +172,19 @@ def transport(self) -> VersionsTransport: @staticmethod def version_path( - project: str, location: str, agent: str, flow: str, version: str, + project: str, + location: str, + agent: str, + flow: str, + version: str, ) -> str: """Returns a fully-qualified version string.""" return "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) @staticmethod @@ -186,7 +197,9 @@ def parse_version_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -199,9 +212,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -210,9 +227,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -221,9 +242,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -232,10 +257,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -421,7 +450,6 @@ def list_versions( r"""Returns the list of all versions in the specified [Flow][google.cloud.dialogflow.cx.v3beta1.Flow]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -502,12 +530,20 @@ def sample_list_versions(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListVersionsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -525,7 +561,6 @@ def get_version( r"""Retrieves the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -600,7 +635,12 @@ def sample_get_version(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -629,7 +669,6 @@ def create_version( - ``response``: [Version][google.cloud.dialogflow.cx.v3beta1.Version] - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -726,7 +765,12 @@ def sample_create_version(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -752,7 +796,6 @@ def update_version( r"""Updates the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -838,7 +881,12 @@ def sample_update_version(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -855,7 +903,6 @@ def delete_version( r"""Deletes the specified [Version][google.cloud.dialogflow.cx.v3beta1.Version]. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -924,7 +971,10 @@ def sample_delete_version(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def load_version( @@ -948,7 +998,6 @@ def load_version( - ``response``: An `Empty message `__ - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1042,7 +1091,12 @@ def sample_load_version(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1067,7 +1121,6 @@ def compare_versions( r"""Compares the specified base version with target version. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -1149,7 +1202,12 @@ def sample_compare_versions(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response diff --git a/google/cloud/dialogflowcx_v3beta1/services/versions/transports/base.py b/google/cloud/dialogflowcx_v3beta1/services/versions/transports/base.py index 1008d2fd..5ae74b4b 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/versions/transports/base.py +++ b/google/cloud/dialogflowcx_v3beta1/services/versions/transports/base.py @@ -87,6 +87,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -128,34 +129,48 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_versions: gapic_v1.method.wrap_method( - self.list_versions, default_timeout=None, client_info=client_info, + self.list_versions, + default_timeout=None, + client_info=client_info, ), self.get_version: gapic_v1.method.wrap_method( - self.get_version, default_timeout=None, client_info=client_info, + self.get_version, + default_timeout=None, + client_info=client_info, ), self.create_version: gapic_v1.method.wrap_method( - self.create_version, default_timeout=None, client_info=client_info, + self.create_version, + default_timeout=None, + client_info=client_info, ), self.update_version: gapic_v1.method.wrap_method( - self.update_version, default_timeout=None, client_info=client_info, + self.update_version, + default_timeout=None, + client_info=client_info, ), self.delete_version: gapic_v1.method.wrap_method( - self.delete_version, default_timeout=None, client_info=client_info, + self.delete_version, + default_timeout=None, + client_info=client_info, ), self.load_version: gapic_v1.method.wrap_method( - self.load_version, default_timeout=None, client_info=client_info, + self.load_version, + default_timeout=None, + client_info=client_info, ), self.compare_versions: gapic_v1.method.wrap_method( - self.compare_versions, default_timeout=None, client_info=client_info, + self.compare_versions, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -228,5 +243,9 @@ def compare_versions( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("VersionsTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/versions/transports/grpc.py b/google/cloud/dialogflowcx_v3beta1/services/versions/transports/grpc.py index 9e7d1655..b7b5bb8d 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/versions/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3beta1/services/versions/transports/grpc.py @@ -230,8 +230,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -458,5 +457,9 @@ def compare_versions( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("VersionsGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/webhooks/async_client.py b/google/cloud/dialogflowcx_v3beta1/services/webhooks/async_client.py index d933c98e..ae18bcf0 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/webhooks/async_client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/webhooks/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -213,14 +213,13 @@ async def list_webhooks( r"""Returns the list of all webhooks in the specified agent. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 - def sample_list_webhooks(): + async def sample_list_webhooks(): # Create a client - client = dialogflowcx_v3beta1.WebhooksClient() + client = dialogflowcx_v3beta1.WebhooksAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.ListWebhooksRequest( @@ -231,7 +230,7 @@ def sample_list_webhooks(): page_result = client.list_webhooks(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -292,12 +291,20 @@ def sample_list_webhooks(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListWebhooksAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -318,9 +325,9 @@ async def get_webhook( from google.cloud import dialogflowcx_v3beta1 - def sample_get_webhook(): + async def sample_get_webhook(): # Create a client - client = dialogflowcx_v3beta1.WebhooksClient() + client = dialogflowcx_v3beta1.WebhooksAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.GetWebhookRequest( @@ -328,7 +335,7 @@ def sample_get_webhook(): ) # Make the request - response = client.get_webhook(request=request) + response = await client.get_webhook(request=request) # Handle the response print(response) @@ -393,7 +400,12 @@ def sample_get_webhook(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -414,9 +426,9 @@ async def create_webhook( from google.cloud import dialogflowcx_v3beta1 - def sample_create_webhook(): + async def sample_create_webhook(): # Create a client - client = dialogflowcx_v3beta1.WebhooksClient() + client = dialogflowcx_v3beta1.WebhooksAsyncClient() # Initialize request argument(s) webhook = dialogflowcx_v3beta1.Webhook() @@ -429,7 +441,7 @@ def sample_create_webhook(): ) # Make the request - response = client.create_webhook(request=request) + response = await client.create_webhook(request=request) # Handle the response print(response) @@ -501,7 +513,12 @@ def sample_create_webhook(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -522,9 +539,9 @@ async def update_webhook( from google.cloud import dialogflowcx_v3beta1 - def sample_update_webhook(): + async def sample_update_webhook(): # Create a client - client = dialogflowcx_v3beta1.WebhooksClient() + client = dialogflowcx_v3beta1.WebhooksAsyncClient() # Initialize request argument(s) webhook = dialogflowcx_v3beta1.Webhook() @@ -536,7 +553,7 @@ def sample_update_webhook(): ) # Make the request - response = client.update_webhook(request=request) + response = await client.update_webhook(request=request) # Handle the response print(response) @@ -611,7 +628,12 @@ def sample_update_webhook(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -631,9 +653,9 @@ async def delete_webhook( from google.cloud import dialogflowcx_v3beta1 - def sample_delete_webhook(): + async def sample_delete_webhook(): # Create a client - client = dialogflowcx_v3beta1.WebhooksClient() + client = dialogflowcx_v3beta1.WebhooksAsyncClient() # Initialize request argument(s) request = dialogflowcx_v3beta1.DeleteWebhookRequest( @@ -641,7 +663,7 @@ def sample_delete_webhook(): ) # Make the request - client.delete_webhook(request=request) + await client.delete_webhook(request=request) Args: request (Union[google.cloud.dialogflowcx_v3beta1.types.DeleteWebhookRequest, dict]): @@ -693,7 +715,10 @@ def sample_delete_webhook(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def __aenter__(self): diff --git a/google/cloud/dialogflowcx_v3beta1/services/webhooks/client.py b/google/cloud/dialogflowcx_v3beta1/services/webhooks/client.py index bbacdd67..00ac090f 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/webhooks/client.py +++ b/google/cloud/dialogflowcx_v3beta1/services/webhooks/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -56,7 +56,10 @@ class WebhooksClientMeta(type): _transport_registry["grpc"] = WebhooksGrpcTransport _transport_registry["grpc_asyncio"] = WebhooksGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[WebhooksTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[WebhooksTransport]: """Returns an appropriate transport class. Args: @@ -163,10 +166,18 @@ def transport(self) -> WebhooksTransport: return self._transport @staticmethod - def service_path(project: str, location: str, namespace: str, service: str,) -> str: + def service_path( + project: str, + location: str, + namespace: str, + service: str, + ) -> str: """Returns a fully-qualified service string.""" return "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}".format( - project=project, location=location, namespace=namespace, service=service, + project=project, + location=location, + namespace=namespace, + service=service, ) @staticmethod @@ -179,10 +190,18 @@ def parse_service_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def webhook_path(project: str, location: str, agent: str, webhook: str,) -> str: + def webhook_path( + project: str, + location: str, + agent: str, + webhook: str, + ) -> str: """Returns a fully-qualified webhook string.""" return "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) @staticmethod @@ -195,7 +214,9 @@ def parse_webhook_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -208,9 +229,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -219,9 +244,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -230,9 +259,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -241,10 +274,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -430,7 +467,6 @@ def list_webhooks( r"""Returns the list of all webhooks in the specified agent. - .. code-block:: python from google.cloud import dialogflowcx_v3beta1 @@ -509,12 +545,20 @@ def sample_list_webhooks(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListWebhooksPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -610,7 +654,12 @@ def sample_get_webhook(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -718,7 +767,12 @@ def sample_create_webhook(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -828,7 +882,12 @@ def sample_update_webhook(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -910,7 +969,10 @@ def sample_delete_webhook(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def __enter__(self): diff --git a/google/cloud/dialogflowcx_v3beta1/services/webhooks/transports/base.py b/google/cloud/dialogflowcx_v3beta1/services/webhooks/transports/base.py index 4fa4a8dd..9ab9e508 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/webhooks/transports/base.py +++ b/google/cloud/dialogflowcx_v3beta1/services/webhooks/transports/base.py @@ -85,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -126,28 +127,38 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.list_webhooks: gapic_v1.method.wrap_method( - self.list_webhooks, default_timeout=None, client_info=client_info, + self.list_webhooks, + default_timeout=None, + client_info=client_info, ), self.get_webhook: gapic_v1.method.wrap_method( - self.get_webhook, default_timeout=None, client_info=client_info, + self.get_webhook, + default_timeout=None, + client_info=client_info, ), self.create_webhook: gapic_v1.method.wrap_method( - self.create_webhook, default_timeout=None, client_info=client_info, + self.create_webhook, + default_timeout=None, + client_info=client_info, ), self.update_webhook: gapic_v1.method.wrap_method( - self.update_webhook, default_timeout=None, client_info=client_info, + self.update_webhook, + default_timeout=None, + client_info=client_info, ), self.delete_webhook: gapic_v1.method.wrap_method( - self.delete_webhook, default_timeout=None, client_info=client_info, + self.delete_webhook, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -195,5 +206,9 @@ def delete_webhook( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("WebhooksTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/services/webhooks/transports/grpc.py b/google/cloud/dialogflowcx_v3beta1/services/webhooks/transports/grpc.py index 3f2ae596..97fb4dfa 100644 --- a/google/cloud/dialogflowcx_v3beta1/services/webhooks/transports/grpc.py +++ b/google/cloud/dialogflowcx_v3beta1/services/webhooks/transports/grpc.py @@ -227,8 +227,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -363,5 +362,9 @@ def delete_webhook( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("WebhooksGrpcTransport",) diff --git a/google/cloud/dialogflowcx_v3beta1/types/__init__.py b/google/cloud/dialogflowcx_v3beta1/types/__init__.py index f5baa497..fe4a75ea 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/__init__.py +++ b/google/cloud/dialogflowcx_v3beta1/types/__init__.py @@ -13,7 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .advanced_settings import AdvancedSettings +from .advanced_settings import ( + AdvancedSettings, +) from .agent import ( Agent, AgentValidationResult, @@ -115,7 +117,9 @@ UpdateFlowRequest, ValidateFlowRequest, ) -from .fulfillment import Fulfillment +from .fulfillment import ( + Fulfillment, +) from .intent import ( CreateIntentRequest, DeleteIntentRequest, @@ -138,7 +142,9 @@ TransitionRoute, UpdatePageRequest, ) -from .response_message import ResponseMessage +from .response_message import ( + ResponseMessage, +) from .security_settings import ( CreateSecuritySettingsRequest, DeleteSecuritySettingsRequest, diff --git a/google/cloud/dialogflowcx_v3beta1/types/advanced_settings.py b/google/cloud/dialogflowcx_v3beta1/types/advanced_settings.py index 386f99d2..69e2bcf7 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/advanced_settings.py +++ b/google/cloud/dialogflowcx_v3beta1/types/advanced_settings.py @@ -17,7 +17,10 @@ __protobuf__ = proto.module( - package="google.cloud.dialogflow.cx.v3beta1", manifest={"AdvancedSettings",}, + package="google.cloud.dialogflow.cx.v3beta1", + manifest={ + "AdvancedSettings", + }, ) @@ -49,10 +52,20 @@ class LoggingSettings(proto.Message): enabled. """ - enable_stackdriver_logging = proto.Field(proto.BOOL, number=2,) - enable_interaction_logging = proto.Field(proto.BOOL, number=3,) + enable_stackdriver_logging = proto.Field( + proto.BOOL, + number=2, + ) + enable_interaction_logging = proto.Field( + proto.BOOL, + number=3, + ) - logging_settings = proto.Field(proto.MESSAGE, number=6, message=LoggingSettings,) + logging_settings = proto.Field( + proto.MESSAGE, + number=6, + message=LoggingSettings, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3beta1/types/agent.py b/google/cloud/dialogflowcx_v3beta1/types/agent.py index 8e39df1b..fdd33881 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/agent.py +++ b/google/cloud/dialogflowcx_v3beta1/types/agent.py @@ -52,7 +52,10 @@ class SpeechToTextSettings(proto.Message): recognition. """ - enable_speech_adaptation = proto.Field(proto.BOOL, number=1,) + enable_speech_adaptation = proto.Field( + proto.BOOL, + number=1, + ) class Agent(proto.Message): @@ -125,6 +128,10 @@ class Agent(proto.Message): enable_spell_correction (bool): Indicates if automatic spell correction is enabled in detect intent requests. + locked (bool): + Indiciates whether the agent is locked for changes. If the + agent is locked, modifications to the agent will be rejected + except for [RestoreAgent][]. advanced_settings (google.cloud.dialogflowcx_v3beta1.types.AdvancedSettings): Hierarchical advanced settings for this agent. The settings exposed at the lower level @@ -132,22 +139,63 @@ class Agent(proto.Message): level. """ - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - default_language_code = proto.Field(proto.STRING, number=3,) - supported_language_codes = proto.RepeatedField(proto.STRING, number=4,) - time_zone = proto.Field(proto.STRING, number=5,) - description = proto.Field(proto.STRING, number=6,) - avatar_uri = proto.Field(proto.STRING, number=7,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + default_language_code = proto.Field( + proto.STRING, + number=3, + ) + supported_language_codes = proto.RepeatedField( + proto.STRING, + number=4, + ) + time_zone = proto.Field( + proto.STRING, + number=5, + ) + description = proto.Field( + proto.STRING, + number=6, + ) + avatar_uri = proto.Field( + proto.STRING, + number=7, + ) speech_to_text_settings = proto.Field( - proto.MESSAGE, number=13, message="SpeechToTextSettings", + proto.MESSAGE, + number=13, + message="SpeechToTextSettings", + ) + start_flow = proto.Field( + proto.STRING, + number=16, + ) + security_settings = proto.Field( + proto.STRING, + number=17, + ) + enable_stackdriver_logging = proto.Field( + proto.BOOL, + number=18, + ) + enable_spell_correction = proto.Field( + proto.BOOL, + number=20, + ) + locked = proto.Field( + proto.BOOL, + number=27, ) - start_flow = proto.Field(proto.STRING, number=16,) - security_settings = proto.Field(proto.STRING, number=17,) - enable_stackdriver_logging = proto.Field(proto.BOOL, number=18,) - enable_spell_correction = proto.Field(proto.BOOL, number=20,) advanced_settings = proto.Field( - proto.MESSAGE, number=22, message=gcdc_advanced_settings.AdvancedSettings, + proto.MESSAGE, + number=22, + message=gcdc_advanced_settings.AdvancedSettings, ) @@ -167,9 +215,18 @@ class ListAgentsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListAgentsResponse(proto.Message): @@ -190,8 +247,15 @@ class ListAgentsResponse(proto.Message): def raw_page(self): return self - agents = proto.RepeatedField(proto.MESSAGE, number=1, message="Agent",) - next_page_token = proto.Field(proto.STRING, number=2,) + agents = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Agent", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetAgentRequest(proto.Message): @@ -204,7 +268,10 @@ class GetAgentRequest(proto.Message): ``projects//locations//agents/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateAgentRequest(proto.Message): @@ -219,8 +286,15 @@ class CreateAgentRequest(proto.Message): Required. The agent to create. """ - parent = proto.Field(proto.STRING, number=1,) - agent = proto.Field(proto.MESSAGE, number=2, message="Agent",) + parent = proto.Field( + proto.STRING, + number=1, + ) + agent = proto.Field( + proto.MESSAGE, + number=2, + message="Agent", + ) class UpdateAgentRequest(proto.Message): @@ -236,9 +310,15 @@ class UpdateAgentRequest(proto.Message): updated. """ - agent = proto.Field(proto.MESSAGE, number=1, message="Agent",) + agent = proto.Field( + proto.MESSAGE, + number=1, + message="Agent", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -252,7 +332,10 @@ class DeleteAgentRequest(proto.Message): ``projects//locations//agents/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ExportAgentRequest(proto.Message): @@ -269,15 +352,43 @@ class ExportAgentRequest(proto.Message): export the agent to. The format of this URI must be ``gs:///``. If left unspecified, the serialized agent is returned inline. + + Dialogflow performs a write operation for the Cloud Storage + object on the caller's behalf, so your request + authentication must have write permissions for the object. + For more information, see `Dialogflow access + control `__. + data_format (google.cloud.dialogflowcx_v3beta1.types.ExportAgentRequest.DataFormat): + Optional. The data format of the exported agent. If not + specified, ``BLOB`` is assumed. environment (str): Optional. Environment name. If not set, draft environment is assumed. Format: ``projects//locations//agents//environments/``. """ - name = proto.Field(proto.STRING, number=1,) - agent_uri = proto.Field(proto.STRING, number=2,) - environment = proto.Field(proto.STRING, number=5,) + class DataFormat(proto.Enum): + r"""Data format of the exported agent.""" + DATA_FORMAT_UNSPECIFIED = 0 + BLOB = 1 + + name = proto.Field( + proto.STRING, + number=1, + ) + agent_uri = proto.Field( + proto.STRING, + number=2, + ) + data_format = proto.Field( + proto.ENUM, + number=3, + enum=DataFormat, + ) + environment = proto.Field( + proto.STRING, + number=5, + ) class ExportAgentResponse(proto.Message): @@ -304,8 +415,16 @@ class ExportAgentResponse(proto.Message): This field is a member of `oneof`_ ``agent``. """ - agent_uri = proto.Field(proto.STRING, number=1, oneof="agent",) - agent_content = proto.Field(proto.BYTES, number=2, oneof="agent",) + agent_uri = proto.Field( + proto.STRING, + number=1, + oneof="agent", + ) + agent_content = proto.Field( + proto.BYTES, + number=2, + oneof="agent", + ) class RestoreAgentRequest(proto.Message): @@ -329,6 +448,12 @@ class RestoreAgentRequest(proto.Message): restore agent from. The format of this URI must be ``gs:///``. + Dialogflow performs a read operation for the Cloud Storage + object on the caller's behalf, so your request + authentication must have read permissions for the object. + For more information, see `Dialogflow access + control `__. + This field is a member of `oneof`_ ``agent``. agent_content (bytes): Uncompressed raw byte content for agent. @@ -344,10 +469,25 @@ class RestoreOption(proto.Enum): KEEP = 1 FALLBACK = 2 - name = proto.Field(proto.STRING, number=1,) - agent_uri = proto.Field(proto.STRING, number=2, oneof="agent",) - agent_content = proto.Field(proto.BYTES, number=3, oneof="agent",) - restore_option = proto.Field(proto.ENUM, number=5, enum=RestoreOption,) + name = proto.Field( + proto.STRING, + number=1, + ) + agent_uri = proto.Field( + proto.STRING, + number=2, + oneof="agent", + ) + agent_content = proto.Field( + proto.BYTES, + number=3, + oneof="agent", + ) + restore_option = proto.Field( + proto.ENUM, + number=5, + enum=RestoreOption, + ) class ValidateAgentRequest(proto.Message): @@ -363,8 +503,14 @@ class ValidateAgentRequest(proto.Message): language is used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class GetAgentValidationResultRequest(proto.Message): @@ -380,8 +526,14 @@ class GetAgentValidationResultRequest(proto.Message): language is used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class AgentValidationResult(proto.Message): @@ -397,9 +549,14 @@ class AgentValidationResult(proto.Message): Contains all flow validation results. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) flow_validation_results = proto.RepeatedField( - proto.MESSAGE, number=2, message=flow.FlowValidationResult, + proto.MESSAGE, + number=2, + message=flow.FlowValidationResult, ) diff --git a/google/cloud/dialogflowcx_v3beta1/types/audio_config.py b/google/cloud/dialogflowcx_v3beta1/types/audio_config.py index a6b80868..577764f4 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/audio_config.py +++ b/google/cloud/dialogflowcx_v3beta1/types/audio_config.py @@ -117,10 +117,24 @@ class SpeechWordInfo(proto.Message): also not rely on it to always be provided. """ - word = proto.Field(proto.STRING, number=3,) - start_offset = proto.Field(proto.MESSAGE, number=1, message=duration_pb2.Duration,) - end_offset = proto.Field(proto.MESSAGE, number=2, message=duration_pb2.Duration,) - confidence = proto.Field(proto.FLOAT, number=4,) + word = proto.Field( + proto.STRING, + number=3, + ) + start_offset = proto.Field( + proto.MESSAGE, + number=1, + message=duration_pb2.Duration, + ) + end_offset = proto.Field( + proto.MESSAGE, + number=2, + message=duration_pb2.Duration, + ) + confidence = proto.Field( + proto.FLOAT, + number=4, + ) class InputAudioConfig(proto.Message): @@ -179,13 +193,36 @@ class InputAudioConfig(proto.Message): is relevant only for streaming methods. """ - audio_encoding = proto.Field(proto.ENUM, number=1, enum="AudioEncoding",) - sample_rate_hertz = proto.Field(proto.INT32, number=2,) - enable_word_info = proto.Field(proto.BOOL, number=13,) - phrase_hints = proto.RepeatedField(proto.STRING, number=4,) - model = proto.Field(proto.STRING, number=7,) - model_variant = proto.Field(proto.ENUM, number=10, enum="SpeechModelVariant",) - single_utterance = proto.Field(proto.BOOL, number=8,) + audio_encoding = proto.Field( + proto.ENUM, + number=1, + enum="AudioEncoding", + ) + sample_rate_hertz = proto.Field( + proto.INT32, + number=2, + ) + enable_word_info = proto.Field( + proto.BOOL, + number=13, + ) + phrase_hints = proto.RepeatedField( + proto.STRING, + number=4, + ) + model = proto.Field( + proto.STRING, + number=7, + ) + model_variant = proto.Field( + proto.ENUM, + number=10, + enum="SpeechModelVariant", + ) + single_utterance = proto.Field( + proto.BOOL, + number=8, + ) class VoiceSelectionParams(proto.Message): @@ -212,8 +249,15 @@ class VoiceSelectionParams(proto.Message): gender rather than failing the request. """ - name = proto.Field(proto.STRING, number=1,) - ssml_gender = proto.Field(proto.ENUM, number=2, enum="SsmlVoiceGender",) + name = proto.Field( + proto.STRING, + number=1, + ) + ssml_gender = proto.Field( + proto.ENUM, + number=2, + enum="SsmlVoiceGender", + ) class SynthesizeSpeechConfig(proto.Message): @@ -252,11 +296,27 @@ class SynthesizeSpeechConfig(proto.Message): synthesized audio. """ - speaking_rate = proto.Field(proto.DOUBLE, number=1,) - pitch = proto.Field(proto.DOUBLE, number=2,) - volume_gain_db = proto.Field(proto.DOUBLE, number=3,) - effects_profile_id = proto.RepeatedField(proto.STRING, number=5,) - voice = proto.Field(proto.MESSAGE, number=4, message="VoiceSelectionParams",) + speaking_rate = proto.Field( + proto.DOUBLE, + number=1, + ) + pitch = proto.Field( + proto.DOUBLE, + number=2, + ) + volume_gain_db = proto.Field( + proto.DOUBLE, + number=3, + ) + effects_profile_id = proto.RepeatedField( + proto.STRING, + number=5, + ) + voice = proto.Field( + proto.MESSAGE, + number=4, + message="VoiceSelectionParams", + ) class OutputAudioConfig(proto.Message): @@ -281,10 +341,19 @@ class OutputAudioConfig(proto.Message): be synthesized. """ - audio_encoding = proto.Field(proto.ENUM, number=1, enum="OutputAudioEncoding",) - sample_rate_hertz = proto.Field(proto.INT32, number=2,) + audio_encoding = proto.Field( + proto.ENUM, + number=1, + enum="OutputAudioEncoding", + ) + sample_rate_hertz = proto.Field( + proto.INT32, + number=2, + ) synthesize_speech_config = proto.Field( - proto.MESSAGE, number=3, message="SynthesizeSpeechConfig", + proto.MESSAGE, + number=3, + message="SynthesizeSpeechConfig", ) diff --git a/google/cloud/dialogflowcx_v3beta1/types/changelog.py b/google/cloud/dialogflowcx_v3beta1/types/changelog.py index aec0a816..ce68f75c 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/changelog.py +++ b/google/cloud/dialogflowcx_v3beta1/types/changelog.py @@ -63,10 +63,22 @@ class ListChangelogsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - filter = proto.Field(proto.STRING, number=2,) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + filter = proto.Field( + proto.STRING, + number=2, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class ListChangelogsResponse(proto.Message): @@ -88,8 +100,15 @@ class ListChangelogsResponse(proto.Message): def raw_page(self): return self - changelogs = proto.RepeatedField(proto.MESSAGE, number=1, message="Changelog",) - next_page_token = proto.Field(proto.STRING, number=2,) + changelogs = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Changelog", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetChangelogRequest(proto.Message): @@ -102,7 +121,10 @@ class GetChangelogRequest(proto.Message): ``projects//locations//agents//changelogs/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class Changelog(proto.Message): @@ -127,13 +149,35 @@ class Changelog(proto.Message): The timestamp of the change. """ - name = proto.Field(proto.STRING, number=1,) - user_email = proto.Field(proto.STRING, number=2,) - display_name = proto.Field(proto.STRING, number=7,) - action = proto.Field(proto.STRING, number=11,) - type_ = proto.Field(proto.STRING, number=8,) - resource = proto.Field(proto.STRING, number=3,) - create_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + user_email = proto.Field( + proto.STRING, + number=2, + ) + display_name = proto.Field( + proto.STRING, + number=7, + ) + action = proto.Field( + proto.STRING, + number=11, + ) + type_ = proto.Field( + proto.STRING, + number=8, + ) + resource = proto.Field( + proto.STRING, + number=3, + ) + create_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3beta1/types/deployment.py b/google/cloud/dialogflowcx_v3beta1/types/deployment.py index e354a042..9b4af77d 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/deployment.py +++ b/google/cloud/dialogflowcx_v3beta1/types/deployment.py @@ -80,15 +80,43 @@ class Result(proto.Message): ID>/experiments/. """ - deployment_test_results = proto.RepeatedField(proto.STRING, number=1,) - experiment = proto.Field(proto.STRING, number=2,) - - name = proto.Field(proto.STRING, number=1,) - flow_version = proto.Field(proto.STRING, number=2,) - state = proto.Field(proto.ENUM, number=3, enum=State,) - result = proto.Field(proto.MESSAGE, number=4, message=Result,) - start_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) + deployment_test_results = proto.RepeatedField( + proto.STRING, + number=1, + ) + experiment = proto.Field( + proto.STRING, + number=2, + ) + + name = proto.Field( + proto.STRING, + number=1, + ) + flow_version = proto.Field( + proto.STRING, + number=2, + ) + state = proto.Field( + proto.ENUM, + number=3, + enum=State, + ) + result = proto.Field( + proto.MESSAGE, + number=4, + message=Result, + ) + start_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) class ListDeploymentsRequest(proto.Message): @@ -109,9 +137,18 @@ class ListDeploymentsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListDeploymentsResponse(proto.Message): @@ -134,8 +171,15 @@ class ListDeploymentsResponse(proto.Message): def raw_page(self): return self - deployments = proto.RepeatedField(proto.MESSAGE, number=1, message="Deployment",) - next_page_token = proto.Field(proto.STRING, number=2,) + deployments = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Deployment", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetDeploymentRequest(proto.Message): @@ -150,7 +194,10 @@ class GetDeploymentRequest(proto.Message): ``projects//locations//agents//environments//deployments/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3beta1/types/entity_type.py b/google/cloud/dialogflowcx_v3beta1/types/entity_type.py index 7017f026..df43ee3f 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/entity_type.py +++ b/google/cloud/dialogflowcx_v3beta1/types/entity_type.py @@ -144,8 +144,14 @@ class Entity(proto.Message): ``value``. """ - value = proto.Field(proto.STRING, number=1,) - synonyms = proto.RepeatedField(proto.STRING, number=2,) + value = proto.Field( + proto.STRING, + number=1, + ) + synonyms = proto.RepeatedField( + proto.STRING, + number=2, + ) class ExcludedPhrase(proto.Message): r"""An excluded entity phrase that should not be matched. @@ -155,18 +161,47 @@ class ExcludedPhrase(proto.Message): Required. The word or phrase to be excluded. """ - value = proto.Field(proto.STRING, number=1,) + value = proto.Field( + proto.STRING, + number=1, + ) - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - kind = proto.Field(proto.ENUM, number=3, enum=Kind,) - auto_expansion_mode = proto.Field(proto.ENUM, number=4, enum=AutoExpansionMode,) - entities = proto.RepeatedField(proto.MESSAGE, number=5, message=Entity,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + kind = proto.Field( + proto.ENUM, + number=3, + enum=Kind, + ) + auto_expansion_mode = proto.Field( + proto.ENUM, + number=4, + enum=AutoExpansionMode, + ) + entities = proto.RepeatedField( + proto.MESSAGE, + number=5, + message=Entity, + ) excluded_phrases = proto.RepeatedField( - proto.MESSAGE, number=6, message=ExcludedPhrase, + proto.MESSAGE, + number=6, + message=ExcludedPhrase, + ) + enable_fuzzy_extraction = proto.Field( + proto.BOOL, + number=7, + ) + redact = proto.Field( + proto.BOOL, + number=9, ) - enable_fuzzy_extraction = proto.Field(proto.BOOL, number=7,) - redact = proto.Field(proto.BOOL, number=9,) class ListEntityTypesRequest(proto.Message): @@ -198,10 +233,22 @@ class ListEntityTypesRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class ListEntityTypesResponse(proto.Message): @@ -222,8 +269,15 @@ class ListEntityTypesResponse(proto.Message): def raw_page(self): return self - entity_types = proto.RepeatedField(proto.MESSAGE, number=1, message="EntityType",) - next_page_token = proto.Field(proto.STRING, number=2,) + entity_types = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="EntityType", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetEntityTypeRequest(proto.Message): @@ -249,8 +303,14 @@ class GetEntityTypeRequest(proto.Message): before they can be used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class CreateEntityTypeRequest(proto.Message): @@ -277,9 +337,19 @@ class CreateEntityTypeRequest(proto.Message): before they can be used. """ - parent = proto.Field(proto.STRING, number=1,) - entity_type = proto.Field(proto.MESSAGE, number=2, message="EntityType",) - language_code = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + entity_type = proto.Field( + proto.MESSAGE, + number=2, + message="EntityType", + ) + language_code = proto.Field( + proto.STRING, + number=3, + ) class UpdateEntityTypeRequest(proto.Message): @@ -305,10 +375,19 @@ class UpdateEntityTypeRequest(proto.Message): The mask to control which fields get updated. """ - entity_type = proto.Field(proto.MESSAGE, number=1, message="EntityType",) - language_code = proto.Field(proto.STRING, number=2,) + entity_type = proto.Field( + proto.MESSAGE, + number=1, + message="EntityType", + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) @@ -336,8 +415,14 @@ class DeleteEntityTypeRequest(proto.Message): of the entity type will be removed). """ - name = proto.Field(proto.STRING, number=1,) - force = proto.Field(proto.BOOL, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + force = proto.Field( + proto.BOOL, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3beta1/types/environment.py b/google/cloud/dialogflowcx_v3beta1/types/environment.py index b526248b..076a92b6 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/environment.py +++ b/google/cloud/dialogflowcx_v3beta1/types/environment.py @@ -91,7 +91,10 @@ class VersionConfig(proto.Message): ID>/flows//versions/. """ - version = proto.Field(proto.STRING, number=1,) + version = proto.Field( + proto.STRING, + number=1, + ) class TestCasesConfig(proto.Message): r"""The configuration for continuous tests. @@ -112,18 +115,46 @@ class TestCasesConfig(proto.Message): false. """ - test_cases = proto.RepeatedField(proto.STRING, number=1,) - enable_continuous_run = proto.Field(proto.BOOL, number=2,) - enable_predeployment_run = proto.Field(proto.BOOL, number=3,) - - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) + test_cases = proto.RepeatedField( + proto.STRING, + number=1, + ) + enable_continuous_run = proto.Field( + proto.BOOL, + number=2, + ) + enable_predeployment_run = proto.Field( + proto.BOOL, + number=3, + ) + + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) version_configs = proto.RepeatedField( - proto.MESSAGE, number=6, message=VersionConfig, + proto.MESSAGE, + number=6, + message=VersionConfig, + ) + update_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + test_cases_config = proto.Field( + proto.MESSAGE, + number=7, + message=TestCasesConfig, ) - update_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - test_cases_config = proto.Field(proto.MESSAGE, number=7, message=TestCasesConfig,) class ListEnvironmentsRequest(proto.Message): @@ -144,9 +175,18 @@ class ListEnvironmentsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListEnvironmentsResponse(proto.Message): @@ -169,8 +209,15 @@ class ListEnvironmentsResponse(proto.Message): def raw_page(self): return self - environments = proto.RepeatedField(proto.MESSAGE, number=1, message="Environment",) - next_page_token = proto.Field(proto.STRING, number=2,) + environments = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Environment", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetEnvironmentRequest(proto.Message): @@ -185,7 +232,10 @@ class GetEnvironmentRequest(proto.Message): ``projects//locations//agents//environments/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateEnvironmentRequest(proto.Message): @@ -204,8 +254,15 @@ class CreateEnvironmentRequest(proto.Message): Required. The environment to create. """ - parent = proto.Field(proto.STRING, number=1,) - environment = proto.Field(proto.MESSAGE, number=2, message="Environment",) + parent = proto.Field( + proto.STRING, + number=1, + ) + environment = proto.Field( + proto.MESSAGE, + number=2, + message="Environment", + ) class UpdateEnvironmentRequest(proto.Message): @@ -220,9 +277,15 @@ class UpdateEnvironmentRequest(proto.Message): get updated. """ - environment = proto.Field(proto.MESSAGE, number=1, message="Environment",) + environment = proto.Field( + proto.MESSAGE, + number=1, + message="Environment", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -238,7 +301,10 @@ class DeleteEnvironmentRequest(proto.Message): ``projects//locations//agents//environments/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class LookupEnvironmentHistoryRequest(proto.Message): @@ -258,9 +324,18 @@ class LookupEnvironmentHistoryRequest(proto.Message): request. """ - name = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class LookupEnvironmentHistoryResponse(proto.Message): @@ -282,8 +357,15 @@ class LookupEnvironmentHistoryResponse(proto.Message): def raw_page(self): return self - environments = proto.RepeatedField(proto.MESSAGE, number=1, message="Environment",) - next_page_token = proto.Field(proto.STRING, number=2,) + environments = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Environment", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class ContinuousTestResult(proto.Message): @@ -313,10 +395,24 @@ class AggregatedTestResult(proto.Enum): PASSED = 1 FAILED = 2 - name = proto.Field(proto.STRING, number=1,) - result = proto.Field(proto.ENUM, number=2, enum=AggregatedTestResult,) - test_case_results = proto.RepeatedField(proto.STRING, number=3,) - run_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + result = proto.Field( + proto.ENUM, + number=2, + enum=AggregatedTestResult, + ) + test_case_results = proto.RepeatedField( + proto.STRING, + number=3, + ) + run_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) class RunContinuousTestRequest(proto.Message): @@ -329,7 +425,10 @@ class RunContinuousTestRequest(proto.Message): ``projects//locations//agents//environments/``. """ - environment = proto.Field(proto.STRING, number=1,) + environment = proto.Field( + proto.STRING, + number=1, + ) class RunContinuousTestResponse(proto.Message): @@ -342,7 +441,9 @@ class RunContinuousTestResponse(proto.Message): """ continuous_test_result = proto.Field( - proto.MESSAGE, number=1, message="ContinuousTestResult", + proto.MESSAGE, + number=1, + message="ContinuousTestResult", ) @@ -356,7 +457,11 @@ class RunContinuousTestMetadata(proto.Message): The test errors. """ - errors = proto.RepeatedField(proto.MESSAGE, number=1, message=test_case.TestError,) + errors = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=test_case.TestError, + ) class ListContinuousTestResultsRequest(proto.Message): @@ -375,9 +480,18 @@ class ListContinuousTestResultsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListContinuousTestResultsResponse(proto.Message): @@ -397,9 +511,14 @@ def raw_page(self): return self continuous_test_results = proto.RepeatedField( - proto.MESSAGE, number=1, message="ContinuousTestResult", + proto.MESSAGE, + number=1, + message="ContinuousTestResult", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class DeployFlowRequest(proto.Message): @@ -415,8 +534,14 @@ class DeployFlowRequest(proto.Message): ``projects//locations//agents// flows//versions/``. """ - environment = proto.Field(proto.STRING, number=1,) - flow_version = proto.Field(proto.STRING, number=2,) + environment = proto.Field( + proto.STRING, + number=1, + ) + flow_version = proto.Field( + proto.STRING, + number=2, + ) class DeployFlowResponse(proto.Message): @@ -432,8 +557,15 @@ class DeployFlowResponse(proto.Message): ``projects//locations//agents// environments//deployments/``. """ - environment = proto.Field(proto.MESSAGE, number=1, message="Environment",) - deployment = proto.Field(proto.STRING, number=2,) + environment = proto.Field( + proto.MESSAGE, + number=1, + message="Environment", + ) + deployment = proto.Field( + proto.STRING, + number=2, + ) class DeployFlowMetadata(proto.Message): @@ -447,7 +579,9 @@ class DeployFlowMetadata(proto.Message): """ test_errors = proto.RepeatedField( - proto.MESSAGE, number=1, message=test_case.TestError, + proto.MESSAGE, + number=1, + message=test_case.TestError, ) diff --git a/google/cloud/dialogflowcx_v3beta1/types/experiment.py b/google/cloud/dialogflowcx_v3beta1/types/experiment.py index e269e3cb..7ed8b351 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/experiment.py +++ b/google/cloud/dialogflowcx_v3beta1/types/experiment.py @@ -128,9 +128,15 @@ class Definition(proto.Message): This field is a member of `oneof`_ ``variants``. """ - condition = proto.Field(proto.STRING, number=1,) + condition = proto.Field( + proto.STRING, + number=1, + ) version_variants = proto.Field( - proto.MESSAGE, number=2, oneof="variants", message="VersionVariants", + proto.MESSAGE, + number=2, + oneof="variants", + message="VersionVariants", ) class Result(proto.Message): @@ -180,10 +186,22 @@ class ConfidenceInterval(proto.Message): Upper bound of the interval. """ - confidence_level = proto.Field(proto.DOUBLE, number=1,) - ratio = proto.Field(proto.DOUBLE, number=2,) - lower_bound = proto.Field(proto.DOUBLE, number=3,) - upper_bound = proto.Field(proto.DOUBLE, number=4,) + confidence_level = proto.Field( + proto.DOUBLE, + number=1, + ) + ratio = proto.Field( + proto.DOUBLE, + number=2, + ) + lower_bound = proto.Field( + proto.DOUBLE, + number=3, + ) + upper_bound = proto.Field( + proto.DOUBLE, + number=4, + ) class Metric(proto.Message): r"""Metric and corresponding confidence intervals. @@ -216,15 +234,29 @@ class Metric(proto.Message): """ type_ = proto.Field( - proto.ENUM, number=1, enum="Experiment.Result.MetricType", + proto.ENUM, + number=1, + enum="Experiment.Result.MetricType", ) count_type = proto.Field( - proto.ENUM, number=5, enum="Experiment.Result.CountType", + proto.ENUM, + number=5, + enum="Experiment.Result.CountType", + ) + ratio = proto.Field( + proto.DOUBLE, + number=2, + oneof="value", + ) + count = proto.Field( + proto.DOUBLE, + number=4, + oneof="value", ) - ratio = proto.Field(proto.DOUBLE, number=2, oneof="value",) - count = proto.Field(proto.DOUBLE, number=4, oneof="value",) confidence_interval = proto.Field( - proto.MESSAGE, number=3, message="Experiment.Result.ConfidenceInterval", + proto.MESSAGE, + number=3, + message="Experiment.Result.ConfidenceInterval", ) class VersionMetrics(proto.Message): @@ -244,39 +276,101 @@ class VersionMetrics(proto.Message): this version. """ - version = proto.Field(proto.STRING, number=1,) + version = proto.Field( + proto.STRING, + number=1, + ) metrics = proto.RepeatedField( - proto.MESSAGE, number=2, message="Experiment.Result.Metric", + proto.MESSAGE, + number=2, + message="Experiment.Result.Metric", + ) + session_count = proto.Field( + proto.INT32, + number=3, ) - session_count = proto.Field(proto.INT32, number=3,) version_metrics = proto.RepeatedField( - proto.MESSAGE, number=1, message="Experiment.Result.VersionMetrics", + proto.MESSAGE, + number=1, + message="Experiment.Result.VersionMetrics", ) last_update_time = proto.Field( - proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, ) - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) - state = proto.Field(proto.ENUM, number=4, enum=State,) - definition = proto.Field(proto.MESSAGE, number=5, message=Definition,) - rollout_config = proto.Field(proto.MESSAGE, number=14, message="RolloutConfig",) - rollout_state = proto.Field(proto.MESSAGE, number=15, message="RolloutState",) - rollout_failure_reason = proto.Field(proto.STRING, number=16,) - result = proto.Field(proto.MESSAGE, number=6, message=Result,) - create_time = proto.Field(proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,) - start_time = proto.Field(proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=9, message=timestamp_pb2.Timestamp,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + state = proto.Field( + proto.ENUM, + number=4, + enum=State, + ) + definition = proto.Field( + proto.MESSAGE, + number=5, + message=Definition, + ) + rollout_config = proto.Field( + proto.MESSAGE, + number=14, + message="RolloutConfig", + ) + rollout_state = proto.Field( + proto.MESSAGE, + number=15, + message="RolloutState", + ) + rollout_failure_reason = proto.Field( + proto.STRING, + number=16, + ) + result = proto.Field( + proto.MESSAGE, + number=6, + message=Result, + ) + create_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + start_time = proto.Field( + proto.MESSAGE, + number=8, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=9, + message=timestamp_pb2.Timestamp, + ) last_update_time = proto.Field( - proto.MESSAGE, number=10, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=10, + message=timestamp_pb2.Timestamp, ) experiment_length = proto.Field( - proto.MESSAGE, number=11, message=duration_pb2.Duration, + proto.MESSAGE, + number=11, + message=duration_pb2.Duration, ) variants_history = proto.RepeatedField( - proto.MESSAGE, number=12, message="VariantsHistory", + proto.MESSAGE, + number=12, + message="VariantsHistory", ) @@ -303,11 +397,24 @@ class Variant(proto.Message): Whether the variant is for the control group. """ - version = proto.Field(proto.STRING, number=1,) - traffic_allocation = proto.Field(proto.FLOAT, number=2,) - is_control_group = proto.Field(proto.BOOL, number=3,) + version = proto.Field( + proto.STRING, + number=1, + ) + traffic_allocation = proto.Field( + proto.FLOAT, + number=2, + ) + is_control_group = proto.Field( + proto.BOOL, + number=3, + ) - variants = proto.RepeatedField(proto.MESSAGE, number=1, message=Variant,) + variants = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=Variant, + ) class RolloutConfig(proto.Message): @@ -349,15 +456,33 @@ class RolloutStep(proto.Message): hour. """ - display_name = proto.Field(proto.STRING, number=1,) - traffic_percent = proto.Field(proto.INT32, number=2,) + display_name = proto.Field( + proto.STRING, + number=1, + ) + traffic_percent = proto.Field( + proto.INT32, + number=2, + ) min_duration = proto.Field( - proto.MESSAGE, number=3, message=duration_pb2.Duration, + proto.MESSAGE, + number=3, + message=duration_pb2.Duration, ) - rollout_steps = proto.RepeatedField(proto.MESSAGE, number=1, message=RolloutStep,) - rollout_condition = proto.Field(proto.STRING, number=2,) - failure_condition = proto.Field(proto.STRING, number=3,) + rollout_steps = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=RolloutStep, + ) + rollout_condition = proto.Field( + proto.STRING, + number=2, + ) + failure_condition = proto.Field( + proto.STRING, + number=3, + ) class RolloutState(proto.Message): @@ -374,9 +499,19 @@ class RolloutState(proto.Message): Start time of the current step. """ - step = proto.Field(proto.STRING, number=1,) - step_index = proto.Field(proto.INT32, number=3,) - start_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) + step = proto.Field( + proto.STRING, + number=1, + ) + step_index = proto.Field( + proto.INT32, + number=3, + ) + start_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) class VariantsHistory(proto.Message): @@ -394,9 +529,16 @@ class VariantsHistory(proto.Message): """ version_variants = proto.Field( - proto.MESSAGE, number=1, oneof="variants", message="VersionVariants", + proto.MESSAGE, + number=1, + oneof="variants", + message="VersionVariants", + ) + update_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, ) - update_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) class ListExperimentsRequest(proto.Message): @@ -417,9 +559,18 @@ class ListExperimentsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListExperimentsResponse(proto.Message): @@ -442,8 +593,15 @@ class ListExperimentsResponse(proto.Message): def raw_page(self): return self - experiments = proto.RepeatedField(proto.MESSAGE, number=1, message="Experiment",) - next_page_token = proto.Field(proto.STRING, number=2,) + experiments = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Experiment", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetExperimentRequest(proto.Message): @@ -458,7 +616,10 @@ class GetExperimentRequest(proto.Message): ``projects//locations//agents//environments//experiments/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateExperimentRequest(proto.Message): @@ -477,8 +638,15 @@ class CreateExperimentRequest(proto.Message): Required. The experiment to create. """ - parent = proto.Field(proto.STRING, number=1,) - experiment = proto.Field(proto.MESSAGE, number=2, message="Experiment",) + parent = proto.Field( + proto.STRING, + number=1, + ) + experiment = proto.Field( + proto.MESSAGE, + number=2, + message="Experiment", + ) class UpdateExperimentRequest(proto.Message): @@ -493,9 +661,15 @@ class UpdateExperimentRequest(proto.Message): get updated. """ - experiment = proto.Field(proto.MESSAGE, number=1, message="Experiment",) + experiment = proto.Field( + proto.MESSAGE, + number=1, + message="Experiment", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -511,7 +685,10 @@ class DeleteExperimentRequest(proto.Message): ``projects//locations//agents//environments//experiments/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class StartExperimentRequest(proto.Message): @@ -524,7 +701,10 @@ class StartExperimentRequest(proto.Message): ``projects//locations//agents//environments//experiments/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class StopExperimentRequest(proto.Message): @@ -537,7 +717,10 @@ class StopExperimentRequest(proto.Message): ``projects//locations//agents//environments//experiments/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3beta1/types/flow.py b/google/cloud/dialogflowcx_v3beta1/types/flow.py index 045c25a2..086736c2 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/flow.py +++ b/google/cloud/dialogflowcx_v3beta1/types/flow.py @@ -76,9 +76,20 @@ class ModelTrainingMode(proto.Enum): MODEL_TRAINING_MODE_AUTOMATIC = 1 MODEL_TRAINING_MODE_MANUAL = 2 - model_type = proto.Field(proto.ENUM, number=1, enum=ModelType,) - classification_threshold = proto.Field(proto.FLOAT, number=3,) - model_training_mode = proto.Field(proto.ENUM, number=4, enum=ModelTrainingMode,) + model_type = proto.Field( + proto.ENUM, + number=1, + enum=ModelType, + ) + classification_threshold = proto.Field( + proto.FLOAT, + number=3, + ) + model_training_mode = proto.Field( + proto.ENUM, + number=4, + enum=ModelTrainingMode, + ) class Flow(proto.Message): @@ -124,7 +135,7 @@ class Flow(proto.Message): TransitionRoutes are evalauted in the following order: - - TransitionRoutes with intent specified.. + - TransitionRoutes with intent specified. - TransitionRoutes with only condition specified. TransitionRoutes with intent specified are inherited by @@ -160,17 +171,37 @@ class Flow(proto.Message): NLU related settings of the flow. """ - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) transition_routes = proto.RepeatedField( - proto.MESSAGE, number=4, message=page.TransitionRoute, + proto.MESSAGE, + number=4, + message=page.TransitionRoute, ) event_handlers = proto.RepeatedField( - proto.MESSAGE, number=10, message=page.EventHandler, + proto.MESSAGE, + number=10, + message=page.EventHandler, + ) + transition_route_groups = proto.RepeatedField( + proto.STRING, + number=15, + ) + nlu_settings = proto.Field( + proto.MESSAGE, + number=11, + message="NluSettings", ) - transition_route_groups = proto.RepeatedField(proto.STRING, number=15,) - nlu_settings = proto.Field(proto.MESSAGE, number=11, message="NluSettings",) class CreateFlowRequest(proto.Message): @@ -198,9 +229,19 @@ class CreateFlowRequest(proto.Message): before they can be used. """ - parent = proto.Field(proto.STRING, number=1,) - flow = proto.Field(proto.MESSAGE, number=2, message="Flow",) - language_code = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + flow = proto.Field( + proto.MESSAGE, + number=2, + message="Flow", + ) + language_code = proto.Field( + proto.STRING, + number=3, + ) class DeleteFlowRequest(proto.Message): @@ -225,8 +266,14 @@ class DeleteFlowRequest(proto.Message): cleared). """ - name = proto.Field(proto.STRING, number=1,) - force = proto.Field(proto.BOOL, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + force = proto.Field( + proto.BOOL, + number=2, + ) class ListFlowsRequest(proto.Message): @@ -259,10 +306,22 @@ class ListFlowsRequest(proto.Message): before they can be used. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - language_code = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + language_code = proto.Field( + proto.STRING, + number=4, + ) class ListFlowsResponse(proto.Message): @@ -283,8 +342,15 @@ class ListFlowsResponse(proto.Message): def raw_page(self): return self - flows = proto.RepeatedField(proto.MESSAGE, number=1, message="Flow",) - next_page_token = proto.Field(proto.STRING, number=2,) + flows = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Flow", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetFlowRequest(proto.Message): @@ -311,8 +377,14 @@ class GetFlowRequest(proto.Message): before they can be used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class UpdateFlowRequest(proto.Message): @@ -341,11 +413,20 @@ class UpdateFlowRequest(proto.Message): before they can be used. """ - flow = proto.Field(proto.MESSAGE, number=1, message="Flow",) + flow = proto.Field( + proto.MESSAGE, + number=1, + message="Flow", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + language_code = proto.Field( + proto.STRING, + number=3, ) - language_code = proto.Field(proto.STRING, number=3,) class TrainFlowRequest(proto.Message): @@ -358,7 +439,10 @@ class TrainFlowRequest(proto.Message): ``projects//locations//agents//flows/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ValidateFlowRequest(proto.Message): @@ -374,8 +458,14 @@ class ValidateFlowRequest(proto.Message): language is used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class GetFlowValidationResultRequest(proto.Message): @@ -391,8 +481,14 @@ class GetFlowValidationResultRequest(proto.Message): language is used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class FlowValidationResult(proto.Message): @@ -409,11 +505,20 @@ class FlowValidationResult(proto.Message): Last time the flow was validated. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) validation_messages = proto.RepeatedField( - proto.MESSAGE, number=2, message=validation_message.ValidationMessage, + proto.MESSAGE, + number=2, + message=validation_message.ValidationMessage, + ) + update_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, ) - update_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) class ImportFlowRequest(proto.Message): @@ -437,6 +542,12 @@ class ImportFlowRequest(proto.Message): import flow from. The format of this URI must be ``gs:///``. + Dialogflow performs a read operation for the Cloud Storage + object on the caller's behalf, so your request + authentication must have read permissions for the object. + For more information, see `Dialogflow access + control `__. + This field is a member of `oneof`_ ``flow``. flow_content (bytes): Uncompressed raw byte content for flow. @@ -452,10 +563,25 @@ class ImportOption(proto.Enum): KEEP = 1 FALLBACK = 2 - parent = proto.Field(proto.STRING, number=1,) - flow_uri = proto.Field(proto.STRING, number=2, oneof="flow",) - flow_content = proto.Field(proto.BYTES, number=3, oneof="flow",) - import_option = proto.Field(proto.ENUM, number=4, enum=ImportOption,) + parent = proto.Field( + proto.STRING, + number=1, + ) + flow_uri = proto.Field( + proto.STRING, + number=2, + oneof="flow", + ) + flow_content = proto.Field( + proto.BYTES, + number=3, + oneof="flow", + ) + import_option = proto.Field( + proto.ENUM, + number=4, + enum=ImportOption, + ) class ImportFlowResponse(proto.Message): @@ -468,7 +594,10 @@ class ImportFlowResponse(proto.Message): ``projects//locations//agents//flows/``. """ - flow = proto.Field(proto.STRING, number=1,) + flow = proto.Field( + proto.STRING, + number=1, + ) class ExportFlowRequest(proto.Message): @@ -485,14 +614,29 @@ class ExportFlowRequest(proto.Message): export the flow to. The format of this URI must be ``gs:///``. If left unspecified, the serialized flow is returned inline. + + Dialogflow performs a write operation for the Cloud Storage + object on the caller's behalf, so your request + authentication must have write permissions for the object. + For more information, see `Dialogflow access + control `__. include_referenced_flows (bool): Optional. Whether to export flows referenced by the specified flow. """ - name = proto.Field(proto.STRING, number=1,) - flow_uri = proto.Field(proto.STRING, number=2,) - include_referenced_flows = proto.Field(proto.BOOL, number=4,) + name = proto.Field( + proto.STRING, + number=1, + ) + flow_uri = proto.Field( + proto.STRING, + number=2, + ) + include_referenced_flows = proto.Field( + proto.BOOL, + number=4, + ) class ExportFlowResponse(proto.Message): @@ -519,8 +663,16 @@ class ExportFlowResponse(proto.Message): This field is a member of `oneof`_ ``flow``. """ - flow_uri = proto.Field(proto.STRING, number=1, oneof="flow",) - flow_content = proto.Field(proto.BYTES, number=2, oneof="flow",) + flow_uri = proto.Field( + proto.STRING, + number=1, + oneof="flow", + ) + flow_content = proto.Field( + proto.BYTES, + number=2, + oneof="flow", + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3beta1/types/fulfillment.py b/google/cloud/dialogflowcx_v3beta1/types/fulfillment.py index 36df0c57..59537b74 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/fulfillment.py +++ b/google/cloud/dialogflowcx_v3beta1/types/fulfillment.py @@ -20,7 +20,10 @@ __protobuf__ = proto.module( - package="google.cloud.dialogflow.cx.v3beta1", manifest={"Fulfillment",}, + package="google.cloud.dialogflow.cx.v3beta1", + manifest={ + "Fulfillment", + }, ) @@ -66,9 +69,13 @@ class Fulfillment(proto.Message): returned. You may only want to apply it to fulfillments that have slow webhooks. tag (str): - The tag used by the webhook to identify which fulfillment is - being called. This field is required if ``webhook`` is - specified. + The value of this field will be populated in the + [WebhookRequest][google.cloud.dialogflow.cx.v3beta1.WebhookRequest] + ``fulfillmentInfo.tag`` field by Dialogflow when the + associated webhook is called. The tag is typically used by + the webhook service to identify which fulfillment is being + called, but it could be used for other purposes. This field + is required if ``webhook`` is specified. set_parameter_actions (Sequence[google.cloud.dialogflowcx_v3beta1.types.Fulfillment.SetParameterAction]): Set parameter values before executing the webhook. @@ -87,8 +94,15 @@ class SetParameterAction(proto.Message): clears the parameter. """ - parameter = proto.Field(proto.STRING, number=1,) - value = proto.Field(proto.MESSAGE, number=2, message=struct_pb2.Value,) + parameter = proto.Field( + proto.STRING, + number=1, + ) + value = proto.Field( + proto.MESSAGE, + number=2, + message=struct_pb2.Value, + ) class ConditionalCases(proto.Message): r"""A list of cascading if-else conditions. Cases are mutually @@ -153,7 +167,10 @@ class CaseContent(proto.Message): message="Fulfillment.ConditionalCases", ) - condition = proto.Field(proto.STRING, number=1,) + condition = proto.Field( + proto.STRING, + number=1, + ) case_content = proto.RepeatedField( proto.MESSAGE, number=2, @@ -161,20 +178,37 @@ class CaseContent(proto.Message): ) cases = proto.RepeatedField( - proto.MESSAGE, number=1, message="Fulfillment.ConditionalCases.Case", + proto.MESSAGE, + number=1, + message="Fulfillment.ConditionalCases.Case", ) messages = proto.RepeatedField( - proto.MESSAGE, number=1, message=response_message.ResponseMessage, + proto.MESSAGE, + number=1, + message=response_message.ResponseMessage, + ) + webhook = proto.Field( + proto.STRING, + number=2, + ) + return_partial_responses = proto.Field( + proto.BOOL, + number=8, + ) + tag = proto.Field( + proto.STRING, + number=3, ) - webhook = proto.Field(proto.STRING, number=2,) - return_partial_responses = proto.Field(proto.BOOL, number=8,) - tag = proto.Field(proto.STRING, number=3,) set_parameter_actions = proto.RepeatedField( - proto.MESSAGE, number=4, message=SetParameterAction, + proto.MESSAGE, + number=4, + message=SetParameterAction, ) conditional_cases = proto.RepeatedField( - proto.MESSAGE, number=5, message=ConditionalCases, + proto.MESSAGE, + number=5, + message=ConditionalCases, ) diff --git a/google/cloud/dialogflowcx_v3beta1/types/intent.py b/google/cloud/dialogflowcx_v3beta1/types/intent.py index 0c0f8760..b0da47fe 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/intent.py +++ b/google/cloud/dialogflowcx_v3beta1/types/intent.py @@ -87,7 +87,7 @@ class Intent(proto.Message): mistakenly matched, since training phrases assigned to fallback intents act as negative examples that triggers no-match event. - labels (Sequence[google.cloud.dialogflowcx_v3beta1.types.Intent.LabelsEntry]): + labels (Mapping[str, str]): The key/value metadata to label an intent. Labels can contain lowercase letters, digits and the symbols '-' and '_'. International characters are allowed, including letters @@ -160,14 +160,28 @@ class Part(proto.Message): phrase. """ - text = proto.Field(proto.STRING, number=1,) - parameter_id = proto.Field(proto.STRING, number=2,) - - id = proto.Field(proto.STRING, number=1,) + text = proto.Field( + proto.STRING, + number=1, + ) + parameter_id = proto.Field( + proto.STRING, + number=2, + ) + + id = proto.Field( + proto.STRING, + number=1, + ) parts = proto.RepeatedField( - proto.MESSAGE, number=2, message="Intent.TrainingPhrase.Part", + proto.MESSAGE, + number=2, + message="Intent.TrainingPhrase.Part", + ) + repeat_count = proto.Field( + proto.INT32, + number=3, ) - repeat_count = proto.Field(proto.INT32, number=3,) class Parameter(proto.Message): r"""Represents an intent parameter. @@ -200,21 +214,58 @@ class Parameter(proto.Message): is enabled. """ - id = proto.Field(proto.STRING, number=1,) - entity_type = proto.Field(proto.STRING, number=2,) - is_list = proto.Field(proto.BOOL, number=3,) - redact = proto.Field(proto.BOOL, number=4,) + id = proto.Field( + proto.STRING, + number=1, + ) + entity_type = proto.Field( + proto.STRING, + number=2, + ) + is_list = proto.Field( + proto.BOOL, + number=3, + ) + redact = proto.Field( + proto.BOOL, + number=4, + ) - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) training_phrases = proto.RepeatedField( - proto.MESSAGE, number=3, message=TrainingPhrase, + proto.MESSAGE, + number=3, + message=TrainingPhrase, + ) + parameters = proto.RepeatedField( + proto.MESSAGE, + number=4, + message=Parameter, + ) + priority = proto.Field( + proto.INT32, + number=5, + ) + is_fallback = proto.Field( + proto.BOOL, + number=6, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=7, + ) + description = proto.Field( + proto.STRING, + number=8, ) - parameters = proto.RepeatedField(proto.MESSAGE, number=4, message=Parameter,) - priority = proto.Field(proto.INT32, number=5,) - is_fallback = proto.Field(proto.BOOL, number=6,) - labels = proto.MapField(proto.STRING, proto.STRING, number=7,) - description = proto.Field(proto.STRING, number=8,) class ListIntentsRequest(proto.Message): @@ -247,11 +298,27 @@ class ListIntentsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) - intent_view = proto.Field(proto.ENUM, number=5, enum="IntentView",) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) + intent_view = proto.Field( + proto.ENUM, + number=5, + enum="IntentView", + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class ListIntentsResponse(proto.Message): @@ -272,8 +339,15 @@ class ListIntentsResponse(proto.Message): def raw_page(self): return self - intents = proto.RepeatedField(proto.MESSAGE, number=1, message="Intent",) - next_page_token = proto.Field(proto.STRING, number=2,) + intents = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Intent", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetIntentRequest(proto.Message): @@ -297,8 +371,14 @@ class GetIntentRequest(proto.Message): before they can be used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class CreateIntentRequest(proto.Message): @@ -323,9 +403,19 @@ class CreateIntentRequest(proto.Message): before they can be used. """ - parent = proto.Field(proto.STRING, number=1,) - intent = proto.Field(proto.MESSAGE, number=2, message="Intent",) - language_code = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + intent = proto.Field( + proto.MESSAGE, + number=2, + message="Intent", + ) + language_code = proto.Field( + proto.STRING, + number=3, + ) class UpdateIntentRequest(proto.Message): @@ -351,10 +441,19 @@ class UpdateIntentRequest(proto.Message): updated. """ - intent = proto.Field(proto.MESSAGE, number=1, message="Intent",) - language_code = proto.Field(proto.STRING, number=2,) + intent = proto.Field( + proto.MESSAGE, + number=1, + message="Intent", + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) @@ -368,7 +467,10 @@ class DeleteIntentRequest(proto.Message): ``projects//locations//agents//intents/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3beta1/types/page.py b/google/cloud/dialogflowcx_v3beta1/types/page.py index 34066c8b..88cbc310 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/page.py +++ b/google/cloud/dialogflowcx_v3beta1/types/page.py @@ -68,7 +68,7 @@ class Page(proto.Message): ``projects//locations//agents//flows//pages/``. display_name (str): Required. The human-readable name of the - page, unique within the agent. + page, unique within the flow. entry_fulfillment (google.cloud.dialogflowcx_v3beta1.types.Fulfillment): The fulfillment to call when the session is entering the page. @@ -119,18 +119,37 @@ class Page(proto.Message): input. """ - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) entry_fulfillment = proto.Field( - proto.MESSAGE, number=7, message=fulfillment.Fulfillment, + proto.MESSAGE, + number=7, + message=fulfillment.Fulfillment, + ) + form = proto.Field( + proto.MESSAGE, + number=4, + message="Form", + ) + transition_route_groups = proto.RepeatedField( + proto.STRING, + number=11, ) - form = proto.Field(proto.MESSAGE, number=4, message="Form",) - transition_route_groups = proto.RepeatedField(proto.STRING, number=11,) transition_routes = proto.RepeatedField( - proto.MESSAGE, number=9, message="TransitionRoute", + proto.MESSAGE, + number=9, + message="TransitionRoute", ) event_handlers = proto.RepeatedField( - proto.MESSAGE, number=10, message="EventHandler", + proto.MESSAGE, + number=10, + message="EventHandler", ) @@ -239,23 +258,52 @@ class FillBehavior(proto.Message): """ initial_prompt_fulfillment = proto.Field( - proto.MESSAGE, number=3, message=fulfillment.Fulfillment, + proto.MESSAGE, + number=3, + message=fulfillment.Fulfillment, ) reprompt_event_handlers = proto.RepeatedField( - proto.MESSAGE, number=5, message="EventHandler", + proto.MESSAGE, + number=5, + message="EventHandler", ) - display_name = proto.Field(proto.STRING, number=1,) - required = proto.Field(proto.BOOL, number=2,) - entity_type = proto.Field(proto.STRING, number=3,) - is_list = proto.Field(proto.BOOL, number=4,) + display_name = proto.Field( + proto.STRING, + number=1, + ) + required = proto.Field( + proto.BOOL, + number=2, + ) + entity_type = proto.Field( + proto.STRING, + number=3, + ) + is_list = proto.Field( + proto.BOOL, + number=4, + ) fill_behavior = proto.Field( - proto.MESSAGE, number=7, message="Form.Parameter.FillBehavior", + proto.MESSAGE, + number=7, + message="Form.Parameter.FillBehavior", + ) + default_value = proto.Field( + proto.MESSAGE, + number=9, + message=struct_pb2.Value, + ) + redact = proto.Field( + proto.BOOL, + number=11, ) - default_value = proto.Field(proto.MESSAGE, number=9, message=struct_pb2.Value,) - redact = proto.Field(proto.BOOL, number=11,) - parameters = proto.RepeatedField(proto.MESSAGE, number=1, message=Parameter,) + parameters = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=Parameter, + ) class EventHandler(proto.Message): @@ -307,13 +355,29 @@ class EventHandler(proto.Message): This field is a member of `oneof`_ ``target``. """ - name = proto.Field(proto.STRING, number=6,) - event = proto.Field(proto.STRING, number=4,) + name = proto.Field( + proto.STRING, + number=6, + ) + event = proto.Field( + proto.STRING, + number=4, + ) trigger_fulfillment = proto.Field( - proto.MESSAGE, number=5, message=fulfillment.Fulfillment, + proto.MESSAGE, + number=5, + message=fulfillment.Fulfillment, + ) + target_page = proto.Field( + proto.STRING, + number=2, + oneof="target", + ) + target_flow = proto.Field( + proto.STRING, + number=3, + oneof="target", ) - target_page = proto.Field(proto.STRING, number=2, oneof="target",) - target_flow = proto.Field(proto.STRING, number=3, oneof="target",) class TransitionRoute(proto.Message): @@ -384,14 +448,33 @@ class TransitionRoute(proto.Message): This field is a member of `oneof`_ ``target``. """ - name = proto.Field(proto.STRING, number=6,) - intent = proto.Field(proto.STRING, number=1,) - condition = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=6, + ) + intent = proto.Field( + proto.STRING, + number=1, + ) + condition = proto.Field( + proto.STRING, + number=2, + ) trigger_fulfillment = proto.Field( - proto.MESSAGE, number=3, message=fulfillment.Fulfillment, + proto.MESSAGE, + number=3, + message=fulfillment.Fulfillment, + ) + target_page = proto.Field( + proto.STRING, + number=4, + oneof="target", + ) + target_flow = proto.Field( + proto.STRING, + number=5, + oneof="target", ) - target_page = proto.Field(proto.STRING, number=4, oneof="target",) - target_flow = proto.Field(proto.STRING, number=5, oneof="target",) class ListPagesRequest(proto.Message): @@ -436,10 +519,22 @@ class ListPagesRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) - page_size = proto.Field(proto.INT32, number=3,) - page_token = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) + page_size = proto.Field( + proto.INT32, + number=3, + ) + page_token = proto.Field( + proto.STRING, + number=4, + ) class ListPagesResponse(proto.Message): @@ -460,8 +555,15 @@ class ListPagesResponse(proto.Message): def raw_page(self): return self - pages = proto.RepeatedField(proto.MESSAGE, number=1, message="Page",) - next_page_token = proto.Field(proto.STRING, number=2,) + pages = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Page", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetPageRequest(proto.Message): @@ -500,8 +602,14 @@ class GetPageRequest(proto.Message): before they can be used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class CreatePageRequest(proto.Message): @@ -541,9 +649,19 @@ class CreatePageRequest(proto.Message): before they can be used. """ - parent = proto.Field(proto.STRING, number=1,) - page = proto.Field(proto.MESSAGE, number=2, message="Page",) - language_code = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page = proto.Field( + proto.MESSAGE, + number=2, + message="Page", + ) + language_code = proto.Field( + proto.STRING, + number=3, + ) class UpdatePageRequest(proto.Message): @@ -584,10 +702,19 @@ class UpdatePageRequest(proto.Message): updated. """ - page = proto.Field(proto.MESSAGE, number=1, message="Page",) - language_code = proto.Field(proto.STRING, number=2,) + page = proto.Field( + proto.MESSAGE, + number=1, + message="Page", + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) @@ -613,8 +740,14 @@ class DeletePageRequest(proto.Message): cleared). """ - name = proto.Field(proto.STRING, number=1,) - force = proto.Field(proto.BOOL, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + force = proto.Field( + proto.BOOL, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3beta1/types/response_message.py b/google/cloud/dialogflowcx_v3beta1/types/response_message.py index c27fbd10..b252fcdf 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/response_message.py +++ b/google/cloud/dialogflowcx_v3beta1/types/response_message.py @@ -19,7 +19,10 @@ __protobuf__ = proto.module( - package="google.cloud.dialogflow.cx.v3beta1", manifest={"ResponseMessage",}, + package="google.cloud.dialogflow.cx.v3beta1", + manifest={ + "ResponseMessage", + }, ) @@ -126,8 +129,14 @@ class Text(proto.Message): Dialogflow request. """ - text = proto.RepeatedField(proto.STRING, number=1,) - allow_playback_interruption = proto.Field(proto.BOOL, number=2,) + text = proto.RepeatedField( + proto.STRING, + number=1, + ) + allow_playback_interruption = proto.Field( + proto.BOOL, + number=2, + ) class LiveAgentHandoff(proto.Message): r"""Indicates that the conversation should be handed off to a live @@ -153,7 +162,11 @@ class LiveAgentHandoff(proto.Message): Dialogflow doesn't impose any structure on this. """ - metadata = proto.Field(proto.MESSAGE, number=1, message=struct_pb2.Struct,) + metadata = proto.Field( + proto.MESSAGE, + number=1, + message=struct_pb2.Struct, + ) class ConversationSuccess(proto.Message): r"""Indicates that the conversation succeeded, i.e., the bot handled the @@ -181,7 +194,11 @@ class ConversationSuccess(proto.Message): any structure on this. """ - metadata = proto.Field(proto.MESSAGE, number=1, message=struct_pb2.Struct,) + metadata = proto.Field( + proto.MESSAGE, + number=1, + message=struct_pb2.Struct, + ) class OutputAudioText(proto.Message): r"""A text or ssml response that is preferentially used for TTS @@ -212,9 +229,20 @@ class OutputAudioText(proto.Message): Dialogflow request. """ - text = proto.Field(proto.STRING, number=1, oneof="source",) - ssml = proto.Field(proto.STRING, number=2, oneof="source",) - allow_playback_interruption = proto.Field(proto.BOOL, number=3,) + text = proto.Field( + proto.STRING, + number=1, + oneof="source", + ) + ssml = proto.Field( + proto.STRING, + number=2, + oneof="source", + ) + allow_playback_interruption = proto.Field( + proto.BOOL, + number=3, + ) class EndInteraction(proto.Message): r"""Indicates that interaction with the Dialogflow agent has @@ -239,8 +267,14 @@ class PlayAudio(proto.Message): Dialogflow request. """ - audio_uri = proto.Field(proto.STRING, number=1,) - allow_playback_interruption = proto.Field(proto.BOOL, number=2,) + audio_uri = proto.Field( + proto.STRING, + number=1, + ) + allow_playback_interruption = proto.Field( + proto.BOOL, + number=2, + ) class MixedAudio(proto.Message): r"""Represents an audio message that is composed of both segments @@ -286,12 +320,25 @@ class Segment(proto.Message): Dialogflow request. """ - audio = proto.Field(proto.BYTES, number=1, oneof="content",) - uri = proto.Field(proto.STRING, number=2, oneof="content",) - allow_playback_interruption = proto.Field(proto.BOOL, number=3,) + audio = proto.Field( + proto.BYTES, + number=1, + oneof="content", + ) + uri = proto.Field( + proto.STRING, + number=2, + oneof="content", + ) + allow_playback_interruption = proto.Field( + proto.BOOL, + number=3, + ) segments = proto.RepeatedField( - proto.MESSAGE, number=1, message="ResponseMessage.MixedAudio.Segment", + proto.MESSAGE, + number=1, + message="ResponseMessage.MixedAudio.Segment", ) class TelephonyTransferCall(proto.Message): @@ -309,32 +356,65 @@ class TelephonyTransferCall(proto.Message): This field is a member of `oneof`_ ``endpoint``. """ - phone_number = proto.Field(proto.STRING, number=1, oneof="endpoint",) + phone_number = proto.Field( + proto.STRING, + number=1, + oneof="endpoint", + ) - text = proto.Field(proto.MESSAGE, number=1, oneof="message", message=Text,) + text = proto.Field( + proto.MESSAGE, + number=1, + oneof="message", + message=Text, + ) payload = proto.Field( - proto.MESSAGE, number=2, oneof="message", message=struct_pb2.Struct, + proto.MESSAGE, + number=2, + oneof="message", + message=struct_pb2.Struct, ) conversation_success = proto.Field( - proto.MESSAGE, number=9, oneof="message", message=ConversationSuccess, + proto.MESSAGE, + number=9, + oneof="message", + message=ConversationSuccess, ) output_audio_text = proto.Field( - proto.MESSAGE, number=8, oneof="message", message=OutputAudioText, + proto.MESSAGE, + number=8, + oneof="message", + message=OutputAudioText, ) live_agent_handoff = proto.Field( - proto.MESSAGE, number=10, oneof="message", message=LiveAgentHandoff, + proto.MESSAGE, + number=10, + oneof="message", + message=LiveAgentHandoff, ) end_interaction = proto.Field( - proto.MESSAGE, number=11, oneof="message", message=EndInteraction, + proto.MESSAGE, + number=11, + oneof="message", + message=EndInteraction, ) play_audio = proto.Field( - proto.MESSAGE, number=12, oneof="message", message=PlayAudio, + proto.MESSAGE, + number=12, + oneof="message", + message=PlayAudio, ) mixed_audio = proto.Field( - proto.MESSAGE, number=13, oneof="message", message=MixedAudio, + proto.MESSAGE, + number=13, + oneof="message", + message=MixedAudio, ) telephony_transfer_call = proto.Field( - proto.MESSAGE, number=18, oneof="message", message=TelephonyTransferCall, + proto.MESSAGE, + number=18, + oneof="message", + message=TelephonyTransferCall, ) diff --git a/google/cloud/dialogflowcx_v3beta1/types/security_settings.py b/google/cloud/dialogflowcx_v3beta1/types/security_settings.py index de4ea3b0..9c2774e1 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/security_settings.py +++ b/google/cloud/dialogflowcx_v3beta1/types/security_settings.py @@ -42,7 +42,10 @@ class GetSecuritySettingsRequest(proto.Message): ``projects//locations//securitySettings/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateSecuritySettingsRequest(proto.Message): @@ -60,10 +63,14 @@ class UpdateSecuritySettingsRequest(proto.Message): """ security_settings = proto.Field( - proto.MESSAGE, number=1, message="SecuritySettings", + proto.MESSAGE, + number=1, + message="SecuritySettings", ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -82,9 +89,18 @@ class ListSecuritySettingsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListSecuritySettingsResponse(proto.Message): @@ -104,9 +120,14 @@ def raw_page(self): return self security_settings = proto.RepeatedField( - proto.MESSAGE, number=1, message="SecuritySettings", + proto.MESSAGE, + number=1, + message="SecuritySettings", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class CreateSecuritySettingsRequest(proto.Message): @@ -122,9 +143,14 @@ class CreateSecuritySettingsRequest(proto.Message): Required. The security settings to create. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) security_settings = proto.Field( - proto.MESSAGE, number=2, message="SecuritySettings", + proto.MESSAGE, + number=2, + message="SecuritySettings", ) @@ -139,7 +165,10 @@ class DeleteSecuritySettingsRequest(proto.Message): ``projects//locations//securitySettings/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class SecuritySettings(proto.Message): @@ -264,18 +293,51 @@ class InsightsExportSettings(proto.Message): analyzers. """ - enable_insights_export = proto.Field(proto.BOOL, number=1,) + enable_insights_export = proto.Field( + proto.BOOL, + number=1, + ) - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - redaction_strategy = proto.Field(proto.ENUM, number=3, enum=RedactionStrategy,) - redaction_scope = proto.Field(proto.ENUM, number=4, enum=RedactionScope,) - inspect_template = proto.Field(proto.STRING, number=9,) - deidentify_template = proto.Field(proto.STRING, number=17,) - retention_window_days = proto.Field(proto.INT32, number=6, oneof="data_retention",) - purge_data_types = proto.RepeatedField(proto.ENUM, number=8, enum=PurgeDataType,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + redaction_strategy = proto.Field( + proto.ENUM, + number=3, + enum=RedactionStrategy, + ) + redaction_scope = proto.Field( + proto.ENUM, + number=4, + enum=RedactionScope, + ) + inspect_template = proto.Field( + proto.STRING, + number=9, + ) + deidentify_template = proto.Field( + proto.STRING, + number=17, + ) + retention_window_days = proto.Field( + proto.INT32, + number=6, + oneof="data_retention", + ) + purge_data_types = proto.RepeatedField( + proto.ENUM, + number=8, + enum=PurgeDataType, + ) insights_export_settings = proto.Field( - proto.MESSAGE, number=13, message=InsightsExportSettings, + proto.MESSAGE, + number=13, + message=InsightsExportSettings, ) diff --git a/google/cloud/dialogflowcx_v3beta1/types/session.py b/google/cloud/dialogflowcx_v3beta1/types/session.py index 843580cf..b8ce2ef3 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/session.py +++ b/google/cloud/dialogflowcx_v3beta1/types/session.py @@ -83,11 +83,24 @@ class DetectIntentRequest(proto.Message): generate the output audio. """ - session = proto.Field(proto.STRING, number=1,) - query_params = proto.Field(proto.MESSAGE, number=2, message="QueryParameters",) - query_input = proto.Field(proto.MESSAGE, number=3, message="QueryInput",) + session = proto.Field( + proto.STRING, + number=1, + ) + query_params = proto.Field( + proto.MESSAGE, + number=2, + message="QueryParameters", + ) + query_input = proto.Field( + proto.MESSAGE, + number=3, + message="QueryInput", + ) output_audio_config = proto.Field( - proto.MESSAGE, number=4, message=audio_config.OutputAudioConfig, + proto.MESSAGE, + number=4, + message=audio_config.OutputAudioConfig, ) @@ -133,14 +146,33 @@ class ResponseType(proto.Enum): PARTIAL = 1 FINAL = 2 - response_id = proto.Field(proto.STRING, number=1,) - query_result = proto.Field(proto.MESSAGE, number=2, message="QueryResult",) - output_audio = proto.Field(proto.BYTES, number=4,) + response_id = proto.Field( + proto.STRING, + number=1, + ) + query_result = proto.Field( + proto.MESSAGE, + number=2, + message="QueryResult", + ) + output_audio = proto.Field( + proto.BYTES, + number=4, + ) output_audio_config = proto.Field( - proto.MESSAGE, number=5, message=audio_config.OutputAudioConfig, + proto.MESSAGE, + number=5, + message=audio_config.OutputAudioConfig, + ) + response_type = proto.Field( + proto.ENUM, + number=6, + enum=ResponseType, + ) + allow_cancellation = proto.Field( + proto.BOOL, + number=7, ) - response_type = proto.Field(proto.ENUM, number=6, enum=ResponseType,) - allow_cancellation = proto.Field(proto.BOOL, number=7,) class StreamingDetectIntentRequest(proto.Message): @@ -213,13 +245,29 @@ class StreamingDetectIntentRequest(proto.Message): the agent have been configured to return partial responses. """ - session = proto.Field(proto.STRING, number=1,) - query_params = proto.Field(proto.MESSAGE, number=2, message="QueryParameters",) - query_input = proto.Field(proto.MESSAGE, number=3, message="QueryInput",) + session = proto.Field( + proto.STRING, + number=1, + ) + query_params = proto.Field( + proto.MESSAGE, + number=2, + message="QueryParameters", + ) + query_input = proto.Field( + proto.MESSAGE, + number=3, + message="QueryInput", + ) output_audio_config = proto.Field( - proto.MESSAGE, number=4, message=audio_config.OutputAudioConfig, + proto.MESSAGE, + number=4, + message=audio_config.OutputAudioConfig, + ) + enable_partial_response = proto.Field( + proto.BOOL, + number=5, ) - enable_partial_response = proto.Field(proto.BOOL, number=5,) class StreamingDetectIntentResponse(proto.Message): @@ -271,10 +319,16 @@ class StreamingDetectIntentResponse(proto.Message): """ recognition_result = proto.Field( - proto.MESSAGE, number=1, oneof="response", message="StreamingRecognitionResult", + proto.MESSAGE, + number=1, + oneof="response", + message="StreamingRecognitionResult", ) detect_intent_response = proto.Field( - proto.MESSAGE, number=2, oneof="response", message="DetectIntentResponse", + proto.MESSAGE, + number=2, + oneof="response", + message="DetectIntentResponse", ) @@ -373,18 +427,41 @@ class MessageType(proto.Enum): TRANSCRIPT = 1 END_OF_SINGLE_UTTERANCE = 2 - message_type = proto.Field(proto.ENUM, number=1, enum=MessageType,) - transcript = proto.Field(proto.STRING, number=2,) - is_final = proto.Field(proto.BOOL, number=3,) - confidence = proto.Field(proto.FLOAT, number=4,) - stability = proto.Field(proto.FLOAT, number=6,) + message_type = proto.Field( + proto.ENUM, + number=1, + enum=MessageType, + ) + transcript = proto.Field( + proto.STRING, + number=2, + ) + is_final = proto.Field( + proto.BOOL, + number=3, + ) + confidence = proto.Field( + proto.FLOAT, + number=4, + ) + stability = proto.Field( + proto.FLOAT, + number=6, + ) speech_word_info = proto.RepeatedField( - proto.MESSAGE, number=7, message=audio_config.SpeechWordInfo, + proto.MESSAGE, + number=7, + message=audio_config.SpeechWordInfo, ) speech_end_offset = proto.Field( - proto.MESSAGE, number=8, message=duration_pb2.Duration, + proto.MESSAGE, + number=8, + message=duration_pb2.Duration, + ) + language_code = proto.Field( + proto.STRING, + number=10, ) - language_code = proto.Field(proto.STRING, number=10,) class QueryParameters(proto.Message): @@ -435,18 +512,13 @@ class QueryParameters(proto.Message): - MapKey type: string - MapKey value: parameter name - - MapValue type: - - - If parameter's entity type is a composite entity: map - - Else: depending on parameter value type, could be one - of string, number, boolean, null, list or map - - - MapValue value: - - - If parameter's entity type is a composite entity: map - from composite entity property names to property - values - - Else: parameter value + - MapValue type: If parameter's entity type is a composite + entity then use map, otherwise, depending on the + parameter value type, it could be one of string, number, + boolean, null, list or map. + - MapValue value: If parameter's entity type is a composite + entity then use map from composite entity property names + to property values, otherwise, use parameter value. current_page (str): The unique identifier of the [page][google.cloud.dialogflow.cx.v3beta1.Page] to override @@ -470,7 +542,7 @@ class QueryParameters(proto.Message): Configures whether sentiment analysis should be performed. If not provided, sentiment analysis is not performed. - webhook_headers (Sequence[google.cloud.dialogflowcx_v3beta1.types.QueryParameters.WebhookHeadersEntry]): + webhook_headers (Mapping[str, str]): This field can be used to pass HTTP headers for a webhook call. These headers will be sent to webhook along with the headers that have been @@ -494,18 +566,51 @@ class QueryParameters(proto.Message): at most one version specified in this list. """ - time_zone = proto.Field(proto.STRING, number=1,) - geo_location = proto.Field(proto.MESSAGE, number=2, message=latlng_pb2.LatLng,) + time_zone = proto.Field( + proto.STRING, + number=1, + ) + geo_location = proto.Field( + proto.MESSAGE, + number=2, + message=latlng_pb2.LatLng, + ) session_entity_types = proto.RepeatedField( - proto.MESSAGE, number=3, message=session_entity_type.SessionEntityType, + proto.MESSAGE, + number=3, + message=session_entity_type.SessionEntityType, + ) + payload = proto.Field( + proto.MESSAGE, + number=4, + message=struct_pb2.Struct, + ) + parameters = proto.Field( + proto.MESSAGE, + number=5, + message=struct_pb2.Struct, + ) + current_page = proto.Field( + proto.STRING, + number=6, + ) + disable_webhook = proto.Field( + proto.BOOL, + number=7, + ) + analyze_query_text_sentiment = proto.Field( + proto.BOOL, + number=8, + ) + webhook_headers = proto.MapField( + proto.STRING, + proto.STRING, + number=10, + ) + flow_versions = proto.RepeatedField( + proto.STRING, + number=14, ) - payload = proto.Field(proto.MESSAGE, number=4, message=struct_pb2.Struct,) - parameters = proto.Field(proto.MESSAGE, number=5, message=struct_pb2.Struct,) - current_page = proto.Field(proto.STRING, number=6,) - disable_webhook = proto.Field(proto.BOOL, number=7,) - analyze_query_text_sentiment = proto.Field(proto.BOOL, number=8,) - webhook_headers = proto.MapField(proto.STRING, proto.STRING, number=10,) - flow_versions = proto.RepeatedField(proto.STRING, number=14,) class QueryInput(proto.Message): @@ -554,12 +659,40 @@ class QueryInput(proto.Message): specify the same language. """ - text = proto.Field(proto.MESSAGE, number=2, oneof="input", message="TextInput",) - intent = proto.Field(proto.MESSAGE, number=3, oneof="input", message="IntentInput",) - audio = proto.Field(proto.MESSAGE, number=5, oneof="input", message="AudioInput",) - event = proto.Field(proto.MESSAGE, number=6, oneof="input", message="EventInput",) - dtmf = proto.Field(proto.MESSAGE, number=7, oneof="input", message="DtmfInput",) - language_code = proto.Field(proto.STRING, number=4,) + text = proto.Field( + proto.MESSAGE, + number=2, + oneof="input", + message="TextInput", + ) + intent = proto.Field( + proto.MESSAGE, + number=3, + oneof="input", + message="IntentInput", + ) + audio = proto.Field( + proto.MESSAGE, + number=5, + oneof="input", + message="AudioInput", + ) + event = proto.Field( + proto.MESSAGE, + number=6, + oneof="input", + message="EventInput", + ) + dtmf = proto.Field( + proto.MESSAGE, + number=7, + oneof="input", + message="DtmfInput", + ) + language_code = proto.Field( + proto.STRING, + number=4, + ) class QueryResult(proto.Message): @@ -622,18 +755,13 @@ class QueryResult(proto.Message): - MapKey type: string - MapKey value: parameter name - - MapValue type: - - - If parameter's entity type is a composite entity: map - - Else: depending on parameter value type, could be one - of string, number, boolean, null, list or map - - - MapValue value: - - - If parameter's entity type is a composite entity: map - from composite entity property names to property - values - - Else: parameter value + - MapValue type: If parameter's entity type is a composite + entity then use map, otherwise, depending on the + parameter value type, it could be one of string, number, + boolean, null, list or map. + - MapValue value: If parameter's entity type is a composite + entity then use map from composite entity property names + to property values, otherwise, use parameter value. response_messages (Sequence[google.cloud.dialogflowcx_v3beta1.types.ResponseMessage]): The list of rich messages returned to the client. Responses vary from simple text messages @@ -685,29 +813,84 @@ class QueryResult(proto.Message): specified in the request. """ - text = proto.Field(proto.STRING, number=1, oneof="query",) - trigger_intent = proto.Field(proto.STRING, number=11, oneof="query",) - transcript = proto.Field(proto.STRING, number=12, oneof="query",) - trigger_event = proto.Field(proto.STRING, number=14, oneof="query",) - dtmf = proto.Field(proto.MESSAGE, number=23, oneof="query", message="DtmfInput",) - language_code = proto.Field(proto.STRING, number=2,) - parameters = proto.Field(proto.MESSAGE, number=3, message=struct_pb2.Struct,) + text = proto.Field( + proto.STRING, + number=1, + oneof="query", + ) + trigger_intent = proto.Field( + proto.STRING, + number=11, + oneof="query", + ) + transcript = proto.Field( + proto.STRING, + number=12, + oneof="query", + ) + trigger_event = proto.Field( + proto.STRING, + number=14, + oneof="query", + ) + dtmf = proto.Field( + proto.MESSAGE, + number=23, + oneof="query", + message="DtmfInput", + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) + parameters = proto.Field( + proto.MESSAGE, + number=3, + message=struct_pb2.Struct, + ) response_messages = proto.RepeatedField( - proto.MESSAGE, number=4, message=response_message.ResponseMessage, + proto.MESSAGE, + number=4, + message=response_message.ResponseMessage, ) webhook_statuses = proto.RepeatedField( - proto.MESSAGE, number=13, message=status_pb2.Status, + proto.MESSAGE, + number=13, + message=status_pb2.Status, ) webhook_payloads = proto.RepeatedField( - proto.MESSAGE, number=6, message=struct_pb2.Struct, + proto.MESSAGE, + number=6, + message=struct_pb2.Struct, + ) + current_page = proto.Field( + proto.MESSAGE, + number=7, + message=page.Page, + ) + intent = proto.Field( + proto.MESSAGE, + number=8, + message=gcdc_intent.Intent, + ) + intent_detection_confidence = proto.Field( + proto.FLOAT, + number=9, + ) + match = proto.Field( + proto.MESSAGE, + number=15, + message="Match", + ) + diagnostic_info = proto.Field( + proto.MESSAGE, + number=10, + message=struct_pb2.Struct, ) - current_page = proto.Field(proto.MESSAGE, number=7, message=page.Page,) - intent = proto.Field(proto.MESSAGE, number=8, message=gcdc_intent.Intent,) - intent_detection_confidence = proto.Field(proto.FLOAT, number=9,) - match = proto.Field(proto.MESSAGE, number=15, message="Match",) - diagnostic_info = proto.Field(proto.MESSAGE, number=10, message=struct_pb2.Struct,) sentiment_analysis_result = proto.Field( - proto.MESSAGE, number=17, message="SentimentAnalysisResult", + proto.MESSAGE, + number=17, + message="SentimentAnalysisResult", ) @@ -721,7 +904,10 @@ class TextInput(proto.Message): exceed 256 characters. """ - text = proto.Field(proto.STRING, number=1,) + text = proto.Field( + proto.STRING, + number=1, + ) class IntentInput(proto.Message): @@ -734,7 +920,10 @@ class IntentInput(proto.Message): ``projects//locations//agents//intents/``. """ - intent = proto.Field(proto.STRING, number=1,) + intent = proto.Field( + proto.STRING, + number=1, + ) class AudioInput(proto.Message): @@ -758,9 +947,14 @@ class AudioInput(proto.Message): """ config = proto.Field( - proto.MESSAGE, number=1, message=audio_config.InputAudioConfig, + proto.MESSAGE, + number=1, + message=audio_config.InputAudioConfig, + ) + audio = proto.Field( + proto.BYTES, + number=2, ) - audio = proto.Field(proto.BYTES, number=2,) class EventInput(proto.Message): @@ -771,7 +965,10 @@ class EventInput(proto.Message): Name of the event. """ - event = proto.Field(proto.STRING, number=1,) + event = proto.Field( + proto.STRING, + number=1, + ) class DtmfInput(proto.Message): @@ -784,8 +981,14 @@ class DtmfInput(proto.Message): The finish digit (if any). """ - digits = proto.Field(proto.STRING, number=1,) - finish_digit = proto.Field(proto.STRING, number=2,) + digits = proto.Field( + proto.STRING, + number=1, + ) + finish_digit = proto.Field( + proto.STRING, + number=2, + ) class Match(proto.Message): @@ -807,25 +1010,22 @@ class Match(proto.Message): [``NO_INPUT``][google.cloud.dialogflow.cx.v3beta1.Match.MatchType] match types. parameters (google.protobuf.struct_pb2.Struct): - The collection of parameters extracted from - the query. - Depending on your protocol or client library - language, this is a map, associative array, - symbol table, dictionary, or JSON object - composed of a collection of (MapKey, MapValue) + The collection of parameters extracted from the query. + + Depending on your protocol or client library language, this + is a map, associative array, symbol table, dictionary, or + JSON object composed of a collection of (MapKey, MapValue) pairs: - - MapKey type: string - - MapKey value: parameter name - - MapValue type: - - If parameter's entity type is a - composite entity: map - Else: depending on - parameter value type, could be one of string, - number, boolean, null, list or map - - MapValue value: - - If parameter's entity type is a - composite entity: map from composite - entity property names to property values - - Else: parameter value + + - MapKey type: string + - MapKey value: parameter name + - MapValue type: If parameter's entity type is a composite + entity then use map, otherwise, depending on the + parameter value type, it could be one of string, number, + boolean, null, list or map. + - MapValue value: If parameter's entity type is a composite + entity then use map from composite entity property names + to property values, otherwise, use parameter value. resolved_input (str): Final text input which was matched during MatchIntent. This value can be different from @@ -856,12 +1056,33 @@ class MatchType(proto.Enum): NO_INPUT = 5 EVENT = 6 - intent = proto.Field(proto.MESSAGE, number=1, message=gcdc_intent.Intent,) - event = proto.Field(proto.STRING, number=6,) - parameters = proto.Field(proto.MESSAGE, number=2, message=struct_pb2.Struct,) - resolved_input = proto.Field(proto.STRING, number=3,) - match_type = proto.Field(proto.ENUM, number=4, enum=MatchType,) - confidence = proto.Field(proto.FLOAT, number=5,) + intent = proto.Field( + proto.MESSAGE, + number=1, + message=gcdc_intent.Intent, + ) + event = proto.Field( + proto.STRING, + number=6, + ) + parameters = proto.Field( + proto.MESSAGE, + number=2, + message=struct_pb2.Struct, + ) + resolved_input = proto.Field( + proto.STRING, + number=3, + ) + match_type = proto.Field( + proto.ENUM, + number=4, + enum=MatchType, + ) + confidence = proto.Field( + proto.FLOAT, + number=5, + ) class MatchIntentRequest(proto.Message): @@ -888,9 +1109,20 @@ class MatchIntentRequest(proto.Message): Required. The input specification. """ - session = proto.Field(proto.STRING, number=1,) - query_params = proto.Field(proto.MESSAGE, number=2, message="QueryParameters",) - query_input = proto.Field(proto.MESSAGE, number=3, message="QueryInput",) + session = proto.Field( + proto.STRING, + number=1, + ) + query_params = proto.Field( + proto.MESSAGE, + number=2, + message="QueryParameters", + ) + query_input = proto.Field( + proto.MESSAGE, + number=3, + message="QueryInput", + ) class MatchIntentResponse(proto.Message): @@ -942,12 +1174,36 @@ class MatchIntentResponse(proto.Message): but not limited to ``name`` and ``display_name``. """ - text = proto.Field(proto.STRING, number=1, oneof="query",) - trigger_intent = proto.Field(proto.STRING, number=2, oneof="query",) - transcript = proto.Field(proto.STRING, number=3, oneof="query",) - trigger_event = proto.Field(proto.STRING, number=6, oneof="query",) - matches = proto.RepeatedField(proto.MESSAGE, number=4, message="Match",) - current_page = proto.Field(proto.MESSAGE, number=5, message=page.Page,) + text = proto.Field( + proto.STRING, + number=1, + oneof="query", + ) + trigger_intent = proto.Field( + proto.STRING, + number=2, + oneof="query", + ) + transcript = proto.Field( + proto.STRING, + number=3, + oneof="query", + ) + trigger_event = proto.Field( + proto.STRING, + number=6, + oneof="query", + ) + matches = proto.RepeatedField( + proto.MESSAGE, + number=4, + message="Match", + ) + current_page = proto.Field( + proto.MESSAGE, + number=5, + message=page.Page, + ) class FulfillIntentRequest(proto.Message): @@ -965,11 +1221,19 @@ class FulfillIntentRequest(proto.Message): """ match_intent_request = proto.Field( - proto.MESSAGE, number=1, message="MatchIntentRequest", + proto.MESSAGE, + number=1, + message="MatchIntentRequest", + ) + match = proto.Field( + proto.MESSAGE, + number=2, + message="Match", ) - match = proto.Field(proto.MESSAGE, number=2, message="Match",) output_audio_config = proto.Field( - proto.MESSAGE, number=3, message=audio_config.OutputAudioConfig, + proto.MESSAGE, + number=3, + message=audio_config.OutputAudioConfig, ) @@ -1002,11 +1266,23 @@ class FulfillIntentResponse(proto.Message): generate the output audio. """ - response_id = proto.Field(proto.STRING, number=1,) - query_result = proto.Field(proto.MESSAGE, number=2, message="QueryResult",) - output_audio = proto.Field(proto.BYTES, number=3,) + response_id = proto.Field( + proto.STRING, + number=1, + ) + query_result = proto.Field( + proto.MESSAGE, + number=2, + message="QueryResult", + ) + output_audio = proto.Field( + proto.BYTES, + number=3, + ) output_audio_config = proto.Field( - proto.MESSAGE, number=4, message=audio_config.OutputAudioConfig, + proto.MESSAGE, + number=4, + message=audio_config.OutputAudioConfig, ) @@ -1026,8 +1302,14 @@ class SentimentAnalysisResult(proto.Message): of score (positive or negative). """ - score = proto.Field(proto.FLOAT, number=1,) - magnitude = proto.Field(proto.FLOAT, number=2,) + score = proto.Field( + proto.FLOAT, + number=1, + ) + magnitude = proto.Field( + proto.FLOAT, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3beta1/types/session_entity_type.py b/google/cloud/dialogflowcx_v3beta1/types/session_entity_type.py index 7f4a8c1c..e502c9d6 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/session_entity_type.py +++ b/google/cloud/dialogflowcx_v3beta1/types/session_entity_type.py @@ -74,10 +74,19 @@ class EntityOverrideMode(proto.Enum): ENTITY_OVERRIDE_MODE_OVERRIDE = 1 ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2 - name = proto.Field(proto.STRING, number=1,) - entity_override_mode = proto.Field(proto.ENUM, number=3, enum=EntityOverrideMode,) + name = proto.Field( + proto.STRING, + number=1, + ) + entity_override_mode = proto.Field( + proto.ENUM, + number=3, + enum=EntityOverrideMode, + ) entities = proto.RepeatedField( - proto.MESSAGE, number=4, message=entity_type.EntityType.Entity, + proto.MESSAGE, + number=4, + message=entity_type.EntityType.Entity, ) @@ -102,9 +111,18 @@ class ListSessionEntityTypesRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListSessionEntityTypesResponse(proto.Message): @@ -127,9 +145,14 @@ def raw_page(self): return self session_entity_types = proto.RepeatedField( - proto.MESSAGE, number=1, message="SessionEntityType", + proto.MESSAGE, + number=1, + message="SessionEntityType", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class GetSessionEntityTypeRequest(proto.Message): @@ -146,7 +169,10 @@ class GetSessionEntityTypeRequest(proto.Message): 'draft' environment. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateSessionEntityTypeRequest(proto.Message): @@ -166,9 +192,14 @@ class CreateSessionEntityTypeRequest(proto.Message): Required. The session entity type to create. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) session_entity_type = proto.Field( - proto.MESSAGE, number=2, message="SessionEntityType", + proto.MESSAGE, + number=2, + message="SessionEntityType", ) @@ -189,10 +220,14 @@ class UpdateSessionEntityTypeRequest(proto.Message): """ session_entity_type = proto.Field( - proto.MESSAGE, number=1, message="SessionEntityType", + proto.MESSAGE, + number=1, + message="SessionEntityType", ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -211,7 +246,10 @@ class DeleteSessionEntityTypeRequest(proto.Message): 'draft' environment. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3beta1/types/test_case.py b/google/cloud/dialogflowcx_v3beta1/types/test_case.py index 30b4071c..a3472e7b 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/test_case.py +++ b/google/cloud/dialogflowcx_v3beta1/types/test_case.py @@ -110,18 +110,42 @@ class TestCase(proto.Message): The latest test result. """ - name = proto.Field(proto.STRING, number=1,) - tags = proto.RepeatedField(proto.STRING, number=2,) - display_name = proto.Field(proto.STRING, number=3,) - notes = proto.Field(proto.STRING, number=4,) - test_config = proto.Field(proto.MESSAGE, number=13, message="TestConfig",) + name = proto.Field( + proto.STRING, + number=1, + ) + tags = proto.RepeatedField( + proto.STRING, + number=2, + ) + display_name = proto.Field( + proto.STRING, + number=3, + ) + notes = proto.Field( + proto.STRING, + number=4, + ) + test_config = proto.Field( + proto.MESSAGE, + number=13, + message="TestConfig", + ) test_case_conversation_turns = proto.RepeatedField( - proto.MESSAGE, number=5, message="ConversationTurn", + proto.MESSAGE, + number=5, + message="ConversationTurn", ) creation_time = proto.Field( - proto.MESSAGE, number=10, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=10, + message=timestamp_pb2.Timestamp, + ) + last_test_result = proto.Field( + proto.MESSAGE, + number=12, + message="TestCaseResult", ) - last_test_result = proto.Field(proto.MESSAGE, number=12, message="TestCaseResult",) class TestCaseResult(proto.Message): @@ -145,13 +169,29 @@ class TestCaseResult(proto.Message): The time that the test was run. """ - name = proto.Field(proto.STRING, number=1,) - environment = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + environment = proto.Field( + proto.STRING, + number=2, + ) conversation_turns = proto.RepeatedField( - proto.MESSAGE, number=3, message="ConversationTurn", + proto.MESSAGE, + number=3, + message="ConversationTurn", + ) + test_result = proto.Field( + proto.ENUM, + number=4, + enum="TestResult", + ) + test_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, ) - test_result = proto.Field(proto.ENUM, number=4, enum="TestResult",) - test_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) class TestConfig(proto.Message): @@ -182,9 +222,18 @@ class TestConfig(proto.Message): start flow. """ - tracking_parameters = proto.RepeatedField(proto.STRING, number=1,) - flow = proto.Field(proto.STRING, number=2,) - page = proto.Field(proto.STRING, number=3,) + tracking_parameters = proto.RepeatedField( + proto.STRING, + number=1, + ) + flow = proto.Field( + proto.STRING, + number=2, + ) + page = proto.Field( + proto.STRING, + number=3, + ) class ConversationTurn(proto.Message): @@ -222,12 +271,24 @@ class UserInput(proto.Message): Whether sentiment analysis is enabled. """ - input = proto.Field(proto.MESSAGE, number=5, message=session.QueryInput,) + input = proto.Field( + proto.MESSAGE, + number=5, + message=session.QueryInput, + ) injected_parameters = proto.Field( - proto.MESSAGE, number=2, message=struct_pb2.Struct, + proto.MESSAGE, + number=2, + message=struct_pb2.Struct, + ) + is_webhook_enabled = proto.Field( + proto.BOOL, + number=3, + ) + enable_sentiment_analysis = proto.Field( + proto.BOOL, + number=7, ) - is_webhook_enabled = proto.Field(proto.BOOL, number=3,) - enable_sentiment_analysis = proto.Field(proto.BOOL, number=7,) class VirtualAgentOutput(proto.Message): r"""The output from the virtual agent. @@ -264,26 +325,50 @@ class VirtualAgentOutput(proto.Message): """ session_parameters = proto.Field( - proto.MESSAGE, number=4, message=struct_pb2.Struct, + proto.MESSAGE, + number=4, + message=struct_pb2.Struct, ) differences = proto.RepeatedField( - proto.MESSAGE, number=5, message="TestRunDifference", + proto.MESSAGE, + number=5, + message="TestRunDifference", ) diagnostic_info = proto.Field( - proto.MESSAGE, number=6, message=struct_pb2.Struct, + proto.MESSAGE, + number=6, + message=struct_pb2.Struct, ) triggered_intent = proto.Field( - proto.MESSAGE, number=7, message=gcdc_intent.Intent, + proto.MESSAGE, + number=7, + message=gcdc_intent.Intent, + ) + current_page = proto.Field( + proto.MESSAGE, + number=8, + message=gcdc_page.Page, ) - current_page = proto.Field(proto.MESSAGE, number=8, message=gcdc_page.Page,) text_responses = proto.RepeatedField( - proto.MESSAGE, number=9, message=response_message.ResponseMessage.Text, + proto.MESSAGE, + number=9, + message=response_message.ResponseMessage.Text, + ) + status = proto.Field( + proto.MESSAGE, + number=10, + message=status_pb2.Status, ) - status = proto.Field(proto.MESSAGE, number=10, message=status_pb2.Status,) - user_input = proto.Field(proto.MESSAGE, number=1, message=UserInput,) + user_input = proto.Field( + proto.MESSAGE, + number=1, + message=UserInput, + ) virtual_agent_output = proto.Field( - proto.MESSAGE, number=2, message=VirtualAgentOutput, + proto.MESSAGE, + number=2, + message=VirtualAgentOutput, ) @@ -307,8 +392,15 @@ class DiffType(proto.Enum): PARAMETERS = 3 UTTERANCE = 4 - type_ = proto.Field(proto.ENUM, number=1, enum=DiffType,) - description = proto.Field(proto.STRING, number=2,) + type_ = proto.Field( + proto.ENUM, + number=1, + enum=DiffType, + ) + description = proto.Field( + proto.STRING, + number=2, + ) class TransitionCoverage(proto.Message): @@ -351,10 +443,16 @@ class TransitionNode(proto.Message): """ page = proto.Field( - proto.MESSAGE, number=1, oneof="kind", message=gcdc_page.Page, + proto.MESSAGE, + number=1, + oneof="kind", + message=gcdc_page.Page, ) flow = proto.Field( - proto.MESSAGE, number=2, oneof="kind", message=gcdc_flow.Flow, + proto.MESSAGE, + number=2, + oneof="kind", + message=gcdc_flow.Flow, ) class Transition(proto.Message): @@ -389,22 +487,45 @@ class Transition(proto.Message): """ source = proto.Field( - proto.MESSAGE, number=1, message="TransitionCoverage.TransitionNode", + proto.MESSAGE, + number=1, + message="TransitionCoverage.TransitionNode", + ) + index = proto.Field( + proto.INT32, + number=4, ) - index = proto.Field(proto.INT32, number=4,) target = proto.Field( - proto.MESSAGE, number=2, message="TransitionCoverage.TransitionNode", + proto.MESSAGE, + number=2, + message="TransitionCoverage.TransitionNode", + ) + covered = proto.Field( + proto.BOOL, + number=3, ) - covered = proto.Field(proto.BOOL, number=3,) transition_route = proto.Field( - proto.MESSAGE, number=5, oneof="detail", message=gcdc_page.TransitionRoute, + proto.MESSAGE, + number=5, + oneof="detail", + message=gcdc_page.TransitionRoute, ) event_handler = proto.Field( - proto.MESSAGE, number=6, oneof="detail", message=gcdc_page.EventHandler, + proto.MESSAGE, + number=6, + oneof="detail", + message=gcdc_page.EventHandler, ) - transitions = proto.RepeatedField(proto.MESSAGE, number=1, message=Transition,) - coverage_score = proto.Field(proto.FLOAT, number=2,) + transitions = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=Transition, + ) + coverage_score = proto.Field( + proto.FLOAT, + number=2, + ) class TransitionRouteGroupCoverage(proto.Message): @@ -449,9 +570,14 @@ class Transition(proto.Message): """ transition_route = proto.Field( - proto.MESSAGE, number=1, message=gcdc_page.TransitionRoute, + proto.MESSAGE, + number=1, + message=gcdc_page.TransitionRoute, + ) + covered = proto.Field( + proto.BOOL, + number=2, ) - covered = proto.Field(proto.BOOL, number=2,) route_group = proto.Field( proto.MESSAGE, @@ -463,10 +589,20 @@ class Transition(proto.Message): number=2, message="TransitionRouteGroupCoverage.Coverage.Transition", ) - coverage_score = proto.Field(proto.FLOAT, number=3,) + coverage_score = proto.Field( + proto.FLOAT, + number=3, + ) - coverages = proto.RepeatedField(proto.MESSAGE, number=1, message=Coverage,) - coverage_score = proto.Field(proto.FLOAT, number=2,) + coverages = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=Coverage, + ) + coverage_score = proto.Field( + proto.FLOAT, + number=2, + ) class IntentCoverage(proto.Message): @@ -493,11 +629,24 @@ class Intent(proto.Message): least one of the agent's test cases. """ - intent = proto.Field(proto.STRING, number=1,) - covered = proto.Field(proto.BOOL, number=2,) + intent = proto.Field( + proto.STRING, + number=1, + ) + covered = proto.Field( + proto.BOOL, + number=2, + ) - intents = proto.RepeatedField(proto.MESSAGE, number=1, message=Intent,) - coverage_score = proto.Field(proto.FLOAT, number=2,) + intents = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=Intent, + ) + coverage_score = proto.Field( + proto.FLOAT, + number=2, + ) class CalculateCoverageRequest(proto.Message): @@ -519,8 +668,15 @@ class CoverageType(proto.Enum): PAGE_TRANSITION = 2 TRANSITION_ROUTE_GROUP = 3 - agent = proto.Field(proto.STRING, number=3,) - type_ = proto.Field(proto.ENUM, number=2, enum=CoverageType,) + agent = proto.Field( + proto.STRING, + number=3, + ) + type_ = proto.Field( + proto.ENUM, + number=2, + enum=CoverageType, + ) class CalculateCoverageResponse(proto.Message): @@ -553,12 +709,21 @@ class CalculateCoverageResponse(proto.Message): This field is a member of `oneof`_ ``coverage_type``. """ - agent = proto.Field(proto.STRING, number=5,) + agent = proto.Field( + proto.STRING, + number=5, + ) intent_coverage = proto.Field( - proto.MESSAGE, number=2, oneof="coverage_type", message="IntentCoverage", + proto.MESSAGE, + number=2, + oneof="coverage_type", + message="IntentCoverage", ) transition_coverage = proto.Field( - proto.MESSAGE, number=4, oneof="coverage_type", message="TransitionCoverage", + proto.MESSAGE, + number=4, + oneof="coverage_type", + message="TransitionCoverage", ) route_group_coverage = proto.Field( proto.MESSAGE, @@ -598,10 +763,23 @@ class TestCaseView(proto.Enum): BASIC = 1 FULL = 2 - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - view = proto.Field(proto.ENUM, number=4, enum=TestCaseView,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + view = proto.Field( + proto.ENUM, + number=4, + enum=TestCaseView, + ) class ListTestCasesResponse(proto.Message): @@ -622,8 +800,15 @@ class ListTestCasesResponse(proto.Message): def raw_page(self): return self - test_cases = proto.RepeatedField(proto.MESSAGE, number=1, message="TestCase",) - next_page_token = proto.Field(proto.STRING, number=2,) + test_cases = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="TestCase", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class BatchDeleteTestCasesRequest(proto.Message): @@ -639,8 +824,14 @@ class BatchDeleteTestCasesRequest(proto.Message): ``projects//locations/ /agents//testCases/``. """ - parent = proto.Field(proto.STRING, number=1,) - names = proto.RepeatedField(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + names = proto.RepeatedField( + proto.STRING, + number=3, + ) class CreateTestCaseRequest(proto.Message): @@ -655,8 +846,15 @@ class CreateTestCaseRequest(proto.Message): Required. The test case to create. """ - parent = proto.Field(proto.STRING, number=1,) - test_case = proto.Field(proto.MESSAGE, number=2, message="TestCase",) + parent = proto.Field( + proto.STRING, + number=1, + ) + test_case = proto.Field( + proto.MESSAGE, + number=2, + message="TestCase", + ) class UpdateTestCaseRequest(proto.Message): @@ -675,9 +873,15 @@ class UpdateTestCaseRequest(proto.Message): cannot be updated. """ - test_case = proto.Field(proto.MESSAGE, number=1, message="TestCase",) + test_case = proto.Field( + proto.MESSAGE, + number=1, + message="TestCase", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -691,7 +895,10 @@ class GetTestCaseRequest(proto.Message): ``projects//locations//agents//testCases/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class RunTestCaseRequest(proto.Message): @@ -708,8 +915,14 @@ class RunTestCaseRequest(proto.Message): ``projects//locations//agents//environments/``. """ - name = proto.Field(proto.STRING, number=1,) - environment = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + environment = proto.Field( + proto.STRING, + number=2, + ) class RunTestCaseResponse(proto.Message): @@ -721,7 +934,11 @@ class RunTestCaseResponse(proto.Message): The result. """ - result = proto.Field(proto.MESSAGE, number=2, message="TestCaseResult",) + result = proto.Field( + proto.MESSAGE, + number=2, + message="TestCaseResult", + ) class RunTestCaseMetadata(proto.Message): @@ -748,9 +965,18 @@ class BatchRunTestCasesRequest(proto.Message): ``projects//locations//agents//testCases/``. """ - parent = proto.Field(proto.STRING, number=1,) - environment = proto.Field(proto.STRING, number=2,) - test_cases = proto.RepeatedField(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + environment = proto.Field( + proto.STRING, + number=2, + ) + test_cases = proto.RepeatedField( + proto.STRING, + number=3, + ) class BatchRunTestCasesResponse(proto.Message): @@ -764,7 +990,11 @@ class BatchRunTestCasesResponse(proto.Message): are empty in this response. """ - results = proto.RepeatedField(proto.MESSAGE, number=1, message="TestCaseResult",) + results = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="TestCaseResult", + ) class BatchRunTestCasesMetadata(proto.Message): @@ -777,7 +1007,11 @@ class BatchRunTestCasesMetadata(proto.Message): The test errors. """ - errors = proto.RepeatedField(proto.MESSAGE, number=1, message="TestError",) + errors = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="TestError", + ) class TestError(proto.Message): @@ -792,9 +1026,20 @@ class TestError(proto.Message): The timestamp when the test was completed. """ - test_case = proto.Field(proto.STRING, number=1,) - status = proto.Field(proto.MESSAGE, number=2, message=status_pb2.Status,) - test_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) + test_case = proto.Field( + proto.STRING, + number=1, + ) + status = proto.Field( + proto.MESSAGE, + number=2, + message=status_pb2.Status, + ) + test_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) class ImportTestCasesRequest(proto.Message): @@ -818,6 +1063,12 @@ class ImportTestCasesRequest(proto.Message): import test cases from. The format of this URI must be ``gs:///``. + Dialogflow performs a read operation for the Cloud Storage + object on the caller's behalf, so your request + authentication must have read permissions for the object. + For more information, see `Dialogflow access + control `__. + This field is a member of `oneof`_ ``source``. content (bytes): Uncompressed raw byte content for test cases. @@ -825,9 +1076,20 @@ class ImportTestCasesRequest(proto.Message): This field is a member of `oneof`_ ``source``. """ - parent = proto.Field(proto.STRING, number=1,) - gcs_uri = proto.Field(proto.STRING, number=2, oneof="source",) - content = proto.Field(proto.BYTES, number=3, oneof="source",) + parent = proto.Field( + proto.STRING, + number=1, + ) + gcs_uri = proto.Field( + proto.STRING, + number=2, + oneof="source", + ) + content = proto.Field( + proto.BYTES, + number=3, + oneof="source", + ) class ImportTestCasesResponse(proto.Message): @@ -840,7 +1102,10 @@ class ImportTestCasesResponse(proto.Message): ``projects//locations//agents//testCases/``. """ - names = proto.RepeatedField(proto.STRING, number=1,) + names = proto.RepeatedField( + proto.STRING, + number=1, + ) class ImportTestCasesMetadata(proto.Message): @@ -853,7 +1118,11 @@ class ImportTestCasesMetadata(proto.Message): Errors for failed test cases. """ - errors = proto.RepeatedField(proto.MESSAGE, number=1, message="TestCaseError",) + errors = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="TestCaseError", + ) class TestCaseError(proto.Message): @@ -866,8 +1135,16 @@ class TestCaseError(proto.Message): The status associated with the test case. """ - test_case = proto.Field(proto.MESSAGE, number=1, message="TestCase",) - status = proto.Field(proto.MESSAGE, number=2, message=status_pb2.Status,) + test_case = proto.Field( + proto.MESSAGE, + number=1, + message="TestCase", + ) + status = proto.Field( + proto.MESSAGE, + number=2, + message=status_pb2.Status, + ) class ExportTestCasesRequest(proto.Message): @@ -888,6 +1165,12 @@ class ExportTestCasesRequest(proto.Message): ``gs:///``. If unspecified, the serialized test cases is returned inline. + Dialogflow performs a write operation for the Cloud Storage + object on the caller's behalf, so your request + authentication must have write permissions for the object. + For more information, see `Dialogflow access + control `__. + This field is a member of `oneof`_ ``destination``. data_format (google.cloud.dialogflowcx_v3beta1.types.ExportTestCasesRequest.DataFormat): The data format of the exported test cases. If not @@ -911,10 +1194,24 @@ class DataFormat(proto.Enum): BLOB = 1 JSON = 2 - parent = proto.Field(proto.STRING, number=1,) - gcs_uri = proto.Field(proto.STRING, number=2, oneof="destination",) - data_format = proto.Field(proto.ENUM, number=3, enum=DataFormat,) - filter = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + gcs_uri = proto.Field( + proto.STRING, + number=2, + oneof="destination", + ) + data_format = proto.Field( + proto.ENUM, + number=3, + enum=DataFormat, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) class ExportTestCasesResponse(proto.Message): @@ -941,8 +1238,16 @@ class ExportTestCasesResponse(proto.Message): This field is a member of `oneof`_ ``destination``. """ - gcs_uri = proto.Field(proto.STRING, number=1, oneof="destination",) - content = proto.Field(proto.BYTES, number=2, oneof="destination",) + gcs_uri = proto.Field( + proto.STRING, + number=1, + oneof="destination", + ) + content = proto.Field( + proto.BYTES, + number=2, + oneof="destination", + ) class ExportTestCasesMetadata(proto.Message): @@ -997,10 +1302,22 @@ class ListTestCaseResultsRequest(proto.Message): 1602540713. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - filter = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + filter = proto.Field( + proto.STRING, + number=4, + ) class ListTestCaseResultsResponse(proto.Message): @@ -1021,9 +1338,14 @@ def raw_page(self): return self test_case_results = proto.RepeatedField( - proto.MESSAGE, number=1, message="TestCaseResult", + proto.MESSAGE, + number=1, + message="TestCaseResult", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class GetTestCaseResultRequest(proto.Message): @@ -1036,7 +1358,10 @@ class GetTestCaseResultRequest(proto.Message): ``projects//locations//agents//testCases//results/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3beta1/types/transition_route_group.py b/google/cloud/dialogflowcx_v3beta1/types/transition_route_group.py index 91d5de03..fdbd7fcc 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/transition_route_group.py +++ b/google/cloud/dialogflowcx_v3beta1/types/transition_route_group.py @@ -45,19 +45,27 @@ class TransitionRouteGroup(proto.Message): populates the name automatically. Format: ``projects//locations//agents//flows//transitionRouteGroups/``. display_name (str): - Required. The human-readable name of the transition route - group, unique within the - [Agent][google.cloud.dialogflow.cx.v3beta1.Agent]. The - display name can be no longer than 30 characters. + Required. The human-readable name of the + transition route group, unique within the flow. + The display name can be no longer than 30 + characters. transition_routes (Sequence[google.cloud.dialogflowcx_v3beta1.types.TransitionRoute]): Transition routes associated with the [TransitionRouteGroup][google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup]. """ - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) transition_routes = proto.RepeatedField( - proto.MESSAGE, number=5, message=page.TransitionRoute, + proto.MESSAGE, + number=5, + message=page.TransitionRoute, ) @@ -92,10 +100,22 @@ class ListTransitionRouteGroupsRequest(proto.Message): before they can be used. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) - language_code = proto.Field(proto.STRING, number=4,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) + language_code = proto.Field( + proto.STRING, + number=4, + ) class ListTransitionRouteGroupsResponse(proto.Message): @@ -120,9 +140,14 @@ def raw_page(self): return self transition_route_groups = proto.RepeatedField( - proto.MESSAGE, number=1, message="TransitionRouteGroup", + proto.MESSAGE, + number=1, + message="TransitionRouteGroup", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class GetTransitionRouteGroupRequest(proto.Message): @@ -151,8 +176,14 @@ class GetTransitionRouteGroupRequest(proto.Message): before they can be used. """ - name = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) class CreateTransitionRouteGroupRequest(proto.Message): @@ -184,11 +215,19 @@ class CreateTransitionRouteGroupRequest(proto.Message): before they can be used. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) transition_route_group = proto.Field( - proto.MESSAGE, number=2, message="TransitionRouteGroup", + proto.MESSAGE, + number=2, + message="TransitionRouteGroup", + ) + language_code = proto.Field( + proto.STRING, + number=3, ) - language_code = proto.Field(proto.STRING, number=3,) class UpdateTransitionRouteGroupRequest(proto.Message): @@ -218,12 +257,19 @@ class UpdateTransitionRouteGroupRequest(proto.Message): """ transition_route_group = proto.Field( - proto.MESSAGE, number=1, message="TransitionRouteGroup", + proto.MESSAGE, + number=1, + message="TransitionRouteGroup", ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + language_code = proto.Field( + proto.STRING, + number=3, ) - language_code = proto.Field(proto.STRING, number=3,) class DeleteTransitionRouteGroupRequest(proto.Message): @@ -248,8 +294,14 @@ class DeleteTransitionRouteGroupRequest(proto.Message): transition route group, as well as any reference to it. """ - name = proto.Field(proto.STRING, number=1,) - force = proto.Field(proto.BOOL, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + force = proto.Field( + proto.BOOL, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3beta1/types/validation_message.py b/google/cloud/dialogflowcx_v3beta1/types/validation_message.py index 3a864804..1f579ac6 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/validation_message.py +++ b/google/cloud/dialogflowcx_v3beta1/types/validation_message.py @@ -18,7 +18,10 @@ __protobuf__ = proto.module( package="google.cloud.dialogflow.cx.v3beta1", - manifest={"ValidationMessage", "ResourceName",}, + manifest={ + "ValidationMessage", + "ResourceName", + }, ) @@ -65,13 +68,29 @@ class Severity(proto.Enum): WARNING = 2 ERROR = 3 - resource_type = proto.Field(proto.ENUM, number=1, enum=ResourceType,) - resources = proto.RepeatedField(proto.STRING, number=2,) + resource_type = proto.Field( + proto.ENUM, + number=1, + enum=ResourceType, + ) + resources = proto.RepeatedField( + proto.STRING, + number=2, + ) resource_names = proto.RepeatedField( - proto.MESSAGE, number=6, message="ResourceName", + proto.MESSAGE, + number=6, + message="ResourceName", + ) + severity = proto.Field( + proto.ENUM, + number=3, + enum=Severity, + ) + detail = proto.Field( + proto.STRING, + number=4, ) - severity = proto.Field(proto.ENUM, number=3, enum=Severity,) - detail = proto.Field(proto.STRING, number=4,) class ResourceName(proto.Message): @@ -84,8 +103,14 @@ class ResourceName(proto.Message): Display name. """ - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dialogflowcx_v3beta1/types/version.py b/google/cloud/dialogflowcx_v3beta1/types/version.py index 54257b02..415b9b2b 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/version.py +++ b/google/cloud/dialogflowcx_v3beta1/types/version.py @@ -48,7 +48,10 @@ class CreateVersionOperationMetadata(proto.Message): ``projects//locations//agents//flows//versions/``. """ - version = proto.Field(proto.STRING, number=1,) + version = proto.Field( + proto.STRING, + number=1, + ) class Version(proto.Message): @@ -86,12 +89,33 @@ class State(proto.Enum): SUCCEEDED = 2 FAILED = 3 - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) - nlu_settings = proto.Field(proto.MESSAGE, number=4, message=flow.NluSettings,) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - state = proto.Field(proto.ENUM, number=6, enum=State,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + nlu_settings = proto.Field( + proto.MESSAGE, + number=4, + message=flow.NluSettings, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + state = proto.Field( + proto.ENUM, + number=6, + enum=State, + ) class ListVersionsRequest(proto.Message): @@ -112,9 +136,18 @@ class ListVersionsRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListVersionsResponse(proto.Message): @@ -137,8 +170,15 @@ class ListVersionsResponse(proto.Message): def raw_page(self): return self - versions = proto.RepeatedField(proto.MESSAGE, number=1, message="Version",) - next_page_token = proto.Field(proto.STRING, number=2,) + versions = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Version", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetVersionRequest(proto.Message): @@ -153,7 +193,10 @@ class GetVersionRequest(proto.Message): ``projects//locations//agents//flows//versions/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateVersionRequest(proto.Message): @@ -171,8 +214,15 @@ class CreateVersionRequest(proto.Message): Required. The version to create. """ - parent = proto.Field(proto.STRING, number=1,) - version = proto.Field(proto.MESSAGE, number=2, message="Version",) + parent = proto.Field( + proto.STRING, + number=1, + ) + version = proto.Field( + proto.MESSAGE, + number=2, + message="Version", + ) class UpdateVersionRequest(proto.Message): @@ -188,9 +238,15 @@ class UpdateVersionRequest(proto.Message): updated. """ - version = proto.Field(proto.MESSAGE, number=1, message="Version",) + version = proto.Field( + proto.MESSAGE, + number=1, + message="Version", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -206,7 +262,10 @@ class DeleteVersionRequest(proto.Message): ``projects//locations//agents//flows//versions/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class LoadVersionRequest(proto.Message): @@ -227,8 +286,14 @@ class LoadVersionRequest(proto.Message): (i.e. intents, entities, webhooks). """ - name = proto.Field(proto.STRING, number=1,) - allow_override_agent_resources = proto.Field(proto.BOOL, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + allow_override_agent_resources = proto.Field( + proto.BOOL, + number=2, + ) class CompareVersionsRequest(proto.Message): @@ -258,9 +323,18 @@ class CompareVersionsRequest(proto.Message): before they can be used. """ - base_version = proto.Field(proto.STRING, number=1,) - target_version = proto.Field(proto.STRING, number=2,) - language_code = proto.Field(proto.STRING, number=3,) + base_version = proto.Field( + proto.STRING, + number=1, + ) + target_version = proto.Field( + proto.STRING, + number=2, + ) + language_code = proto.Field( + proto.STRING, + number=3, + ) class CompareVersionsResponse(proto.Message): @@ -278,10 +352,18 @@ class CompareVersionsResponse(proto.Message): The timestamp when the two version compares. """ - base_version_content_json = proto.Field(proto.STRING, number=1,) - target_version_content_json = proto.Field(proto.STRING, number=2,) + base_version_content_json = proto.Field( + proto.STRING, + number=1, + ) + target_version_content_json = proto.Field( + proto.STRING, + number=2, + ) compare_time = proto.Field( - proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, ) diff --git a/google/cloud/dialogflowcx_v3beta1/types/webhook.py b/google/cloud/dialogflowcx_v3beta1/types/webhook.py index 3fe876d4..33b0f5d5 100644 --- a/google/cloud/dialogflowcx_v3beta1/types/webhook.py +++ b/google/cloud/dialogflowcx_v3beta1/types/webhook.py @@ -95,33 +95,47 @@ class GenericWebService(proto.Message): The user name for HTTP Basic authentication. password (str): The password for HTTP Basic authentication. - request_headers (Sequence[google.cloud.dialogflowcx_v3beta1.types.Webhook.GenericWebService.RequestHeadersEntry]): + request_headers (Mapping[str, str]): The HTTP request headers to send together with webhook requests. allowed_ca_certs (Sequence[bytes]): - Optional. Specifies a list of allowed custom - CA certificates (in DER format) for HTTPS - verification. This overrides the default SSL - trust store. If this is empty or unspecified, - Dialogflow will use Google's default trust store - to verify certificates. - N.B. Make sure the HTTPS server certificates are - signed with "subject alt name". For instance a - certificate can be self-signed using the - following command, - openssl x509 -req -days 200 -in - example.com.csr \ -signkey example.com.key - \ - -out example.com.crt \ - -extfile <(printf - "\nsubjectAltName='DNS:www.example.com'") + Optional. Specifies a list of allowed custom CA certificates + (in DER format) for HTTPS verification. This overrides the + default SSL trust store. If this is empty or unspecified, + Dialogflow will use Google's default trust store to verify + certificates. N.B. Make sure the HTTPS server certificates + are signed with "subject alt name". For instance a + certificate can be self-signed using the following command, + + :: + + openssl x509 -req -days 200 -in example.com.csr \ + -signkey example.com.key \ + -out example.com.crt \ + -extfile <(printf "\nsubjectAltName='DNS:www.example.com'") """ - uri = proto.Field(proto.STRING, number=1,) - username = proto.Field(proto.STRING, number=2,) - password = proto.Field(proto.STRING, number=3,) - request_headers = proto.MapField(proto.STRING, proto.STRING, number=4,) - allowed_ca_certs = proto.RepeatedField(proto.BYTES, number=5,) + uri = proto.Field( + proto.STRING, + number=1, + ) + username = proto.Field( + proto.STRING, + number=2, + ) + password = proto.Field( + proto.STRING, + number=3, + ) + request_headers = proto.MapField( + proto.STRING, + proto.STRING, + number=4, + ) + allowed_ca_certs = proto.RepeatedField( + proto.BYTES, + number=5, + ) class ServiceDirectoryConfig(proto.Message): r"""Represents configuration for a `Service @@ -140,21 +154,45 @@ class ServiceDirectoryConfig(proto.Message): webhook. """ - service = proto.Field(proto.STRING, number=1,) + service = proto.Field( + proto.STRING, + number=1, + ) generic_web_service = proto.Field( - proto.MESSAGE, number=2, message="Webhook.GenericWebService", + proto.MESSAGE, + number=2, + message="Webhook.GenericWebService", ) - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) generic_web_service = proto.Field( - proto.MESSAGE, number=4, oneof="webhook", message=GenericWebService, + proto.MESSAGE, + number=4, + oneof="webhook", + message=GenericWebService, ) service_directory = proto.Field( - proto.MESSAGE, number=7, oneof="webhook", message=ServiceDirectoryConfig, + proto.MESSAGE, + number=7, + oneof="webhook", + message=ServiceDirectoryConfig, + ) + timeout = proto.Field( + proto.MESSAGE, + number=6, + message=duration_pb2.Duration, + ) + disabled = proto.Field( + proto.BOOL, + number=5, ) - timeout = proto.Field(proto.MESSAGE, number=6, message=duration_pb2.Duration,) - disabled = proto.Field(proto.BOOL, number=5,) class ListWebhooksRequest(proto.Message): @@ -173,9 +211,18 @@ class ListWebhooksRequest(proto.Message): request. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListWebhooksResponse(proto.Message): @@ -196,8 +243,15 @@ class ListWebhooksResponse(proto.Message): def raw_page(self): return self - webhooks = proto.RepeatedField(proto.MESSAGE, number=1, message="Webhook",) - next_page_token = proto.Field(proto.STRING, number=2,) + webhooks = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Webhook", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetWebhookRequest(proto.Message): @@ -210,7 +264,10 @@ class GetWebhookRequest(proto.Message): ``projects//locations//agents//webhooks/``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateWebhookRequest(proto.Message): @@ -225,8 +282,15 @@ class CreateWebhookRequest(proto.Message): Required. The webhook to create. """ - parent = proto.Field(proto.STRING, number=1,) - webhook = proto.Field(proto.MESSAGE, number=2, message="Webhook",) + parent = proto.Field( + proto.STRING, + number=1, + ) + webhook = proto.Field( + proto.MESSAGE, + number=2, + message="Webhook", + ) class UpdateWebhookRequest(proto.Message): @@ -242,9 +306,15 @@ class UpdateWebhookRequest(proto.Message): updated. """ - webhook = proto.Field(proto.MESSAGE, number=1, message="Webhook",) + webhook = proto.Field( + proto.MESSAGE, + number=1, + message="Webhook", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -271,8 +341,14 @@ class DeleteWebhookRequest(proto.Message): fulfillments that point to this webhook will be removed). """ - name = proto.Field(proto.STRING, number=1,) - force = proto.Field(proto.BOOL, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + force = proto.Field( + proto.BOOL, + number=2, + ) class WebhookRequest(proto.Message): @@ -352,11 +428,18 @@ class FulfillmentInfo(proto.Message): Attributes: tag (str): - Always present. The tag used to identify - which fulfillment is being called. + Always present. The value of the + [Fulfillment.tag][google.cloud.dialogflow.cx.v3beta1.Fulfillment.tag] + field will be populated in this field by Dialogflow when the + associated webhook is called. The tag is typically used by + the webhook service to identify which fulfillment is being + called, but it could be used for other purposes. """ - tag = proto.Field(proto.STRING, number=1,) + tag = proto.Field( + proto.STRING, + number=1, + ) class IntentInfo(proto.Message): r"""Represents intent information communicated to the webhook. @@ -369,7 +452,7 @@ class IntentInfo(proto.Message): display_name (str): Always present. The display name of the last matched [intent][google.cloud.dialogflow.cx.v3beta1.Intent]. - parameters (Sequence[google.cloud.dialogflowcx_v3beta1.types.WebhookRequest.IntentInfo.ParametersEntry]): + parameters (Mapping[str, google.cloud.dialogflowcx_v3beta1.types.WebhookRequest.IntentInfo.IntentParameterValue]): Parameters identified as a result of intent matching. This is a map of the name of the identified parameter to the value of the @@ -394,20 +477,34 @@ class IntentParameterValue(proto.Message): parameter extracted from user utterance. """ - original_value = proto.Field(proto.STRING, number=1,) + original_value = proto.Field( + proto.STRING, + number=1, + ) resolved_value = proto.Field( - proto.MESSAGE, number=2, message=struct_pb2.Value, + proto.MESSAGE, + number=2, + message=struct_pb2.Value, ) - last_matched_intent = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=3,) + last_matched_intent = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=3, + ) parameters = proto.MapField( proto.STRING, proto.MESSAGE, number=2, message="WebhookRequest.IntentInfo.IntentParameterValue", ) - confidence = proto.Field(proto.FLOAT, number=4,) + confidence = proto.Field( + proto.FLOAT, + number=4, + ) class SentimentAnalysisResult(proto.Message): r"""Represents the result of sentiment analysis. @@ -422,25 +519,77 @@ class SentimentAnalysisResult(proto.Message): of score (positive or negative). """ - score = proto.Field(proto.FLOAT, number=1,) - magnitude = proto.Field(proto.FLOAT, number=2,) - - detect_intent_response_id = proto.Field(proto.STRING, number=1,) - text = proto.Field(proto.STRING, number=10, oneof="query",) - trigger_intent = proto.Field(proto.STRING, number=11, oneof="query",) - transcript = proto.Field(proto.STRING, number=12, oneof="query",) - trigger_event = proto.Field(proto.STRING, number=14, oneof="query",) - language_code = proto.Field(proto.STRING, number=15,) - fulfillment_info = proto.Field(proto.MESSAGE, number=6, message=FulfillmentInfo,) - intent_info = proto.Field(proto.MESSAGE, number=3, message=IntentInfo,) - page_info = proto.Field(proto.MESSAGE, number=4, message="PageInfo",) - session_info = proto.Field(proto.MESSAGE, number=5, message="SessionInfo",) + score = proto.Field( + proto.FLOAT, + number=1, + ) + magnitude = proto.Field( + proto.FLOAT, + number=2, + ) + + detect_intent_response_id = proto.Field( + proto.STRING, + number=1, + ) + text = proto.Field( + proto.STRING, + number=10, + oneof="query", + ) + trigger_intent = proto.Field( + proto.STRING, + number=11, + oneof="query", + ) + transcript = proto.Field( + proto.STRING, + number=12, + oneof="query", + ) + trigger_event = proto.Field( + proto.STRING, + number=14, + oneof="query", + ) + language_code = proto.Field( + proto.STRING, + number=15, + ) + fulfillment_info = proto.Field( + proto.MESSAGE, + number=6, + message=FulfillmentInfo, + ) + intent_info = proto.Field( + proto.MESSAGE, + number=3, + message=IntentInfo, + ) + page_info = proto.Field( + proto.MESSAGE, + number=4, + message="PageInfo", + ) + session_info = proto.Field( + proto.MESSAGE, + number=5, + message="SessionInfo", + ) messages = proto.RepeatedField( - proto.MESSAGE, number=7, message=response_message.ResponseMessage, + proto.MESSAGE, + number=7, + message=response_message.ResponseMessage, + ) + payload = proto.Field( + proto.MESSAGE, + number=8, + message=struct_pb2.Struct, ) - payload = proto.Field(proto.MESSAGE, number=8, message=struct_pb2.Struct,) sentiment_analysis_result = proto.Field( - proto.MESSAGE, number=9, message=SentimentAnalysisResult, + proto.MESSAGE, + number=9, + message=SentimentAnalysisResult, ) @@ -501,7 +650,9 @@ class MergeBehavior(proto.Enum): REPLACE = 2 messages = proto.RepeatedField( - proto.MESSAGE, number=1, message=response_message.ResponseMessage, + proto.MESSAGE, + number=1, + message=response_message.ResponseMessage, ) merge_behavior = proto.Field( proto.ENUM, @@ -510,13 +661,35 @@ class MergeBehavior(proto.Enum): ) fulfillment_response = proto.Field( - proto.MESSAGE, number=1, message=FulfillmentResponse, + proto.MESSAGE, + number=1, + message=FulfillmentResponse, + ) + page_info = proto.Field( + proto.MESSAGE, + number=2, + message="PageInfo", + ) + session_info = proto.Field( + proto.MESSAGE, + number=3, + message="SessionInfo", + ) + payload = proto.Field( + proto.MESSAGE, + number=4, + message=struct_pb2.Struct, + ) + target_page = proto.Field( + proto.STRING, + number=5, + oneof="transition", + ) + target_flow = proto.Field( + proto.STRING, + number=6, + oneof="transition", ) - page_info = proto.Field(proto.MESSAGE, number=2, message="PageInfo",) - session_info = proto.Field(proto.MESSAGE, number=3, message="SessionInfo",) - payload = proto.Field(proto.MESSAGE, number=4, message=struct_pb2.Struct,) - target_page = proto.Field(proto.STRING, number=5, oneof="transition",) - target_flow = proto.Field(proto.STRING, number=6, oneof="transition",) class PageInfo(proto.Message): @@ -610,23 +783,48 @@ class ParameterState(proto.Enum): INVALID = 2 FILLED = 3 - display_name = proto.Field(proto.STRING, number=1,) - required = proto.Field(proto.BOOL, number=2,) + display_name = proto.Field( + proto.STRING, + number=1, + ) + required = proto.Field( + proto.BOOL, + number=2, + ) state = proto.Field( proto.ENUM, number=3, enum="PageInfo.FormInfo.ParameterInfo.ParameterState", ) - value = proto.Field(proto.MESSAGE, number=4, message=struct_pb2.Value,) - just_collected = proto.Field(proto.BOOL, number=5,) + value = proto.Field( + proto.MESSAGE, + number=4, + message=struct_pb2.Value, + ) + just_collected = proto.Field( + proto.BOOL, + number=5, + ) parameter_info = proto.RepeatedField( - proto.MESSAGE, number=2, message="PageInfo.FormInfo.ParameterInfo", + proto.MESSAGE, + number=2, + message="PageInfo.FormInfo.ParameterInfo", ) - current_page = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=4,) - form_info = proto.Field(proto.MESSAGE, number=3, message=FormInfo,) + current_page = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=4, + ) + form_info = proto.Field( + proto.MESSAGE, + number=3, + message=FormInfo, + ) class SessionInfo(proto.Message): @@ -647,7 +845,7 @@ class SessionInfo(proto.Message): or ``projects//locations//agents//environments//sessions/`` if environment is specified. - parameters (Sequence[google.cloud.dialogflowcx_v3beta1.types.SessionInfo.ParametersEntry]): + parameters (Mapping[str, google.protobuf.struct_pb2.Value]): Optional for [WebhookRequest][google.cloud.dialogflow.cx.v3beta1.WebhookRequest]. Optional for @@ -660,9 +858,15 @@ class SessionInfo(proto.Message): The map is keyed by parameters' display names. """ - session = proto.Field(proto.STRING, number=1,) + session = proto.Field( + proto.STRING, + number=1, + ) parameters = proto.MapField( - proto.STRING, proto.MESSAGE, number=2, message=struct_pb2.Value, + proto.STRING, + proto.MESSAGE, + number=2, + message=struct_pb2.Value, ) diff --git a/noxfile.py b/noxfile.py index 55cc38be..7407a8c2 100644 --- a/noxfile.py +++ b/noxfile.py @@ -20,16 +20,41 @@ import os import pathlib import shutil +import warnings import nox - -BLACK_VERSION = "black==19.10b0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" +LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] + UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", +] +UNIT_TEST_EXTERNAL_DEPENDENCIES = [] +UNIT_TEST_LOCAL_DEPENDENCIES = [] +UNIT_TEST_DEPENDENCIES = [] +UNIT_TEST_EXTRAS = [] +UNIT_TEST_EXTRAS_BY_PYTHON = {} + +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +SYSTEM_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "pytest", + "google-cloud-testutils", +] +SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [] +SYSTEM_TEST_LOCAL_DEPENDENCIES = [] +SYSTEM_TEST_DEPENDENCIES = [] +SYSTEM_TEST_EXTRAS = [] +SYSTEM_TEST_EXTRAS_BY_PYTHON = {} CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -57,7 +82,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +94,28 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *LINT_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def format(session): + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run( + "isort", + "--fss", + *LINT_PATHS, + ) + session.run( + "black", + *LINT_PATHS, ) @@ -78,23 +126,41 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") +def install_unittest_dependencies(session, *constraints): + standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES + session.install(*standard_deps, *constraints) + + if UNIT_TEST_EXTERNAL_DEPENDENCIES: + warnings.warn( + "'unit_test_external_dependencies' is deprecated. Instead, please " + "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + DeprecationWarning, + ) + session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_LOCAL_DEPENDENCIES: + session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_EXTRAS_BY_PYTHON: + extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif UNIT_TEST_EXTRAS: + extras = UNIT_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + def default(session): # Install all test dependencies, then install this package in-place. constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - session.install("-e", ".", "-c", constraints_path) + install_unittest_dependencies(session, "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -118,6 +184,35 @@ def unit(session): default(session) +def install_systemtest_dependencies(session, *constraints): + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: + session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_LOCAL_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTRAS_BY_PYTHON: + extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif SYSTEM_TEST_EXTRAS: + extras = SYSTEM_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" @@ -140,13 +235,7 @@ def system(session): if not system_test_exists and not system_test_folder_exists: session.skip("System tests were not found") - # Use pre-release gRPC for system tests. - session.install("--pre", "grpcio") - - # Install all test dependencies, then install this package into the - # virtualenv's dist-packages. - session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) - session.install("-e", ".", "-c", constraints_path) + install_systemtest_dependencies(session, "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: diff --git a/owlbot.py b/owlbot.py index 388c8f89..d2aa450f 100644 --- a/owlbot.py +++ b/owlbot.py @@ -46,6 +46,8 @@ python.py_samples(skip_readmes=True) +python.configure_previous_major_version_branches() + # ---------------------------------------------------------------------------- # Run blacken session # ---------------------------------------------------------------------------- diff --git a/samples/generated_samples/snippet_metadata_dialogflowcx_v3.json b/samples/generated_samples/snippet_metadata_dialogflowcx_v3.json index 4219b511..3767a1c6 100644 --- a/samples/generated_samples/snippet_metadata_dialogflowcx_v3.json +++ b/samples/generated_samples/snippet_metadata_dialogflowcx_v3.json @@ -1,16 +1,65 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.dialogflow.cx.v3", + "version": "v3" + } + ], + "language": "PYTHON", + "name": "google-cloud-dialogflowcx" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient.create_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.CreateAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "CreateAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateAgentRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "agent", + "type": "google.cloud.dialogflowcx_v3.types.Agent" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Agent", + "shortName": "create_agent" }, + "description": "Sample for CreateAgent", "file": "dialogflow_v3_generated_agents_create_agent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_CreateAgent_async", "segments": [ { @@ -43,18 +92,58 @@ "start": 48, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_create_agent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient.create_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.CreateAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "CreateAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateAgentRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "agent", + "type": "google.cloud.dialogflowcx_v3.types.Agent" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Agent", + "shortName": "create_agent" }, + "description": "Sample for CreateAgent", "file": "dialogflow_v3_generated_agents_create_agent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_CreateAgent_sync", "segments": [ { @@ -87,19 +176,54 @@ "start": 48, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_create_agent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient.delete_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.DeleteAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "DeleteAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteAgentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_agent" }, + "description": "Sample for DeleteAgent", "file": "dialogflow_v3_generated_agents_delete_agent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_DeleteAgent_async", "segments": [ { @@ -130,18 +254,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_delete_agent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient.delete_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.DeleteAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "DeleteAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteAgentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_agent" }, + "description": "Sample for DeleteAgent", "file": "dialogflow_v3_generated_agents_delete_agent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_DeleteAgent_sync", "segments": [ { @@ -172,19 +331,51 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_delete_agent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient.export_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.ExportAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "ExportAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ExportAgentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "export_agent" }, + "description": "Sample for ExportAgent", "file": "dialogflow_v3_generated_agents_export_agent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_ExportAgent_async", "segments": [ { @@ -217,18 +408,50 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_export_agent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient.export_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.ExportAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "ExportAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ExportAgentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "export_agent" }, + "description": "Sample for ExportAgent", "file": "dialogflow_v3_generated_agents_export_agent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_ExportAgent_sync", "segments": [ { @@ -261,19 +484,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_export_agent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient.get_agent_validation_result", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.GetAgentValidationResult", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "GetAgentValidationResult" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetAgentValidationResultRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.AgentValidationResult", + "shortName": "get_agent_validation_result" }, + "description": "Sample for GetAgentValidationResult", "file": "dialogflow_v3_generated_agents_get_agent_validation_result_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_GetAgentValidationResult_async", "segments": [ { @@ -306,18 +565,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_get_agent_validation_result_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient.get_agent_validation_result", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.GetAgentValidationResult", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "GetAgentValidationResult" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetAgentValidationResultRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.AgentValidationResult", + "shortName": "get_agent_validation_result" }, + "description": "Sample for GetAgentValidationResult", "file": "dialogflow_v3_generated_agents_get_agent_validation_result_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_GetAgentValidationResult_sync", "segments": [ { @@ -350,19 +645,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_get_agent_validation_result_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient.get_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.GetAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "GetAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetAgentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Agent", + "shortName": "get_agent" }, + "description": "Sample for GetAgent", "file": "dialogflow_v3_generated_agents_get_agent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_GetAgent_async", "segments": [ { @@ -395,18 +726,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_get_agent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient.get_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.GetAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "GetAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetAgentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Agent", + "shortName": "get_agent" }, + "description": "Sample for GetAgent", "file": "dialogflow_v3_generated_agents_get_agent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_GetAgent_sync", "segments": [ { @@ -439,19 +806,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_get_agent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient.list_agents", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.ListAgents", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "ListAgents" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListAgentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.agents.pagers.ListAgentsAsyncPager", + "shortName": "list_agents" }, + "description": "Sample for ListAgents", "file": "dialogflow_v3_generated_agents_list_agents_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_ListAgents_async", "segments": [ { @@ -484,18 +887,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_list_agents_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient.list_agents", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.ListAgents", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "ListAgents" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListAgentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.agents.pagers.ListAgentsPager", + "shortName": "list_agents" }, + "description": "Sample for ListAgents", "file": "dialogflow_v3_generated_agents_list_agents_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_ListAgents_sync", "segments": [ { @@ -528,19 +967,51 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_list_agents_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient.restore_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.RestoreAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "RestoreAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.RestoreAgentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "restore_agent" }, + "description": "Sample for RestoreAgent", "file": "dialogflow_v3_generated_agents_restore_agent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_RestoreAgent_async", "segments": [ { @@ -573,18 +1044,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_restore_agent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient.restore_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.RestoreAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "RestoreAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.RestoreAgentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "restore_agent" }, + "description": "Sample for RestoreAgent", "file": "dialogflow_v3_generated_agents_restore_agent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_RestoreAgent_sync", "segments": [ { @@ -617,19 +1120,59 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_restore_agent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient.update_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.UpdateAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "UpdateAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateAgentRequest" + }, + { + "name": "agent", + "type": "google.cloud.dialogflowcx_v3.types.Agent" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Agent", + "shortName": "update_agent" }, + "description": "Sample for UpdateAgent", "file": "dialogflow_v3_generated_agents_update_agent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_UpdateAgent_async", "segments": [ { @@ -662,18 +1205,58 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_update_agent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient.update_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.UpdateAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "UpdateAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateAgentRequest" + }, + { + "name": "agent", + "type": "google.cloud.dialogflowcx_v3.types.Agent" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Agent", + "shortName": "update_agent" }, + "description": "Sample for UpdateAgent", "file": "dialogflow_v3_generated_agents_update_agent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_UpdateAgent_sync", "segments": [ { @@ -706,19 +1289,51 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_update_agent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsAsyncClient.validate_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.ValidateAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "ValidateAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ValidateAgentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.AgentValidationResult", + "shortName": "validate_agent" }, + "description": "Sample for ValidateAgent", "file": "dialogflow_v3_generated_agents_validate_agent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_ValidateAgent_async", "segments": [ { @@ -751,18 +1366,50 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_validate_agent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.AgentsClient.validate_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents.ValidateAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Agents", "shortName": "Agents" }, "shortName": "ValidateAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ValidateAgentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.AgentValidationResult", + "shortName": "validate_agent" }, + "description": "Sample for ValidateAgent", "file": "dialogflow_v3_generated_agents_validate_agent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Agents_ValidateAgent_sync", "segments": [ { @@ -795,19 +1442,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_agents_validate_agent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ChangelogsAsyncClient", + "shortName": "ChangelogsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ChangelogsAsyncClient.get_changelog", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Changelogs.GetChangelog", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Changelogs", "shortName": "Changelogs" }, "shortName": "GetChangelog" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetChangelogRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Changelog", + "shortName": "get_changelog" }, + "description": "Sample for GetChangelog", "file": "dialogflow_v3_generated_changelogs_get_changelog_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Changelogs_GetChangelog_async", "segments": [ { @@ -840,18 +1523,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_changelogs_get_changelog_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ChangelogsClient", + "shortName": "ChangelogsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ChangelogsClient.get_changelog", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Changelogs.GetChangelog", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Changelogs", "shortName": "Changelogs" }, "shortName": "GetChangelog" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetChangelogRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Changelog", + "shortName": "get_changelog" }, + "description": "Sample for GetChangelog", "file": "dialogflow_v3_generated_changelogs_get_changelog_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Changelogs_GetChangelog_sync", "segments": [ { @@ -884,19 +1603,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_changelogs_get_changelog_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ChangelogsAsyncClient", + "shortName": "ChangelogsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ChangelogsAsyncClient.list_changelogs", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Changelogs.ListChangelogs", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Changelogs", "shortName": "Changelogs" }, "shortName": "ListChangelogs" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListChangelogsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.changelogs.pagers.ListChangelogsAsyncPager", + "shortName": "list_changelogs" }, + "description": "Sample for ListChangelogs", "file": "dialogflow_v3_generated_changelogs_list_changelogs_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Changelogs_ListChangelogs_async", "segments": [ { @@ -929,18 +1684,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_changelogs_list_changelogs_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ChangelogsClient", + "shortName": "ChangelogsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ChangelogsClient.list_changelogs", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Changelogs.ListChangelogs", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Changelogs", "shortName": "Changelogs" }, "shortName": "ListChangelogs" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListChangelogsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.changelogs.pagers.ListChangelogsPager", + "shortName": "list_changelogs" }, + "description": "Sample for ListChangelogs", "file": "dialogflow_v3_generated_changelogs_list_changelogs_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Changelogs_ListChangelogs_sync", "segments": [ { @@ -973,19 +1764,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_changelogs_list_changelogs_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.DeploymentsAsyncClient", + "shortName": "DeploymentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.DeploymentsAsyncClient.get_deployment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Deployments.GetDeployment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Deployments", "shortName": "Deployments" }, "shortName": "GetDeployment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetDeploymentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Deployment", + "shortName": "get_deployment" }, + "description": "Sample for GetDeployment", "file": "dialogflow_v3_generated_deployments_get_deployment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Deployments_GetDeployment_async", "segments": [ { @@ -1018,18 +1845,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_deployments_get_deployment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.DeploymentsClient", + "shortName": "DeploymentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.DeploymentsClient.get_deployment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Deployments.GetDeployment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Deployments", "shortName": "Deployments" }, "shortName": "GetDeployment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetDeploymentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Deployment", + "shortName": "get_deployment" }, + "description": "Sample for GetDeployment", "file": "dialogflow_v3_generated_deployments_get_deployment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Deployments_GetDeployment_sync", "segments": [ { @@ -1062,19 +1925,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_deployments_get_deployment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.DeploymentsAsyncClient", + "shortName": "DeploymentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.DeploymentsAsyncClient.list_deployments", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Deployments.ListDeployments", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Deployments", "shortName": "Deployments" }, "shortName": "ListDeployments" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListDeploymentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.deployments.pagers.ListDeploymentsAsyncPager", + "shortName": "list_deployments" }, + "description": "Sample for ListDeployments", "file": "dialogflow_v3_generated_deployments_list_deployments_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Deployments_ListDeployments_async", "segments": [ { @@ -1107,18 +2006,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_deployments_list_deployments_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.DeploymentsClient", + "shortName": "DeploymentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.DeploymentsClient.list_deployments", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Deployments.ListDeployments", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Deployments", "shortName": "Deployments" }, "shortName": "ListDeployments" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListDeploymentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.deployments.pagers.ListDeploymentsPager", + "shortName": "list_deployments" }, + "description": "Sample for ListDeployments", "file": "dialogflow_v3_generated_deployments_list_deployments_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Deployments_ListDeployments_sync", "segments": [ { @@ -1151,19 +2086,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_deployments_list_deployments_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesAsyncClient", + "shortName": "EntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesAsyncClient.create_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes.CreateEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes", "shortName": "EntityTypes" }, "shortName": "CreateEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateEntityTypeRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "entity_type", + "type": "google.cloud.dialogflowcx_v3.types.EntityType" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.EntityType", + "shortName": "create_entity_type" }, + "description": "Sample for CreateEntityType", "file": "dialogflow_v3_generated_entity_types_create_entity_type_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_EntityTypes_CreateEntityType_async", "segments": [ { @@ -1196,18 +2171,58 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_entity_types_create_entity_type_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesClient", + "shortName": "EntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesClient.create_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes.CreateEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes", "shortName": "EntityTypes" }, "shortName": "CreateEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateEntityTypeRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "entity_type", + "type": "google.cloud.dialogflowcx_v3.types.EntityType" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.EntityType", + "shortName": "create_entity_type" }, + "description": "Sample for CreateEntityType", "file": "dialogflow_v3_generated_entity_types_create_entity_type_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_EntityTypes_CreateEntityType_sync", "segments": [ { @@ -1240,19 +2255,54 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_entity_types_create_entity_type_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesAsyncClient", + "shortName": "EntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesAsyncClient.delete_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes.DeleteEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes", "shortName": "EntityTypes" }, "shortName": "DeleteEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteEntityTypeRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_entity_type" }, + "description": "Sample for DeleteEntityType", "file": "dialogflow_v3_generated_entity_types_delete_entity_type_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_EntityTypes_DeleteEntityType_async", "segments": [ { @@ -1283,18 +2333,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_entity_types_delete_entity_type_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesClient", + "shortName": "EntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesClient.delete_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes.DeleteEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes", "shortName": "EntityTypes" }, "shortName": "DeleteEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteEntityTypeRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_entity_type" }, + "description": "Sample for DeleteEntityType", "file": "dialogflow_v3_generated_entity_types_delete_entity_type_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_EntityTypes_DeleteEntityType_sync", "segments": [ { @@ -1325,19 +2410,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_entity_types_delete_entity_type_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesAsyncClient", + "shortName": "EntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesAsyncClient.get_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes.GetEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes", "shortName": "EntityTypes" }, "shortName": "GetEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetEntityTypeRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.EntityType", + "shortName": "get_entity_type" }, + "description": "Sample for GetEntityType", "file": "dialogflow_v3_generated_entity_types_get_entity_type_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_EntityTypes_GetEntityType_async", "segments": [ { @@ -1370,18 +2491,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_entity_types_get_entity_type_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesClient", + "shortName": "EntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesClient.get_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes.GetEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes", "shortName": "EntityTypes" }, "shortName": "GetEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetEntityTypeRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.EntityType", + "shortName": "get_entity_type" }, + "description": "Sample for GetEntityType", "file": "dialogflow_v3_generated_entity_types_get_entity_type_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_EntityTypes_GetEntityType_sync", "segments": [ { @@ -1414,19 +2571,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_entity_types_get_entity_type_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesAsyncClient", + "shortName": "EntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesAsyncClient.list_entity_types", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes.ListEntityTypes", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes", "shortName": "EntityTypes" }, "shortName": "ListEntityTypes" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListEntityTypesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.entity_types.pagers.ListEntityTypesAsyncPager", + "shortName": "list_entity_types" }, + "description": "Sample for ListEntityTypes", "file": "dialogflow_v3_generated_entity_types_list_entity_types_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_EntityTypes_ListEntityTypes_async", "segments": [ { @@ -1459,18 +2652,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_entity_types_list_entity_types_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesClient", + "shortName": "EntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesClient.list_entity_types", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes.ListEntityTypes", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes", "shortName": "EntityTypes" }, "shortName": "ListEntityTypes" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListEntityTypesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.entity_types.pagers.ListEntityTypesPager", + "shortName": "list_entity_types" }, + "description": "Sample for ListEntityTypes", "file": "dialogflow_v3_generated_entity_types_list_entity_types_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_EntityTypes_ListEntityTypes_sync", "segments": [ { @@ -1503,19 +2732,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_entity_types_list_entity_types_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesAsyncClient", + "shortName": "EntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesAsyncClient.update_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes.UpdateEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes", "shortName": "EntityTypes" }, "shortName": "UpdateEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateEntityTypeRequest" + }, + { + "name": "entity_type", + "type": "google.cloud.dialogflowcx_v3.types.EntityType" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.EntityType", + "shortName": "update_entity_type" }, + "description": "Sample for UpdateEntityType", "file": "dialogflow_v3_generated_entity_types_update_entity_type_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_EntityTypes_UpdateEntityType_async", "segments": [ { @@ -1548,18 +2817,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_entity_types_update_entity_type_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesClient", + "shortName": "EntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EntityTypesClient.update_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes.UpdateEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.EntityTypes", "shortName": "EntityTypes" }, "shortName": "UpdateEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateEntityTypeRequest" + }, + { + "name": "entity_type", + "type": "google.cloud.dialogflowcx_v3.types.EntityType" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.EntityType", + "shortName": "update_entity_type" }, + "description": "Sample for UpdateEntityType", "file": "dialogflow_v3_generated_entity_types_update_entity_type_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_EntityTypes_UpdateEntityType_sync", "segments": [ { @@ -1592,19 +2901,59 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_entity_types_update_entity_type_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient.create_environment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.CreateEnvironment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "CreateEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateEnvironmentRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "environment", + "type": "google.cloud.dialogflowcx_v3.types.Environment" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_environment" }, + "description": "Sample for CreateEnvironment", "file": "dialogflow_v3_generated_environments_create_environment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_CreateEnvironment_async", "segments": [ { @@ -1637,18 +2986,58 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_create_environment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient.create_environment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.CreateEnvironment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "CreateEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateEnvironmentRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "environment", + "type": "google.cloud.dialogflowcx_v3.types.Environment" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_environment" }, + "description": "Sample for CreateEnvironment", "file": "dialogflow_v3_generated_environments_create_environment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_CreateEnvironment_sync", "segments": [ { @@ -1681,19 +3070,54 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_create_environment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient.delete_environment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.DeleteEnvironment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "DeleteEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteEnvironmentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_environment" }, + "description": "Sample for DeleteEnvironment", "file": "dialogflow_v3_generated_environments_delete_environment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_DeleteEnvironment_async", "segments": [ { @@ -1724,18 +3148,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_delete_environment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient.delete_environment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.DeleteEnvironment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "DeleteEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteEnvironmentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_environment" }, + "description": "Sample for DeleteEnvironment", "file": "dialogflow_v3_generated_environments_delete_environment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_DeleteEnvironment_sync", "segments": [ { @@ -1766,19 +3225,51 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_delete_environment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient.deploy_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.DeployFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "DeployFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeployFlowRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "deploy_flow" }, + "description": "Sample for DeployFlow", "file": "dialogflow_v3_generated_environments_deploy_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_DeployFlow_async", "segments": [ { @@ -1811,18 +3302,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_deploy_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient.deploy_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.DeployFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "DeployFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeployFlowRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "deploy_flow" }, + "description": "Sample for DeployFlow", "file": "dialogflow_v3_generated_environments_deploy_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_DeployFlow_sync", "segments": [ { @@ -1855,19 +3378,55 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_deploy_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient.get_environment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.GetEnvironment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "GetEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetEnvironmentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Environment", + "shortName": "get_environment" }, + "description": "Sample for GetEnvironment", "file": "dialogflow_v3_generated_environments_get_environment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_GetEnvironment_async", "segments": [ { @@ -1900,18 +3459,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_get_environment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient.get_environment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.GetEnvironment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "GetEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetEnvironmentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Environment", + "shortName": "get_environment" }, + "description": "Sample for GetEnvironment", "file": "dialogflow_v3_generated_environments_get_environment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_GetEnvironment_sync", "segments": [ { @@ -1944,19 +3539,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_get_environment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient.list_continuous_test_results", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.ListContinuousTestResults", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "ListContinuousTestResults" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListContinuousTestResultsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.environments.pagers.ListContinuousTestResultsAsyncPager", + "shortName": "list_continuous_test_results" }, + "description": "Sample for ListContinuousTestResults", "file": "dialogflow_v3_generated_environments_list_continuous_test_results_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_ListContinuousTestResults_async", "segments": [ { @@ -1989,18 +3620,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_list_continuous_test_results_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient.list_continuous_test_results", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.ListContinuousTestResults", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "ListContinuousTestResults" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListContinuousTestResultsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.environments.pagers.ListContinuousTestResultsPager", + "shortName": "list_continuous_test_results" }, + "description": "Sample for ListContinuousTestResults", "file": "dialogflow_v3_generated_environments_list_continuous_test_results_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_ListContinuousTestResults_sync", "segments": [ { @@ -2033,19 +3700,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_list_continuous_test_results_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient.list_environments", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.ListEnvironments", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "ListEnvironments" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListEnvironmentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.environments.pagers.ListEnvironmentsAsyncPager", + "shortName": "list_environments" }, + "description": "Sample for ListEnvironments", "file": "dialogflow_v3_generated_environments_list_environments_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_ListEnvironments_async", "segments": [ { @@ -2078,18 +3781,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_list_environments_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient.list_environments", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.ListEnvironments", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "ListEnvironments" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListEnvironmentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.environments.pagers.ListEnvironmentsPager", + "shortName": "list_environments" }, + "description": "Sample for ListEnvironments", "file": "dialogflow_v3_generated_environments_list_environments_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_ListEnvironments_sync", "segments": [ { @@ -2122,19 +3861,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_list_environments_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient.lookup_environment_history", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.LookupEnvironmentHistory", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "LookupEnvironmentHistory" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.LookupEnvironmentHistoryRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.environments.pagers.LookupEnvironmentHistoryAsyncPager", + "shortName": "lookup_environment_history" }, + "description": "Sample for LookupEnvironmentHistory", "file": "dialogflow_v3_generated_environments_lookup_environment_history_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_LookupEnvironmentHistory_async", "segments": [ { @@ -2167,18 +3942,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_lookup_environment_history_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient.lookup_environment_history", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.LookupEnvironmentHistory", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "LookupEnvironmentHistory" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.LookupEnvironmentHistoryRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.environments.pagers.LookupEnvironmentHistoryPager", + "shortName": "lookup_environment_history" }, + "description": "Sample for LookupEnvironmentHistory", "file": "dialogflow_v3_generated_environments_lookup_environment_history_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_LookupEnvironmentHistory_sync", "segments": [ { @@ -2211,19 +4022,51 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_lookup_environment_history_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient.run_continuous_test", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.RunContinuousTest", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "RunContinuousTest" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.RunContinuousTestRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "run_continuous_test" }, + "description": "Sample for RunContinuousTest", "file": "dialogflow_v3_generated_environments_run_continuous_test_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_RunContinuousTest_async", "segments": [ { @@ -2256,18 +4099,50 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_run_continuous_test_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient.run_continuous_test", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.RunContinuousTest", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "RunContinuousTest" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.RunContinuousTestRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "run_continuous_test" }, + "description": "Sample for RunContinuousTest", "file": "dialogflow_v3_generated_environments_run_continuous_test_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_RunContinuousTest_sync", "segments": [ { @@ -2300,19 +4175,59 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_run_continuous_test_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsAsyncClient.update_environment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.UpdateEnvironment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "UpdateEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateEnvironmentRequest" + }, + { + "name": "environment", + "type": "google.cloud.dialogflowcx_v3.types.Environment" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_environment" }, + "description": "Sample for UpdateEnvironment", "file": "dialogflow_v3_generated_environments_update_environment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_UpdateEnvironment_async", "segments": [ { @@ -2345,18 +4260,58 @@ "start": 50, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_update_environment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.EnvironmentsClient.update_environment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments.UpdateEnvironment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Environments", "shortName": "Environments" }, "shortName": "UpdateEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateEnvironmentRequest" + }, + { + "name": "environment", + "type": "google.cloud.dialogflowcx_v3.types.Environment" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_environment" }, + "description": "Sample for UpdateEnvironment", "file": "dialogflow_v3_generated_environments_update_environment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Environments_UpdateEnvironment_sync", "segments": [ { @@ -2389,19 +4344,59 @@ "start": 50, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_environments_update_environment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsAsyncClient", + "shortName": "ExperimentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsAsyncClient.create_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments.CreateExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments", "shortName": "Experiments" }, "shortName": "CreateExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateExperimentRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "experiment", + "type": "google.cloud.dialogflowcx_v3.types.Experiment" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Experiment", + "shortName": "create_experiment" }, + "description": "Sample for CreateExperiment", "file": "dialogflow_v3_generated_experiments_create_experiment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Experiments_CreateExperiment_async", "segments": [ { @@ -2434,18 +4429,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_experiments_create_experiment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsClient", + "shortName": "ExperimentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsClient.create_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments.CreateExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments", "shortName": "Experiments" }, "shortName": "CreateExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateExperimentRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "experiment", + "type": "google.cloud.dialogflowcx_v3.types.Experiment" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Experiment", + "shortName": "create_experiment" }, + "description": "Sample for CreateExperiment", "file": "dialogflow_v3_generated_experiments_create_experiment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Experiments_CreateExperiment_sync", "segments": [ { @@ -2478,19 +4513,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_experiments_create_experiment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsAsyncClient", + "shortName": "ExperimentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsAsyncClient.delete_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments.DeleteExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments", "shortName": "Experiments" }, "shortName": "DeleteExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteExperimentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_experiment" }, + "description": "Sample for DeleteExperiment", "file": "dialogflow_v3_generated_experiments_delete_experiment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Experiments_DeleteExperiment_async", "segments": [ { @@ -2521,18 +4591,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_experiments_delete_experiment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsClient", + "shortName": "ExperimentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsClient.delete_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments.DeleteExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments", "shortName": "Experiments" }, "shortName": "DeleteExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteExperimentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_experiment" }, + "description": "Sample for DeleteExperiment", "file": "dialogflow_v3_generated_experiments_delete_experiment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Experiments_DeleteExperiment_sync", "segments": [ { @@ -2563,19 +4668,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_experiments_delete_experiment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsAsyncClient", + "shortName": "ExperimentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsAsyncClient.get_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments.GetExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments", "shortName": "Experiments" }, "shortName": "GetExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetExperimentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Experiment", + "shortName": "get_experiment" }, + "description": "Sample for GetExperiment", "file": "dialogflow_v3_generated_experiments_get_experiment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Experiments_GetExperiment_async", "segments": [ { @@ -2608,18 +4749,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_experiments_get_experiment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsClient", + "shortName": "ExperimentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsClient.get_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments.GetExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments", "shortName": "Experiments" }, "shortName": "GetExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetExperimentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Experiment", + "shortName": "get_experiment" }, + "description": "Sample for GetExperiment", "file": "dialogflow_v3_generated_experiments_get_experiment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Experiments_GetExperiment_sync", "segments": [ { @@ -2652,19 +4829,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_experiments_get_experiment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsAsyncClient", + "shortName": "ExperimentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsAsyncClient.list_experiments", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments.ListExperiments", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments", "shortName": "Experiments" }, "shortName": "ListExperiments" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListExperimentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.experiments.pagers.ListExperimentsAsyncPager", + "shortName": "list_experiments" }, + "description": "Sample for ListExperiments", "file": "dialogflow_v3_generated_experiments_list_experiments_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Experiments_ListExperiments_async", "segments": [ { @@ -2697,18 +4910,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_experiments_list_experiments_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsClient", + "shortName": "ExperimentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsClient.list_experiments", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments.ListExperiments", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments", "shortName": "Experiments" }, "shortName": "ListExperiments" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListExperimentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.experiments.pagers.ListExperimentsPager", + "shortName": "list_experiments" }, + "description": "Sample for ListExperiments", "file": "dialogflow_v3_generated_experiments_list_experiments_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Experiments_ListExperiments_sync", "segments": [ { @@ -2741,19 +4990,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_experiments_list_experiments_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsAsyncClient", + "shortName": "ExperimentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsAsyncClient.start_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments.StartExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments", "shortName": "Experiments" }, "shortName": "StartExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.StartExperimentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Experiment", + "shortName": "start_experiment" }, + "description": "Sample for StartExperiment", "file": "dialogflow_v3_generated_experiments_start_experiment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Experiments_StartExperiment_async", "segments": [ { @@ -2786,18 +5071,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_experiments_start_experiment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsClient", + "shortName": "ExperimentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsClient.start_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments.StartExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments", "shortName": "Experiments" }, "shortName": "StartExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.StartExperimentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Experiment", + "shortName": "start_experiment" }, + "description": "Sample for StartExperiment", "file": "dialogflow_v3_generated_experiments_start_experiment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Experiments_StartExperiment_sync", "segments": [ { @@ -2830,19 +5151,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_experiments_start_experiment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsAsyncClient", + "shortName": "ExperimentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsAsyncClient.stop_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments.StopExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments", "shortName": "Experiments" }, "shortName": "StopExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.StopExperimentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Experiment", + "shortName": "stop_experiment" }, + "description": "Sample for StopExperiment", "file": "dialogflow_v3_generated_experiments_stop_experiment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Experiments_StopExperiment_async", "segments": [ { @@ -2875,18 +5232,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_experiments_stop_experiment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsClient", + "shortName": "ExperimentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsClient.stop_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments.StopExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments", "shortName": "Experiments" }, "shortName": "StopExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.StopExperimentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Experiment", + "shortName": "stop_experiment" }, + "description": "Sample for StopExperiment", "file": "dialogflow_v3_generated_experiments_stop_experiment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Experiments_StopExperiment_sync", "segments": [ { @@ -2919,19 +5312,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_experiments_stop_experiment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsAsyncClient", + "shortName": "ExperimentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsAsyncClient.update_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments.UpdateExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments", "shortName": "Experiments" }, "shortName": "UpdateExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateExperimentRequest" + }, + { + "name": "experiment", + "type": "google.cloud.dialogflowcx_v3.types.Experiment" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Experiment", + "shortName": "update_experiment" }, + "description": "Sample for UpdateExperiment", "file": "dialogflow_v3_generated_experiments_update_experiment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Experiments_UpdateExperiment_async", "segments": [ { @@ -2964,18 +5397,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_experiments_update_experiment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsClient", + "shortName": "ExperimentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.ExperimentsClient.update_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments.UpdateExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Experiments", "shortName": "Experiments" }, "shortName": "UpdateExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateExperimentRequest" + }, + { + "name": "experiment", + "type": "google.cloud.dialogflowcx_v3.types.Experiment" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Experiment", + "shortName": "update_experiment" }, + "description": "Sample for UpdateExperiment", "file": "dialogflow_v3_generated_experiments_update_experiment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Experiments_UpdateExperiment_sync", "segments": [ { @@ -3008,19 +5481,59 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_experiments_update_experiment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient.create_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.CreateFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "CreateFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateFlowRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "flow", + "type": "google.cloud.dialogflowcx_v3.types.Flow" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Flow", + "shortName": "create_flow" }, + "description": "Sample for CreateFlow", "file": "dialogflow_v3_generated_flows_create_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_CreateFlow_async", "segments": [ { @@ -3053,18 +5566,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_create_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient.create_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.CreateFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "CreateFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateFlowRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "flow", + "type": "google.cloud.dialogflowcx_v3.types.Flow" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Flow", + "shortName": "create_flow" }, + "description": "Sample for CreateFlow", "file": "dialogflow_v3_generated_flows_create_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_CreateFlow_sync", "segments": [ { @@ -3097,19 +5650,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_create_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient.delete_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.DeleteFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "DeleteFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteFlowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_flow" }, + "description": "Sample for DeleteFlow", "file": "dialogflow_v3_generated_flows_delete_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_DeleteFlow_async", "segments": [ { @@ -3140,18 +5728,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_delete_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient.delete_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.DeleteFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "DeleteFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteFlowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_flow" }, + "description": "Sample for DeleteFlow", "file": "dialogflow_v3_generated_flows_delete_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_DeleteFlow_sync", "segments": [ { @@ -3182,19 +5805,51 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_delete_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient.export_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.ExportFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "ExportFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ExportFlowRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "export_flow" }, + "description": "Sample for ExportFlow", "file": "dialogflow_v3_generated_flows_export_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_ExportFlow_async", "segments": [ { @@ -3227,18 +5882,50 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_export_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient.export_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.ExportFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "ExportFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ExportFlowRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "export_flow" }, + "description": "Sample for ExportFlow", "file": "dialogflow_v3_generated_flows_export_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_ExportFlow_sync", "segments": [ { @@ -3271,19 +5958,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_export_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient.get_flow_validation_result", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.GetFlowValidationResult", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "GetFlowValidationResult" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetFlowValidationResultRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.FlowValidationResult", + "shortName": "get_flow_validation_result" }, + "description": "Sample for GetFlowValidationResult", "file": "dialogflow_v3_generated_flows_get_flow_validation_result_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_GetFlowValidationResult_async", "segments": [ { @@ -3316,18 +6039,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_get_flow_validation_result_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient.get_flow_validation_result", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.GetFlowValidationResult", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "GetFlowValidationResult" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetFlowValidationResultRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.FlowValidationResult", + "shortName": "get_flow_validation_result" }, + "description": "Sample for GetFlowValidationResult", "file": "dialogflow_v3_generated_flows_get_flow_validation_result_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_GetFlowValidationResult_sync", "segments": [ { @@ -3360,19 +6119,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_get_flow_validation_result_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient.get_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.GetFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "GetFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetFlowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Flow", + "shortName": "get_flow" }, + "description": "Sample for GetFlow", "file": "dialogflow_v3_generated_flows_get_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_GetFlow_async", "segments": [ { @@ -3405,18 +6200,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_get_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient.get_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.GetFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "GetFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetFlowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Flow", + "shortName": "get_flow" }, + "description": "Sample for GetFlow", "file": "dialogflow_v3_generated_flows_get_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_GetFlow_sync", "segments": [ { @@ -3449,19 +6280,51 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_get_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient.import_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.ImportFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "ImportFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ImportFlowRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "import_flow" }, + "description": "Sample for ImportFlow", "file": "dialogflow_v3_generated_flows_import_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_ImportFlow_async", "segments": [ { @@ -3494,18 +6357,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_import_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient.import_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.ImportFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "ImportFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ImportFlowRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "import_flow" }, + "description": "Sample for ImportFlow", "file": "dialogflow_v3_generated_flows_import_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_ImportFlow_sync", "segments": [ { @@ -3538,19 +6433,55 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_import_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient.list_flows", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.ListFlows", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "ListFlows" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListFlowsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.flows.pagers.ListFlowsAsyncPager", + "shortName": "list_flows" }, + "description": "Sample for ListFlows", "file": "dialogflow_v3_generated_flows_list_flows_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_ListFlows_async", "segments": [ { @@ -3583,18 +6514,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_list_flows_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient.list_flows", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.ListFlows", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "ListFlows" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListFlowsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.flows.pagers.ListFlowsPager", + "shortName": "list_flows" }, + "description": "Sample for ListFlows", "file": "dialogflow_v3_generated_flows_list_flows_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_ListFlows_sync", "segments": [ { @@ -3627,19 +6594,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_list_flows_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient.train_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.TrainFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "TrainFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.TrainFlowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "train_flow" }, + "description": "Sample for TrainFlow", "file": "dialogflow_v3_generated_flows_train_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_TrainFlow_async", "segments": [ { @@ -3672,18 +6675,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_train_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient.train_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.TrainFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "TrainFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.TrainFlowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "train_flow" }, + "description": "Sample for TrainFlow", "file": "dialogflow_v3_generated_flows_train_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_TrainFlow_sync", "segments": [ { @@ -3716,19 +6755,59 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_train_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient.update_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.UpdateFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "UpdateFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateFlowRequest" + }, + { + "name": "flow", + "type": "google.cloud.dialogflowcx_v3.types.Flow" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Flow", + "shortName": "update_flow" }, + "description": "Sample for UpdateFlow", "file": "dialogflow_v3_generated_flows_update_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_UpdateFlow_async", "segments": [ { @@ -3761,18 +6840,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_update_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient.update_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.UpdateFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "UpdateFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateFlowRequest" + }, + { + "name": "flow", + "type": "google.cloud.dialogflowcx_v3.types.Flow" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Flow", + "shortName": "update_flow" }, + "description": "Sample for UpdateFlow", "file": "dialogflow_v3_generated_flows_update_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_UpdateFlow_sync", "segments": [ { @@ -3805,19 +6924,51 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_update_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsAsyncClient.validate_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.ValidateFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "ValidateFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ValidateFlowRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.FlowValidationResult", + "shortName": "validate_flow" }, + "description": "Sample for ValidateFlow", "file": "dialogflow_v3_generated_flows_validate_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_ValidateFlow_async", "segments": [ { @@ -3850,18 +7001,50 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_validate_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.FlowsClient.validate_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows.ValidateFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Flows", "shortName": "Flows" }, "shortName": "ValidateFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ValidateFlowRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.FlowValidationResult", + "shortName": "validate_flow" }, + "description": "Sample for ValidateFlow", "file": "dialogflow_v3_generated_flows_validate_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Flows_ValidateFlow_sync", "segments": [ { @@ -3894,19 +7077,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_flows_validate_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.IntentsAsyncClient", + "shortName": "IntentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.IntentsAsyncClient.create_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents.CreateIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents", "shortName": "Intents" }, "shortName": "CreateIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateIntentRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "intent", + "type": "google.cloud.dialogflowcx_v3.types.Intent" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Intent", + "shortName": "create_intent" }, + "description": "Sample for CreateIntent", "file": "dialogflow_v3_generated_intents_create_intent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Intents_CreateIntent_async", "segments": [ { @@ -3939,18 +7162,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_intents_create_intent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.IntentsClient", + "shortName": "IntentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.IntentsClient.create_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents.CreateIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents", "shortName": "Intents" }, "shortName": "CreateIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateIntentRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "intent", + "type": "google.cloud.dialogflowcx_v3.types.Intent" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Intent", + "shortName": "create_intent" }, + "description": "Sample for CreateIntent", "file": "dialogflow_v3_generated_intents_create_intent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Intents_CreateIntent_sync", "segments": [ { @@ -3983,19 +7246,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_intents_create_intent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.IntentsAsyncClient", + "shortName": "IntentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.IntentsAsyncClient.delete_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents.DeleteIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents", "shortName": "Intents" }, "shortName": "DeleteIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteIntentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_intent" }, + "description": "Sample for DeleteIntent", "file": "dialogflow_v3_generated_intents_delete_intent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Intents_DeleteIntent_async", "segments": [ { @@ -4026,18 +7324,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_intents_delete_intent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.IntentsClient", + "shortName": "IntentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.IntentsClient.delete_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents.DeleteIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents", "shortName": "Intents" }, "shortName": "DeleteIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteIntentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_intent" }, + "description": "Sample for DeleteIntent", "file": "dialogflow_v3_generated_intents_delete_intent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Intents_DeleteIntent_sync", "segments": [ { @@ -4068,19 +7401,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_intents_delete_intent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.IntentsAsyncClient", + "shortName": "IntentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.IntentsAsyncClient.get_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents.GetIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents", "shortName": "Intents" }, "shortName": "GetIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetIntentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Intent", + "shortName": "get_intent" }, + "description": "Sample for GetIntent", "file": "dialogflow_v3_generated_intents_get_intent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Intents_GetIntent_async", "segments": [ { @@ -4113,18 +7482,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_intents_get_intent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.IntentsClient", + "shortName": "IntentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.IntentsClient.get_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents.GetIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents", "shortName": "Intents" }, "shortName": "GetIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetIntentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Intent", + "shortName": "get_intent" }, + "description": "Sample for GetIntent", "file": "dialogflow_v3_generated_intents_get_intent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Intents_GetIntent_sync", "segments": [ { @@ -4157,19 +7562,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_intents_get_intent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.IntentsAsyncClient", + "shortName": "IntentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.IntentsAsyncClient.list_intents", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents.ListIntents", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents", "shortName": "Intents" }, "shortName": "ListIntents" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListIntentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.intents.pagers.ListIntentsAsyncPager", + "shortName": "list_intents" }, + "description": "Sample for ListIntents", "file": "dialogflow_v3_generated_intents_list_intents_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Intents_ListIntents_async", "segments": [ { @@ -4202,18 +7643,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_intents_list_intents_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.IntentsClient", + "shortName": "IntentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.IntentsClient.list_intents", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents.ListIntents", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents", "shortName": "Intents" }, "shortName": "ListIntents" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListIntentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.intents.pagers.ListIntentsPager", + "shortName": "list_intents" }, + "description": "Sample for ListIntents", "file": "dialogflow_v3_generated_intents_list_intents_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Intents_ListIntents_sync", "segments": [ { @@ -4246,19 +7723,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_intents_list_intents_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.IntentsAsyncClient", + "shortName": "IntentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.IntentsAsyncClient.update_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents.UpdateIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents", "shortName": "Intents" }, "shortName": "UpdateIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateIntentRequest" + }, + { + "name": "intent", + "type": "google.cloud.dialogflowcx_v3.types.Intent" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Intent", + "shortName": "update_intent" }, + "description": "Sample for UpdateIntent", "file": "dialogflow_v3_generated_intents_update_intent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Intents_UpdateIntent_async", "segments": [ { @@ -4291,18 +7808,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_intents_update_intent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.IntentsClient", + "shortName": "IntentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.IntentsClient.update_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents.UpdateIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Intents", "shortName": "Intents" }, "shortName": "UpdateIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateIntentRequest" + }, + { + "name": "intent", + "type": "google.cloud.dialogflowcx_v3.types.Intent" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Intent", + "shortName": "update_intent" }, + "description": "Sample for UpdateIntent", "file": "dialogflow_v3_generated_intents_update_intent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Intents_UpdateIntent_sync", "segments": [ { @@ -4335,19 +7892,59 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_intents_update_intent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.PagesAsyncClient", + "shortName": "PagesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.PagesAsyncClient.create_page", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages.CreatePage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages", "shortName": "Pages" }, "shortName": "CreatePage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreatePageRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "page", + "type": "google.cloud.dialogflowcx_v3.types.Page" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Page", + "shortName": "create_page" }, + "description": "Sample for CreatePage", "file": "dialogflow_v3_generated_pages_create_page_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Pages_CreatePage_async", "segments": [ { @@ -4380,18 +7977,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_pages_create_page_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.PagesClient", + "shortName": "PagesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.PagesClient.create_page", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages.CreatePage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages", "shortName": "Pages" }, "shortName": "CreatePage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreatePageRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "page", + "type": "google.cloud.dialogflowcx_v3.types.Page" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Page", + "shortName": "create_page" }, + "description": "Sample for CreatePage", "file": "dialogflow_v3_generated_pages_create_page_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Pages_CreatePage_sync", "segments": [ { @@ -4424,19 +8061,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_pages_create_page_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.PagesAsyncClient", + "shortName": "PagesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.PagesAsyncClient.delete_page", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages.DeletePage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages", "shortName": "Pages" }, "shortName": "DeletePage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeletePageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_page" }, + "description": "Sample for DeletePage", "file": "dialogflow_v3_generated_pages_delete_page_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Pages_DeletePage_async", "segments": [ { @@ -4467,18 +8139,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_pages_delete_page_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.PagesClient", + "shortName": "PagesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.PagesClient.delete_page", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages.DeletePage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages", "shortName": "Pages" }, "shortName": "DeletePage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeletePageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_page" }, + "description": "Sample for DeletePage", "file": "dialogflow_v3_generated_pages_delete_page_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Pages_DeletePage_sync", "segments": [ { @@ -4509,19 +8216,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_pages_delete_page_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.PagesAsyncClient", + "shortName": "PagesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.PagesAsyncClient.get_page", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages.GetPage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages", "shortName": "Pages" }, "shortName": "GetPage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetPageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Page", + "shortName": "get_page" }, + "description": "Sample for GetPage", "file": "dialogflow_v3_generated_pages_get_page_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Pages_GetPage_async", "segments": [ { @@ -4554,18 +8297,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_pages_get_page_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.PagesClient", + "shortName": "PagesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.PagesClient.get_page", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages.GetPage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages", "shortName": "Pages" }, "shortName": "GetPage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetPageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Page", + "shortName": "get_page" }, + "description": "Sample for GetPage", "file": "dialogflow_v3_generated_pages_get_page_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Pages_GetPage_sync", "segments": [ { @@ -4598,19 +8377,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_pages_get_page_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.PagesAsyncClient", + "shortName": "PagesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.PagesAsyncClient.list_pages", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages.ListPages", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages", "shortName": "Pages" }, "shortName": "ListPages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListPagesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.pages.pagers.ListPagesAsyncPager", + "shortName": "list_pages" }, + "description": "Sample for ListPages", "file": "dialogflow_v3_generated_pages_list_pages_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Pages_ListPages_async", "segments": [ { @@ -4643,18 +8458,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_pages_list_pages_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.PagesClient", + "shortName": "PagesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.PagesClient.list_pages", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages.ListPages", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages", "shortName": "Pages" }, "shortName": "ListPages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListPagesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.pages.pagers.ListPagesPager", + "shortName": "list_pages" }, + "description": "Sample for ListPages", "file": "dialogflow_v3_generated_pages_list_pages_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Pages_ListPages_sync", "segments": [ { @@ -4687,19 +8538,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_pages_list_pages_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.PagesAsyncClient", + "shortName": "PagesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.PagesAsyncClient.update_page", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages.UpdatePage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages", "shortName": "Pages" }, "shortName": "UpdatePage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdatePageRequest" + }, + { + "name": "page", + "type": "google.cloud.dialogflowcx_v3.types.Page" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Page", + "shortName": "update_page" }, + "description": "Sample for UpdatePage", "file": "dialogflow_v3_generated_pages_update_page_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Pages_UpdatePage_async", "segments": [ { @@ -4732,18 +8623,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_pages_update_page_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.PagesClient", + "shortName": "PagesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.PagesClient.update_page", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages.UpdatePage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Pages", "shortName": "Pages" }, "shortName": "UpdatePage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdatePageRequest" + }, + { + "name": "page", + "type": "google.cloud.dialogflowcx_v3.types.Page" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Page", + "shortName": "update_page" }, + "description": "Sample for UpdatePage", "file": "dialogflow_v3_generated_pages_update_page_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Pages_UpdatePage_sync", "segments": [ { @@ -4776,19 +8707,59 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_pages_update_page_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceAsyncClient", + "shortName": "SecuritySettingsServiceAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceAsyncClient.create_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService.CreateSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "CreateSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateSecuritySettingsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "security_settings", + "type": "google.cloud.dialogflowcx_v3.types.SecuritySettings" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.SecuritySettings", + "shortName": "create_security_settings" }, + "description": "Sample for CreateSecuritySettings", "file": "dialogflow_v3_generated_security_settings_service_create_security_settings_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SecuritySettingsService_CreateSecuritySettings_async", "segments": [ { @@ -4821,18 +8792,58 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_security_settings_service_create_security_settings_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceClient", + "shortName": "SecuritySettingsServiceClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceClient.create_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService.CreateSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "CreateSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateSecuritySettingsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "security_settings", + "type": "google.cloud.dialogflowcx_v3.types.SecuritySettings" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.SecuritySettings", + "shortName": "create_security_settings" }, + "description": "Sample for CreateSecuritySettings", "file": "dialogflow_v3_generated_security_settings_service_create_security_settings_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SecuritySettingsService_CreateSecuritySettings_sync", "segments": [ { @@ -4865,19 +8876,54 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_security_settings_service_create_security_settings_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceAsyncClient", + "shortName": "SecuritySettingsServiceAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceAsyncClient.delete_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService.DeleteSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "DeleteSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteSecuritySettingsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_security_settings" }, + "description": "Sample for DeleteSecuritySettings", "file": "dialogflow_v3_generated_security_settings_service_delete_security_settings_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SecuritySettingsService_DeleteSecuritySettings_async", "segments": [ { @@ -4908,18 +8954,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_security_settings_service_delete_security_settings_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceClient", + "shortName": "SecuritySettingsServiceClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceClient.delete_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService.DeleteSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "DeleteSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteSecuritySettingsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_security_settings" }, + "description": "Sample for DeleteSecuritySettings", "file": "dialogflow_v3_generated_security_settings_service_delete_security_settings_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SecuritySettingsService_DeleteSecuritySettings_sync", "segments": [ { @@ -4950,19 +9031,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_security_settings_service_delete_security_settings_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceAsyncClient", + "shortName": "SecuritySettingsServiceAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceAsyncClient.get_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService.GetSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "GetSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetSecuritySettingsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.SecuritySettings", + "shortName": "get_security_settings" }, + "description": "Sample for GetSecuritySettings", "file": "dialogflow_v3_generated_security_settings_service_get_security_settings_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SecuritySettingsService_GetSecuritySettings_async", "segments": [ { @@ -4995,18 +9112,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_security_settings_service_get_security_settings_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceClient", + "shortName": "SecuritySettingsServiceClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceClient.get_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService.GetSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "GetSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetSecuritySettingsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.SecuritySettings", + "shortName": "get_security_settings" }, + "description": "Sample for GetSecuritySettings", "file": "dialogflow_v3_generated_security_settings_service_get_security_settings_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SecuritySettingsService_GetSecuritySettings_sync", "segments": [ { @@ -5039,19 +9192,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_security_settings_service_get_security_settings_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceAsyncClient", + "shortName": "SecuritySettingsServiceAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceAsyncClient.list_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService.ListSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "ListSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListSecuritySettingsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.security_settings_service.pagers.ListSecuritySettingsAsyncPager", + "shortName": "list_security_settings" }, + "description": "Sample for ListSecuritySettings", "file": "dialogflow_v3_generated_security_settings_service_list_security_settings_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SecuritySettingsService_ListSecuritySettings_async", "segments": [ { @@ -5084,18 +9273,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_security_settings_service_list_security_settings_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceClient", + "shortName": "SecuritySettingsServiceClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceClient.list_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService.ListSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "ListSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListSecuritySettingsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.security_settings_service.pagers.ListSecuritySettingsPager", + "shortName": "list_security_settings" }, + "description": "Sample for ListSecuritySettings", "file": "dialogflow_v3_generated_security_settings_service_list_security_settings_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SecuritySettingsService_ListSecuritySettings_sync", "segments": [ { @@ -5128,19 +9353,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_security_settings_service_list_security_settings_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceAsyncClient", + "shortName": "SecuritySettingsServiceAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceAsyncClient.update_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService.UpdateSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "UpdateSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateSecuritySettingsRequest" + }, + { + "name": "security_settings", + "type": "google.cloud.dialogflowcx_v3.types.SecuritySettings" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.SecuritySettings", + "shortName": "update_security_settings" }, + "description": "Sample for UpdateSecuritySettings", "file": "dialogflow_v3_generated_security_settings_service_update_security_settings_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SecuritySettingsService_UpdateSecuritySettings_async", "segments": [ { @@ -5173,18 +9438,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_security_settings_service_update_security_settings_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceClient", + "shortName": "SecuritySettingsServiceClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SecuritySettingsServiceClient.update_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService.UpdateSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "UpdateSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateSecuritySettingsRequest" + }, + { + "name": "security_settings", + "type": "google.cloud.dialogflowcx_v3.types.SecuritySettings" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.SecuritySettings", + "shortName": "update_security_settings" }, + "description": "Sample for UpdateSecuritySettings", "file": "dialogflow_v3_generated_security_settings_service_update_security_settings_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SecuritySettingsService_UpdateSecuritySettings_sync", "segments": [ { @@ -5217,19 +9522,59 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_security_settings_service_update_security_settings_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesAsyncClient", + "shortName": "SessionEntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesAsyncClient.create_session_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes.CreateSessionEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "CreateSessionEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateSessionEntityTypeRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "session_entity_type", + "type": "google.cloud.dialogflowcx_v3.types.SessionEntityType" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.SessionEntityType", + "shortName": "create_session_entity_type" }, + "description": "Sample for CreateSessionEntityType", "file": "dialogflow_v3_generated_session_entity_types_create_session_entity_type_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SessionEntityTypes_CreateSessionEntityType_async", "segments": [ { @@ -5262,18 +9607,58 @@ "start": 49, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_session_entity_types_create_session_entity_type_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesClient", + "shortName": "SessionEntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesClient.create_session_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes.CreateSessionEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "CreateSessionEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateSessionEntityTypeRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "session_entity_type", + "type": "google.cloud.dialogflowcx_v3.types.SessionEntityType" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.SessionEntityType", + "shortName": "create_session_entity_type" }, + "description": "Sample for CreateSessionEntityType", "file": "dialogflow_v3_generated_session_entity_types_create_session_entity_type_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SessionEntityTypes_CreateSessionEntityType_sync", "segments": [ { @@ -5306,19 +9691,54 @@ "start": 49, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_session_entity_types_create_session_entity_type_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesAsyncClient", + "shortName": "SessionEntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesAsyncClient.delete_session_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes.DeleteSessionEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "DeleteSessionEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteSessionEntityTypeRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_session_entity_type" }, + "description": "Sample for DeleteSessionEntityType", "file": "dialogflow_v3_generated_session_entity_types_delete_session_entity_type_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SessionEntityTypes_DeleteSessionEntityType_async", "segments": [ { @@ -5349,18 +9769,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_session_entity_types_delete_session_entity_type_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesClient", + "shortName": "SessionEntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesClient.delete_session_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes.DeleteSessionEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "DeleteSessionEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteSessionEntityTypeRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_session_entity_type" }, + "description": "Sample for DeleteSessionEntityType", "file": "dialogflow_v3_generated_session_entity_types_delete_session_entity_type_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SessionEntityTypes_DeleteSessionEntityType_sync", "segments": [ { @@ -5391,19 +9846,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_session_entity_types_delete_session_entity_type_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesAsyncClient", + "shortName": "SessionEntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesAsyncClient.get_session_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes.GetSessionEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "GetSessionEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetSessionEntityTypeRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.SessionEntityType", + "shortName": "get_session_entity_type" }, + "description": "Sample for GetSessionEntityType", "file": "dialogflow_v3_generated_session_entity_types_get_session_entity_type_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SessionEntityTypes_GetSessionEntityType_async", "segments": [ { @@ -5436,18 +9927,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_session_entity_types_get_session_entity_type_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesClient", + "shortName": "SessionEntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesClient.get_session_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes.GetSessionEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "GetSessionEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetSessionEntityTypeRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.SessionEntityType", + "shortName": "get_session_entity_type" }, + "description": "Sample for GetSessionEntityType", "file": "dialogflow_v3_generated_session_entity_types_get_session_entity_type_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SessionEntityTypes_GetSessionEntityType_sync", "segments": [ { @@ -5480,19 +10007,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_session_entity_types_get_session_entity_type_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesAsyncClient", + "shortName": "SessionEntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesAsyncClient.list_session_entity_types", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes.ListSessionEntityTypes", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "ListSessionEntityTypes" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListSessionEntityTypesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.session_entity_types.pagers.ListSessionEntityTypesAsyncPager", + "shortName": "list_session_entity_types" }, + "description": "Sample for ListSessionEntityTypes", "file": "dialogflow_v3_generated_session_entity_types_list_session_entity_types_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SessionEntityTypes_ListSessionEntityTypes_async", "segments": [ { @@ -5525,18 +10088,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_session_entity_types_list_session_entity_types_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesClient", + "shortName": "SessionEntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesClient.list_session_entity_types", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes.ListSessionEntityTypes", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "ListSessionEntityTypes" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListSessionEntityTypesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.session_entity_types.pagers.ListSessionEntityTypesPager", + "shortName": "list_session_entity_types" }, + "description": "Sample for ListSessionEntityTypes", "file": "dialogflow_v3_generated_session_entity_types_list_session_entity_types_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SessionEntityTypes_ListSessionEntityTypes_sync", "segments": [ { @@ -5569,19 +10168,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_session_entity_types_list_session_entity_types_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesAsyncClient", + "shortName": "SessionEntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesAsyncClient.update_session_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes.UpdateSessionEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "UpdateSessionEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateSessionEntityTypeRequest" + }, + { + "name": "session_entity_type", + "type": "google.cloud.dialogflowcx_v3.types.SessionEntityType" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.SessionEntityType", + "shortName": "update_session_entity_type" }, + "description": "Sample for UpdateSessionEntityType", "file": "dialogflow_v3_generated_session_entity_types_update_session_entity_type_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SessionEntityTypes_UpdateSessionEntityType_async", "segments": [ { @@ -5614,18 +10253,58 @@ "start": 48, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_session_entity_types_update_session_entity_type_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesClient", + "shortName": "SessionEntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionEntityTypesClient.update_session_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes.UpdateSessionEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "UpdateSessionEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateSessionEntityTypeRequest" + }, + { + "name": "session_entity_type", + "type": "google.cloud.dialogflowcx_v3.types.SessionEntityType" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.SessionEntityType", + "shortName": "update_session_entity_type" }, + "description": "Sample for UpdateSessionEntityType", "file": "dialogflow_v3_generated_session_entity_types_update_session_entity_type_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_SessionEntityTypes_UpdateSessionEntityType_sync", "segments": [ { @@ -5658,19 +10337,51 @@ "start": 48, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_session_entity_types_update_session_entity_type_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionsAsyncClient", + "shortName": "SessionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionsAsyncClient.detect_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Sessions.DetectIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Sessions", "shortName": "Sessions" }, "shortName": "DetectIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DetectIntentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.DetectIntentResponse", + "shortName": "detect_intent" }, + "description": "Sample for DetectIntent", "file": "dialogflow_v3_generated_sessions_detect_intent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Sessions_DetectIntent_async", "segments": [ { @@ -5703,18 +10414,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_sessions_detect_intent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionsClient", + "shortName": "SessionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionsClient.detect_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Sessions.DetectIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Sessions", "shortName": "Sessions" }, "shortName": "DetectIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DetectIntentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.DetectIntentResponse", + "shortName": "detect_intent" }, + "description": "Sample for DetectIntent", "file": "dialogflow_v3_generated_sessions_detect_intent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Sessions_DetectIntent_sync", "segments": [ { @@ -5747,19 +10490,51 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_sessions_detect_intent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionsAsyncClient", + "shortName": "SessionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionsAsyncClient.fulfill_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Sessions.FulfillIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Sessions", "shortName": "Sessions" }, "shortName": "FulfillIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.FulfillIntentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.FulfillIntentResponse", + "shortName": "fulfill_intent" }, + "description": "Sample for FulfillIntent", "file": "dialogflow_v3_generated_sessions_fulfill_intent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Sessions_FulfillIntent_async", "segments": [ { @@ -5792,18 +10567,50 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_sessions_fulfill_intent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionsClient", + "shortName": "SessionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionsClient.fulfill_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Sessions.FulfillIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Sessions", "shortName": "Sessions" }, "shortName": "FulfillIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.FulfillIntentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.FulfillIntentResponse", + "shortName": "fulfill_intent" }, + "description": "Sample for FulfillIntent", "file": "dialogflow_v3_generated_sessions_fulfill_intent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Sessions_FulfillIntent_sync", "segments": [ { @@ -5836,19 +10643,51 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_sessions_fulfill_intent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionsAsyncClient", + "shortName": "SessionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionsAsyncClient.match_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Sessions.MatchIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Sessions", "shortName": "Sessions" }, "shortName": "MatchIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.MatchIntentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.MatchIntentResponse", + "shortName": "match_intent" }, + "description": "Sample for MatchIntent", "file": "dialogflow_v3_generated_sessions_match_intent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Sessions_MatchIntent_async", "segments": [ { @@ -5881,18 +10720,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_sessions_match_intent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionsClient", + "shortName": "SessionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionsClient.match_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Sessions.MatchIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Sessions", "shortName": "Sessions" }, "shortName": "MatchIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.MatchIntentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.MatchIntentResponse", + "shortName": "match_intent" }, + "description": "Sample for MatchIntent", "file": "dialogflow_v3_generated_sessions_match_intent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Sessions_MatchIntent_sync", "segments": [ { @@ -5925,19 +10796,51 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_sessions_match_intent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionsAsyncClient", + "shortName": "SessionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionsAsyncClient.streaming_detect_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Sessions.StreamingDetectIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Sessions", "shortName": "Sessions" }, "shortName": "StreamingDetectIntent" - } + }, + "parameters": [ + { + "name": "requests", + "type": "Iterator[google.cloud.dialogflowcx_v3.types.StreamingDetectIntentRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "Iterable[google.cloud.dialogflowcx_v3.types.StreamingDetectIntentResponse]", + "shortName": "streaming_detect_intent" }, + "description": "Sample for StreamingDetectIntent", "file": "dialogflow_v3_generated_sessions_streaming_detect_intent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Sessions_StreamingDetectIntent_async", "segments": [ { @@ -5970,18 +10873,50 @@ "start": 56, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_sessions_streaming_detect_intent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.SessionsClient", + "shortName": "SessionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.SessionsClient.streaming_detect_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Sessions.StreamingDetectIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Sessions", "shortName": "Sessions" }, "shortName": "StreamingDetectIntent" - } + }, + "parameters": [ + { + "name": "requests", + "type": "Iterator[google.cloud.dialogflowcx_v3.types.StreamingDetectIntentRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "Iterable[google.cloud.dialogflowcx_v3.types.StreamingDetectIntentResponse]", + "shortName": "streaming_detect_intent" }, + "description": "Sample for StreamingDetectIntent", "file": "dialogflow_v3_generated_sessions_streaming_detect_intent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Sessions_StreamingDetectIntent_sync", "segments": [ { @@ -6014,19 +10949,54 @@ "start": 56, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_sessions_streaming_detect_intent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient.batch_delete_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.BatchDeleteTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "BatchDeleteTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.BatchDeleteTestCasesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "batch_delete_test_cases" }, + "description": "Sample for BatchDeleteTestCases", "file": "dialogflow_v3_generated_test_cases_batch_delete_test_cases_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_BatchDeleteTestCases_async", "segments": [ { @@ -6057,18 +11027,53 @@ "end": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_batch_delete_test_cases_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient.batch_delete_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.BatchDeleteTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "BatchDeleteTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.BatchDeleteTestCasesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "batch_delete_test_cases" }, + "description": "Sample for BatchDeleteTestCases", "file": "dialogflow_v3_generated_test_cases_batch_delete_test_cases_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_BatchDeleteTestCases_sync", "segments": [ { @@ -6099,19 +11104,51 @@ "end": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_batch_delete_test_cases_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient.batch_run_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.BatchRunTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "BatchRunTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.BatchRunTestCasesRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "batch_run_test_cases" }, + "description": "Sample for BatchRunTestCases", "file": "dialogflow_v3_generated_test_cases_batch_run_test_cases_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_BatchRunTestCases_async", "segments": [ { @@ -6144,18 +11181,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_batch_run_test_cases_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient.batch_run_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.BatchRunTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "BatchRunTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.BatchRunTestCasesRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "batch_run_test_cases" }, + "description": "Sample for BatchRunTestCases", "file": "dialogflow_v3_generated_test_cases_batch_run_test_cases_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_BatchRunTestCases_sync", "segments": [ { @@ -6188,19 +11257,51 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_batch_run_test_cases_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient.calculate_coverage", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.CalculateCoverage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "CalculateCoverage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CalculateCoverageRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.CalculateCoverageResponse", + "shortName": "calculate_coverage" }, + "description": "Sample for CalculateCoverage", "file": "dialogflow_v3_generated_test_cases_calculate_coverage_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_CalculateCoverage_async", "segments": [ { @@ -6233,18 +11334,50 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_calculate_coverage_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient.calculate_coverage", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.CalculateCoverage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "CalculateCoverage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CalculateCoverageRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.CalculateCoverageResponse", + "shortName": "calculate_coverage" }, + "description": "Sample for CalculateCoverage", "file": "dialogflow_v3_generated_test_cases_calculate_coverage_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_CalculateCoverage_sync", "segments": [ { @@ -6277,19 +11410,59 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_calculate_coverage_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient.create_test_case", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.CreateTestCase", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "CreateTestCase" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateTestCaseRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "test_case", + "type": "google.cloud.dialogflowcx_v3.types.TestCase" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.TestCase", + "shortName": "create_test_case" }, + "description": "Sample for CreateTestCase", "file": "dialogflow_v3_generated_test_cases_create_test_case_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_CreateTestCase_async", "segments": [ { @@ -6322,18 +11495,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_create_test_case_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient.create_test_case", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.CreateTestCase", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "CreateTestCase" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateTestCaseRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "test_case", + "type": "google.cloud.dialogflowcx_v3.types.TestCase" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.TestCase", + "shortName": "create_test_case" }, + "description": "Sample for CreateTestCase", "file": "dialogflow_v3_generated_test_cases_create_test_case_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_CreateTestCase_sync", "segments": [ { @@ -6366,19 +11579,51 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_create_test_case_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient.export_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.ExportTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "ExportTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ExportTestCasesRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "export_test_cases" }, + "description": "Sample for ExportTestCases", "file": "dialogflow_v3_generated_test_cases_export_test_cases_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_ExportTestCases_async", "segments": [ { @@ -6411,18 +11656,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_export_test_cases_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient.export_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.ExportTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "ExportTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ExportTestCasesRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "export_test_cases" }, + "description": "Sample for ExportTestCases", "file": "dialogflow_v3_generated_test_cases_export_test_cases_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_ExportTestCases_sync", "segments": [ { @@ -6455,19 +11732,55 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_export_test_cases_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient.get_test_case_result", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.GetTestCaseResult", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "GetTestCaseResult" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetTestCaseResultRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.TestCaseResult", + "shortName": "get_test_case_result" }, + "description": "Sample for GetTestCaseResult", "file": "dialogflow_v3_generated_test_cases_get_test_case_result_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_GetTestCaseResult_async", "segments": [ { @@ -6500,18 +11813,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_get_test_case_result_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient.get_test_case_result", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.GetTestCaseResult", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "GetTestCaseResult" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetTestCaseResultRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.TestCaseResult", + "shortName": "get_test_case_result" }, + "description": "Sample for GetTestCaseResult", "file": "dialogflow_v3_generated_test_cases_get_test_case_result_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_GetTestCaseResult_sync", "segments": [ { @@ -6544,19 +11893,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_get_test_case_result_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient.get_test_case", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.GetTestCase", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "GetTestCase" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetTestCaseRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.TestCase", + "shortName": "get_test_case" }, + "description": "Sample for GetTestCase", "file": "dialogflow_v3_generated_test_cases_get_test_case_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_GetTestCase_async", "segments": [ { @@ -6589,18 +11974,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_get_test_case_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient.get_test_case", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.GetTestCase", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "GetTestCase" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetTestCaseRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.TestCase", + "shortName": "get_test_case" }, + "description": "Sample for GetTestCase", "file": "dialogflow_v3_generated_test_cases_get_test_case_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_GetTestCase_sync", "segments": [ { @@ -6633,19 +12054,51 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_get_test_case_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient.import_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.ImportTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "ImportTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ImportTestCasesRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "import_test_cases" }, + "description": "Sample for ImportTestCases", "file": "dialogflow_v3_generated_test_cases_import_test_cases_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_ImportTestCases_async", "segments": [ { @@ -6678,18 +12131,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_import_test_cases_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient.import_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.ImportTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "ImportTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ImportTestCasesRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "import_test_cases" }, + "description": "Sample for ImportTestCases", "file": "dialogflow_v3_generated_test_cases_import_test_cases_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_ImportTestCases_sync", "segments": [ { @@ -6722,19 +12207,55 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_import_test_cases_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient.list_test_case_results", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.ListTestCaseResults", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "ListTestCaseResults" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListTestCaseResultsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.test_cases.pagers.ListTestCaseResultsAsyncPager", + "shortName": "list_test_case_results" }, + "description": "Sample for ListTestCaseResults", "file": "dialogflow_v3_generated_test_cases_list_test_case_results_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_ListTestCaseResults_async", "segments": [ { @@ -6767,18 +12288,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_list_test_case_results_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient.list_test_case_results", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.ListTestCaseResults", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "ListTestCaseResults" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListTestCaseResultsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.test_cases.pagers.ListTestCaseResultsPager", + "shortName": "list_test_case_results" }, + "description": "Sample for ListTestCaseResults", "file": "dialogflow_v3_generated_test_cases_list_test_case_results_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_ListTestCaseResults_sync", "segments": [ { @@ -6811,19 +12368,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_list_test_case_results_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient.list_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.ListTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "ListTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListTestCasesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.test_cases.pagers.ListTestCasesAsyncPager", + "shortName": "list_test_cases" }, + "description": "Sample for ListTestCases", "file": "dialogflow_v3_generated_test_cases_list_test_cases_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_ListTestCases_async", "segments": [ { @@ -6856,18 +12449,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_list_test_cases_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient.list_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.ListTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "ListTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListTestCasesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.test_cases.pagers.ListTestCasesPager", + "shortName": "list_test_cases" }, + "description": "Sample for ListTestCases", "file": "dialogflow_v3_generated_test_cases_list_test_cases_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_ListTestCases_sync", "segments": [ { @@ -6900,19 +12529,51 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_list_test_cases_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient.run_test_case", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.RunTestCase", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "RunTestCase" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.RunTestCaseRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "run_test_case" }, + "description": "Sample for RunTestCase", "file": "dialogflow_v3_generated_test_cases_run_test_case_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_RunTestCase_async", "segments": [ { @@ -6945,18 +12606,50 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_run_test_case_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient.run_test_case", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.RunTestCase", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "RunTestCase" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.RunTestCaseRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "run_test_case" }, + "description": "Sample for RunTestCase", "file": "dialogflow_v3_generated_test_cases_run_test_case_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_RunTestCase_sync", "segments": [ { @@ -6989,19 +12682,59 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_run_test_case_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesAsyncClient.update_test_case", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.UpdateTestCase", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "UpdateTestCase" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateTestCaseRequest" + }, + { + "name": "test_case", + "type": "google.cloud.dialogflowcx_v3.types.TestCase" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.TestCase", + "shortName": "update_test_case" }, + "description": "Sample for UpdateTestCase", "file": "dialogflow_v3_generated_test_cases_update_test_case_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_UpdateTestCase_async", "segments": [ { @@ -7034,18 +12767,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_update_test_case_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TestCasesClient.update_test_case", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases.UpdateTestCase", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TestCases", "shortName": "TestCases" }, "shortName": "UpdateTestCase" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateTestCaseRequest" + }, + { + "name": "test_case", + "type": "google.cloud.dialogflowcx_v3.types.TestCase" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.TestCase", + "shortName": "update_test_case" }, + "description": "Sample for UpdateTestCase", "file": "dialogflow_v3_generated_test_cases_update_test_case_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TestCases_UpdateTestCase_sync", "segments": [ { @@ -7078,19 +12851,59 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_test_cases_update_test_case_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsAsyncClient", + "shortName": "TransitionRouteGroupsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsAsyncClient.create_transition_route_group", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups.CreateTransitionRouteGroup", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "CreateTransitionRouteGroup" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateTransitionRouteGroupRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "transition_route_group", + "type": "google.cloud.dialogflowcx_v3.types.TransitionRouteGroup" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.TransitionRouteGroup", + "shortName": "create_transition_route_group" }, + "description": "Sample for CreateTransitionRouteGroup", "file": "dialogflow_v3_generated_transition_route_groups_create_transition_route_group_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TransitionRouteGroups_CreateTransitionRouteGroup_async", "segments": [ { @@ -7123,18 +12936,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_transition_route_groups_create_transition_route_group_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsClient", + "shortName": "TransitionRouteGroupsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsClient.create_transition_route_group", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups.CreateTransitionRouteGroup", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "CreateTransitionRouteGroup" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateTransitionRouteGroupRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "transition_route_group", + "type": "google.cloud.dialogflowcx_v3.types.TransitionRouteGroup" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.TransitionRouteGroup", + "shortName": "create_transition_route_group" }, + "description": "Sample for CreateTransitionRouteGroup", "file": "dialogflow_v3_generated_transition_route_groups_create_transition_route_group_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TransitionRouteGroups_CreateTransitionRouteGroup_sync", "segments": [ { @@ -7167,19 +13020,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_transition_route_groups_create_transition_route_group_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsAsyncClient", + "shortName": "TransitionRouteGroupsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsAsyncClient.delete_transition_route_group", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups.DeleteTransitionRouteGroup", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "DeleteTransitionRouteGroup" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteTransitionRouteGroupRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_transition_route_group" }, + "description": "Sample for DeleteTransitionRouteGroup", "file": "dialogflow_v3_generated_transition_route_groups_delete_transition_route_group_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TransitionRouteGroups_DeleteTransitionRouteGroup_async", "segments": [ { @@ -7210,18 +13098,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_transition_route_groups_delete_transition_route_group_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsClient", + "shortName": "TransitionRouteGroupsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsClient.delete_transition_route_group", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups.DeleteTransitionRouteGroup", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "DeleteTransitionRouteGroup" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteTransitionRouteGroupRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_transition_route_group" }, + "description": "Sample for DeleteTransitionRouteGroup", "file": "dialogflow_v3_generated_transition_route_groups_delete_transition_route_group_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TransitionRouteGroups_DeleteTransitionRouteGroup_sync", "segments": [ { @@ -7252,19 +13175,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_transition_route_groups_delete_transition_route_group_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsAsyncClient", + "shortName": "TransitionRouteGroupsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsAsyncClient.get_transition_route_group", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups.GetTransitionRouteGroup", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "GetTransitionRouteGroup" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetTransitionRouteGroupRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.TransitionRouteGroup", + "shortName": "get_transition_route_group" }, + "description": "Sample for GetTransitionRouteGroup", "file": "dialogflow_v3_generated_transition_route_groups_get_transition_route_group_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TransitionRouteGroups_GetTransitionRouteGroup_async", "segments": [ { @@ -7297,18 +13256,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_transition_route_groups_get_transition_route_group_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsClient", + "shortName": "TransitionRouteGroupsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsClient.get_transition_route_group", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups.GetTransitionRouteGroup", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "GetTransitionRouteGroup" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetTransitionRouteGroupRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.TransitionRouteGroup", + "shortName": "get_transition_route_group" }, + "description": "Sample for GetTransitionRouteGroup", "file": "dialogflow_v3_generated_transition_route_groups_get_transition_route_group_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TransitionRouteGroups_GetTransitionRouteGroup_sync", "segments": [ { @@ -7341,19 +13336,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_transition_route_groups_get_transition_route_group_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsAsyncClient", + "shortName": "TransitionRouteGroupsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsAsyncClient.list_transition_route_groups", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups.ListTransitionRouteGroups", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "ListTransitionRouteGroups" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListTransitionRouteGroupsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.transition_route_groups.pagers.ListTransitionRouteGroupsAsyncPager", + "shortName": "list_transition_route_groups" }, + "description": "Sample for ListTransitionRouteGroups", "file": "dialogflow_v3_generated_transition_route_groups_list_transition_route_groups_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TransitionRouteGroups_ListTransitionRouteGroups_async", "segments": [ { @@ -7386,18 +13417,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_transition_route_groups_list_transition_route_groups_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsClient", + "shortName": "TransitionRouteGroupsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsClient.list_transition_route_groups", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups.ListTransitionRouteGroups", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "ListTransitionRouteGroups" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListTransitionRouteGroupsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.transition_route_groups.pagers.ListTransitionRouteGroupsPager", + "shortName": "list_transition_route_groups" }, + "description": "Sample for ListTransitionRouteGroups", "file": "dialogflow_v3_generated_transition_route_groups_list_transition_route_groups_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TransitionRouteGroups_ListTransitionRouteGroups_sync", "segments": [ { @@ -7430,19 +13497,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_transition_route_groups_list_transition_route_groups_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsAsyncClient", + "shortName": "TransitionRouteGroupsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsAsyncClient.update_transition_route_group", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups.UpdateTransitionRouteGroup", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "UpdateTransitionRouteGroup" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateTransitionRouteGroupRequest" + }, + { + "name": "transition_route_group", + "type": "google.cloud.dialogflowcx_v3.types.TransitionRouteGroup" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.TransitionRouteGroup", + "shortName": "update_transition_route_group" }, + "description": "Sample for UpdateTransitionRouteGroup", "file": "dialogflow_v3_generated_transition_route_groups_update_transition_route_group_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TransitionRouteGroups_UpdateTransitionRouteGroup_async", "segments": [ { @@ -7475,18 +13582,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_transition_route_groups_update_transition_route_group_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsClient", + "shortName": "TransitionRouteGroupsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.TransitionRouteGroupsClient.update_transition_route_group", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups.UpdateTransitionRouteGroup", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "UpdateTransitionRouteGroup" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateTransitionRouteGroupRequest" + }, + { + "name": "transition_route_group", + "type": "google.cloud.dialogflowcx_v3.types.TransitionRouteGroup" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.TransitionRouteGroup", + "shortName": "update_transition_route_group" }, + "description": "Sample for UpdateTransitionRouteGroup", "file": "dialogflow_v3_generated_transition_route_groups_update_transition_route_group_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_TransitionRouteGroups_UpdateTransitionRouteGroup_sync", "segments": [ { @@ -7519,19 +13666,55 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_transition_route_groups_update_transition_route_group_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.VersionsAsyncClient", + "shortName": "VersionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.VersionsAsyncClient.compare_versions", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions.CompareVersions", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions", "shortName": "Versions" }, "shortName": "CompareVersions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CompareVersionsRequest" + }, + { + "name": "base_version", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.CompareVersionsResponse", + "shortName": "compare_versions" }, + "description": "Sample for CompareVersions", "file": "dialogflow_v3_generated_versions_compare_versions_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Versions_CompareVersions_async", "segments": [ { @@ -7564,18 +13747,54 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_versions_compare_versions_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.VersionsClient", + "shortName": "VersionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.VersionsClient.compare_versions", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions.CompareVersions", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions", "shortName": "Versions" }, "shortName": "CompareVersions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CompareVersionsRequest" + }, + { + "name": "base_version", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.CompareVersionsResponse", + "shortName": "compare_versions" }, + "description": "Sample for CompareVersions", "file": "dialogflow_v3_generated_versions_compare_versions_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Versions_CompareVersions_sync", "segments": [ { @@ -7608,19 +13827,59 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_versions_compare_versions_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.VersionsAsyncClient", + "shortName": "VersionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.VersionsAsyncClient.create_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions.CreateVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions", "shortName": "Versions" }, "shortName": "CreateVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateVersionRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "version", + "type": "google.cloud.dialogflowcx_v3.types.Version" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_version" }, + "description": "Sample for CreateVersion", "file": "dialogflow_v3_generated_versions_create_version_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Versions_CreateVersion_async", "segments": [ { @@ -7653,18 +13912,58 @@ "start": 50, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_versions_create_version_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.VersionsClient", + "shortName": "VersionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.VersionsClient.create_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions.CreateVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions", "shortName": "Versions" }, "shortName": "CreateVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateVersionRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "version", + "type": "google.cloud.dialogflowcx_v3.types.Version" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_version" }, + "description": "Sample for CreateVersion", "file": "dialogflow_v3_generated_versions_create_version_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Versions_CreateVersion_sync", "segments": [ { @@ -7697,19 +13996,54 @@ "start": 50, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_versions_create_version_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.VersionsAsyncClient", + "shortName": "VersionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.VersionsAsyncClient.delete_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions.DeleteVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions", "shortName": "Versions" }, "shortName": "DeleteVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_version" }, + "description": "Sample for DeleteVersion", "file": "dialogflow_v3_generated_versions_delete_version_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Versions_DeleteVersion_async", "segments": [ { @@ -7740,18 +14074,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_versions_delete_version_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.VersionsClient", + "shortName": "VersionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.VersionsClient.delete_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions.DeleteVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions", "shortName": "Versions" }, "shortName": "DeleteVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_version" }, + "description": "Sample for DeleteVersion", "file": "dialogflow_v3_generated_versions_delete_version_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Versions_DeleteVersion_sync", "segments": [ { @@ -7782,19 +14151,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_versions_delete_version_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.VersionsAsyncClient", + "shortName": "VersionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.VersionsAsyncClient.get_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions.GetVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions", "shortName": "Versions" }, "shortName": "GetVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Version", + "shortName": "get_version" }, + "description": "Sample for GetVersion", "file": "dialogflow_v3_generated_versions_get_version_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Versions_GetVersion_async", "segments": [ { @@ -7827,18 +14232,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_versions_get_version_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.VersionsClient", + "shortName": "VersionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.VersionsClient.get_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions.GetVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions", "shortName": "Versions" }, "shortName": "GetVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Version", + "shortName": "get_version" }, + "description": "Sample for GetVersion", "file": "dialogflow_v3_generated_versions_get_version_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Versions_GetVersion_sync", "segments": [ { @@ -7871,19 +14312,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_versions_get_version_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.VersionsAsyncClient", + "shortName": "VersionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.VersionsAsyncClient.list_versions", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions.ListVersions", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions", "shortName": "Versions" }, "shortName": "ListVersions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListVersionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.versions.pagers.ListVersionsAsyncPager", + "shortName": "list_versions" }, + "description": "Sample for ListVersions", "file": "dialogflow_v3_generated_versions_list_versions_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Versions_ListVersions_async", "segments": [ { @@ -7916,18 +14393,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_versions_list_versions_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.VersionsClient", + "shortName": "VersionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.VersionsClient.list_versions", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions.ListVersions", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions", "shortName": "Versions" }, "shortName": "ListVersions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListVersionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.versions.pagers.ListVersionsPager", + "shortName": "list_versions" }, + "description": "Sample for ListVersions", "file": "dialogflow_v3_generated_versions_list_versions_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Versions_ListVersions_sync", "segments": [ { @@ -7960,19 +14473,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_versions_list_versions_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.VersionsAsyncClient", + "shortName": "VersionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.VersionsAsyncClient.load_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions.LoadVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions", "shortName": "Versions" }, "shortName": "LoadVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.LoadVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "load_version" }, + "description": "Sample for LoadVersion", "file": "dialogflow_v3_generated_versions_load_version_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Versions_LoadVersion_async", "segments": [ { @@ -8005,18 +14554,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_versions_load_version_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.VersionsClient", + "shortName": "VersionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.VersionsClient.load_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions.LoadVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions", "shortName": "Versions" }, "shortName": "LoadVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.LoadVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "load_version" }, + "description": "Sample for LoadVersion", "file": "dialogflow_v3_generated_versions_load_version_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Versions_LoadVersion_sync", "segments": [ { @@ -8049,19 +14634,59 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_versions_load_version_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.VersionsAsyncClient", + "shortName": "VersionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.VersionsAsyncClient.update_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions.UpdateVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions", "shortName": "Versions" }, "shortName": "UpdateVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateVersionRequest" + }, + { + "name": "version", + "type": "google.cloud.dialogflowcx_v3.types.Version" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Version", + "shortName": "update_version" }, + "description": "Sample for UpdateVersion", "file": "dialogflow_v3_generated_versions_update_version_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Versions_UpdateVersion_async", "segments": [ { @@ -8094,18 +14719,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_versions_update_version_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.VersionsClient", + "shortName": "VersionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.VersionsClient.update_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions.UpdateVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Versions", "shortName": "Versions" }, "shortName": "UpdateVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateVersionRequest" + }, + { + "name": "version", + "type": "google.cloud.dialogflowcx_v3.types.Version" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Version", + "shortName": "update_version" }, + "description": "Sample for UpdateVersion", "file": "dialogflow_v3_generated_versions_update_version_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Versions_UpdateVersion_sync", "segments": [ { @@ -8138,19 +14803,59 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_versions_update_version_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.WebhooksAsyncClient", + "shortName": "WebhooksAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.WebhooksAsyncClient.create_webhook", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks.CreateWebhook", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks", "shortName": "Webhooks" }, "shortName": "CreateWebhook" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateWebhookRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "webhook", + "type": "google.cloud.dialogflowcx_v3.types.Webhook" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Webhook", + "shortName": "create_webhook" }, + "description": "Sample for CreateWebhook", "file": "dialogflow_v3_generated_webhooks_create_webhook_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Webhooks_CreateWebhook_async", "segments": [ { @@ -8183,18 +14888,58 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_webhooks_create_webhook_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.WebhooksClient", + "shortName": "WebhooksClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.WebhooksClient.create_webhook", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks.CreateWebhook", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks", "shortName": "Webhooks" }, "shortName": "CreateWebhook" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.CreateWebhookRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "webhook", + "type": "google.cloud.dialogflowcx_v3.types.Webhook" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Webhook", + "shortName": "create_webhook" }, + "description": "Sample for CreateWebhook", "file": "dialogflow_v3_generated_webhooks_create_webhook_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Webhooks_CreateWebhook_sync", "segments": [ { @@ -8227,19 +14972,54 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_webhooks_create_webhook_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.WebhooksAsyncClient", + "shortName": "WebhooksAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.WebhooksAsyncClient.delete_webhook", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks.DeleteWebhook", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks", "shortName": "Webhooks" }, "shortName": "DeleteWebhook" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteWebhookRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_webhook" }, + "description": "Sample for DeleteWebhook", "file": "dialogflow_v3_generated_webhooks_delete_webhook_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Webhooks_DeleteWebhook_async", "segments": [ { @@ -8270,18 +15050,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_webhooks_delete_webhook_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.WebhooksClient", + "shortName": "WebhooksClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.WebhooksClient.delete_webhook", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks.DeleteWebhook", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks", "shortName": "Webhooks" }, "shortName": "DeleteWebhook" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.DeleteWebhookRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_webhook" }, + "description": "Sample for DeleteWebhook", "file": "dialogflow_v3_generated_webhooks_delete_webhook_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Webhooks_DeleteWebhook_sync", "segments": [ { @@ -8312,19 +15127,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_webhooks_delete_webhook_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.WebhooksAsyncClient", + "shortName": "WebhooksAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.WebhooksAsyncClient.get_webhook", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks.GetWebhook", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks", "shortName": "Webhooks" }, "shortName": "GetWebhook" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetWebhookRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Webhook", + "shortName": "get_webhook" }, + "description": "Sample for GetWebhook", "file": "dialogflow_v3_generated_webhooks_get_webhook_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Webhooks_GetWebhook_async", "segments": [ { @@ -8357,18 +15208,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_webhooks_get_webhook_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.WebhooksClient", + "shortName": "WebhooksClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.WebhooksClient.get_webhook", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks.GetWebhook", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks", "shortName": "Webhooks" }, "shortName": "GetWebhook" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.GetWebhookRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Webhook", + "shortName": "get_webhook" }, + "description": "Sample for GetWebhook", "file": "dialogflow_v3_generated_webhooks_get_webhook_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Webhooks_GetWebhook_sync", "segments": [ { @@ -8401,19 +15288,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_webhooks_get_webhook_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.WebhooksAsyncClient", + "shortName": "WebhooksAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.WebhooksAsyncClient.list_webhooks", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks.ListWebhooks", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks", "shortName": "Webhooks" }, "shortName": "ListWebhooks" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListWebhooksRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.webhooks.pagers.ListWebhooksAsyncPager", + "shortName": "list_webhooks" }, + "description": "Sample for ListWebhooks", "file": "dialogflow_v3_generated_webhooks_list_webhooks_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Webhooks_ListWebhooks_async", "segments": [ { @@ -8446,18 +15369,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_webhooks_list_webhooks_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.WebhooksClient", + "shortName": "WebhooksClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.WebhooksClient.list_webhooks", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks.ListWebhooks", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks", "shortName": "Webhooks" }, "shortName": "ListWebhooks" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.ListWebhooksRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.services.webhooks.pagers.ListWebhooksPager", + "shortName": "list_webhooks" }, + "description": "Sample for ListWebhooks", "file": "dialogflow_v3_generated_webhooks_list_webhooks_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Webhooks_ListWebhooks_sync", "segments": [ { @@ -8490,19 +15449,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_webhooks_list_webhooks_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3.WebhooksAsyncClient", + "shortName": "WebhooksAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.WebhooksAsyncClient.update_webhook", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks.UpdateWebhook", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks", "shortName": "Webhooks" }, "shortName": "UpdateWebhook" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateWebhookRequest" + }, + { + "name": "webhook", + "type": "google.cloud.dialogflowcx_v3.types.Webhook" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Webhook", + "shortName": "update_webhook" }, + "description": "Sample for UpdateWebhook", "file": "dialogflow_v3_generated_webhooks_update_webhook_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Webhooks_UpdateWebhook_async", "segments": [ { @@ -8535,18 +15534,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_webhooks_update_webhook_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3.WebhooksClient", + "shortName": "WebhooksClient" + }, + "fullName": "google.cloud.dialogflowcx_v3.WebhooksClient.update_webhook", "method": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks.UpdateWebhook", "service": { + "fullName": "google.cloud.dialogflow.cx.v3.Webhooks", "shortName": "Webhooks" }, "shortName": "UpdateWebhook" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3.types.UpdateWebhookRequest" + }, + { + "name": "webhook", + "type": "google.cloud.dialogflowcx_v3.types.Webhook" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3.types.Webhook", + "shortName": "update_webhook" }, + "description": "Sample for UpdateWebhook", "file": "dialogflow_v3_generated_webhooks_update_webhook_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3_generated_Webhooks_UpdateWebhook_sync", "segments": [ { @@ -8579,7 +15618,8 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3_generated_webhooks_update_webhook_sync.py" } ] } diff --git a/samples/generated_samples/snippet_metadata_dialogflowcx_v3beta1.json b/samples/generated_samples/snippet_metadata_dialogflowcx_v3beta1.json index 7a70c416..f00da433 100644 --- a/samples/generated_samples/snippet_metadata_dialogflowcx_v3beta1.json +++ b/samples/generated_samples/snippet_metadata_dialogflowcx_v3beta1.json @@ -1,16 +1,65 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.dialogflow.cx.v3beta1", + "version": "v3beta1" + } + ], + "language": "PYTHON", + "name": "google-cloud-dialogflowcx" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient.create_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.CreateAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "CreateAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateAgentRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "agent", + "type": "google.cloud.dialogflowcx_v3beta1.types.Agent" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Agent", + "shortName": "create_agent" }, + "description": "Sample for CreateAgent", "file": "dialogflow_v3beta1_generated_agents_create_agent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_CreateAgent_async", "segments": [ { @@ -43,18 +92,58 @@ "start": 48, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_create_agent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient.create_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.CreateAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "CreateAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateAgentRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "agent", + "type": "google.cloud.dialogflowcx_v3beta1.types.Agent" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Agent", + "shortName": "create_agent" }, + "description": "Sample for CreateAgent", "file": "dialogflow_v3beta1_generated_agents_create_agent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_CreateAgent_sync", "segments": [ { @@ -87,19 +176,54 @@ "start": 48, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_create_agent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient.delete_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.DeleteAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "DeleteAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteAgentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_agent" }, + "description": "Sample for DeleteAgent", "file": "dialogflow_v3beta1_generated_agents_delete_agent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_DeleteAgent_async", "segments": [ { @@ -130,18 +254,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_delete_agent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient.delete_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.DeleteAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "DeleteAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteAgentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_agent" }, + "description": "Sample for DeleteAgent", "file": "dialogflow_v3beta1_generated_agents_delete_agent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_DeleteAgent_sync", "segments": [ { @@ -172,19 +331,51 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_delete_agent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient.export_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.ExportAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "ExportAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ExportAgentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "export_agent" }, + "description": "Sample for ExportAgent", "file": "dialogflow_v3beta1_generated_agents_export_agent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_ExportAgent_async", "segments": [ { @@ -217,18 +408,50 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_export_agent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient.export_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.ExportAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "ExportAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ExportAgentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "export_agent" }, + "description": "Sample for ExportAgent", "file": "dialogflow_v3beta1_generated_agents_export_agent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_ExportAgent_sync", "segments": [ { @@ -261,19 +484,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_export_agent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient.get_agent_validation_result", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.GetAgentValidationResult", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "GetAgentValidationResult" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetAgentValidationResultRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.AgentValidationResult", + "shortName": "get_agent_validation_result" }, + "description": "Sample for GetAgentValidationResult", "file": "dialogflow_v3beta1_generated_agents_get_agent_validation_result_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_GetAgentValidationResult_async", "segments": [ { @@ -306,18 +565,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_get_agent_validation_result_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient.get_agent_validation_result", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.GetAgentValidationResult", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "GetAgentValidationResult" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetAgentValidationResultRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.AgentValidationResult", + "shortName": "get_agent_validation_result" }, + "description": "Sample for GetAgentValidationResult", "file": "dialogflow_v3beta1_generated_agents_get_agent_validation_result_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_GetAgentValidationResult_sync", "segments": [ { @@ -350,19 +645,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_get_agent_validation_result_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient.get_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.GetAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "GetAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetAgentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Agent", + "shortName": "get_agent" }, + "description": "Sample for GetAgent", "file": "dialogflow_v3beta1_generated_agents_get_agent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_GetAgent_async", "segments": [ { @@ -395,18 +726,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_get_agent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient.get_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.GetAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "GetAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetAgentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Agent", + "shortName": "get_agent" }, + "description": "Sample for GetAgent", "file": "dialogflow_v3beta1_generated_agents_get_agent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_GetAgent_sync", "segments": [ { @@ -439,19 +806,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_get_agent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient.list_agents", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.ListAgents", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "ListAgents" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListAgentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.agents.pagers.ListAgentsAsyncPager", + "shortName": "list_agents" }, + "description": "Sample for ListAgents", "file": "dialogflow_v3beta1_generated_agents_list_agents_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_ListAgents_async", "segments": [ { @@ -484,18 +887,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_list_agents_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient.list_agents", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.ListAgents", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "ListAgents" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListAgentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.agents.pagers.ListAgentsPager", + "shortName": "list_agents" }, + "description": "Sample for ListAgents", "file": "dialogflow_v3beta1_generated_agents_list_agents_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_ListAgents_sync", "segments": [ { @@ -528,19 +967,51 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_list_agents_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient.restore_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.RestoreAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "RestoreAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.RestoreAgentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "restore_agent" }, + "description": "Sample for RestoreAgent", "file": "dialogflow_v3beta1_generated_agents_restore_agent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_RestoreAgent_async", "segments": [ { @@ -573,18 +1044,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_restore_agent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient.restore_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.RestoreAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "RestoreAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.RestoreAgentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "restore_agent" }, + "description": "Sample for RestoreAgent", "file": "dialogflow_v3beta1_generated_agents_restore_agent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_RestoreAgent_sync", "segments": [ { @@ -617,19 +1120,59 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_restore_agent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient.update_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.UpdateAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "UpdateAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateAgentRequest" + }, + { + "name": "agent", + "type": "google.cloud.dialogflowcx_v3beta1.types.Agent" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Agent", + "shortName": "update_agent" }, + "description": "Sample for UpdateAgent", "file": "dialogflow_v3beta1_generated_agents_update_agent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_UpdateAgent_async", "segments": [ { @@ -662,18 +1205,58 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_update_agent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient.update_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.UpdateAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "UpdateAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateAgentRequest" + }, + { + "name": "agent", + "type": "google.cloud.dialogflowcx_v3beta1.types.Agent" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Agent", + "shortName": "update_agent" }, + "description": "Sample for UpdateAgent", "file": "dialogflow_v3beta1_generated_agents_update_agent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_UpdateAgent_sync", "segments": [ { @@ -706,19 +1289,51 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_update_agent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient", + "shortName": "AgentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsAsyncClient.validate_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.ValidateAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "ValidateAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ValidateAgentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.AgentValidationResult", + "shortName": "validate_agent" }, + "description": "Sample for ValidateAgent", "file": "dialogflow_v3beta1_generated_agents_validate_agent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_ValidateAgent_async", "segments": [ { @@ -751,18 +1366,50 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_validate_agent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient", + "shortName": "AgentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.AgentsClient.validate_agent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents.ValidateAgent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Agents", "shortName": "Agents" }, "shortName": "ValidateAgent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ValidateAgentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.AgentValidationResult", + "shortName": "validate_agent" }, + "description": "Sample for ValidateAgent", "file": "dialogflow_v3beta1_generated_agents_validate_agent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Agents_ValidateAgent_sync", "segments": [ { @@ -795,19 +1442,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_agents_validate_agent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ChangelogsAsyncClient", + "shortName": "ChangelogsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ChangelogsAsyncClient.get_changelog", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Changelogs.GetChangelog", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Changelogs", "shortName": "Changelogs" }, "shortName": "GetChangelog" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetChangelogRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Changelog", + "shortName": "get_changelog" }, + "description": "Sample for GetChangelog", "file": "dialogflow_v3beta1_generated_changelogs_get_changelog_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Changelogs_GetChangelog_async", "segments": [ { @@ -840,18 +1523,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_changelogs_get_changelog_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ChangelogsClient", + "shortName": "ChangelogsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ChangelogsClient.get_changelog", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Changelogs.GetChangelog", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Changelogs", "shortName": "Changelogs" }, "shortName": "GetChangelog" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetChangelogRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Changelog", + "shortName": "get_changelog" }, + "description": "Sample for GetChangelog", "file": "dialogflow_v3beta1_generated_changelogs_get_changelog_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Changelogs_GetChangelog_sync", "segments": [ { @@ -884,19 +1603,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_changelogs_get_changelog_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ChangelogsAsyncClient", + "shortName": "ChangelogsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ChangelogsAsyncClient.list_changelogs", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Changelogs.ListChangelogs", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Changelogs", "shortName": "Changelogs" }, "shortName": "ListChangelogs" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListChangelogsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.changelogs.pagers.ListChangelogsAsyncPager", + "shortName": "list_changelogs" }, + "description": "Sample for ListChangelogs", "file": "dialogflow_v3beta1_generated_changelogs_list_changelogs_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Changelogs_ListChangelogs_async", "segments": [ { @@ -929,18 +1684,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_changelogs_list_changelogs_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ChangelogsClient", + "shortName": "ChangelogsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ChangelogsClient.list_changelogs", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Changelogs.ListChangelogs", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Changelogs", "shortName": "Changelogs" }, "shortName": "ListChangelogs" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListChangelogsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.changelogs.pagers.ListChangelogsPager", + "shortName": "list_changelogs" }, + "description": "Sample for ListChangelogs", "file": "dialogflow_v3beta1_generated_changelogs_list_changelogs_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Changelogs_ListChangelogs_sync", "segments": [ { @@ -973,19 +1764,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_changelogs_list_changelogs_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.DeploymentsAsyncClient", + "shortName": "DeploymentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.DeploymentsAsyncClient.get_deployment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Deployments.GetDeployment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Deployments", "shortName": "Deployments" }, "shortName": "GetDeployment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetDeploymentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Deployment", + "shortName": "get_deployment" }, + "description": "Sample for GetDeployment", "file": "dialogflow_v3beta1_generated_deployments_get_deployment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Deployments_GetDeployment_async", "segments": [ { @@ -1018,18 +1845,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_deployments_get_deployment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.DeploymentsClient", + "shortName": "DeploymentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.DeploymentsClient.get_deployment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Deployments.GetDeployment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Deployments", "shortName": "Deployments" }, "shortName": "GetDeployment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetDeploymentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Deployment", + "shortName": "get_deployment" }, + "description": "Sample for GetDeployment", "file": "dialogflow_v3beta1_generated_deployments_get_deployment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Deployments_GetDeployment_sync", "segments": [ { @@ -1062,19 +1925,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_deployments_get_deployment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.DeploymentsAsyncClient", + "shortName": "DeploymentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.DeploymentsAsyncClient.list_deployments", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Deployments.ListDeployments", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Deployments", "shortName": "Deployments" }, "shortName": "ListDeployments" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListDeploymentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.deployments.pagers.ListDeploymentsAsyncPager", + "shortName": "list_deployments" }, + "description": "Sample for ListDeployments", "file": "dialogflow_v3beta1_generated_deployments_list_deployments_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Deployments_ListDeployments_async", "segments": [ { @@ -1107,18 +2006,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_deployments_list_deployments_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.DeploymentsClient", + "shortName": "DeploymentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.DeploymentsClient.list_deployments", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Deployments.ListDeployments", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Deployments", "shortName": "Deployments" }, "shortName": "ListDeployments" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListDeploymentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.deployments.pagers.ListDeploymentsPager", + "shortName": "list_deployments" }, + "description": "Sample for ListDeployments", "file": "dialogflow_v3beta1_generated_deployments_list_deployments_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Deployments_ListDeployments_sync", "segments": [ { @@ -1151,19 +2086,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_deployments_list_deployments_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesAsyncClient", + "shortName": "EntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesAsyncClient.create_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes.CreateEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes", "shortName": "EntityTypes" }, "shortName": "CreateEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateEntityTypeRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "entity_type", + "type": "google.cloud.dialogflowcx_v3beta1.types.EntityType" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.EntityType", + "shortName": "create_entity_type" }, + "description": "Sample for CreateEntityType", "file": "dialogflow_v3beta1_generated_entity_types_create_entity_type_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_EntityTypes_CreateEntityType_async", "segments": [ { @@ -1196,18 +2171,58 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_entity_types_create_entity_type_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesClient", + "shortName": "EntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesClient.create_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes.CreateEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes", "shortName": "EntityTypes" }, "shortName": "CreateEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateEntityTypeRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "entity_type", + "type": "google.cloud.dialogflowcx_v3beta1.types.EntityType" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.EntityType", + "shortName": "create_entity_type" }, + "description": "Sample for CreateEntityType", "file": "dialogflow_v3beta1_generated_entity_types_create_entity_type_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_EntityTypes_CreateEntityType_sync", "segments": [ { @@ -1240,19 +2255,54 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_entity_types_create_entity_type_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesAsyncClient", + "shortName": "EntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesAsyncClient.delete_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes.DeleteEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes", "shortName": "EntityTypes" }, "shortName": "DeleteEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteEntityTypeRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_entity_type" }, + "description": "Sample for DeleteEntityType", "file": "dialogflow_v3beta1_generated_entity_types_delete_entity_type_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_EntityTypes_DeleteEntityType_async", "segments": [ { @@ -1283,18 +2333,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_entity_types_delete_entity_type_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesClient", + "shortName": "EntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesClient.delete_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes.DeleteEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes", "shortName": "EntityTypes" }, "shortName": "DeleteEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteEntityTypeRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_entity_type" }, + "description": "Sample for DeleteEntityType", "file": "dialogflow_v3beta1_generated_entity_types_delete_entity_type_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_EntityTypes_DeleteEntityType_sync", "segments": [ { @@ -1325,19 +2410,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_entity_types_delete_entity_type_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesAsyncClient", + "shortName": "EntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesAsyncClient.get_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes.GetEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes", "shortName": "EntityTypes" }, "shortName": "GetEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetEntityTypeRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.EntityType", + "shortName": "get_entity_type" }, + "description": "Sample for GetEntityType", "file": "dialogflow_v3beta1_generated_entity_types_get_entity_type_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_EntityTypes_GetEntityType_async", "segments": [ { @@ -1370,18 +2491,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_entity_types_get_entity_type_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesClient", + "shortName": "EntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesClient.get_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes.GetEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes", "shortName": "EntityTypes" }, "shortName": "GetEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetEntityTypeRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.EntityType", + "shortName": "get_entity_type" }, + "description": "Sample for GetEntityType", "file": "dialogflow_v3beta1_generated_entity_types_get_entity_type_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_EntityTypes_GetEntityType_sync", "segments": [ { @@ -1414,19 +2571,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_entity_types_get_entity_type_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesAsyncClient", + "shortName": "EntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesAsyncClient.list_entity_types", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes.ListEntityTypes", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes", "shortName": "EntityTypes" }, "shortName": "ListEntityTypes" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListEntityTypesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.entity_types.pagers.ListEntityTypesAsyncPager", + "shortName": "list_entity_types" }, + "description": "Sample for ListEntityTypes", "file": "dialogflow_v3beta1_generated_entity_types_list_entity_types_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_EntityTypes_ListEntityTypes_async", "segments": [ { @@ -1459,18 +2652,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_entity_types_list_entity_types_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesClient", + "shortName": "EntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesClient.list_entity_types", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes.ListEntityTypes", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes", "shortName": "EntityTypes" }, "shortName": "ListEntityTypes" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListEntityTypesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.entity_types.pagers.ListEntityTypesPager", + "shortName": "list_entity_types" }, + "description": "Sample for ListEntityTypes", "file": "dialogflow_v3beta1_generated_entity_types_list_entity_types_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_EntityTypes_ListEntityTypes_sync", "segments": [ { @@ -1503,19 +2732,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_entity_types_list_entity_types_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesAsyncClient", + "shortName": "EntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesAsyncClient.update_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes.UpdateEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes", "shortName": "EntityTypes" }, "shortName": "UpdateEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateEntityTypeRequest" + }, + { + "name": "entity_type", + "type": "google.cloud.dialogflowcx_v3beta1.types.EntityType" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.EntityType", + "shortName": "update_entity_type" }, + "description": "Sample for UpdateEntityType", "file": "dialogflow_v3beta1_generated_entity_types_update_entity_type_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_EntityTypes_UpdateEntityType_async", "segments": [ { @@ -1548,18 +2817,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_entity_types_update_entity_type_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesClient", + "shortName": "EntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EntityTypesClient.update_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes.UpdateEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.EntityTypes", "shortName": "EntityTypes" }, "shortName": "UpdateEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateEntityTypeRequest" + }, + { + "name": "entity_type", + "type": "google.cloud.dialogflowcx_v3beta1.types.EntityType" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.EntityType", + "shortName": "update_entity_type" }, + "description": "Sample for UpdateEntityType", "file": "dialogflow_v3beta1_generated_entity_types_update_entity_type_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_EntityTypes_UpdateEntityType_sync", "segments": [ { @@ -1592,19 +2901,59 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_entity_types_update_entity_type_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient.create_environment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.CreateEnvironment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "CreateEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateEnvironmentRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "environment", + "type": "google.cloud.dialogflowcx_v3beta1.types.Environment" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_environment" }, + "description": "Sample for CreateEnvironment", "file": "dialogflow_v3beta1_generated_environments_create_environment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_CreateEnvironment_async", "segments": [ { @@ -1637,18 +2986,58 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_create_environment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient.create_environment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.CreateEnvironment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "CreateEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateEnvironmentRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "environment", + "type": "google.cloud.dialogflowcx_v3beta1.types.Environment" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_environment" }, + "description": "Sample for CreateEnvironment", "file": "dialogflow_v3beta1_generated_environments_create_environment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_CreateEnvironment_sync", "segments": [ { @@ -1681,19 +3070,54 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_create_environment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient.delete_environment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.DeleteEnvironment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "DeleteEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteEnvironmentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_environment" }, + "description": "Sample for DeleteEnvironment", "file": "dialogflow_v3beta1_generated_environments_delete_environment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_DeleteEnvironment_async", "segments": [ { @@ -1724,18 +3148,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_delete_environment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient.delete_environment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.DeleteEnvironment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "DeleteEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteEnvironmentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_environment" }, + "description": "Sample for DeleteEnvironment", "file": "dialogflow_v3beta1_generated_environments_delete_environment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_DeleteEnvironment_sync", "segments": [ { @@ -1766,19 +3225,51 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_delete_environment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient.deploy_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.DeployFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "DeployFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeployFlowRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "deploy_flow" }, + "description": "Sample for DeployFlow", "file": "dialogflow_v3beta1_generated_environments_deploy_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_DeployFlow_async", "segments": [ { @@ -1811,18 +3302,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_deploy_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient.deploy_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.DeployFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "DeployFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeployFlowRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "deploy_flow" }, + "description": "Sample for DeployFlow", "file": "dialogflow_v3beta1_generated_environments_deploy_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_DeployFlow_sync", "segments": [ { @@ -1855,19 +3378,55 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_deploy_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient.get_environment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.GetEnvironment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "GetEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetEnvironmentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Environment", + "shortName": "get_environment" }, + "description": "Sample for GetEnvironment", "file": "dialogflow_v3beta1_generated_environments_get_environment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_GetEnvironment_async", "segments": [ { @@ -1900,18 +3459,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_get_environment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient.get_environment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.GetEnvironment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "GetEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetEnvironmentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Environment", + "shortName": "get_environment" }, + "description": "Sample for GetEnvironment", "file": "dialogflow_v3beta1_generated_environments_get_environment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_GetEnvironment_sync", "segments": [ { @@ -1944,19 +3539,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_get_environment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient.list_continuous_test_results", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.ListContinuousTestResults", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "ListContinuousTestResults" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListContinuousTestResultsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.environments.pagers.ListContinuousTestResultsAsyncPager", + "shortName": "list_continuous_test_results" }, + "description": "Sample for ListContinuousTestResults", "file": "dialogflow_v3beta1_generated_environments_list_continuous_test_results_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_ListContinuousTestResults_async", "segments": [ { @@ -1989,18 +3620,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_list_continuous_test_results_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient.list_continuous_test_results", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.ListContinuousTestResults", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "ListContinuousTestResults" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListContinuousTestResultsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.environments.pagers.ListContinuousTestResultsPager", + "shortName": "list_continuous_test_results" }, + "description": "Sample for ListContinuousTestResults", "file": "dialogflow_v3beta1_generated_environments_list_continuous_test_results_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_ListContinuousTestResults_sync", "segments": [ { @@ -2033,19 +3700,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_list_continuous_test_results_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient.list_environments", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.ListEnvironments", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "ListEnvironments" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListEnvironmentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.environments.pagers.ListEnvironmentsAsyncPager", + "shortName": "list_environments" }, + "description": "Sample for ListEnvironments", "file": "dialogflow_v3beta1_generated_environments_list_environments_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_ListEnvironments_async", "segments": [ { @@ -2078,18 +3781,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_list_environments_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient.list_environments", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.ListEnvironments", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "ListEnvironments" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListEnvironmentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.environments.pagers.ListEnvironmentsPager", + "shortName": "list_environments" }, + "description": "Sample for ListEnvironments", "file": "dialogflow_v3beta1_generated_environments_list_environments_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_ListEnvironments_sync", "segments": [ { @@ -2122,19 +3861,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_list_environments_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient.lookup_environment_history", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.LookupEnvironmentHistory", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "LookupEnvironmentHistory" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.LookupEnvironmentHistoryRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.environments.pagers.LookupEnvironmentHistoryAsyncPager", + "shortName": "lookup_environment_history" }, + "description": "Sample for LookupEnvironmentHistory", "file": "dialogflow_v3beta1_generated_environments_lookup_environment_history_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_LookupEnvironmentHistory_async", "segments": [ { @@ -2167,18 +3942,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_lookup_environment_history_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient.lookup_environment_history", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.LookupEnvironmentHistory", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "LookupEnvironmentHistory" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.LookupEnvironmentHistoryRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.environments.pagers.LookupEnvironmentHistoryPager", + "shortName": "lookup_environment_history" }, + "description": "Sample for LookupEnvironmentHistory", "file": "dialogflow_v3beta1_generated_environments_lookup_environment_history_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_LookupEnvironmentHistory_sync", "segments": [ { @@ -2211,19 +4022,51 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_lookup_environment_history_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient.run_continuous_test", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.RunContinuousTest", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "RunContinuousTest" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.RunContinuousTestRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "run_continuous_test" }, + "description": "Sample for RunContinuousTest", "file": "dialogflow_v3beta1_generated_environments_run_continuous_test_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_RunContinuousTest_async", "segments": [ { @@ -2256,18 +4099,50 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_run_continuous_test_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient.run_continuous_test", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.RunContinuousTest", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "RunContinuousTest" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.RunContinuousTestRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "run_continuous_test" }, + "description": "Sample for RunContinuousTest", "file": "dialogflow_v3beta1_generated_environments_run_continuous_test_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_RunContinuousTest_sync", "segments": [ { @@ -2300,19 +4175,59 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_run_continuous_test_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient", + "shortName": "EnvironmentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsAsyncClient.update_environment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.UpdateEnvironment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "UpdateEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateEnvironmentRequest" + }, + { + "name": "environment", + "type": "google.cloud.dialogflowcx_v3beta1.types.Environment" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_environment" }, + "description": "Sample for UpdateEnvironment", "file": "dialogflow_v3beta1_generated_environments_update_environment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_UpdateEnvironment_async", "segments": [ { @@ -2345,18 +4260,58 @@ "start": 50, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_update_environment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient", + "shortName": "EnvironmentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.EnvironmentsClient.update_environment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments.UpdateEnvironment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Environments", "shortName": "Environments" }, "shortName": "UpdateEnvironment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateEnvironmentRequest" + }, + { + "name": "environment", + "type": "google.cloud.dialogflowcx_v3beta1.types.Environment" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_environment" }, + "description": "Sample for UpdateEnvironment", "file": "dialogflow_v3beta1_generated_environments_update_environment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Environments_UpdateEnvironment_sync", "segments": [ { @@ -2389,19 +4344,59 @@ "start": 50, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_environments_update_environment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsAsyncClient", + "shortName": "ExperimentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsAsyncClient.create_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments.CreateExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments", "shortName": "Experiments" }, "shortName": "CreateExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateExperimentRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "experiment", + "type": "google.cloud.dialogflowcx_v3beta1.types.Experiment" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Experiment", + "shortName": "create_experiment" }, + "description": "Sample for CreateExperiment", "file": "dialogflow_v3beta1_generated_experiments_create_experiment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Experiments_CreateExperiment_async", "segments": [ { @@ -2434,18 +4429,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_experiments_create_experiment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsClient", + "shortName": "ExperimentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsClient.create_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments.CreateExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments", "shortName": "Experiments" }, "shortName": "CreateExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateExperimentRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "experiment", + "type": "google.cloud.dialogflowcx_v3beta1.types.Experiment" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Experiment", + "shortName": "create_experiment" }, + "description": "Sample for CreateExperiment", "file": "dialogflow_v3beta1_generated_experiments_create_experiment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Experiments_CreateExperiment_sync", "segments": [ { @@ -2478,19 +4513,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_experiments_create_experiment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsAsyncClient", + "shortName": "ExperimentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsAsyncClient.delete_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments.DeleteExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments", "shortName": "Experiments" }, "shortName": "DeleteExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteExperimentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_experiment" }, + "description": "Sample for DeleteExperiment", "file": "dialogflow_v3beta1_generated_experiments_delete_experiment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Experiments_DeleteExperiment_async", "segments": [ { @@ -2521,18 +4591,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_experiments_delete_experiment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsClient", + "shortName": "ExperimentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsClient.delete_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments.DeleteExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments", "shortName": "Experiments" }, "shortName": "DeleteExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteExperimentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_experiment" }, + "description": "Sample for DeleteExperiment", "file": "dialogflow_v3beta1_generated_experiments_delete_experiment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Experiments_DeleteExperiment_sync", "segments": [ { @@ -2563,19 +4668,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_experiments_delete_experiment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsAsyncClient", + "shortName": "ExperimentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsAsyncClient.get_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments.GetExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments", "shortName": "Experiments" }, "shortName": "GetExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetExperimentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Experiment", + "shortName": "get_experiment" }, + "description": "Sample for GetExperiment", "file": "dialogflow_v3beta1_generated_experiments_get_experiment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Experiments_GetExperiment_async", "segments": [ { @@ -2608,18 +4749,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_experiments_get_experiment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsClient", + "shortName": "ExperimentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsClient.get_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments.GetExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments", "shortName": "Experiments" }, "shortName": "GetExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetExperimentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Experiment", + "shortName": "get_experiment" }, + "description": "Sample for GetExperiment", "file": "dialogflow_v3beta1_generated_experiments_get_experiment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Experiments_GetExperiment_sync", "segments": [ { @@ -2652,19 +4829,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_experiments_get_experiment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsAsyncClient", + "shortName": "ExperimentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsAsyncClient.list_experiments", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments.ListExperiments", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments", "shortName": "Experiments" }, "shortName": "ListExperiments" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListExperimentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.experiments.pagers.ListExperimentsAsyncPager", + "shortName": "list_experiments" }, + "description": "Sample for ListExperiments", "file": "dialogflow_v3beta1_generated_experiments_list_experiments_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Experiments_ListExperiments_async", "segments": [ { @@ -2697,18 +4910,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_experiments_list_experiments_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsClient", + "shortName": "ExperimentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsClient.list_experiments", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments.ListExperiments", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments", "shortName": "Experiments" }, "shortName": "ListExperiments" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListExperimentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.experiments.pagers.ListExperimentsPager", + "shortName": "list_experiments" }, + "description": "Sample for ListExperiments", "file": "dialogflow_v3beta1_generated_experiments_list_experiments_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Experiments_ListExperiments_sync", "segments": [ { @@ -2741,19 +4990,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_experiments_list_experiments_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsAsyncClient", + "shortName": "ExperimentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsAsyncClient.start_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments.StartExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments", "shortName": "Experiments" }, "shortName": "StartExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.StartExperimentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Experiment", + "shortName": "start_experiment" }, + "description": "Sample for StartExperiment", "file": "dialogflow_v3beta1_generated_experiments_start_experiment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Experiments_StartExperiment_async", "segments": [ { @@ -2786,18 +5071,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_experiments_start_experiment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsClient", + "shortName": "ExperimentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsClient.start_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments.StartExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments", "shortName": "Experiments" }, "shortName": "StartExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.StartExperimentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Experiment", + "shortName": "start_experiment" }, + "description": "Sample for StartExperiment", "file": "dialogflow_v3beta1_generated_experiments_start_experiment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Experiments_StartExperiment_sync", "segments": [ { @@ -2830,19 +5151,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_experiments_start_experiment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsAsyncClient", + "shortName": "ExperimentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsAsyncClient.stop_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments.StopExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments", "shortName": "Experiments" }, "shortName": "StopExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.StopExperimentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Experiment", + "shortName": "stop_experiment" }, + "description": "Sample for StopExperiment", "file": "dialogflow_v3beta1_generated_experiments_stop_experiment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Experiments_StopExperiment_async", "segments": [ { @@ -2875,18 +5232,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_experiments_stop_experiment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsClient", + "shortName": "ExperimentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsClient.stop_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments.StopExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments", "shortName": "Experiments" }, "shortName": "StopExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.StopExperimentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Experiment", + "shortName": "stop_experiment" }, + "description": "Sample for StopExperiment", "file": "dialogflow_v3beta1_generated_experiments_stop_experiment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Experiments_StopExperiment_sync", "segments": [ { @@ -2919,19 +5312,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_experiments_stop_experiment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsAsyncClient", + "shortName": "ExperimentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsAsyncClient.update_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments.UpdateExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments", "shortName": "Experiments" }, "shortName": "UpdateExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateExperimentRequest" + }, + { + "name": "experiment", + "type": "google.cloud.dialogflowcx_v3beta1.types.Experiment" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Experiment", + "shortName": "update_experiment" }, + "description": "Sample for UpdateExperiment", "file": "dialogflow_v3beta1_generated_experiments_update_experiment_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Experiments_UpdateExperiment_async", "segments": [ { @@ -2964,18 +5397,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_experiments_update_experiment_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsClient", + "shortName": "ExperimentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.ExperimentsClient.update_experiment", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments.UpdateExperiment", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Experiments", "shortName": "Experiments" }, "shortName": "UpdateExperiment" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateExperimentRequest" + }, + { + "name": "experiment", + "type": "google.cloud.dialogflowcx_v3beta1.types.Experiment" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Experiment", + "shortName": "update_experiment" }, + "description": "Sample for UpdateExperiment", "file": "dialogflow_v3beta1_generated_experiments_update_experiment_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Experiments_UpdateExperiment_sync", "segments": [ { @@ -3008,19 +5481,59 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_experiments_update_experiment_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient.create_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.CreateFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "CreateFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateFlowRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "flow", + "type": "google.cloud.dialogflowcx_v3beta1.types.Flow" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Flow", + "shortName": "create_flow" }, + "description": "Sample for CreateFlow", "file": "dialogflow_v3beta1_generated_flows_create_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_CreateFlow_async", "segments": [ { @@ -3053,18 +5566,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_create_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient.create_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.CreateFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "CreateFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateFlowRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "flow", + "type": "google.cloud.dialogflowcx_v3beta1.types.Flow" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Flow", + "shortName": "create_flow" }, + "description": "Sample for CreateFlow", "file": "dialogflow_v3beta1_generated_flows_create_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_CreateFlow_sync", "segments": [ { @@ -3097,19 +5650,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_create_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient.delete_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.DeleteFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "DeleteFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteFlowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_flow" }, + "description": "Sample for DeleteFlow", "file": "dialogflow_v3beta1_generated_flows_delete_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_DeleteFlow_async", "segments": [ { @@ -3140,18 +5728,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_delete_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient.delete_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.DeleteFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "DeleteFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteFlowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_flow" }, + "description": "Sample for DeleteFlow", "file": "dialogflow_v3beta1_generated_flows_delete_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_DeleteFlow_sync", "segments": [ { @@ -3182,19 +5805,51 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_delete_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient.export_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.ExportFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "ExportFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ExportFlowRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "export_flow" }, + "description": "Sample for ExportFlow", "file": "dialogflow_v3beta1_generated_flows_export_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_ExportFlow_async", "segments": [ { @@ -3227,18 +5882,50 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_export_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient.export_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.ExportFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "ExportFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ExportFlowRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "export_flow" }, + "description": "Sample for ExportFlow", "file": "dialogflow_v3beta1_generated_flows_export_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_ExportFlow_sync", "segments": [ { @@ -3271,19 +5958,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_export_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient.get_flow_validation_result", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.GetFlowValidationResult", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "GetFlowValidationResult" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetFlowValidationResultRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.FlowValidationResult", + "shortName": "get_flow_validation_result" }, + "description": "Sample for GetFlowValidationResult", "file": "dialogflow_v3beta1_generated_flows_get_flow_validation_result_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_GetFlowValidationResult_async", "segments": [ { @@ -3316,18 +6039,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_get_flow_validation_result_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient.get_flow_validation_result", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.GetFlowValidationResult", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "GetFlowValidationResult" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetFlowValidationResultRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.FlowValidationResult", + "shortName": "get_flow_validation_result" }, + "description": "Sample for GetFlowValidationResult", "file": "dialogflow_v3beta1_generated_flows_get_flow_validation_result_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_GetFlowValidationResult_sync", "segments": [ { @@ -3360,19 +6119,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_get_flow_validation_result_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient.get_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.GetFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "GetFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetFlowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Flow", + "shortName": "get_flow" }, + "description": "Sample for GetFlow", "file": "dialogflow_v3beta1_generated_flows_get_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_GetFlow_async", "segments": [ { @@ -3405,18 +6200,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_get_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient.get_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.GetFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "GetFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetFlowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Flow", + "shortName": "get_flow" }, + "description": "Sample for GetFlow", "file": "dialogflow_v3beta1_generated_flows_get_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_GetFlow_sync", "segments": [ { @@ -3449,19 +6280,51 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_get_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient.import_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.ImportFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "ImportFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ImportFlowRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "import_flow" }, + "description": "Sample for ImportFlow", "file": "dialogflow_v3beta1_generated_flows_import_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_ImportFlow_async", "segments": [ { @@ -3494,18 +6357,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_import_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient.import_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.ImportFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "ImportFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ImportFlowRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "import_flow" }, + "description": "Sample for ImportFlow", "file": "dialogflow_v3beta1_generated_flows_import_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_ImportFlow_sync", "segments": [ { @@ -3538,19 +6433,55 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_import_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient.list_flows", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.ListFlows", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "ListFlows" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListFlowsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.flows.pagers.ListFlowsAsyncPager", + "shortName": "list_flows" }, + "description": "Sample for ListFlows", "file": "dialogflow_v3beta1_generated_flows_list_flows_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_ListFlows_async", "segments": [ { @@ -3583,18 +6514,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_list_flows_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient.list_flows", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.ListFlows", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "ListFlows" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListFlowsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.flows.pagers.ListFlowsPager", + "shortName": "list_flows" }, + "description": "Sample for ListFlows", "file": "dialogflow_v3beta1_generated_flows_list_flows_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_ListFlows_sync", "segments": [ { @@ -3627,19 +6594,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_list_flows_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient.train_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.TrainFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "TrainFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.TrainFlowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "train_flow" }, + "description": "Sample for TrainFlow", "file": "dialogflow_v3beta1_generated_flows_train_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_TrainFlow_async", "segments": [ { @@ -3672,18 +6675,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_train_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient.train_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.TrainFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "TrainFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.TrainFlowRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "train_flow" }, + "description": "Sample for TrainFlow", "file": "dialogflow_v3beta1_generated_flows_train_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_TrainFlow_sync", "segments": [ { @@ -3716,19 +6755,59 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_train_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient.update_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.UpdateFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "UpdateFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateFlowRequest" + }, + { + "name": "flow", + "type": "google.cloud.dialogflowcx_v3beta1.types.Flow" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Flow", + "shortName": "update_flow" }, + "description": "Sample for UpdateFlow", "file": "dialogflow_v3beta1_generated_flows_update_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_UpdateFlow_async", "segments": [ { @@ -3761,18 +6840,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_update_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient.update_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.UpdateFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "UpdateFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateFlowRequest" + }, + { + "name": "flow", + "type": "google.cloud.dialogflowcx_v3beta1.types.Flow" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Flow", + "shortName": "update_flow" }, + "description": "Sample for UpdateFlow", "file": "dialogflow_v3beta1_generated_flows_update_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_UpdateFlow_sync", "segments": [ { @@ -3805,19 +6924,51 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_update_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient", + "shortName": "FlowsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsAsyncClient.validate_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.ValidateFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "ValidateFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ValidateFlowRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.FlowValidationResult", + "shortName": "validate_flow" }, + "description": "Sample for ValidateFlow", "file": "dialogflow_v3beta1_generated_flows_validate_flow_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_ValidateFlow_async", "segments": [ { @@ -3850,18 +7001,50 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_validate_flow_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient", + "shortName": "FlowsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.FlowsClient.validate_flow", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows.ValidateFlow", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Flows", "shortName": "Flows" }, "shortName": "ValidateFlow" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ValidateFlowRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.FlowValidationResult", + "shortName": "validate_flow" }, + "description": "Sample for ValidateFlow", "file": "dialogflow_v3beta1_generated_flows_validate_flow_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Flows_ValidateFlow_sync", "segments": [ { @@ -3894,19 +7077,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_flows_validate_flow_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsAsyncClient", + "shortName": "IntentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsAsyncClient.create_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents.CreateIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents", "shortName": "Intents" }, "shortName": "CreateIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateIntentRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "intent", + "type": "google.cloud.dialogflowcx_v3beta1.types.Intent" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Intent", + "shortName": "create_intent" }, + "description": "Sample for CreateIntent", "file": "dialogflow_v3beta1_generated_intents_create_intent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Intents_CreateIntent_async", "segments": [ { @@ -3939,18 +7162,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_intents_create_intent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsClient", + "shortName": "IntentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsClient.create_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents.CreateIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents", "shortName": "Intents" }, "shortName": "CreateIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateIntentRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "intent", + "type": "google.cloud.dialogflowcx_v3beta1.types.Intent" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Intent", + "shortName": "create_intent" }, + "description": "Sample for CreateIntent", "file": "dialogflow_v3beta1_generated_intents_create_intent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Intents_CreateIntent_sync", "segments": [ { @@ -3983,19 +7246,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_intents_create_intent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsAsyncClient", + "shortName": "IntentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsAsyncClient.delete_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents.DeleteIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents", "shortName": "Intents" }, "shortName": "DeleteIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteIntentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_intent" }, + "description": "Sample for DeleteIntent", "file": "dialogflow_v3beta1_generated_intents_delete_intent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Intents_DeleteIntent_async", "segments": [ { @@ -4026,18 +7324,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_intents_delete_intent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsClient", + "shortName": "IntentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsClient.delete_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents.DeleteIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents", "shortName": "Intents" }, "shortName": "DeleteIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteIntentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_intent" }, + "description": "Sample for DeleteIntent", "file": "dialogflow_v3beta1_generated_intents_delete_intent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Intents_DeleteIntent_sync", "segments": [ { @@ -4068,19 +7401,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_intents_delete_intent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsAsyncClient", + "shortName": "IntentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsAsyncClient.get_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents.GetIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents", "shortName": "Intents" }, "shortName": "GetIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetIntentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Intent", + "shortName": "get_intent" }, + "description": "Sample for GetIntent", "file": "dialogflow_v3beta1_generated_intents_get_intent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Intents_GetIntent_async", "segments": [ { @@ -4113,18 +7482,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_intents_get_intent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsClient", + "shortName": "IntentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsClient.get_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents.GetIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents", "shortName": "Intents" }, "shortName": "GetIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetIntentRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Intent", + "shortName": "get_intent" }, + "description": "Sample for GetIntent", "file": "dialogflow_v3beta1_generated_intents_get_intent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Intents_GetIntent_sync", "segments": [ { @@ -4157,19 +7562,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_intents_get_intent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsAsyncClient", + "shortName": "IntentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsAsyncClient.list_intents", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents.ListIntents", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents", "shortName": "Intents" }, "shortName": "ListIntents" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListIntentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.intents.pagers.ListIntentsAsyncPager", + "shortName": "list_intents" }, + "description": "Sample for ListIntents", "file": "dialogflow_v3beta1_generated_intents_list_intents_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Intents_ListIntents_async", "segments": [ { @@ -4202,18 +7643,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_intents_list_intents_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsClient", + "shortName": "IntentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsClient.list_intents", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents.ListIntents", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents", "shortName": "Intents" }, "shortName": "ListIntents" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListIntentsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.intents.pagers.ListIntentsPager", + "shortName": "list_intents" }, + "description": "Sample for ListIntents", "file": "dialogflow_v3beta1_generated_intents_list_intents_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Intents_ListIntents_sync", "segments": [ { @@ -4246,19 +7723,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_intents_list_intents_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsAsyncClient", + "shortName": "IntentsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsAsyncClient.update_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents.UpdateIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents", "shortName": "Intents" }, "shortName": "UpdateIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateIntentRequest" + }, + { + "name": "intent", + "type": "google.cloud.dialogflowcx_v3beta1.types.Intent" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Intent", + "shortName": "update_intent" }, + "description": "Sample for UpdateIntent", "file": "dialogflow_v3beta1_generated_intents_update_intent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Intents_UpdateIntent_async", "segments": [ { @@ -4291,18 +7808,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_intents_update_intent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsClient", + "shortName": "IntentsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.IntentsClient.update_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents.UpdateIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Intents", "shortName": "Intents" }, "shortName": "UpdateIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateIntentRequest" + }, + { + "name": "intent", + "type": "google.cloud.dialogflowcx_v3beta1.types.Intent" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Intent", + "shortName": "update_intent" }, + "description": "Sample for UpdateIntent", "file": "dialogflow_v3beta1_generated_intents_update_intent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Intents_UpdateIntent_sync", "segments": [ { @@ -4335,19 +7892,59 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_intents_update_intent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesAsyncClient", + "shortName": "PagesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesAsyncClient.create_page", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages.CreatePage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages", "shortName": "Pages" }, "shortName": "CreatePage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreatePageRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "page", + "type": "google.cloud.dialogflowcx_v3beta1.types.Page" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Page", + "shortName": "create_page" }, + "description": "Sample for CreatePage", "file": "dialogflow_v3beta1_generated_pages_create_page_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Pages_CreatePage_async", "segments": [ { @@ -4380,18 +7977,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_pages_create_page_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesClient", + "shortName": "PagesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesClient.create_page", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages.CreatePage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages", "shortName": "Pages" }, "shortName": "CreatePage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreatePageRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "page", + "type": "google.cloud.dialogflowcx_v3beta1.types.Page" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Page", + "shortName": "create_page" }, + "description": "Sample for CreatePage", "file": "dialogflow_v3beta1_generated_pages_create_page_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Pages_CreatePage_sync", "segments": [ { @@ -4424,19 +8061,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_pages_create_page_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesAsyncClient", + "shortName": "PagesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesAsyncClient.delete_page", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages.DeletePage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages", "shortName": "Pages" }, "shortName": "DeletePage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeletePageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_page" }, + "description": "Sample for DeletePage", "file": "dialogflow_v3beta1_generated_pages_delete_page_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Pages_DeletePage_async", "segments": [ { @@ -4467,18 +8139,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_pages_delete_page_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesClient", + "shortName": "PagesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesClient.delete_page", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages.DeletePage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages", "shortName": "Pages" }, "shortName": "DeletePage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeletePageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_page" }, + "description": "Sample for DeletePage", "file": "dialogflow_v3beta1_generated_pages_delete_page_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Pages_DeletePage_sync", "segments": [ { @@ -4509,19 +8216,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_pages_delete_page_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesAsyncClient", + "shortName": "PagesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesAsyncClient.get_page", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages.GetPage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages", "shortName": "Pages" }, "shortName": "GetPage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetPageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Page", + "shortName": "get_page" }, + "description": "Sample for GetPage", "file": "dialogflow_v3beta1_generated_pages_get_page_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Pages_GetPage_async", "segments": [ { @@ -4554,18 +8297,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_pages_get_page_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesClient", + "shortName": "PagesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesClient.get_page", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages.GetPage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages", "shortName": "Pages" }, "shortName": "GetPage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetPageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Page", + "shortName": "get_page" }, + "description": "Sample for GetPage", "file": "dialogflow_v3beta1_generated_pages_get_page_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Pages_GetPage_sync", "segments": [ { @@ -4598,19 +8377,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_pages_get_page_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesAsyncClient", + "shortName": "PagesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesAsyncClient.list_pages", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages.ListPages", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages", "shortName": "Pages" }, "shortName": "ListPages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListPagesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.pages.pagers.ListPagesAsyncPager", + "shortName": "list_pages" }, + "description": "Sample for ListPages", "file": "dialogflow_v3beta1_generated_pages_list_pages_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Pages_ListPages_async", "segments": [ { @@ -4643,18 +8458,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_pages_list_pages_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesClient", + "shortName": "PagesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesClient.list_pages", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages.ListPages", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages", "shortName": "Pages" }, "shortName": "ListPages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListPagesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.pages.pagers.ListPagesPager", + "shortName": "list_pages" }, + "description": "Sample for ListPages", "file": "dialogflow_v3beta1_generated_pages_list_pages_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Pages_ListPages_sync", "segments": [ { @@ -4687,19 +8538,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_pages_list_pages_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesAsyncClient", + "shortName": "PagesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesAsyncClient.update_page", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages.UpdatePage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages", "shortName": "Pages" }, "shortName": "UpdatePage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdatePageRequest" + }, + { + "name": "page", + "type": "google.cloud.dialogflowcx_v3beta1.types.Page" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Page", + "shortName": "update_page" }, + "description": "Sample for UpdatePage", "file": "dialogflow_v3beta1_generated_pages_update_page_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Pages_UpdatePage_async", "segments": [ { @@ -4732,18 +8623,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_pages_update_page_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesClient", + "shortName": "PagesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.PagesClient.update_page", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages.UpdatePage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Pages", "shortName": "Pages" }, "shortName": "UpdatePage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdatePageRequest" + }, + { + "name": "page", + "type": "google.cloud.dialogflowcx_v3beta1.types.Page" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Page", + "shortName": "update_page" }, + "description": "Sample for UpdatePage", "file": "dialogflow_v3beta1_generated_pages_update_page_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Pages_UpdatePage_sync", "segments": [ { @@ -4776,19 +8707,59 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_pages_update_page_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceAsyncClient", + "shortName": "SecuritySettingsServiceAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceAsyncClient.create_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService.CreateSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "CreateSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateSecuritySettingsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "security_settings", + "type": "google.cloud.dialogflowcx_v3beta1.types.SecuritySettings" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.SecuritySettings", + "shortName": "create_security_settings" }, + "description": "Sample for CreateSecuritySettings", "file": "dialogflow_v3beta1_generated_security_settings_service_create_security_settings_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SecuritySettingsService_CreateSecuritySettings_async", "segments": [ { @@ -4821,18 +8792,58 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_security_settings_service_create_security_settings_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceClient", + "shortName": "SecuritySettingsServiceClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceClient.create_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService.CreateSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "CreateSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateSecuritySettingsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "security_settings", + "type": "google.cloud.dialogflowcx_v3beta1.types.SecuritySettings" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.SecuritySettings", + "shortName": "create_security_settings" }, + "description": "Sample for CreateSecuritySettings", "file": "dialogflow_v3beta1_generated_security_settings_service_create_security_settings_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SecuritySettingsService_CreateSecuritySettings_sync", "segments": [ { @@ -4865,19 +8876,54 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_security_settings_service_create_security_settings_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceAsyncClient", + "shortName": "SecuritySettingsServiceAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceAsyncClient.delete_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService.DeleteSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "DeleteSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteSecuritySettingsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_security_settings" }, + "description": "Sample for DeleteSecuritySettings", "file": "dialogflow_v3beta1_generated_security_settings_service_delete_security_settings_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SecuritySettingsService_DeleteSecuritySettings_async", "segments": [ { @@ -4908,18 +8954,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_security_settings_service_delete_security_settings_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceClient", + "shortName": "SecuritySettingsServiceClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceClient.delete_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService.DeleteSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "DeleteSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteSecuritySettingsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_security_settings" }, + "description": "Sample for DeleteSecuritySettings", "file": "dialogflow_v3beta1_generated_security_settings_service_delete_security_settings_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SecuritySettingsService_DeleteSecuritySettings_sync", "segments": [ { @@ -4950,19 +9031,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_security_settings_service_delete_security_settings_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceAsyncClient", + "shortName": "SecuritySettingsServiceAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceAsyncClient.get_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService.GetSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "GetSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetSecuritySettingsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.SecuritySettings", + "shortName": "get_security_settings" }, + "description": "Sample for GetSecuritySettings", "file": "dialogflow_v3beta1_generated_security_settings_service_get_security_settings_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SecuritySettingsService_GetSecuritySettings_async", "segments": [ { @@ -4995,18 +9112,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_security_settings_service_get_security_settings_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceClient", + "shortName": "SecuritySettingsServiceClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceClient.get_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService.GetSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "GetSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetSecuritySettingsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.SecuritySettings", + "shortName": "get_security_settings" }, + "description": "Sample for GetSecuritySettings", "file": "dialogflow_v3beta1_generated_security_settings_service_get_security_settings_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SecuritySettingsService_GetSecuritySettings_sync", "segments": [ { @@ -5039,19 +9192,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_security_settings_service_get_security_settings_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceAsyncClient", + "shortName": "SecuritySettingsServiceAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceAsyncClient.list_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService.ListSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "ListSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListSecuritySettingsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.security_settings_service.pagers.ListSecuritySettingsAsyncPager", + "shortName": "list_security_settings" }, + "description": "Sample for ListSecuritySettings", "file": "dialogflow_v3beta1_generated_security_settings_service_list_security_settings_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SecuritySettingsService_ListSecuritySettings_async", "segments": [ { @@ -5084,18 +9273,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_security_settings_service_list_security_settings_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceClient", + "shortName": "SecuritySettingsServiceClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceClient.list_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService.ListSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "ListSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListSecuritySettingsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.security_settings_service.pagers.ListSecuritySettingsPager", + "shortName": "list_security_settings" }, + "description": "Sample for ListSecuritySettings", "file": "dialogflow_v3beta1_generated_security_settings_service_list_security_settings_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SecuritySettingsService_ListSecuritySettings_sync", "segments": [ { @@ -5128,19 +9353,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_security_settings_service_list_security_settings_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceAsyncClient", + "shortName": "SecuritySettingsServiceAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceAsyncClient.update_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService.UpdateSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "UpdateSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateSecuritySettingsRequest" + }, + { + "name": "security_settings", + "type": "google.cloud.dialogflowcx_v3beta1.types.SecuritySettings" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.SecuritySettings", + "shortName": "update_security_settings" }, + "description": "Sample for UpdateSecuritySettings", "file": "dialogflow_v3beta1_generated_security_settings_service_update_security_settings_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SecuritySettingsService_UpdateSecuritySettings_async", "segments": [ { @@ -5173,18 +9438,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_security_settings_service_update_security_settings_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceClient", + "shortName": "SecuritySettingsServiceClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SecuritySettingsServiceClient.update_security_settings", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService.UpdateSecuritySettings", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SecuritySettingsService", "shortName": "SecuritySettingsService" }, "shortName": "UpdateSecuritySettings" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateSecuritySettingsRequest" + }, + { + "name": "security_settings", + "type": "google.cloud.dialogflowcx_v3beta1.types.SecuritySettings" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.SecuritySettings", + "shortName": "update_security_settings" }, + "description": "Sample for UpdateSecuritySettings", "file": "dialogflow_v3beta1_generated_security_settings_service_update_security_settings_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SecuritySettingsService_UpdateSecuritySettings_sync", "segments": [ { @@ -5217,19 +9522,59 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_security_settings_service_update_security_settings_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesAsyncClient", + "shortName": "SessionEntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesAsyncClient.create_session_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.CreateSessionEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "CreateSessionEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateSessionEntityTypeRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "session_entity_type", + "type": "google.cloud.dialogflowcx_v3beta1.types.SessionEntityType" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.SessionEntityType", + "shortName": "create_session_entity_type" }, + "description": "Sample for CreateSessionEntityType", "file": "dialogflow_v3beta1_generated_session_entity_types_create_session_entity_type_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SessionEntityTypes_CreateSessionEntityType_async", "segments": [ { @@ -5262,18 +9607,58 @@ "start": 49, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_session_entity_types_create_session_entity_type_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesClient", + "shortName": "SessionEntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesClient.create_session_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.CreateSessionEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "CreateSessionEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateSessionEntityTypeRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "session_entity_type", + "type": "google.cloud.dialogflowcx_v3beta1.types.SessionEntityType" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.SessionEntityType", + "shortName": "create_session_entity_type" }, + "description": "Sample for CreateSessionEntityType", "file": "dialogflow_v3beta1_generated_session_entity_types_create_session_entity_type_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SessionEntityTypes_CreateSessionEntityType_sync", "segments": [ { @@ -5306,19 +9691,54 @@ "start": 49, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_session_entity_types_create_session_entity_type_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesAsyncClient", + "shortName": "SessionEntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesAsyncClient.delete_session_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.DeleteSessionEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "DeleteSessionEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteSessionEntityTypeRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_session_entity_type" }, + "description": "Sample for DeleteSessionEntityType", "file": "dialogflow_v3beta1_generated_session_entity_types_delete_session_entity_type_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SessionEntityTypes_DeleteSessionEntityType_async", "segments": [ { @@ -5349,18 +9769,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_session_entity_types_delete_session_entity_type_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesClient", + "shortName": "SessionEntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesClient.delete_session_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.DeleteSessionEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "DeleteSessionEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteSessionEntityTypeRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_session_entity_type" }, + "description": "Sample for DeleteSessionEntityType", "file": "dialogflow_v3beta1_generated_session_entity_types_delete_session_entity_type_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SessionEntityTypes_DeleteSessionEntityType_sync", "segments": [ { @@ -5391,19 +9846,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_session_entity_types_delete_session_entity_type_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesAsyncClient", + "shortName": "SessionEntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesAsyncClient.get_session_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.GetSessionEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "GetSessionEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetSessionEntityTypeRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.SessionEntityType", + "shortName": "get_session_entity_type" }, + "description": "Sample for GetSessionEntityType", "file": "dialogflow_v3beta1_generated_session_entity_types_get_session_entity_type_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SessionEntityTypes_GetSessionEntityType_async", "segments": [ { @@ -5436,18 +9927,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_session_entity_types_get_session_entity_type_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesClient", + "shortName": "SessionEntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesClient.get_session_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.GetSessionEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "GetSessionEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetSessionEntityTypeRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.SessionEntityType", + "shortName": "get_session_entity_type" }, + "description": "Sample for GetSessionEntityType", "file": "dialogflow_v3beta1_generated_session_entity_types_get_session_entity_type_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SessionEntityTypes_GetSessionEntityType_sync", "segments": [ { @@ -5480,19 +10007,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_session_entity_types_get_session_entity_type_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesAsyncClient", + "shortName": "SessionEntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesAsyncClient.list_session_entity_types", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.ListSessionEntityTypes", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "ListSessionEntityTypes" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListSessionEntityTypesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.session_entity_types.pagers.ListSessionEntityTypesAsyncPager", + "shortName": "list_session_entity_types" }, + "description": "Sample for ListSessionEntityTypes", "file": "dialogflow_v3beta1_generated_session_entity_types_list_session_entity_types_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SessionEntityTypes_ListSessionEntityTypes_async", "segments": [ { @@ -5525,18 +10088,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_session_entity_types_list_session_entity_types_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesClient", + "shortName": "SessionEntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesClient.list_session_entity_types", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.ListSessionEntityTypes", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "ListSessionEntityTypes" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListSessionEntityTypesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.session_entity_types.pagers.ListSessionEntityTypesPager", + "shortName": "list_session_entity_types" }, + "description": "Sample for ListSessionEntityTypes", "file": "dialogflow_v3beta1_generated_session_entity_types_list_session_entity_types_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SessionEntityTypes_ListSessionEntityTypes_sync", "segments": [ { @@ -5569,19 +10168,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_session_entity_types_list_session_entity_types_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesAsyncClient", + "shortName": "SessionEntityTypesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesAsyncClient.update_session_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.UpdateSessionEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "UpdateSessionEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateSessionEntityTypeRequest" + }, + { + "name": "session_entity_type", + "type": "google.cloud.dialogflowcx_v3beta1.types.SessionEntityType" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.SessionEntityType", + "shortName": "update_session_entity_type" }, + "description": "Sample for UpdateSessionEntityType", "file": "dialogflow_v3beta1_generated_session_entity_types_update_session_entity_type_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SessionEntityTypes_UpdateSessionEntityType_async", "segments": [ { @@ -5614,18 +10253,58 @@ "start": 48, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_session_entity_types_update_session_entity_type_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesClient", + "shortName": "SessionEntityTypesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionEntityTypesClient.update_session_entity_type", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes.UpdateSessionEntityType", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.SessionEntityTypes", "shortName": "SessionEntityTypes" }, "shortName": "UpdateSessionEntityType" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateSessionEntityTypeRequest" + }, + { + "name": "session_entity_type", + "type": "google.cloud.dialogflowcx_v3beta1.types.SessionEntityType" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.SessionEntityType", + "shortName": "update_session_entity_type" }, + "description": "Sample for UpdateSessionEntityType", "file": "dialogflow_v3beta1_generated_session_entity_types_update_session_entity_type_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_SessionEntityTypes_UpdateSessionEntityType_sync", "segments": [ { @@ -5658,19 +10337,51 @@ "start": 48, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_session_entity_types_update_session_entity_type_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionsAsyncClient", + "shortName": "SessionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionsAsyncClient.detect_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Sessions.DetectIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Sessions", "shortName": "Sessions" }, "shortName": "DetectIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DetectIntentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.DetectIntentResponse", + "shortName": "detect_intent" }, + "description": "Sample for DetectIntent", "file": "dialogflow_v3beta1_generated_sessions_detect_intent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Sessions_DetectIntent_async", "segments": [ { @@ -5703,18 +10414,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_sessions_detect_intent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionsClient", + "shortName": "SessionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionsClient.detect_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Sessions.DetectIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Sessions", "shortName": "Sessions" }, "shortName": "DetectIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DetectIntentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.DetectIntentResponse", + "shortName": "detect_intent" }, + "description": "Sample for DetectIntent", "file": "dialogflow_v3beta1_generated_sessions_detect_intent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Sessions_DetectIntent_sync", "segments": [ { @@ -5747,19 +10490,51 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_sessions_detect_intent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionsAsyncClient", + "shortName": "SessionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionsAsyncClient.fulfill_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Sessions.FulfillIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Sessions", "shortName": "Sessions" }, "shortName": "FulfillIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.FulfillIntentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.FulfillIntentResponse", + "shortName": "fulfill_intent" }, + "description": "Sample for FulfillIntent", "file": "dialogflow_v3beta1_generated_sessions_fulfill_intent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Sessions_FulfillIntent_async", "segments": [ { @@ -5792,18 +10567,50 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_sessions_fulfill_intent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionsClient", + "shortName": "SessionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionsClient.fulfill_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Sessions.FulfillIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Sessions", "shortName": "Sessions" }, "shortName": "FulfillIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.FulfillIntentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.FulfillIntentResponse", + "shortName": "fulfill_intent" }, + "description": "Sample for FulfillIntent", "file": "dialogflow_v3beta1_generated_sessions_fulfill_intent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Sessions_FulfillIntent_sync", "segments": [ { @@ -5836,19 +10643,51 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_sessions_fulfill_intent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionsAsyncClient", + "shortName": "SessionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionsAsyncClient.match_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Sessions.MatchIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Sessions", "shortName": "Sessions" }, "shortName": "MatchIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.MatchIntentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.MatchIntentResponse", + "shortName": "match_intent" }, + "description": "Sample for MatchIntent", "file": "dialogflow_v3beta1_generated_sessions_match_intent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Sessions_MatchIntent_async", "segments": [ { @@ -5881,18 +10720,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_sessions_match_intent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionsClient", + "shortName": "SessionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionsClient.match_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Sessions.MatchIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Sessions", "shortName": "Sessions" }, "shortName": "MatchIntent" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.MatchIntentRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.MatchIntentResponse", + "shortName": "match_intent" }, + "description": "Sample for MatchIntent", "file": "dialogflow_v3beta1_generated_sessions_match_intent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Sessions_MatchIntent_sync", "segments": [ { @@ -5925,19 +10796,51 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_sessions_match_intent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionsAsyncClient", + "shortName": "SessionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionsAsyncClient.streaming_detect_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Sessions.StreamingDetectIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Sessions", "shortName": "Sessions" }, "shortName": "StreamingDetectIntent" - } + }, + "parameters": [ + { + "name": "requests", + "type": "Iterator[google.cloud.dialogflowcx_v3beta1.types.StreamingDetectIntentRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "Iterable[google.cloud.dialogflowcx_v3beta1.types.StreamingDetectIntentResponse]", + "shortName": "streaming_detect_intent" }, + "description": "Sample for StreamingDetectIntent", "file": "dialogflow_v3beta1_generated_sessions_streaming_detect_intent_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Sessions_StreamingDetectIntent_async", "segments": [ { @@ -5970,18 +10873,50 @@ "start": 56, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_sessions_streaming_detect_intent_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionsClient", + "shortName": "SessionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.SessionsClient.streaming_detect_intent", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Sessions.StreamingDetectIntent", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Sessions", "shortName": "Sessions" }, "shortName": "StreamingDetectIntent" - } + }, + "parameters": [ + { + "name": "requests", + "type": "Iterator[google.cloud.dialogflowcx_v3beta1.types.StreamingDetectIntentRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "Iterable[google.cloud.dialogflowcx_v3beta1.types.StreamingDetectIntentResponse]", + "shortName": "streaming_detect_intent" }, + "description": "Sample for StreamingDetectIntent", "file": "dialogflow_v3beta1_generated_sessions_streaming_detect_intent_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Sessions_StreamingDetectIntent_sync", "segments": [ { @@ -6014,19 +10949,54 @@ "start": 56, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_sessions_streaming_detect_intent_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient.batch_delete_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.BatchDeleteTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "BatchDeleteTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.BatchDeleteTestCasesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "batch_delete_test_cases" }, + "description": "Sample for BatchDeleteTestCases", "file": "dialogflow_v3beta1_generated_test_cases_batch_delete_test_cases_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_BatchDeleteTestCases_async", "segments": [ { @@ -6057,18 +11027,53 @@ "end": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_batch_delete_test_cases_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient.batch_delete_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.BatchDeleteTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "BatchDeleteTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.BatchDeleteTestCasesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "batch_delete_test_cases" }, + "description": "Sample for BatchDeleteTestCases", "file": "dialogflow_v3beta1_generated_test_cases_batch_delete_test_cases_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_BatchDeleteTestCases_sync", "segments": [ { @@ -6099,19 +11104,51 @@ "end": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_batch_delete_test_cases_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient.batch_run_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.BatchRunTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "BatchRunTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.BatchRunTestCasesRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "batch_run_test_cases" }, + "description": "Sample for BatchRunTestCases", "file": "dialogflow_v3beta1_generated_test_cases_batch_run_test_cases_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_BatchRunTestCases_async", "segments": [ { @@ -6144,18 +11181,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_batch_run_test_cases_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient.batch_run_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.BatchRunTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "BatchRunTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.BatchRunTestCasesRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "batch_run_test_cases" }, + "description": "Sample for BatchRunTestCases", "file": "dialogflow_v3beta1_generated_test_cases_batch_run_test_cases_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_BatchRunTestCases_sync", "segments": [ { @@ -6188,19 +11257,51 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_batch_run_test_cases_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient.calculate_coverage", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.CalculateCoverage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "CalculateCoverage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CalculateCoverageRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.CalculateCoverageResponse", + "shortName": "calculate_coverage" }, + "description": "Sample for CalculateCoverage", "file": "dialogflow_v3beta1_generated_test_cases_calculate_coverage_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_CalculateCoverage_async", "segments": [ { @@ -6233,18 +11334,50 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_calculate_coverage_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient.calculate_coverage", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.CalculateCoverage", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "CalculateCoverage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CalculateCoverageRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.CalculateCoverageResponse", + "shortName": "calculate_coverage" }, + "description": "Sample for CalculateCoverage", "file": "dialogflow_v3beta1_generated_test_cases_calculate_coverage_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_CalculateCoverage_sync", "segments": [ { @@ -6277,19 +11410,59 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_calculate_coverage_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient.create_test_case", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.CreateTestCase", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "CreateTestCase" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateTestCaseRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "test_case", + "type": "google.cloud.dialogflowcx_v3beta1.types.TestCase" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.TestCase", + "shortName": "create_test_case" }, + "description": "Sample for CreateTestCase", "file": "dialogflow_v3beta1_generated_test_cases_create_test_case_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_CreateTestCase_async", "segments": [ { @@ -6322,18 +11495,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_create_test_case_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient.create_test_case", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.CreateTestCase", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "CreateTestCase" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateTestCaseRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "test_case", + "type": "google.cloud.dialogflowcx_v3beta1.types.TestCase" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.TestCase", + "shortName": "create_test_case" }, + "description": "Sample for CreateTestCase", "file": "dialogflow_v3beta1_generated_test_cases_create_test_case_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_CreateTestCase_sync", "segments": [ { @@ -6366,19 +11579,51 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_create_test_case_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient.export_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.ExportTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "ExportTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ExportTestCasesRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "export_test_cases" }, + "description": "Sample for ExportTestCases", "file": "dialogflow_v3beta1_generated_test_cases_export_test_cases_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_ExportTestCases_async", "segments": [ { @@ -6411,18 +11656,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_export_test_cases_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient.export_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.ExportTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "ExportTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ExportTestCasesRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "export_test_cases" }, + "description": "Sample for ExportTestCases", "file": "dialogflow_v3beta1_generated_test_cases_export_test_cases_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_ExportTestCases_sync", "segments": [ { @@ -6455,19 +11732,55 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_export_test_cases_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient.get_test_case_result", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.GetTestCaseResult", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "GetTestCaseResult" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetTestCaseResultRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.TestCaseResult", + "shortName": "get_test_case_result" }, + "description": "Sample for GetTestCaseResult", "file": "dialogflow_v3beta1_generated_test_cases_get_test_case_result_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_GetTestCaseResult_async", "segments": [ { @@ -6500,18 +11813,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_get_test_case_result_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient.get_test_case_result", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.GetTestCaseResult", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "GetTestCaseResult" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetTestCaseResultRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.TestCaseResult", + "shortName": "get_test_case_result" }, + "description": "Sample for GetTestCaseResult", "file": "dialogflow_v3beta1_generated_test_cases_get_test_case_result_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_GetTestCaseResult_sync", "segments": [ { @@ -6544,19 +11893,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_get_test_case_result_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient.get_test_case", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.GetTestCase", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "GetTestCase" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetTestCaseRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.TestCase", + "shortName": "get_test_case" }, + "description": "Sample for GetTestCase", "file": "dialogflow_v3beta1_generated_test_cases_get_test_case_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_GetTestCase_async", "segments": [ { @@ -6589,18 +11974,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_get_test_case_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient.get_test_case", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.GetTestCase", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "GetTestCase" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetTestCaseRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.TestCase", + "shortName": "get_test_case" }, + "description": "Sample for GetTestCase", "file": "dialogflow_v3beta1_generated_test_cases_get_test_case_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_GetTestCase_sync", "segments": [ { @@ -6633,19 +12054,51 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_get_test_case_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient.import_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.ImportTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "ImportTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ImportTestCasesRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "import_test_cases" }, + "description": "Sample for ImportTestCases", "file": "dialogflow_v3beta1_generated_test_cases_import_test_cases_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_ImportTestCases_async", "segments": [ { @@ -6678,18 +12131,50 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_import_test_cases_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient.import_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.ImportTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "ImportTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ImportTestCasesRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "import_test_cases" }, + "description": "Sample for ImportTestCases", "file": "dialogflow_v3beta1_generated_test_cases_import_test_cases_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_ImportTestCases_sync", "segments": [ { @@ -6722,19 +12207,55 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_import_test_cases_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient.list_test_case_results", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.ListTestCaseResults", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "ListTestCaseResults" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListTestCaseResultsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.test_cases.pagers.ListTestCaseResultsAsyncPager", + "shortName": "list_test_case_results" }, + "description": "Sample for ListTestCaseResults", "file": "dialogflow_v3beta1_generated_test_cases_list_test_case_results_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_ListTestCaseResults_async", "segments": [ { @@ -6767,18 +12288,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_list_test_case_results_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient.list_test_case_results", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.ListTestCaseResults", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "ListTestCaseResults" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListTestCaseResultsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.test_cases.pagers.ListTestCaseResultsPager", + "shortName": "list_test_case_results" }, + "description": "Sample for ListTestCaseResults", "file": "dialogflow_v3beta1_generated_test_cases_list_test_case_results_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_ListTestCaseResults_sync", "segments": [ { @@ -6811,19 +12368,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_list_test_case_results_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient.list_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.ListTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "ListTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListTestCasesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.test_cases.pagers.ListTestCasesAsyncPager", + "shortName": "list_test_cases" }, + "description": "Sample for ListTestCases", "file": "dialogflow_v3beta1_generated_test_cases_list_test_cases_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_ListTestCases_async", "segments": [ { @@ -6856,18 +12449,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_list_test_cases_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient.list_test_cases", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.ListTestCases", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "ListTestCases" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListTestCasesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.test_cases.pagers.ListTestCasesPager", + "shortName": "list_test_cases" }, + "description": "Sample for ListTestCases", "file": "dialogflow_v3beta1_generated_test_cases_list_test_cases_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_ListTestCases_sync", "segments": [ { @@ -6900,19 +12529,51 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_list_test_cases_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient.run_test_case", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.RunTestCase", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "RunTestCase" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.RunTestCaseRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "run_test_case" }, + "description": "Sample for RunTestCase", "file": "dialogflow_v3beta1_generated_test_cases_run_test_case_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_RunTestCase_async", "segments": [ { @@ -6945,18 +12606,50 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_run_test_case_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient.run_test_case", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.RunTestCase", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "RunTestCase" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.RunTestCaseRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "run_test_case" }, + "description": "Sample for RunTestCase", "file": "dialogflow_v3beta1_generated_test_cases_run_test_case_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_RunTestCase_sync", "segments": [ { @@ -6989,19 +12682,59 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_run_test_case_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient", + "shortName": "TestCasesAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesAsyncClient.update_test_case", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.UpdateTestCase", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "UpdateTestCase" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateTestCaseRequest" + }, + { + "name": "test_case", + "type": "google.cloud.dialogflowcx_v3beta1.types.TestCase" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.TestCase", + "shortName": "update_test_case" }, + "description": "Sample for UpdateTestCase", "file": "dialogflow_v3beta1_generated_test_cases_update_test_case_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_UpdateTestCase_async", "segments": [ { @@ -7034,18 +12767,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_update_test_case_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient", + "shortName": "TestCasesClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TestCasesClient.update_test_case", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases.UpdateTestCase", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TestCases", "shortName": "TestCases" }, "shortName": "UpdateTestCase" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateTestCaseRequest" + }, + { + "name": "test_case", + "type": "google.cloud.dialogflowcx_v3beta1.types.TestCase" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.TestCase", + "shortName": "update_test_case" }, + "description": "Sample for UpdateTestCase", "file": "dialogflow_v3beta1_generated_test_cases_update_test_case_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TestCases_UpdateTestCase_sync", "segments": [ { @@ -7078,19 +12851,59 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_test_cases_update_test_case_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsAsyncClient", + "shortName": "TransitionRouteGroupsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsAsyncClient.create_transition_route_group", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.CreateTransitionRouteGroup", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "CreateTransitionRouteGroup" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateTransitionRouteGroupRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "transition_route_group", + "type": "google.cloud.dialogflowcx_v3beta1.types.TransitionRouteGroup" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.TransitionRouteGroup", + "shortName": "create_transition_route_group" }, + "description": "Sample for CreateTransitionRouteGroup", "file": "dialogflow_v3beta1_generated_transition_route_groups_create_transition_route_group_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TransitionRouteGroups_CreateTransitionRouteGroup_async", "segments": [ { @@ -7123,18 +12936,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_transition_route_groups_create_transition_route_group_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsClient", + "shortName": "TransitionRouteGroupsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsClient.create_transition_route_group", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.CreateTransitionRouteGroup", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "CreateTransitionRouteGroup" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateTransitionRouteGroupRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "transition_route_group", + "type": "google.cloud.dialogflowcx_v3beta1.types.TransitionRouteGroup" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.TransitionRouteGroup", + "shortName": "create_transition_route_group" }, + "description": "Sample for CreateTransitionRouteGroup", "file": "dialogflow_v3beta1_generated_transition_route_groups_create_transition_route_group_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TransitionRouteGroups_CreateTransitionRouteGroup_sync", "segments": [ { @@ -7167,19 +13020,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_transition_route_groups_create_transition_route_group_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsAsyncClient", + "shortName": "TransitionRouteGroupsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsAsyncClient.delete_transition_route_group", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.DeleteTransitionRouteGroup", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "DeleteTransitionRouteGroup" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteTransitionRouteGroupRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_transition_route_group" }, + "description": "Sample for DeleteTransitionRouteGroup", "file": "dialogflow_v3beta1_generated_transition_route_groups_delete_transition_route_group_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TransitionRouteGroups_DeleteTransitionRouteGroup_async", "segments": [ { @@ -7210,18 +13098,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_transition_route_groups_delete_transition_route_group_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsClient", + "shortName": "TransitionRouteGroupsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsClient.delete_transition_route_group", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.DeleteTransitionRouteGroup", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "DeleteTransitionRouteGroup" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteTransitionRouteGroupRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_transition_route_group" }, + "description": "Sample for DeleteTransitionRouteGroup", "file": "dialogflow_v3beta1_generated_transition_route_groups_delete_transition_route_group_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TransitionRouteGroups_DeleteTransitionRouteGroup_sync", "segments": [ { @@ -7252,19 +13175,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_transition_route_groups_delete_transition_route_group_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsAsyncClient", + "shortName": "TransitionRouteGroupsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsAsyncClient.get_transition_route_group", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.GetTransitionRouteGroup", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "GetTransitionRouteGroup" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetTransitionRouteGroupRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.TransitionRouteGroup", + "shortName": "get_transition_route_group" }, + "description": "Sample for GetTransitionRouteGroup", "file": "dialogflow_v3beta1_generated_transition_route_groups_get_transition_route_group_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TransitionRouteGroups_GetTransitionRouteGroup_async", "segments": [ { @@ -7297,18 +13256,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_transition_route_groups_get_transition_route_group_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsClient", + "shortName": "TransitionRouteGroupsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsClient.get_transition_route_group", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.GetTransitionRouteGroup", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "GetTransitionRouteGroup" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetTransitionRouteGroupRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.TransitionRouteGroup", + "shortName": "get_transition_route_group" }, + "description": "Sample for GetTransitionRouteGroup", "file": "dialogflow_v3beta1_generated_transition_route_groups_get_transition_route_group_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TransitionRouteGroups_GetTransitionRouteGroup_sync", "segments": [ { @@ -7341,19 +13336,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_transition_route_groups_get_transition_route_group_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsAsyncClient", + "shortName": "TransitionRouteGroupsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsAsyncClient.list_transition_route_groups", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.ListTransitionRouteGroups", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "ListTransitionRouteGroups" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListTransitionRouteGroupsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.transition_route_groups.pagers.ListTransitionRouteGroupsAsyncPager", + "shortName": "list_transition_route_groups" }, + "description": "Sample for ListTransitionRouteGroups", "file": "dialogflow_v3beta1_generated_transition_route_groups_list_transition_route_groups_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TransitionRouteGroups_ListTransitionRouteGroups_async", "segments": [ { @@ -7386,18 +13417,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_transition_route_groups_list_transition_route_groups_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsClient", + "shortName": "TransitionRouteGroupsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsClient.list_transition_route_groups", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.ListTransitionRouteGroups", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "ListTransitionRouteGroups" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListTransitionRouteGroupsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.transition_route_groups.pagers.ListTransitionRouteGroupsPager", + "shortName": "list_transition_route_groups" }, + "description": "Sample for ListTransitionRouteGroups", "file": "dialogflow_v3beta1_generated_transition_route_groups_list_transition_route_groups_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TransitionRouteGroups_ListTransitionRouteGroups_sync", "segments": [ { @@ -7430,19 +13497,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_transition_route_groups_list_transition_route_groups_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsAsyncClient", + "shortName": "TransitionRouteGroupsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsAsyncClient.update_transition_route_group", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.UpdateTransitionRouteGroup", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "UpdateTransitionRouteGroup" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateTransitionRouteGroupRequest" + }, + { + "name": "transition_route_group", + "type": "google.cloud.dialogflowcx_v3beta1.types.TransitionRouteGroup" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.TransitionRouteGroup", + "shortName": "update_transition_route_group" }, + "description": "Sample for UpdateTransitionRouteGroup", "file": "dialogflow_v3beta1_generated_transition_route_groups_update_transition_route_group_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TransitionRouteGroups_UpdateTransitionRouteGroup_async", "segments": [ { @@ -7475,18 +13582,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_transition_route_groups_update_transition_route_group_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsClient", + "shortName": "TransitionRouteGroupsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.TransitionRouteGroupsClient.update_transition_route_group", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups.UpdateTransitionRouteGroup", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroups", "shortName": "TransitionRouteGroups" }, "shortName": "UpdateTransitionRouteGroup" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateTransitionRouteGroupRequest" + }, + { + "name": "transition_route_group", + "type": "google.cloud.dialogflowcx_v3beta1.types.TransitionRouteGroup" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.TransitionRouteGroup", + "shortName": "update_transition_route_group" }, + "description": "Sample for UpdateTransitionRouteGroup", "file": "dialogflow_v3beta1_generated_transition_route_groups_update_transition_route_group_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_TransitionRouteGroups_UpdateTransitionRouteGroup_sync", "segments": [ { @@ -7519,19 +13666,55 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_transition_route_groups_update_transition_route_group_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsAsyncClient", + "shortName": "VersionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsAsyncClient.compare_versions", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions.CompareVersions", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions", "shortName": "Versions" }, "shortName": "CompareVersions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CompareVersionsRequest" + }, + { + "name": "base_version", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.CompareVersionsResponse", + "shortName": "compare_versions" }, + "description": "Sample for CompareVersions", "file": "dialogflow_v3beta1_generated_versions_compare_versions_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Versions_CompareVersions_async", "segments": [ { @@ -7564,18 +13747,54 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_versions_compare_versions_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsClient", + "shortName": "VersionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsClient.compare_versions", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions.CompareVersions", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions", "shortName": "Versions" }, "shortName": "CompareVersions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CompareVersionsRequest" + }, + { + "name": "base_version", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.CompareVersionsResponse", + "shortName": "compare_versions" }, + "description": "Sample for CompareVersions", "file": "dialogflow_v3beta1_generated_versions_compare_versions_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Versions_CompareVersions_sync", "segments": [ { @@ -7608,19 +13827,59 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_versions_compare_versions_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsAsyncClient", + "shortName": "VersionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsAsyncClient.create_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions.CreateVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions", "shortName": "Versions" }, "shortName": "CreateVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateVersionRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "version", + "type": "google.cloud.dialogflowcx_v3beta1.types.Version" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_version" }, + "description": "Sample for CreateVersion", "file": "dialogflow_v3beta1_generated_versions_create_version_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Versions_CreateVersion_async", "segments": [ { @@ -7653,18 +13912,58 @@ "start": 50, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_versions_create_version_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsClient", + "shortName": "VersionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsClient.create_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions.CreateVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions", "shortName": "Versions" }, "shortName": "CreateVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateVersionRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "version", + "type": "google.cloud.dialogflowcx_v3beta1.types.Version" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_version" }, + "description": "Sample for CreateVersion", "file": "dialogflow_v3beta1_generated_versions_create_version_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Versions_CreateVersion_sync", "segments": [ { @@ -7697,19 +13996,54 @@ "start": 50, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_versions_create_version_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsAsyncClient", + "shortName": "VersionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsAsyncClient.delete_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions.DeleteVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions", "shortName": "Versions" }, "shortName": "DeleteVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_version" }, + "description": "Sample for DeleteVersion", "file": "dialogflow_v3beta1_generated_versions_delete_version_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Versions_DeleteVersion_async", "segments": [ { @@ -7740,18 +14074,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_versions_delete_version_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsClient", + "shortName": "VersionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsClient.delete_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions.DeleteVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions", "shortName": "Versions" }, "shortName": "DeleteVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_version" }, + "description": "Sample for DeleteVersion", "file": "dialogflow_v3beta1_generated_versions_delete_version_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Versions_DeleteVersion_sync", "segments": [ { @@ -7782,19 +14151,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_versions_delete_version_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsAsyncClient", + "shortName": "VersionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsAsyncClient.get_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions.GetVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions", "shortName": "Versions" }, "shortName": "GetVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Version", + "shortName": "get_version" }, + "description": "Sample for GetVersion", "file": "dialogflow_v3beta1_generated_versions_get_version_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Versions_GetVersion_async", "segments": [ { @@ -7827,18 +14232,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_versions_get_version_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsClient", + "shortName": "VersionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsClient.get_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions.GetVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions", "shortName": "Versions" }, "shortName": "GetVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Version", + "shortName": "get_version" }, + "description": "Sample for GetVersion", "file": "dialogflow_v3beta1_generated_versions_get_version_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Versions_GetVersion_sync", "segments": [ { @@ -7871,19 +14312,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_versions_get_version_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsAsyncClient", + "shortName": "VersionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsAsyncClient.list_versions", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions.ListVersions", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions", "shortName": "Versions" }, "shortName": "ListVersions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListVersionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.versions.pagers.ListVersionsAsyncPager", + "shortName": "list_versions" }, + "description": "Sample for ListVersions", "file": "dialogflow_v3beta1_generated_versions_list_versions_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Versions_ListVersions_async", "segments": [ { @@ -7916,18 +14393,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_versions_list_versions_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsClient", + "shortName": "VersionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsClient.list_versions", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions.ListVersions", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions", "shortName": "Versions" }, "shortName": "ListVersions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListVersionsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.versions.pagers.ListVersionsPager", + "shortName": "list_versions" }, + "description": "Sample for ListVersions", "file": "dialogflow_v3beta1_generated_versions_list_versions_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Versions_ListVersions_sync", "segments": [ { @@ -7960,19 +14473,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_versions_list_versions_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsAsyncClient", + "shortName": "VersionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsAsyncClient.load_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions.LoadVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions", "shortName": "Versions" }, "shortName": "LoadVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.LoadVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "load_version" }, + "description": "Sample for LoadVersion", "file": "dialogflow_v3beta1_generated_versions_load_version_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Versions_LoadVersion_async", "segments": [ { @@ -8005,18 +14554,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_versions_load_version_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsClient", + "shortName": "VersionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsClient.load_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions.LoadVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions", "shortName": "Versions" }, "shortName": "LoadVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.LoadVersionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "load_version" }, + "description": "Sample for LoadVersion", "file": "dialogflow_v3beta1_generated_versions_load_version_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Versions_LoadVersion_sync", "segments": [ { @@ -8049,19 +14634,59 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_versions_load_version_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsAsyncClient", + "shortName": "VersionsAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsAsyncClient.update_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions.UpdateVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions", "shortName": "Versions" }, "shortName": "UpdateVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateVersionRequest" + }, + { + "name": "version", + "type": "google.cloud.dialogflowcx_v3beta1.types.Version" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Version", + "shortName": "update_version" }, + "description": "Sample for UpdateVersion", "file": "dialogflow_v3beta1_generated_versions_update_version_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Versions_UpdateVersion_async", "segments": [ { @@ -8094,18 +14719,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_versions_update_version_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsClient", + "shortName": "VersionsClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.VersionsClient.update_version", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions.UpdateVersion", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Versions", "shortName": "Versions" }, "shortName": "UpdateVersion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateVersionRequest" + }, + { + "name": "version", + "type": "google.cloud.dialogflowcx_v3beta1.types.Version" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Version", + "shortName": "update_version" }, + "description": "Sample for UpdateVersion", "file": "dialogflow_v3beta1_generated_versions_update_version_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Versions_UpdateVersion_sync", "segments": [ { @@ -8138,19 +14803,59 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_versions_update_version_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksAsyncClient", + "shortName": "WebhooksAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksAsyncClient.create_webhook", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks.CreateWebhook", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks", "shortName": "Webhooks" }, "shortName": "CreateWebhook" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateWebhookRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "webhook", + "type": "google.cloud.dialogflowcx_v3beta1.types.Webhook" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Webhook", + "shortName": "create_webhook" }, + "description": "Sample for CreateWebhook", "file": "dialogflow_v3beta1_generated_webhooks_create_webhook_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Webhooks_CreateWebhook_async", "segments": [ { @@ -8183,18 +14888,58 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_webhooks_create_webhook_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksClient", + "shortName": "WebhooksClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksClient.create_webhook", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks.CreateWebhook", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks", "shortName": "Webhooks" }, "shortName": "CreateWebhook" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.CreateWebhookRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "webhook", + "type": "google.cloud.dialogflowcx_v3beta1.types.Webhook" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Webhook", + "shortName": "create_webhook" }, + "description": "Sample for CreateWebhook", "file": "dialogflow_v3beta1_generated_webhooks_create_webhook_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Webhooks_CreateWebhook_sync", "segments": [ { @@ -8227,19 +14972,54 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_webhooks_create_webhook_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksAsyncClient", + "shortName": "WebhooksAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksAsyncClient.delete_webhook", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks.DeleteWebhook", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks", "shortName": "Webhooks" }, "shortName": "DeleteWebhook" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteWebhookRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_webhook" }, + "description": "Sample for DeleteWebhook", "file": "dialogflow_v3beta1_generated_webhooks_delete_webhook_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Webhooks_DeleteWebhook_async", "segments": [ { @@ -8270,18 +15050,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_webhooks_delete_webhook_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksClient", + "shortName": "WebhooksClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksClient.delete_webhook", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks.DeleteWebhook", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks", "shortName": "Webhooks" }, "shortName": "DeleteWebhook" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.DeleteWebhookRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_webhook" }, + "description": "Sample for DeleteWebhook", "file": "dialogflow_v3beta1_generated_webhooks_delete_webhook_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Webhooks_DeleteWebhook_sync", "segments": [ { @@ -8312,19 +15127,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_webhooks_delete_webhook_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksAsyncClient", + "shortName": "WebhooksAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksAsyncClient.get_webhook", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks.GetWebhook", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks", "shortName": "Webhooks" }, "shortName": "GetWebhook" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetWebhookRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Webhook", + "shortName": "get_webhook" }, + "description": "Sample for GetWebhook", "file": "dialogflow_v3beta1_generated_webhooks_get_webhook_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Webhooks_GetWebhook_async", "segments": [ { @@ -8357,18 +15208,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_webhooks_get_webhook_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksClient", + "shortName": "WebhooksClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksClient.get_webhook", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks.GetWebhook", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks", "shortName": "Webhooks" }, "shortName": "GetWebhook" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.GetWebhookRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Webhook", + "shortName": "get_webhook" }, + "description": "Sample for GetWebhook", "file": "dialogflow_v3beta1_generated_webhooks_get_webhook_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Webhooks_GetWebhook_sync", "segments": [ { @@ -8401,19 +15288,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_webhooks_get_webhook_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksAsyncClient", + "shortName": "WebhooksAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksAsyncClient.list_webhooks", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks.ListWebhooks", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks", "shortName": "Webhooks" }, "shortName": "ListWebhooks" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListWebhooksRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.webhooks.pagers.ListWebhooksAsyncPager", + "shortName": "list_webhooks" }, + "description": "Sample for ListWebhooks", "file": "dialogflow_v3beta1_generated_webhooks_list_webhooks_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Webhooks_ListWebhooks_async", "segments": [ { @@ -8446,18 +15369,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_webhooks_list_webhooks_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksClient", + "shortName": "WebhooksClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksClient.list_webhooks", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks.ListWebhooks", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks", "shortName": "Webhooks" }, "shortName": "ListWebhooks" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.ListWebhooksRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.services.webhooks.pagers.ListWebhooksPager", + "shortName": "list_webhooks" }, + "description": "Sample for ListWebhooks", "file": "dialogflow_v3beta1_generated_webhooks_list_webhooks_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Webhooks_ListWebhooks_sync", "segments": [ { @@ -8490,19 +15449,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_webhooks_list_webhooks_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksAsyncClient", + "shortName": "WebhooksAsyncClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksAsyncClient.update_webhook", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks.UpdateWebhook", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks", "shortName": "Webhooks" }, "shortName": "UpdateWebhook" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateWebhookRequest" + }, + { + "name": "webhook", + "type": "google.cloud.dialogflowcx_v3beta1.types.Webhook" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Webhook", + "shortName": "update_webhook" }, + "description": "Sample for UpdateWebhook", "file": "dialogflow_v3beta1_generated_webhooks_update_webhook_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Webhooks_UpdateWebhook_async", "segments": [ { @@ -8535,18 +15534,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_webhooks_update_webhook_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksClient", + "shortName": "WebhooksClient" + }, + "fullName": "google.cloud.dialogflowcx_v3beta1.WebhooksClient.update_webhook", "method": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks.UpdateWebhook", "service": { + "fullName": "google.cloud.dialogflow.cx.v3beta1.Webhooks", "shortName": "Webhooks" }, "shortName": "UpdateWebhook" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dialogflowcx_v3beta1.types.UpdateWebhookRequest" + }, + { + "name": "webhook", + "type": "google.cloud.dialogflowcx_v3beta1.types.Webhook" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dialogflowcx_v3beta1.types.Webhook", + "shortName": "update_webhook" }, + "description": "Sample for UpdateWebhook", "file": "dialogflow_v3beta1_generated_webhooks_update_webhook_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dialogflow_v3beta1_generated_Webhooks_UpdateWebhook_sync", "segments": [ { @@ -8579,7 +15618,8 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dialogflow_v3beta1_generated_webhooks_update_webhook_sync.py" } ] } diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index 4c808af7..38bb0a57 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -29,7 +29,8 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" # Copy `noxfile_config.py` to your directory and modify it instead. @@ -168,12 +169,32 @@ def lint(session: nox.sessions.Session) -> None: @nox.session def blacken(session: nox.sessions.Session) -> None: + """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) python_files = [path for path in os.listdir(".") if path.endswith(".py")] session.run("black", *python_files) +# +# format = isort + black +# + +@nox.session +def format(session: nox.sessions.Session) -> None: + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + python_files = [path for path in os.listdir(".") if path.endswith(".py")] + + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run("isort", "--fss", *python_files) + session.run("black", *python_files) + + # # Sample Tests # diff --git a/samples/snippets/requirements-test.txt b/samples/snippets/requirements-test.txt index c2845bff..d00689e0 100644 --- a/samples/snippets/requirements-test.txt +++ b/samples/snippets/requirements-test.txt @@ -1 +1 @@ -pytest==7.0.1 +pytest==7.1.2 diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index b7972dbe..ee7debd1 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-dialogflow-cx==1.9.1 -Flask==2.0.3 +google-cloud-dialogflow-cx==1.10.0 +Flask==2.1.2 diff --git a/samples/snippets/webhook_configure_optional_or_required_form_parameters.py b/samples/snippets/webhook_configure_optional_or_required_form_parameters.py new file mode 100644 index 00000000..ee0911c1 --- /dev/null +++ b/samples/snippets/webhook_configure_optional_or_required_form_parameters.py @@ -0,0 +1,78 @@ +# Copyright 2022, 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. + + +""" DialogFlow CX: webhook to configure optional or required form parameters.""" + +# [START dialogflow_v3beta1_webhook_configure_optional_or_required_form_params] + +# TODO (developer): change entry point to configure_optional_form_param in Cloud Function + + +def configure_optional_form_param(request): + """Webhook to configure optional or required form parameters.""" + + request_dict = request.get_json() + form_parameter = request_dict["pageInfo"]["formInfo"]["parameterInfo"][0]["value"] + is_param_required = True + param_state = "VALID" + + if form_parameter <= 15: + text = f"{form_parameter} is a number I can work with!" + + if form_parameter > 15 and form_parameter < 20: + text = f"{form_parameter} is too many, but it's okay. Let's move on." + is_param_required = False + else: + text = f"{form_parameter} isn't going to work for me. Please try again!" + param_state = "INVALID" + form_parameter = None + + json_response = { + "fulfillment_response": { + "messages": [ + { + "text": { + "text": [ + # fulfillment text response to be sent to the agent + text + ], + }, + }, + ], + }, + "pageInfo": { + "formInfo": { + "parameterInfo": [ + { + "displayName": form_parameter, + # if required: false, the agent will not reprompt for + # this parameter, even if the state is 'INVALID' + "required": is_param_required, + "state": param_state, + }, + ], + }, + }, + "sessionInfo": { + "parameterInfo": { + # Set session parameter to null if you want to reprompt + # the user to enter a required parameter + "formParameter": form_parameter, + }, + }, + } + return json_response + + +# [END dialogflow_v3beta1_webhook_configure_optional_or_required_form_params] diff --git a/samples/snippets/webhook_configure_optional_or_required_form_parameters_test.py b/samples/snippets/webhook_configure_optional_or_required_form_parameters_test.py new file mode 100644 index 00000000..483813eb --- /dev/null +++ b/samples/snippets/webhook_configure_optional_or_required_form_parameters_test.py @@ -0,0 +1,52 @@ +# Copyright 2022, 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. + +"""Test configure optional or required form param.""" + +import flask +import pytest + +from webhook_configure_optional_or_required_form_parameters import ( + configure_optional_form_param, +) + + +@pytest.fixture(name="app", scope="module") +def fixture_app(): + """Flask fixture to pass a flask.Request to the test function.""" + return flask.Flask(__name__) + + +@pytest.mark.parametrize( + "value,form_parameter,required,state,text", + [ + (10, None, True, "INVALID", "10 isn't going to work for me. Please try again!"), + (17, 17, False, "VALID", "17 is too many, but it's okay. Let's move on."), + (25, None, True, "INVALID", "25 isn't going to work for me. Please try again!"), + ], +) +def test_validate_parameter(value, form_parameter, required, state, text, app): + """Test for configure optional or required form param.""" + + request = {"pageInfo": {"formInfo": {"parameterInfo": [{"value": value}]}}} + + with app.test_request_context(json=request): + res = configure_optional_form_param(flask.request) + assert res["sessionInfo"]["parameterInfo"]["formParameter"] == form_parameter + assert ( + res["pageInfo"]["formInfo"]["parameterInfo"][0]["displayName"] + == form_parameter + ) + assert res["pageInfo"]["formInfo"]["parameterInfo"][0]["required"] == required + assert res["pageInfo"]["formInfo"]["parameterInfo"][0]["state"] == state + assert res["fulfillment_response"]["messages"][0]["text"]["text"][0] == text diff --git a/samples/snippets/webhook_configure_session_parameters.py b/samples/snippets/webhook_configure_session_parameters.py new file mode 100644 index 00000000..4dd7cd20 --- /dev/null +++ b/samples/snippets/webhook_configure_session_parameters.py @@ -0,0 +1,54 @@ +# Copyright 2022, 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. + + +""" DialogFlow CX: webhook to configure new session parameters.""" + +# [START dialogflow_v3beta1_webhook_configure_session_parameters] + +# TODO (developer): change entry point to configure_session_params in Cloud Function + + +def configure_session_params(request): + """Webhook to validate or configure new session parameters.""" + + request_dict = request.get_json() + tag = request_dict["fulfillmentInfo"]["tag"] + + new_session_parameter = "Hi, I am new!" + text = f"{new_session_parameter}. I'm a session parameter configured by the webhook. The webhook's tag is {tag}." + + json_response = { + "fulfillment_response": { + "messages": [ + { + "text": { + "text": [ + # fulfillment text response to be sent to the agent + text + ], + }, + }, + ], + }, + "sessionInfo": { + "parameters": { + "newSessionParameter": new_session_parameter, + }, + }, + } + + return json_response + + +# [END dialogflow_v3beta1_webhook_configure_session_parameters] diff --git a/samples/snippets/webhook_configure_session_parameters_enable_agent_response.py b/samples/snippets/webhook_configure_session_parameters_enable_agent_response.py new file mode 100644 index 00000000..f338ed59 --- /dev/null +++ b/samples/snippets/webhook_configure_session_parameters_enable_agent_response.py @@ -0,0 +1,59 @@ +# Copyright 2022, 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. + + +""" DialogFlow CX: Configures a webhook to enable an agent response.""" + +# [START dialogflow_cx_v3_webhook_configure_session_parameters_enable_agent_response] + +# TODO (developer): change entry point to enable_agent_response in Cloud Function + + +def enable_agent_response(request): + """A webhook to enable an agent response.""" + + request_dict = request.get_json() + tag = request_dict["fulfillmentInfo"]["tag"] + + # The value of the parameter used to enable agent response: + session_parameter = request_dict["sessionInfo"]["parameters"]["number"] + + if tag == "increase number": + session_parameter += 100 + text = f"The new increased value of the number parameter is {session_parameter}" + elif tag == "decrease number": + session_parameter -= 50 + text = f"The new decreased value of the number parameter is {session_parameter}" + + return { + "fulfillment_response": { + "messages": [ + { + "text": { + "text": [ + # fulfillment text response to be sent to the agent + text + ], + }, + }, + ], + }, + "sessionInfo": { + "parameters": { + "number": session_parameter, + }, + }, + } + + +# [END dialogflow_cx_v3_webhook_configure_session_parameters_enable_agent_response] diff --git a/samples/snippets/webhook_configure_session_parameters_enable_agent_response_test.py b/samples/snippets/webhook_configure_session_parameters_enable_agent_response_test.py new file mode 100644 index 00000000..ebbd3c53 --- /dev/null +++ b/samples/snippets/webhook_configure_session_parameters_enable_agent_response_test.py @@ -0,0 +1,60 @@ +# Copyright 2022, 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. + +"""Test webhook to enable an agent response.""" + +import flask +import pytest + +from webhook_configure_session_parameters_enable_agent_response import ( + enable_agent_response, +) + + +@pytest.fixture(name="app", scope="module") +def fixture_app(): + """Flask fixture to pass a flask.Request to the test function.""" + return flask.Flask(__name__) + + +@pytest.mark.parametrize( + "tag,value,expected_value", + [ + ("increase number", 100, 200), + ("decrease number", 100, 50), + ], +) +def test_enable_agent_response(tag, value, expected_value, app): + """Test for webhook to enable an agent response.""" + + request = { + "fulfillmentInfo": {"tag": tag}, + "sessionInfo": {"parameters": {"number": value}}, + } + + if tag == "increase number": + expected_text = ( + f"The new increased value of the number parameter is {expected_value}" + ) + else: + expected_text = ( + f"The new decreased value of the number parameter is {expected_value}" + ) + + with app.test_request_context(json=request): + res = enable_agent_response(flask.request) + assert ( + res["fulfillment_response"]["messages"][0]["text"]["text"][0] + == expected_text + ) + assert res["sessionInfo"]["parameters"]["number"] == expected_value diff --git a/samples/snippets/webhook_configure_session_parameters_test.py b/samples/snippets/webhook_configure_session_parameters_test.py new file mode 100644 index 00000000..832249a2 --- /dev/null +++ b/samples/snippets/webhook_configure_session_parameters_test.py @@ -0,0 +1,41 @@ +# Copyright 2022, 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. + +"""Test configure new session parameters""" + +import flask +import pytest + +from webhook_configure_session_parameters import configure_session_params + + +@pytest.fixture(name="app", scope="module") +def fixture_app(): + """Flask fixture to pass a flask.Request to the test function.""" + return flask.Flask(__name__) + + +def test_validate_parameter(app): + """Test for configure new session parameters.""" + + request = {"fulfillmentInfo": {"tag": "MOCK_TAG"}} + + with app.test_request_context(json=request): + res = configure_session_params(flask.request) + assert ( + res["fulfillment_response"]["messages"][0]["text"]["text"][0] + == ( + "Hi, I am new!. I'm a session parameter configured by the webhook. " + "The webhook's tag is MOCK_TAG." + ) + ) diff --git a/samples/snippets/webhook_configure_session_parameters_trigger_transition.py b/samples/snippets/webhook_configure_session_parameters_trigger_transition.py new file mode 100644 index 00000000..62dde88d --- /dev/null +++ b/samples/snippets/webhook_configure_session_parameters_trigger_transition.py @@ -0,0 +1,60 @@ +# Copyright 2022, 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. + + +""" DialogFlow CX: Configure new session parameters with trigger transition.""" + +# [START dialogflow_v3beta1_webhook_configure_session_parameters_trigger_transition] + +# TODO (developer): change entry point to trigger_transition in Cloud Function + + +def trigger_transition(request): + """Webhook to validate or configure new session parameters.""" + + request_dict = request.get_json() + session_parameter = request_dict["sessionInfo"]["parameters"].get("value", 25) + + if session_parameter > 15: + text = f"You said {session_parameter}. Let me redirect you to our higher number department" + target_page = ( + "projects//locations//" + "agents//flows//pages/" + ) + else: + text = f"{session_parameter} is a number I can help you with!" + target_page = ( + "projects//locations//" + "agents//flows//pages/" + ) + + json_response = { + "target_page": target_page, + "fulfillment_response": { + "messages": [ + { + "text": { + "text": [ + # fulfillment text response to be sent to the agent + text + ], + }, + }, + ], + }, + } + + return json_response + + +# [END dialogflow_v3beta1_webhook_configure_session_parameters_trigger_transition] diff --git a/samples/snippets/webhook_configure_session_parameters_trigger_transition_test.py b/samples/snippets/webhook_configure_session_parameters_trigger_transition_test.py new file mode 100644 index 00000000..99b73222 --- /dev/null +++ b/samples/snippets/webhook_configure_session_parameters_trigger_transition_test.py @@ -0,0 +1,53 @@ +# Copyright 2022, 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. + +"""Test configure new session parameters trigger transition.""" + +import flask +import pytest + +from webhook_configure_session_parameters_trigger_transition import trigger_transition + + +@pytest.fixture(name="app", scope="module") +def fixture_app(): + """Flask fixture to pass a flask.Request to the test function.""" + return flask.Flask(__name__) + + +@pytest.mark.parametrize( + "value,expected_response", + [ + (15, "15 is a number I can help you with!"), + (None, "You said 25. Let me redirect you to our higher number department"), + (30, "You said 30. Let me redirect you to our higher number department"), + ], +) +def test_trigger_transition(value, expected_response, app): + """Parameterized test for configure new session parameters with trigger transition.""" + + if not value: + request = {"sessionInfo": {"parameters": {}}} + else: + request = {"sessionInfo": {"parameters": {"value": value}}} + + with app.test_request_context(json=request): + res = trigger_transition(flask.request) + assert res["target_page"] == ( + "projects//locations//" + "agents//flows//pages/" + ) + assert ( + res["fulfillment_response"]["messages"][0]["text"]["text"][0] + == expected_response + ) diff --git a/samples/snippets/webhook_validate_form_parameter.py b/samples/snippets/webhook_validate_form_parameter.py new file mode 100644 index 00000000..9430e457 --- /dev/null +++ b/samples/snippets/webhook_validate_form_parameter.py @@ -0,0 +1,71 @@ +# Copyright 2022, 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. + + +""" DialogFlow CX: webhook to validate or invalidate form parameters snippet.""" + +# [START dialogflow_v3beta1_webhook_validate_form_parameter] + +# TODO (developer): change entry point to validate_parameter in Cloud Function + + +def validate_parameter(request): + """Webhook to validate or invalidate parameter based on conditions configured by the user.""" + + request_dict = request.get_json() + param_to_validate = request_dict["pageInfo"]["formInfo"]["parameterInfo"][0][ + "value" + ] + + if param_to_validate > 15: + text = "That is too many! Please pick another number." + param_state = "INVALID" + else: + text = "That is a number I can work with!" + param_state = "VALID" + + json_response = { + "fulfillment_response": { + "messages": [ + { + "text": { + "text": [ + text + ], # fulfillment text response to be sent to the agent + }, + }, + ], + }, + "page_info": { + "form_info": { + "parameter_info": [ + { + "displayName": "paramToValidate", + "required": True, + "state": param_state, + }, + ], + }, + }, + "sessionInfo": { + "parameters": { + # Set session parameter to null if your agent needs to reprompt the user + "paramToValidate": None + }, + }, + } + + return json_response + + +# [END dialogflow_v3beta1_webhook_validate_form_parameter] diff --git a/samples/snippets/webhook_validate_form_parameter_test.py b/samples/snippets/webhook_validate_form_parameter_test.py new file mode 100644 index 00000000..b8aa8c98 --- /dev/null +++ b/samples/snippets/webhook_validate_form_parameter_test.py @@ -0,0 +1,45 @@ +# Copyright 2022, 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. + +"""Test validate form parameter webhook snippet.""" + +import flask +import pytest + +from webhook_validate_form_parameter import validate_parameter + + +@pytest.fixture(name="app", scope="module") +def fixture_app(): + """Flask fixture to pass a flask.Request to the test function""" + return flask.Flask(__name__) + + +@pytest.mark.parametrize( + "value,expected_response", + [ + (15, "That is a number I can work with!"), + (16, "That is too many! Please pick another number."), + ], +) +def test_validate_parameter(value, expected_response, app): + """Parameterized test for validate form parameter webhook snippet.""" + + request = {"pageInfo": {"formInfo": {"parameterInfo": [{"value": value}]}}} + + with app.test_request_context(json=request): + res = validate_parameter(flask.request) + assert ( + res["fulfillment_response"]["messages"][0]["text"]["text"][0] + == expected_response + ) diff --git a/scripts/fixup_dialogflowcx_v3_keywords.py b/scripts/fixup_dialogflowcx_v3_keywords.py index 87532407..24a0ece5 100644 --- a/scripts/fixup_dialogflowcx_v3_keywords.py +++ b/scripts/fixup_dialogflowcx_v3_keywords.py @@ -70,7 +70,7 @@ class dialogflowcxCallTransformer(cst.CSTTransformer): 'delete_webhook': ('name', 'force', ), 'deploy_flow': ('environment', 'flow_version', ), 'detect_intent': ('session', 'query_input', 'query_params', 'output_audio_config', ), - 'export_agent': ('name', 'agent_uri', 'environment', ), + 'export_agent': ('name', 'agent_uri', 'data_format', 'environment', ), 'export_flow': ('name', 'flow_uri', 'include_referenced_flows', ), 'export_test_cases': ('parent', 'gcs_uri', 'data_format', 'filter', ), 'fulfill_intent': ('match_intent_request', 'match', 'output_audio_config', ), diff --git a/scripts/fixup_dialogflowcx_v3beta1_keywords.py b/scripts/fixup_dialogflowcx_v3beta1_keywords.py index 87532407..24a0ece5 100644 --- a/scripts/fixup_dialogflowcx_v3beta1_keywords.py +++ b/scripts/fixup_dialogflowcx_v3beta1_keywords.py @@ -70,7 +70,7 @@ class dialogflowcxCallTransformer(cst.CSTTransformer): 'delete_webhook': ('name', 'force', ), 'deploy_flow': ('environment', 'flow_version', ), 'detect_intent': ('session', 'query_input', 'query_params', 'output_audio_config', ), - 'export_agent': ('name', 'agent_uri', 'environment', ), + 'export_agent': ('name', 'agent_uri', 'data_format', 'environment', ), 'export_flow': ('name', 'flow_uri', 'include_referenced_flows', ), 'export_test_cases': ('parent', 'gcs_uri', 'data_format', 'filter', ), 'fulfill_intent': ('match_intent_request', 'match', 'output_audio_config', ), diff --git a/setup.py b/setup.py index f47a1d73..5af06827 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ import os import setuptools # type: ignore -version = "1.10.0" +version = "1.11.0" package_root = os.path.abspath(os.path.dirname(__file__)) diff --git a/tests/unit/gapic/dialogflowcx_v3/test_agents.py b/tests/unit/gapic/dialogflowcx_v3/test_agents.py index d6d26853..bf3c1c22 100644 --- a/tests/unit/gapic/dialogflowcx_v3/test_agents.py +++ b/tests/unit/gapic/dialogflowcx_v3/test_agents.py @@ -88,19 +88,25 @@ def test__get_default_mtls_endpoint(): assert AgentsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [AgentsClient, AgentsAsyncClient,]) -def test_agents_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (AgentsClient, "grpc"), + (AgentsAsyncClient, "grpc_asyncio"), + ], +) +def test_agents_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -126,22 +132,32 @@ def test_agents_client_service_account_always_use_jwt(transport_class, transport use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [AgentsClient, AgentsAsyncClient,]) -def test_agents_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (AgentsClient, "grpc"), + (AgentsAsyncClient, "grpc_asyncio"), + ], +) +def test_agents_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_agents_client_get_transport_class(): @@ -465,7 +481,9 @@ def test_agents_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -596,10 +614,17 @@ def test_agents_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [agent.ListAgentsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + agent.ListAgentsRequest, + dict, + ], +) def test_list_agents(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -628,7 +653,8 @@ def test_list_agents_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -644,7 +670,8 @@ async def test_list_agents_async( transport: str = "grpc_asyncio", request_type=agent.ListAgentsRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -655,7 +682,9 @@ async def test_list_agents_async( with mock.patch.object(type(client.transport.list_agents), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - agent.ListAgentsResponse(next_page_token="next_page_token_value",) + agent.ListAgentsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_agents(request) @@ -675,13 +704,15 @@ async def test_list_agents_async_from_dict(): def test_list_agents_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.ListAgentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_agents), "__call__") as call: @@ -695,18 +726,23 @@ def test_list_agents_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_agents_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.ListAgentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_agents), "__call__") as call: @@ -722,11 +758,16 @@ async def test_list_agents_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_agents_flattened(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_agents), "__call__") as call: @@ -734,7 +775,9 @@ def test_list_agents_flattened(): call.return_value = agent.ListAgentsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_agents(parent="parent_value",) + client.list_agents( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -746,19 +789,24 @@ def test_list_agents_flattened(): def test_list_agents_flattened_error(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_agents( - agent.ListAgentsRequest(), parent="parent_value", + agent.ListAgentsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_agents_flattened_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_agents), "__call__") as call: @@ -770,7 +818,9 @@ async def test_list_agents_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_agents(parent="parent_value",) + response = await client.list_agents( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -783,19 +833,23 @@ async def test_list_agents_flattened_async(): @pytest.mark.asyncio async def test_list_agents_flattened_error_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_agents( - agent.ListAgentsRequest(), parent="parent_value", + agent.ListAgentsRequest(), + parent="parent_value", ) def test_list_agents_pager(transport_name: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -803,12 +857,29 @@ def test_list_agents_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( agent.ListAgentsResponse( - agents=[agent.Agent(), agent.Agent(), agent.Agent(),], + agents=[ + agent.Agent(), + agent.Agent(), + agent.Agent(), + ], next_page_token="abc", ), - agent.ListAgentsResponse(agents=[], next_page_token="def",), - agent.ListAgentsResponse(agents=[agent.Agent(),], next_page_token="ghi",), - agent.ListAgentsResponse(agents=[agent.Agent(), agent.Agent(),],), + agent.ListAgentsResponse( + agents=[], + next_page_token="def", + ), + agent.ListAgentsResponse( + agents=[ + agent.Agent(), + ], + next_page_token="ghi", + ), + agent.ListAgentsResponse( + agents=[ + agent.Agent(), + agent.Agent(), + ], + ), RuntimeError, ) @@ -820,14 +891,15 @@ def test_list_agents_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, agent.Agent) for i in results) def test_list_agents_pages(transport_name: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -835,12 +907,29 @@ def test_list_agents_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( agent.ListAgentsResponse( - agents=[agent.Agent(), agent.Agent(), agent.Agent(),], + agents=[ + agent.Agent(), + agent.Agent(), + agent.Agent(), + ], next_page_token="abc", ), - agent.ListAgentsResponse(agents=[], next_page_token="def",), - agent.ListAgentsResponse(agents=[agent.Agent(),], next_page_token="ghi",), - agent.ListAgentsResponse(agents=[agent.Agent(), agent.Agent(),],), + agent.ListAgentsResponse( + agents=[], + next_page_token="def", + ), + agent.ListAgentsResponse( + agents=[ + agent.Agent(), + ], + next_page_token="ghi", + ), + agent.ListAgentsResponse( + agents=[ + agent.Agent(), + agent.Agent(), + ], + ), RuntimeError, ) pages = list(client.list_agents(request={}).pages) @@ -850,7 +939,9 @@ def test_list_agents_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_agents_async_pager(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -859,18 +950,37 @@ async def test_list_agents_async_pager(): # Set the response to a series of pages. call.side_effect = ( agent.ListAgentsResponse( - agents=[agent.Agent(), agent.Agent(), agent.Agent(),], + agents=[ + agent.Agent(), + agent.Agent(), + agent.Agent(), + ], next_page_token="abc", ), - agent.ListAgentsResponse(agents=[], next_page_token="def",), - agent.ListAgentsResponse(agents=[agent.Agent(),], next_page_token="ghi",), - agent.ListAgentsResponse(agents=[agent.Agent(), agent.Agent(),],), + agent.ListAgentsResponse( + agents=[], + next_page_token="def", + ), + agent.ListAgentsResponse( + agents=[ + agent.Agent(), + ], + next_page_token="ghi", + ), + agent.ListAgentsResponse( + agents=[ + agent.Agent(), + agent.Agent(), + ], + ), RuntimeError, ) - async_pager = await client.list_agents(request={},) + async_pager = await client.list_agents( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -879,7 +989,9 @@ async def test_list_agents_async_pager(): @pytest.mark.asyncio async def test_list_agents_async_pages(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -888,25 +1000,51 @@ async def test_list_agents_async_pages(): # Set the response to a series of pages. call.side_effect = ( agent.ListAgentsResponse( - agents=[agent.Agent(), agent.Agent(), agent.Agent(),], + agents=[ + agent.Agent(), + agent.Agent(), + agent.Agent(), + ], next_page_token="abc", ), - agent.ListAgentsResponse(agents=[], next_page_token="def",), - agent.ListAgentsResponse(agents=[agent.Agent(),], next_page_token="ghi",), - agent.ListAgentsResponse(agents=[agent.Agent(), agent.Agent(),],), + agent.ListAgentsResponse( + agents=[], + next_page_token="def", + ), + agent.ListAgentsResponse( + agents=[ + agent.Agent(), + ], + next_page_token="ghi", + ), + agent.ListAgentsResponse( + agents=[ + agent.Agent(), + agent.Agent(), + ], + ), RuntimeError, ) pages = [] - async for page_ in (await client.list_agents(request={})).pages: + async for page_ in ( + await client.list_agents(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [agent.GetAgentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + agent.GetAgentRequest, + dict, + ], +) def test_get_agent(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -928,6 +1066,7 @@ def test_get_agent(request_type, transport: str = "grpc"): security_settings="security_settings_value", enable_stackdriver_logging=True, enable_spell_correction=True, + locked=True, ) response = client.get_agent(request) @@ -949,13 +1088,15 @@ def test_get_agent(request_type, transport: str = "grpc"): assert response.security_settings == "security_settings_value" assert response.enable_stackdriver_logging is True assert response.enable_spell_correction is True + assert response.locked is True def test_get_agent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -971,7 +1112,8 @@ async def test_get_agent_async( transport: str = "grpc_asyncio", request_type=agent.GetAgentRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -994,6 +1136,7 @@ async def test_get_agent_async( security_settings="security_settings_value", enable_stackdriver_logging=True, enable_spell_correction=True, + locked=True, ) ) response = await client.get_agent(request) @@ -1016,6 +1159,7 @@ async def test_get_agent_async( assert response.security_settings == "security_settings_value" assert response.enable_stackdriver_logging is True assert response.enable_spell_correction is True + assert response.locked is True @pytest.mark.asyncio @@ -1024,13 +1168,15 @@ async def test_get_agent_async_from_dict(): def test_get_agent_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.GetAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_agent), "__call__") as call: @@ -1044,18 +1190,23 @@ def test_get_agent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_agent_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.GetAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_agent), "__call__") as call: @@ -1069,11 +1220,16 @@ async def test_get_agent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_agent_flattened(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_agent), "__call__") as call: @@ -1081,7 +1237,9 @@ def test_get_agent_flattened(): call.return_value = agent.Agent() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_agent(name="name_value",) + client.get_agent( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1093,19 +1251,24 @@ def test_get_agent_flattened(): def test_get_agent_flattened_error(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_agent( - agent.GetAgentRequest(), name="name_value", + agent.GetAgentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_agent_flattened_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_agent), "__call__") as call: @@ -1115,7 +1278,9 @@ async def test_get_agent_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(agent.Agent()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_agent(name="name_value",) + response = await client.get_agent( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1128,20 +1293,30 @@ async def test_get_agent_flattened_async(): @pytest.mark.asyncio async def test_get_agent_flattened_error_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_agent( - agent.GetAgentRequest(), name="name_value", + agent.GetAgentRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [gcdc_agent.CreateAgentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_agent.CreateAgentRequest, + dict, + ], +) def test_create_agent(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1163,6 +1338,7 @@ def test_create_agent(request_type, transport: str = "grpc"): security_settings="security_settings_value", enable_stackdriver_logging=True, enable_spell_correction=True, + locked=True, ) response = client.create_agent(request) @@ -1184,13 +1360,15 @@ def test_create_agent(request_type, transport: str = "grpc"): assert response.security_settings == "security_settings_value" assert response.enable_stackdriver_logging is True assert response.enable_spell_correction is True + assert response.locked is True def test_create_agent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1206,7 +1384,8 @@ async def test_create_agent_async( transport: str = "grpc_asyncio", request_type=gcdc_agent.CreateAgentRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1229,6 +1408,7 @@ async def test_create_agent_async( security_settings="security_settings_value", enable_stackdriver_logging=True, enable_spell_correction=True, + locked=True, ) ) response = await client.create_agent(request) @@ -1251,6 +1431,7 @@ async def test_create_agent_async( assert response.security_settings == "security_settings_value" assert response.enable_stackdriver_logging is True assert response.enable_spell_correction is True + assert response.locked is True @pytest.mark.asyncio @@ -1259,13 +1440,15 @@ async def test_create_agent_async_from_dict(): def test_create_agent_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_agent.CreateAgentRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_agent), "__call__") as call: @@ -1279,18 +1462,23 @@ def test_create_agent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_agent_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_agent.CreateAgentRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_agent), "__call__") as call: @@ -1304,11 +1492,16 @@ async def test_create_agent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_agent_flattened(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_agent), "__call__") as call: @@ -1317,7 +1510,8 @@ def test_create_agent_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_agent( - parent="parent_value", agent=gcdc_agent.Agent(name="name_value"), + parent="parent_value", + agent=gcdc_agent.Agent(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1333,7 +1527,9 @@ def test_create_agent_flattened(): def test_create_agent_flattened_error(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1347,7 +1543,9 @@ def test_create_agent_flattened_error(): @pytest.mark.asyncio async def test_create_agent_flattened_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_agent), "__call__") as call: @@ -1358,7 +1556,8 @@ async def test_create_agent_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_agent( - parent="parent_value", agent=gcdc_agent.Agent(name="name_value"), + parent="parent_value", + agent=gcdc_agent.Agent(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1375,7 +1574,9 @@ async def test_create_agent_flattened_async(): @pytest.mark.asyncio async def test_create_agent_flattened_error_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1387,10 +1588,17 @@ async def test_create_agent_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [gcdc_agent.UpdateAgentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_agent.UpdateAgentRequest, + dict, + ], +) def test_update_agent(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1412,6 +1620,7 @@ def test_update_agent(request_type, transport: str = "grpc"): security_settings="security_settings_value", enable_stackdriver_logging=True, enable_spell_correction=True, + locked=True, ) response = client.update_agent(request) @@ -1433,13 +1642,15 @@ def test_update_agent(request_type, transport: str = "grpc"): assert response.security_settings == "security_settings_value" assert response.enable_stackdriver_logging is True assert response.enable_spell_correction is True + assert response.locked is True def test_update_agent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1455,7 +1666,8 @@ async def test_update_agent_async( transport: str = "grpc_asyncio", request_type=gcdc_agent.UpdateAgentRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1478,6 +1690,7 @@ async def test_update_agent_async( security_settings="security_settings_value", enable_stackdriver_logging=True, enable_spell_correction=True, + locked=True, ) ) response = await client.update_agent(request) @@ -1500,6 +1713,7 @@ async def test_update_agent_async( assert response.security_settings == "security_settings_value" assert response.enable_stackdriver_logging is True assert response.enable_spell_correction is True + assert response.locked is True @pytest.mark.asyncio @@ -1508,13 +1722,15 @@ async def test_update_agent_async_from_dict(): def test_update_agent_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_agent.UpdateAgentRequest() - request.agent.name = "agent.name/value" + request.agent.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_agent), "__call__") as call: @@ -1528,18 +1744,23 @@ def test_update_agent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "agent.name=agent.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "agent.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_agent_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_agent.UpdateAgentRequest() - request.agent.name = "agent.name/value" + request.agent.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_agent), "__call__") as call: @@ -1553,11 +1774,16 @@ async def test_update_agent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "agent.name=agent.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "agent.name=name_value", + ) in kw["metadata"] def test_update_agent_flattened(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_agent), "__call__") as call: @@ -1583,7 +1809,9 @@ def test_update_agent_flattened(): def test_update_agent_flattened_error(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1597,7 +1825,9 @@ def test_update_agent_flattened_error(): @pytest.mark.asyncio async def test_update_agent_flattened_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_agent), "__call__") as call: @@ -1626,7 +1856,9 @@ async def test_update_agent_flattened_async(): @pytest.mark.asyncio async def test_update_agent_flattened_error_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1638,10 +1870,17 @@ async def test_update_agent_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [agent.DeleteAgentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + agent.DeleteAgentRequest, + dict, + ], +) def test_delete_agent(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1667,7 +1906,8 @@ def test_delete_agent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1683,7 +1923,8 @@ async def test_delete_agent_async( transport: str = "grpc_asyncio", request_type=agent.DeleteAgentRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1711,13 +1952,15 @@ async def test_delete_agent_async_from_dict(): def test_delete_agent_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.DeleteAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_agent), "__call__") as call: @@ -1731,18 +1974,23 @@ def test_delete_agent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_agent_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.DeleteAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_agent), "__call__") as call: @@ -1756,11 +2004,16 @@ async def test_delete_agent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_agent_flattened(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_agent), "__call__") as call: @@ -1768,7 +2021,9 @@ def test_delete_agent_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_agent(name="name_value",) + client.delete_agent( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1780,19 +2035,24 @@ def test_delete_agent_flattened(): def test_delete_agent_flattened_error(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_agent( - agent.DeleteAgentRequest(), name="name_value", + agent.DeleteAgentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_agent_flattened_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_agent), "__call__") as call: @@ -1802,7 +2062,9 @@ async def test_delete_agent_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_agent(name="name_value",) + response = await client.delete_agent( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1815,20 +2077,30 @@ async def test_delete_agent_flattened_async(): @pytest.mark.asyncio async def test_delete_agent_flattened_error_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_agent( - agent.DeleteAgentRequest(), name="name_value", + agent.DeleteAgentRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [agent.ExportAgentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + agent.ExportAgentRequest, + dict, + ], +) def test_export_agent(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1854,7 +2126,8 @@ def test_export_agent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1870,7 +2143,8 @@ async def test_export_agent_async( transport: str = "grpc_asyncio", request_type=agent.ExportAgentRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1900,13 +2174,15 @@ async def test_export_agent_async_from_dict(): def test_export_agent_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.ExportAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.export_agent), "__call__") as call: @@ -1920,18 +2196,23 @@ def test_export_agent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_export_agent_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.ExportAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.export_agent), "__call__") as call: @@ -1947,13 +2228,23 @@ async def test_export_agent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [agent.RestoreAgentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + agent.RestoreAgentRequest, + dict, + ], +) def test_restore_agent(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1979,7 +2270,8 @@ def test_restore_agent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1995,7 +2287,8 @@ async def test_restore_agent_async( transport: str = "grpc_asyncio", request_type=agent.RestoreAgentRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2025,13 +2318,15 @@ async def test_restore_agent_async_from_dict(): def test_restore_agent_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.RestoreAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.restore_agent), "__call__") as call: @@ -2045,18 +2340,23 @@ def test_restore_agent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_restore_agent_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.RestoreAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.restore_agent), "__call__") as call: @@ -2072,13 +2372,23 @@ async def test_restore_agent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [agent.ValidateAgentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + agent.ValidateAgentRequest, + dict, + ], +) def test_validate_agent(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2088,7 +2398,9 @@ def test_validate_agent(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.validate_agent), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = agent.AgentValidationResult(name="name_value",) + call.return_value = agent.AgentValidationResult( + name="name_value", + ) response = client.validate_agent(request) # Establish that the underlying gRPC stub method was called. @@ -2105,7 +2417,8 @@ def test_validate_agent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2121,7 +2434,8 @@ async def test_validate_agent_async( transport: str = "grpc_asyncio", request_type=agent.ValidateAgentRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2132,7 +2446,9 @@ async def test_validate_agent_async( with mock.patch.object(type(client.transport.validate_agent), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - agent.AgentValidationResult(name="name_value",) + agent.AgentValidationResult( + name="name_value", + ) ) response = await client.validate_agent(request) @@ -2152,13 +2468,15 @@ async def test_validate_agent_async_from_dict(): def test_validate_agent_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.ValidateAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.validate_agent), "__call__") as call: @@ -2172,18 +2490,23 @@ def test_validate_agent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_validate_agent_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.ValidateAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.validate_agent), "__call__") as call: @@ -2199,13 +2522,23 @@ async def test_validate_agent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [agent.GetAgentValidationResultRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + agent.GetAgentValidationResultRequest, + dict, + ], +) def test_get_agent_validation_result(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2217,7 +2550,9 @@ def test_get_agent_validation_result(request_type, transport: str = "grpc"): type(client.transport.get_agent_validation_result), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = agent.AgentValidationResult(name="name_value",) + call.return_value = agent.AgentValidationResult( + name="name_value", + ) response = client.get_agent_validation_result(request) # Establish that the underlying gRPC stub method was called. @@ -2234,7 +2569,8 @@ def test_get_agent_validation_result_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2252,7 +2588,8 @@ async def test_get_agent_validation_result_async( transport: str = "grpc_asyncio", request_type=agent.GetAgentValidationResultRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2265,7 +2602,9 @@ async def test_get_agent_validation_result_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - agent.AgentValidationResult(name="name_value",) + agent.AgentValidationResult( + name="name_value", + ) ) response = await client.get_agent_validation_result(request) @@ -2285,13 +2624,15 @@ async def test_get_agent_validation_result_async_from_dict(): def test_get_agent_validation_result_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.GetAgentValidationResultRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2307,18 +2648,23 @@ def test_get_agent_validation_result_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_agent_validation_result_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.GetAgentValidationResultRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2336,11 +2682,16 @@ async def test_get_agent_validation_result_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_agent_validation_result_flattened(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2350,7 +2701,9 @@ def test_get_agent_validation_result_flattened(): call.return_value = agent.AgentValidationResult() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_agent_validation_result(name="name_value",) + client.get_agent_validation_result( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2362,19 +2715,24 @@ def test_get_agent_validation_result_flattened(): def test_get_agent_validation_result_flattened_error(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_agent_validation_result( - agent.GetAgentValidationResultRequest(), name="name_value", + agent.GetAgentValidationResultRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_agent_validation_result_flattened_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2388,7 +2746,9 @@ async def test_get_agent_validation_result_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_agent_validation_result(name="name_value",) + response = await client.get_agent_validation_result( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2401,13 +2761,16 @@ async def test_get_agent_validation_result_flattened_async(): @pytest.mark.asyncio async def test_get_agent_validation_result_flattened_error_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_agent_validation_result( - agent.GetAgentValidationResultRequest(), name="name_value", + agent.GetAgentValidationResultRequest(), + name="name_value", ) @@ -2418,7 +2781,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2438,7 +2802,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = AgentsClient(client_options=options, transport=transport,) + client = AgentsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2454,7 +2821,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AgentsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2484,7 +2852,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.AgentsGrpcTransport, transports.AgentsGrpcAsyncIOTransport,], + [ + transports.AgentsGrpcTransport, + transports.AgentsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2494,10 +2865,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = AgentsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.AgentsGrpcTransport,) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.AgentsGrpcTransport, + ) def test_agents_base_transport_error(): @@ -2544,6 +2933,14 @@ def test_agents_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_agents_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2555,7 +2952,8 @@ def test_agents_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AgentsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2596,7 +2994,10 @@ def test_agents_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.AgentsGrpcTransport, transports.AgentsGrpcAsyncIOTransport,], + [ + transports.AgentsGrpcTransport, + transports.AgentsGrpcAsyncIOTransport, + ], ) def test_agents_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2694,24 +3095,40 @@ def test_agents_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_agents_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_agents_host_no_port(transport_name): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_agents_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_agents_host_with_port(transport_name): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_agents_grpc_transport_channel(): @@ -2719,7 +3136,8 @@ def test_agents_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.AgentsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2731,7 +3149,8 @@ def test_agents_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.AgentsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2832,12 +3251,16 @@ def test_agents_transport_channel_mtls_with_adc(transport_class): def test_agents_grpc_lro_client(): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2845,12 +3268,16 @@ def test_agents_grpc_lro_client(): def test_agents_grpc_lro_async_client(): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2861,7 +3288,9 @@ def test_agent_path(): location = "clam" agent = "whelk" expected = "projects/{project}/locations/{location}/agents/{agent}".format( - project=project, location=location, agent=agent, + project=project, + location=location, + agent=agent, ) actual = AgentsClient.agent_path(project, location, agent) assert expected == actual @@ -2885,7 +3314,9 @@ def test_agent_validation_result_path(): location = "mussel" agent = "winkle" expected = "projects/{project}/locations/{location}/agents/{agent}/validationResult".format( - project=project, location=location, agent=agent, + project=project, + location=location, + agent=agent, ) actual = AgentsClient.agent_validation_result_path(project, location, agent) assert expected == actual @@ -2910,7 +3341,10 @@ def test_environment_path(): agent = "whelk" environment = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}".format( - project=project, location=location, agent=agent, environment=environment, + project=project, + location=location, + agent=agent, + environment=environment, ) actual = AgentsClient.environment_path(project, location, agent, environment) assert expected == actual @@ -2935,8 +3369,13 @@ def test_flow_path(): location = "nautilus" agent = "scallop" flow = "abalone" - expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + expected = ( + "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( + project=project, + location=location, + agent=agent, + flow=flow, + ) ) actual = AgentsClient.flow_path(project, location, agent, flow) assert expected == actual @@ -2962,7 +3401,10 @@ def test_flow_validation_result_path(): agent = "cuttlefish" flow = "mussel" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/validationResult".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) actual = AgentsClient.flow_validation_result_path(project, location, agent, flow) assert expected == actual @@ -2987,7 +3429,9 @@ def test_security_settings_path(): location = "clam" security_settings = "whelk" expected = "projects/{project}/locations/{location}/securitySettings/{security_settings}".format( - project=project, location=location, security_settings=security_settings, + project=project, + location=location, + security_settings=security_settings, ) actual = AgentsClient.security_settings_path(project, location, security_settings) assert expected == actual @@ -3028,7 +3472,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "winkle" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = AgentsClient.common_folder_path(folder) assert expected == actual @@ -3046,7 +3492,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "scallop" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = AgentsClient.common_organization_path(organization) assert expected == actual @@ -3064,7 +3512,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "squid" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = AgentsClient.common_project_path(project) assert expected == actual @@ -3084,7 +3534,8 @@ def test_common_location_path(): project = "whelk" location = "octopus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = AgentsClient.common_location_path(project, location) assert expected == actual @@ -3109,7 +3560,8 @@ def test_client_with_default_client_info(): transports.AgentsTransport, "_prep_wrapped_messages" ) as prep: client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3118,7 +3570,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AgentsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3126,7 +3579,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3/test_changelogs.py b/tests/unit/gapic/dialogflowcx_v3/test_changelogs.py index 34a0adff..e0b97063 100644 --- a/tests/unit/gapic/dialogflowcx_v3/test_changelogs.py +++ b/tests/unit/gapic/dialogflowcx_v3/test_changelogs.py @@ -82,19 +82,25 @@ def test__get_default_mtls_endpoint(): assert ChangelogsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [ChangelogsClient, ChangelogsAsyncClient,]) -def test_changelogs_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ChangelogsClient, "grpc"), + (ChangelogsAsyncClient, "grpc_asyncio"), + ], +) +def test_changelogs_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -122,22 +128,32 @@ def test_changelogs_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [ChangelogsClient, ChangelogsAsyncClient,]) -def test_changelogs_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ChangelogsClient, "grpc"), + (ChangelogsAsyncClient, "grpc_asyncio"), + ], +) +def test_changelogs_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_changelogs_client_get_transport_class(): @@ -477,7 +493,9 @@ def test_changelogs_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -608,10 +626,17 @@ def test_changelogs_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [changelog.ListChangelogsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + changelog.ListChangelogsRequest, + dict, + ], +) def test_list_changelogs(request_type, transport: str = "grpc"): client = ChangelogsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -640,7 +665,8 @@ def test_list_changelogs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ChangelogsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -656,7 +682,8 @@ async def test_list_changelogs_async( transport: str = "grpc_asyncio", request_type=changelog.ListChangelogsRequest ): client = ChangelogsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -667,7 +694,9 @@ async def test_list_changelogs_async( with mock.patch.object(type(client.transport.list_changelogs), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - changelog.ListChangelogsResponse(next_page_token="next_page_token_value",) + changelog.ListChangelogsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_changelogs(request) @@ -687,13 +716,15 @@ async def test_list_changelogs_async_from_dict(): def test_list_changelogs_field_headers(): - client = ChangelogsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = changelog.ListChangelogsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_changelogs), "__call__") as call: @@ -707,18 +738,23 @@ def test_list_changelogs_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_changelogs_field_headers_async(): - client = ChangelogsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = changelog.ListChangelogsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_changelogs), "__call__") as call: @@ -734,11 +770,16 @@ async def test_list_changelogs_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_changelogs_flattened(): - client = ChangelogsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_changelogs), "__call__") as call: @@ -746,7 +787,9 @@ def test_list_changelogs_flattened(): call.return_value = changelog.ListChangelogsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_changelogs(parent="parent_value",) + client.list_changelogs( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -758,19 +801,24 @@ def test_list_changelogs_flattened(): def test_list_changelogs_flattened_error(): - client = ChangelogsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_changelogs( - changelog.ListChangelogsRequest(), parent="parent_value", + changelog.ListChangelogsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_changelogs_flattened_async(): - client = ChangelogsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_changelogs), "__call__") as call: @@ -782,7 +830,9 @@ async def test_list_changelogs_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_changelogs(parent="parent_value",) + response = await client.list_changelogs( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -795,19 +845,23 @@ async def test_list_changelogs_flattened_async(): @pytest.mark.asyncio async def test_list_changelogs_flattened_error_async(): - client = ChangelogsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_changelogs( - changelog.ListChangelogsRequest(), parent="parent_value", + changelog.ListChangelogsRequest(), + parent="parent_value", ) def test_list_changelogs_pager(transport_name: str = "grpc"): client = ChangelogsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -822,12 +876,21 @@ def test_list_changelogs_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - changelog.ListChangelogsResponse(changelogs=[], next_page_token="def",), changelog.ListChangelogsResponse( - changelogs=[changelog.Changelog(),], next_page_token="ghi", + changelogs=[], + next_page_token="def", ), changelog.ListChangelogsResponse( - changelogs=[changelog.Changelog(), changelog.Changelog(),], + changelogs=[ + changelog.Changelog(), + ], + next_page_token="ghi", + ), + changelog.ListChangelogsResponse( + changelogs=[ + changelog.Changelog(), + changelog.Changelog(), + ], ), RuntimeError, ) @@ -840,14 +903,15 @@ def test_list_changelogs_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, changelog.Changelog) for i in results) def test_list_changelogs_pages(transport_name: str = "grpc"): client = ChangelogsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -862,12 +926,21 @@ def test_list_changelogs_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - changelog.ListChangelogsResponse(changelogs=[], next_page_token="def",), changelog.ListChangelogsResponse( - changelogs=[changelog.Changelog(),], next_page_token="ghi", + changelogs=[], + next_page_token="def", ), changelog.ListChangelogsResponse( - changelogs=[changelog.Changelog(), changelog.Changelog(),], + changelogs=[ + changelog.Changelog(), + ], + next_page_token="ghi", + ), + changelog.ListChangelogsResponse( + changelogs=[ + changelog.Changelog(), + changelog.Changelog(), + ], ), RuntimeError, ) @@ -878,7 +951,9 @@ def test_list_changelogs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_changelogs_async_pager(): - client = ChangelogsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ChangelogsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -894,19 +969,30 @@ async def test_list_changelogs_async_pager(): ], next_page_token="abc", ), - changelog.ListChangelogsResponse(changelogs=[], next_page_token="def",), changelog.ListChangelogsResponse( - changelogs=[changelog.Changelog(),], next_page_token="ghi", + changelogs=[], + next_page_token="def", ), changelog.ListChangelogsResponse( - changelogs=[changelog.Changelog(), changelog.Changelog(),], + changelogs=[ + changelog.Changelog(), + ], + next_page_token="ghi", + ), + changelog.ListChangelogsResponse( + changelogs=[ + changelog.Changelog(), + changelog.Changelog(), + ], ), RuntimeError, ) - async_pager = await client.list_changelogs(request={},) + async_pager = await client.list_changelogs( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -915,7 +1001,9 @@ async def test_list_changelogs_async_pager(): @pytest.mark.asyncio async def test_list_changelogs_async_pages(): - client = ChangelogsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ChangelogsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -931,26 +1019,44 @@ async def test_list_changelogs_async_pages(): ], next_page_token="abc", ), - changelog.ListChangelogsResponse(changelogs=[], next_page_token="def",), changelog.ListChangelogsResponse( - changelogs=[changelog.Changelog(),], next_page_token="ghi", + changelogs=[], + next_page_token="def", ), changelog.ListChangelogsResponse( - changelogs=[changelog.Changelog(), changelog.Changelog(),], + changelogs=[ + changelog.Changelog(), + ], + next_page_token="ghi", + ), + changelog.ListChangelogsResponse( + changelogs=[ + changelog.Changelog(), + changelog.Changelog(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_changelogs(request={})).pages: + async for page_ in ( + await client.list_changelogs(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [changelog.GetChangelogRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + changelog.GetChangelogRequest, + dict, + ], +) def test_get_changelog(request_type, transport: str = "grpc"): client = ChangelogsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -989,7 +1095,8 @@ def test_get_changelog_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ChangelogsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1005,7 +1112,8 @@ async def test_get_changelog_async( transport: str = "grpc_asyncio", request_type=changelog.GetChangelogRequest ): client = ChangelogsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1048,13 +1156,15 @@ async def test_get_changelog_async_from_dict(): def test_get_changelog_field_headers(): - client = ChangelogsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = changelog.GetChangelogRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_changelog), "__call__") as call: @@ -1068,18 +1178,23 @@ def test_get_changelog_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_changelog_field_headers_async(): - client = ChangelogsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = changelog.GetChangelogRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_changelog), "__call__") as call: @@ -1093,11 +1208,16 @@ async def test_get_changelog_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_changelog_flattened(): - client = ChangelogsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_changelog), "__call__") as call: @@ -1105,7 +1225,9 @@ def test_get_changelog_flattened(): call.return_value = changelog.Changelog() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_changelog(name="name_value",) + client.get_changelog( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1117,19 +1239,24 @@ def test_get_changelog_flattened(): def test_get_changelog_flattened_error(): - client = ChangelogsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_changelog( - changelog.GetChangelogRequest(), name="name_value", + changelog.GetChangelogRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_changelog_flattened_async(): - client = ChangelogsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_changelog), "__call__") as call: @@ -1139,7 +1266,9 @@ async def test_get_changelog_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(changelog.Changelog()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_changelog(name="name_value",) + response = await client.get_changelog( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1152,13 +1281,16 @@ async def test_get_changelog_flattened_async(): @pytest.mark.asyncio async def test_get_changelog_flattened_error_async(): - client = ChangelogsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_changelog( - changelog.GetChangelogRequest(), name="name_value", + changelog.GetChangelogRequest(), + name="name_value", ) @@ -1169,7 +1301,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ChangelogsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1189,7 +1322,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ChangelogsClient(client_options=options, transport=transport,) + client = ChangelogsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1205,7 +1341,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ChangelogsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1235,7 +1372,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.ChangelogsGrpcTransport, transports.ChangelogsGrpcAsyncIOTransport,], + [ + transports.ChangelogsGrpcTransport, + transports.ChangelogsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1245,10 +1385,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ChangelogsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ChangelogsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ChangelogsGrpcTransport,) + client = ChangelogsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ChangelogsGrpcTransport, + ) def test_changelogs_base_transport_error(): @@ -1283,6 +1441,14 @@ def test_changelogs_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_changelogs_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1294,7 +1460,8 @@ def test_changelogs_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ChangelogsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1335,7 +1502,10 @@ def test_changelogs_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.ChangelogsGrpcTransport, transports.ChangelogsGrpcAsyncIOTransport,], + [ + transports.ChangelogsGrpcTransport, + transports.ChangelogsGrpcAsyncIOTransport, + ], ) def test_changelogs_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -1433,24 +1603,40 @@ def test_changelogs_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_changelogs_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_changelogs_host_no_port(transport_name): client = ChangelogsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_changelogs_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_changelogs_host_with_port(transport_name): client = ChangelogsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_changelogs_grpc_transport_channel(): @@ -1458,7 +1644,8 @@ def test_changelogs_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ChangelogsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1470,7 +1657,8 @@ def test_changelogs_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ChangelogsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1575,7 +1763,10 @@ def test_changelog_path(): agent = "whelk" changelog = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/changelogs/{changelog}".format( - project=project, location=location, agent=agent, changelog=changelog, + project=project, + location=location, + agent=agent, + changelog=changelog, ) actual = ChangelogsClient.changelog_path(project, location, agent, changelog) assert expected == actual @@ -1617,7 +1808,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ChangelogsClient.common_folder_path(folder) assert expected == actual @@ -1635,7 +1828,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ChangelogsClient.common_organization_path(organization) assert expected == actual @@ -1653,7 +1848,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ChangelogsClient.common_project_path(project) assert expected == actual @@ -1673,7 +1870,8 @@ def test_common_location_path(): project = "oyster" location = "nudibranch" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ChangelogsClient.common_location_path(project, location) assert expected == actual @@ -1698,7 +1896,8 @@ def test_client_with_default_client_info(): transports.ChangelogsTransport, "_prep_wrapped_messages" ) as prep: client = ChangelogsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1707,7 +1906,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ChangelogsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1715,7 +1915,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ChangelogsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3/test_deployments.py b/tests/unit/gapic/dialogflowcx_v3/test_deployments.py index cdf0324e..e53050fe 100644 --- a/tests/unit/gapic/dialogflowcx_v3/test_deployments.py +++ b/tests/unit/gapic/dialogflowcx_v3/test_deployments.py @@ -82,19 +82,25 @@ def test__get_default_mtls_endpoint(): assert DeploymentsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [DeploymentsClient, DeploymentsAsyncClient,]) -def test_deployments_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (DeploymentsClient, "grpc"), + (DeploymentsAsyncClient, "grpc_asyncio"), + ], +) +def test_deployments_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -122,22 +128,32 @@ def test_deployments_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [DeploymentsClient, DeploymentsAsyncClient,]) -def test_deployments_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (DeploymentsClient, "grpc"), + (DeploymentsAsyncClient, "grpc_asyncio"), + ], +) +def test_deployments_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_deployments_client_get_transport_class(): @@ -477,7 +493,9 @@ def test_deployments_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -608,10 +626,17 @@ def test_deployments_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [deployment.ListDeploymentsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + deployment.ListDeploymentsRequest, + dict, + ], +) def test_list_deployments(request_type, transport: str = "grpc"): client = DeploymentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -640,7 +665,8 @@ def test_list_deployments_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeploymentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -656,7 +682,8 @@ async def test_list_deployments_async( transport: str = "grpc_asyncio", request_type=deployment.ListDeploymentsRequest ): client = DeploymentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -667,7 +694,9 @@ async def test_list_deployments_async( with mock.patch.object(type(client.transport.list_deployments), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - deployment.ListDeploymentsResponse(next_page_token="next_page_token_value",) + deployment.ListDeploymentsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_deployments(request) @@ -687,13 +716,15 @@ async def test_list_deployments_async_from_dict(): def test_list_deployments_field_headers(): - client = DeploymentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = deployment.ListDeploymentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_deployments), "__call__") as call: @@ -707,18 +738,23 @@ def test_list_deployments_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_deployments_field_headers_async(): - client = DeploymentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = deployment.ListDeploymentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_deployments), "__call__") as call: @@ -734,11 +770,16 @@ async def test_list_deployments_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_deployments_flattened(): - client = DeploymentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_deployments), "__call__") as call: @@ -746,7 +787,9 @@ def test_list_deployments_flattened(): call.return_value = deployment.ListDeploymentsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_deployments(parent="parent_value",) + client.list_deployments( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -758,19 +801,24 @@ def test_list_deployments_flattened(): def test_list_deployments_flattened_error(): - client = DeploymentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_deployments( - deployment.ListDeploymentsRequest(), parent="parent_value", + deployment.ListDeploymentsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_deployments_flattened_async(): - client = DeploymentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_deployments), "__call__") as call: @@ -782,7 +830,9 @@ async def test_list_deployments_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_deployments(parent="parent_value",) + response = await client.list_deployments( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -795,19 +845,23 @@ async def test_list_deployments_flattened_async(): @pytest.mark.asyncio async def test_list_deployments_flattened_error_async(): - client = DeploymentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_deployments( - deployment.ListDeploymentsRequest(), parent="parent_value", + deployment.ListDeploymentsRequest(), + parent="parent_value", ) def test_list_deployments_pager(transport_name: str = "grpc"): client = DeploymentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -822,12 +876,21 @@ def test_list_deployments_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - deployment.ListDeploymentsResponse(deployments=[], next_page_token="def",), deployment.ListDeploymentsResponse( - deployments=[deployment.Deployment(),], next_page_token="ghi", + deployments=[], + next_page_token="def", ), deployment.ListDeploymentsResponse( - deployments=[deployment.Deployment(), deployment.Deployment(),], + deployments=[ + deployment.Deployment(), + ], + next_page_token="ghi", + ), + deployment.ListDeploymentsResponse( + deployments=[ + deployment.Deployment(), + deployment.Deployment(), + ], ), RuntimeError, ) @@ -840,14 +903,15 @@ def test_list_deployments_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, deployment.Deployment) for i in results) def test_list_deployments_pages(transport_name: str = "grpc"): client = DeploymentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -862,12 +926,21 @@ def test_list_deployments_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - deployment.ListDeploymentsResponse(deployments=[], next_page_token="def",), deployment.ListDeploymentsResponse( - deployments=[deployment.Deployment(),], next_page_token="ghi", + deployments=[], + next_page_token="def", + ), + deployment.ListDeploymentsResponse( + deployments=[ + deployment.Deployment(), + ], + next_page_token="ghi", ), deployment.ListDeploymentsResponse( - deployments=[deployment.Deployment(), deployment.Deployment(),], + deployments=[ + deployment.Deployment(), + deployment.Deployment(), + ], ), RuntimeError, ) @@ -878,7 +951,9 @@ def test_list_deployments_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_deployments_async_pager(): - client = DeploymentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DeploymentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -894,19 +969,30 @@ async def test_list_deployments_async_pager(): ], next_page_token="abc", ), - deployment.ListDeploymentsResponse(deployments=[], next_page_token="def",), deployment.ListDeploymentsResponse( - deployments=[deployment.Deployment(),], next_page_token="ghi", + deployments=[], + next_page_token="def", ), deployment.ListDeploymentsResponse( - deployments=[deployment.Deployment(), deployment.Deployment(),], + deployments=[ + deployment.Deployment(), + ], + next_page_token="ghi", + ), + deployment.ListDeploymentsResponse( + deployments=[ + deployment.Deployment(), + deployment.Deployment(), + ], ), RuntimeError, ) - async_pager = await client.list_deployments(request={},) + async_pager = await client.list_deployments( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -915,7 +1001,9 @@ async def test_list_deployments_async_pager(): @pytest.mark.asyncio async def test_list_deployments_async_pages(): - client = DeploymentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DeploymentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -931,26 +1019,44 @@ async def test_list_deployments_async_pages(): ], next_page_token="abc", ), - deployment.ListDeploymentsResponse(deployments=[], next_page_token="def",), deployment.ListDeploymentsResponse( - deployments=[deployment.Deployment(),], next_page_token="ghi", + deployments=[], + next_page_token="def", ), deployment.ListDeploymentsResponse( - deployments=[deployment.Deployment(), deployment.Deployment(),], + deployments=[ + deployment.Deployment(), + ], + next_page_token="ghi", + ), + deployment.ListDeploymentsResponse( + deployments=[ + deployment.Deployment(), + deployment.Deployment(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_deployments(request={})).pages: + async for page_ in ( + await client.list_deployments(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [deployment.GetDeploymentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + deployment.GetDeploymentRequest, + dict, + ], +) def test_get_deployment(request_type, transport: str = "grpc"): client = DeploymentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -983,7 +1089,8 @@ def test_get_deployment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeploymentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -999,7 +1106,8 @@ async def test_get_deployment_async( transport: str = "grpc_asyncio", request_type=deployment.GetDeploymentRequest ): client = DeploymentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1036,13 +1144,15 @@ async def test_get_deployment_async_from_dict(): def test_get_deployment_field_headers(): - client = DeploymentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = deployment.GetDeploymentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_deployment), "__call__") as call: @@ -1056,18 +1166,23 @@ def test_get_deployment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_deployment_field_headers_async(): - client = DeploymentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = deployment.GetDeploymentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_deployment), "__call__") as call: @@ -1083,11 +1198,16 @@ async def test_get_deployment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_deployment_flattened(): - client = DeploymentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_deployment), "__call__") as call: @@ -1095,7 +1215,9 @@ def test_get_deployment_flattened(): call.return_value = deployment.Deployment() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_deployment(name="name_value",) + client.get_deployment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1107,19 +1229,24 @@ def test_get_deployment_flattened(): def test_get_deployment_flattened_error(): - client = DeploymentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_deployment( - deployment.GetDeploymentRequest(), name="name_value", + deployment.GetDeploymentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_deployment_flattened_async(): - client = DeploymentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_deployment), "__call__") as call: @@ -1131,7 +1258,9 @@ async def test_get_deployment_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_deployment(name="name_value",) + response = await client.get_deployment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1144,13 +1273,16 @@ async def test_get_deployment_flattened_async(): @pytest.mark.asyncio async def test_get_deployment_flattened_error_async(): - client = DeploymentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_deployment( - deployment.GetDeploymentRequest(), name="name_value", + deployment.GetDeploymentRequest(), + name="name_value", ) @@ -1161,7 +1293,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = DeploymentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1181,7 +1314,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = DeploymentsClient(client_options=options, transport=transport,) + client = DeploymentsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1197,7 +1333,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = DeploymentsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1227,7 +1364,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.DeploymentsGrpcTransport, transports.DeploymentsGrpcAsyncIOTransport,], + [ + transports.DeploymentsGrpcTransport, + transports.DeploymentsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1237,10 +1377,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = DeploymentsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = DeploymentsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.DeploymentsGrpcTransport,) + client = DeploymentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.DeploymentsGrpcTransport, + ) def test_deployments_base_transport_error(): @@ -1275,6 +1433,14 @@ def test_deployments_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_deployments_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1286,7 +1452,8 @@ def test_deployments_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.DeploymentsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1327,7 +1494,10 @@ def test_deployments_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.DeploymentsGrpcTransport, transports.DeploymentsGrpcAsyncIOTransport,], + [ + transports.DeploymentsGrpcTransport, + transports.DeploymentsGrpcAsyncIOTransport, + ], ) def test_deployments_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -1425,24 +1595,40 @@ def test_deployments_grpc_transport_client_cert_source_for_mtls(transport_class) ) -def test_deployments_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_deployments_host_no_port(transport_name): client = DeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_deployments_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_deployments_host_with_port(transport_name): client = DeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_deployments_grpc_transport_channel(): @@ -1450,7 +1636,8 @@ def test_deployments_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.DeploymentsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1462,7 +1649,8 @@ def test_deployments_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.DeploymentsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1670,7 +1858,11 @@ def test_version_path(): flow = "nautilus" version = "scallop" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) actual = DeploymentsClient.version_path(project, location, agent, flow, version) assert expected == actual @@ -1713,7 +1905,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = DeploymentsClient.common_folder_path(folder) assert expected == actual @@ -1731,7 +1925,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "winkle" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = DeploymentsClient.common_organization_path(organization) assert expected == actual @@ -1749,7 +1945,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "scallop" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = DeploymentsClient.common_project_path(project) assert expected == actual @@ -1769,7 +1967,8 @@ def test_common_location_path(): project = "squid" location = "clam" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = DeploymentsClient.common_location_path(project, location) assert expected == actual @@ -1794,7 +1993,8 @@ def test_client_with_default_client_info(): transports.DeploymentsTransport, "_prep_wrapped_messages" ) as prep: client = DeploymentsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1803,7 +2003,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = DeploymentsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1811,7 +2012,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = DeploymentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3/test_entity_types.py b/tests/unit/gapic/dialogflowcx_v3/test_entity_types.py index 33fb08b2..d205edfe 100644 --- a/tests/unit/gapic/dialogflowcx_v3/test_entity_types.py +++ b/tests/unit/gapic/dialogflowcx_v3/test_entity_types.py @@ -83,19 +83,25 @@ def test__get_default_mtls_endpoint(): assert EntityTypesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [EntityTypesClient, EntityTypesAsyncClient,]) -def test_entity_types_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (EntityTypesClient, "grpc"), + (EntityTypesAsyncClient, "grpc_asyncio"), + ], +) +def test_entity_types_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -123,22 +129,32 @@ def test_entity_types_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [EntityTypesClient, EntityTypesAsyncClient,]) -def test_entity_types_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (EntityTypesClient, "grpc"), + (EntityTypesAsyncClient, "grpc_asyncio"), + ], +) +def test_entity_types_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_entity_types_client_get_transport_class(): @@ -478,7 +494,9 @@ def test_entity_types_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -609,10 +627,17 @@ def test_entity_types_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [entity_type.ListEntityTypesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + entity_type.ListEntityTypesRequest, + dict, + ], +) def test_list_entity_types(request_type, transport: str = "grpc"): client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -643,7 +668,8 @@ def test_list_entity_types_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -661,7 +687,8 @@ async def test_list_entity_types_async( transport: str = "grpc_asyncio", request_type=entity_type.ListEntityTypesRequest ): client = EntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -696,13 +723,15 @@ async def test_list_entity_types_async_from_dict(): def test_list_entity_types_field_headers(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = entity_type.ListEntityTypesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -718,18 +747,23 @@ def test_list_entity_types_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_entity_types_field_headers_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = entity_type.ListEntityTypesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -747,11 +781,16 @@ async def test_list_entity_types_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_entity_types_flattened(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -761,7 +800,9 @@ def test_list_entity_types_flattened(): call.return_value = entity_type.ListEntityTypesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_entity_types(parent="parent_value",) + client.list_entity_types( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -773,19 +814,24 @@ def test_list_entity_types_flattened(): def test_list_entity_types_flattened_error(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_entity_types( - entity_type.ListEntityTypesRequest(), parent="parent_value", + entity_type.ListEntityTypesRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_entity_types_flattened_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -799,7 +845,9 @@ async def test_list_entity_types_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_entity_types(parent="parent_value",) + response = await client.list_entity_types( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -812,19 +860,23 @@ async def test_list_entity_types_flattened_async(): @pytest.mark.asyncio async def test_list_entity_types_flattened_error_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_entity_types( - entity_type.ListEntityTypesRequest(), parent="parent_value", + entity_type.ListEntityTypesRequest(), + parent="parent_value", ) def test_list_entity_types_pager(transport_name: str = "grpc"): client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -842,13 +894,20 @@ def test_list_entity_types_pager(transport_name: str = "grpc"): next_page_token="abc", ), entity_type.ListEntityTypesResponse( - entity_types=[], next_page_token="def", + entity_types=[], + next_page_token="def", ), entity_type.ListEntityTypesResponse( - entity_types=[entity_type.EntityType(),], next_page_token="ghi", + entity_types=[ + entity_type.EntityType(), + ], + next_page_token="ghi", ), entity_type.ListEntityTypesResponse( - entity_types=[entity_type.EntityType(), entity_type.EntityType(),], + entity_types=[ + entity_type.EntityType(), + entity_type.EntityType(), + ], ), RuntimeError, ) @@ -861,14 +920,15 @@ def test_list_entity_types_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, entity_type.EntityType) for i in results) def test_list_entity_types_pages(transport_name: str = "grpc"): client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -886,13 +946,20 @@ def test_list_entity_types_pages(transport_name: str = "grpc"): next_page_token="abc", ), entity_type.ListEntityTypesResponse( - entity_types=[], next_page_token="def", + entity_types=[], + next_page_token="def", ), entity_type.ListEntityTypesResponse( - entity_types=[entity_type.EntityType(),], next_page_token="ghi", + entity_types=[ + entity_type.EntityType(), + ], + next_page_token="ghi", ), entity_type.ListEntityTypesResponse( - entity_types=[entity_type.EntityType(), entity_type.EntityType(),], + entity_types=[ + entity_type.EntityType(), + entity_type.EntityType(), + ], ), RuntimeError, ) @@ -903,7 +970,9 @@ def test_list_entity_types_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_entity_types_async_pager(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -922,20 +991,29 @@ async def test_list_entity_types_async_pager(): next_page_token="abc", ), entity_type.ListEntityTypesResponse( - entity_types=[], next_page_token="def", + entity_types=[], + next_page_token="def", ), entity_type.ListEntityTypesResponse( - entity_types=[entity_type.EntityType(),], next_page_token="ghi", + entity_types=[ + entity_type.EntityType(), + ], + next_page_token="ghi", ), entity_type.ListEntityTypesResponse( - entity_types=[entity_type.EntityType(), entity_type.EntityType(),], + entity_types=[ + entity_type.EntityType(), + entity_type.EntityType(), + ], ), RuntimeError, ) - async_pager = await client.list_entity_types(request={},) + async_pager = await client.list_entity_types( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -944,7 +1022,9 @@ async def test_list_entity_types_async_pager(): @pytest.mark.asyncio async def test_list_entity_types_async_pages(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -963,27 +1043,43 @@ async def test_list_entity_types_async_pages(): next_page_token="abc", ), entity_type.ListEntityTypesResponse( - entity_types=[], next_page_token="def", + entity_types=[], + next_page_token="def", ), entity_type.ListEntityTypesResponse( - entity_types=[entity_type.EntityType(),], next_page_token="ghi", + entity_types=[ + entity_type.EntityType(), + ], + next_page_token="ghi", ), entity_type.ListEntityTypesResponse( - entity_types=[entity_type.EntityType(), entity_type.EntityType(),], + entity_types=[ + entity_type.EntityType(), + entity_type.EntityType(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_entity_types(request={})).pages: + async for page_ in ( + await client.list_entity_types(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [entity_type.GetEntityTypeRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + entity_type.GetEntityTypeRequest, + dict, + ], +) def test_get_entity_type(request_type, transport: str = "grpc"): client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1025,7 +1121,8 @@ def test_get_entity_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1041,7 +1138,8 @@ async def test_get_entity_type_async( transport: str = "grpc_asyncio", request_type=entity_type.GetEntityTypeRequest ): client = EntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1087,13 +1185,15 @@ async def test_get_entity_type_async_from_dict(): def test_get_entity_type_field_headers(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = entity_type.GetEntityTypeRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_entity_type), "__call__") as call: @@ -1107,18 +1207,23 @@ def test_get_entity_type_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_entity_type_field_headers_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = entity_type.GetEntityTypeRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_entity_type), "__call__") as call: @@ -1134,11 +1239,16 @@ async def test_get_entity_type_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_entity_type_flattened(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_entity_type), "__call__") as call: @@ -1146,7 +1256,9 @@ def test_get_entity_type_flattened(): call.return_value = entity_type.EntityType() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_entity_type(name="name_value",) + client.get_entity_type( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1158,19 +1270,24 @@ def test_get_entity_type_flattened(): def test_get_entity_type_flattened_error(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_entity_type( - entity_type.GetEntityTypeRequest(), name="name_value", + entity_type.GetEntityTypeRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_entity_type_flattened_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_entity_type), "__call__") as call: @@ -1182,7 +1299,9 @@ async def test_get_entity_type_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_entity_type(name="name_value",) + response = await client.get_entity_type( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1195,22 +1314,30 @@ async def test_get_entity_type_flattened_async(): @pytest.mark.asyncio async def test_get_entity_type_flattened_error_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_entity_type( - entity_type.GetEntityTypeRequest(), name="name_value", + entity_type.GetEntityTypeRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [gcdc_entity_type.CreateEntityTypeRequest, dict,] + "request_type", + [ + gcdc_entity_type.CreateEntityTypeRequest, + dict, + ], ) def test_create_entity_type(request_type, transport: str = "grpc"): client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1254,7 +1381,8 @@ def test_create_entity_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1273,7 +1401,8 @@ async def test_create_entity_type_async( request_type=gcdc_entity_type.CreateEntityTypeRequest, ): client = EntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1321,13 +1450,15 @@ async def test_create_entity_type_async_from_dict(): def test_create_entity_type_field_headers(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_entity_type.CreateEntityTypeRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1343,18 +1474,23 @@ def test_create_entity_type_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_entity_type_field_headers_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_entity_type.CreateEntityTypeRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1372,11 +1508,16 @@ async def test_create_entity_type_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_entity_type_flattened(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1404,7 +1545,9 @@ def test_create_entity_type_flattened(): def test_create_entity_type_flattened_error(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1418,7 +1561,9 @@ def test_create_entity_type_flattened_error(): @pytest.mark.asyncio async def test_create_entity_type_flattened_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1451,7 +1596,9 @@ async def test_create_entity_type_flattened_async(): @pytest.mark.asyncio async def test_create_entity_type_flattened_error_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1464,11 +1611,16 @@ async def test_create_entity_type_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [gcdc_entity_type.UpdateEntityTypeRequest, dict,] + "request_type", + [ + gcdc_entity_type.UpdateEntityTypeRequest, + dict, + ], ) def test_update_entity_type(request_type, transport: str = "grpc"): client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1512,7 +1664,8 @@ def test_update_entity_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1531,7 +1684,8 @@ async def test_update_entity_type_async( request_type=gcdc_entity_type.UpdateEntityTypeRequest, ): client = EntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1579,13 +1733,15 @@ async def test_update_entity_type_async_from_dict(): def test_update_entity_type_field_headers(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_entity_type.UpdateEntityTypeRequest() - request.entity_type.name = "entity_type.name/value" + request.entity_type.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1601,20 +1757,23 @@ def test_update_entity_type_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "entity_type.name=entity_type.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "entity_type.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_entity_type_field_headers_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_entity_type.UpdateEntityTypeRequest() - request.entity_type.name = "entity_type.name/value" + request.entity_type.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1632,13 +1791,16 @@ async def test_update_entity_type_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "entity_type.name=entity_type.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "entity_type.name=name_value", + ) in kw["metadata"] def test_update_entity_type_flattened(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1666,7 +1828,9 @@ def test_update_entity_type_flattened(): def test_update_entity_type_flattened_error(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1680,7 +1844,9 @@ def test_update_entity_type_flattened_error(): @pytest.mark.asyncio async def test_update_entity_type_flattened_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1713,7 +1879,9 @@ async def test_update_entity_type_flattened_async(): @pytest.mark.asyncio async def test_update_entity_type_flattened_error_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1725,10 +1893,17 @@ async def test_update_entity_type_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [entity_type.DeleteEntityTypeRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + entity_type.DeleteEntityTypeRequest, + dict, + ], +) def test_delete_entity_type(request_type, transport: str = "grpc"): client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1756,7 +1931,8 @@ def test_delete_entity_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1774,7 +1950,8 @@ async def test_delete_entity_type_async( transport: str = "grpc_asyncio", request_type=entity_type.DeleteEntityTypeRequest ): client = EntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1804,13 +1981,15 @@ async def test_delete_entity_type_async_from_dict(): def test_delete_entity_type_field_headers(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = entity_type.DeleteEntityTypeRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1826,18 +2005,23 @@ def test_delete_entity_type_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_entity_type_field_headers_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = entity_type.DeleteEntityTypeRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1853,11 +2037,16 @@ async def test_delete_entity_type_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_entity_type_flattened(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1867,7 +2056,9 @@ def test_delete_entity_type_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_entity_type(name="name_value",) + client.delete_entity_type( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1879,19 +2070,24 @@ def test_delete_entity_type_flattened(): def test_delete_entity_type_flattened_error(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_entity_type( - entity_type.DeleteEntityTypeRequest(), name="name_value", + entity_type.DeleteEntityTypeRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_entity_type_flattened_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1903,7 +2099,9 @@ async def test_delete_entity_type_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_entity_type(name="name_value",) + response = await client.delete_entity_type( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1916,13 +2114,16 @@ async def test_delete_entity_type_flattened_async(): @pytest.mark.asyncio async def test_delete_entity_type_flattened_error_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_entity_type( - entity_type.DeleteEntityTypeRequest(), name="name_value", + entity_type.DeleteEntityTypeRequest(), + name="name_value", ) @@ -1933,7 +2134,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1953,7 +2155,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = EntityTypesClient(client_options=options, transport=transport,) + client = EntityTypesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1969,7 +2174,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = EntityTypesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1999,7 +2205,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.EntityTypesGrpcTransport, transports.EntityTypesGrpcAsyncIOTransport,], + [ + transports.EntityTypesGrpcTransport, + transports.EntityTypesGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2009,10 +2218,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = EntityTypesClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.EntityTypesGrpcTransport,) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.EntityTypesGrpcTransport, + ) def test_entity_types_base_transport_error(): @@ -2050,6 +2277,14 @@ def test_entity_types_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_entity_types_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2061,7 +2296,8 @@ def test_entity_types_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.EntityTypesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2102,7 +2338,10 @@ def test_entity_types_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.EntityTypesGrpcTransport, transports.EntityTypesGrpcAsyncIOTransport,], + [ + transports.EntityTypesGrpcTransport, + transports.EntityTypesGrpcAsyncIOTransport, + ], ) def test_entity_types_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2200,24 +2439,40 @@ def test_entity_types_grpc_transport_client_cert_source_for_mtls(transport_class ) -def test_entity_types_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_entity_types_host_no_port(transport_name): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_entity_types_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_entity_types_host_with_port(transport_name): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_entity_types_grpc_transport_channel(): @@ -2225,7 +2480,8 @@ def test_entity_types_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.EntityTypesGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2237,7 +2493,8 @@ def test_entity_types_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.EntityTypesGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2342,7 +2599,10 @@ def test_entity_type_path(): agent = "whelk" entity_type = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) actual = EntityTypesClient.entity_type_path(project, location, agent, entity_type) assert expected == actual @@ -2384,7 +2644,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = EntityTypesClient.common_folder_path(folder) assert expected == actual @@ -2402,7 +2664,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = EntityTypesClient.common_organization_path(organization) assert expected == actual @@ -2420,7 +2684,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = EntityTypesClient.common_project_path(project) assert expected == actual @@ -2440,7 +2706,8 @@ def test_common_location_path(): project = "oyster" location = "nudibranch" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = EntityTypesClient.common_location_path(project, location) assert expected == actual @@ -2465,7 +2732,8 @@ def test_client_with_default_client_info(): transports.EntityTypesTransport, "_prep_wrapped_messages" ) as prep: client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2474,7 +2742,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = EntityTypesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2482,7 +2751,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = EntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3/test_environments.py b/tests/unit/gapic/dialogflowcx_v3/test_environments.py index c4f93879..c5dfd501 100644 --- a/tests/unit/gapic/dialogflowcx_v3/test_environments.py +++ b/tests/unit/gapic/dialogflowcx_v3/test_environments.py @@ -90,19 +90,25 @@ def test__get_default_mtls_endpoint(): assert EnvironmentsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [EnvironmentsClient, EnvironmentsAsyncClient,]) -def test_environments_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (EnvironmentsClient, "grpc"), + (EnvironmentsAsyncClient, "grpc_asyncio"), + ], +) +def test_environments_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -130,22 +136,32 @@ def test_environments_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [EnvironmentsClient, EnvironmentsAsyncClient,]) -def test_environments_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (EnvironmentsClient, "grpc"), + (EnvironmentsAsyncClient, "grpc_asyncio"), + ], +) +def test_environments_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_environments_client_get_transport_class(): @@ -485,7 +501,9 @@ def test_environments_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -626,10 +644,17 @@ def test_environments_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [environment.ListEnvironmentsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + environment.ListEnvironmentsRequest, + dict, + ], +) def test_list_environments(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -660,7 +685,8 @@ def test_list_environments_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -678,7 +704,8 @@ async def test_list_environments_async( transport: str = "grpc_asyncio", request_type=environment.ListEnvironmentsRequest ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -713,13 +740,15 @@ async def test_list_environments_async_from_dict(): def test_list_environments_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.ListEnvironmentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -735,18 +764,23 @@ def test_list_environments_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_environments_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.ListEnvironmentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -764,11 +798,16 @@ async def test_list_environments_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_environments_flattened(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -778,7 +817,9 @@ def test_list_environments_flattened(): call.return_value = environment.ListEnvironmentsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_environments(parent="parent_value",) + client.list_environments( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -790,19 +831,24 @@ def test_list_environments_flattened(): def test_list_environments_flattened_error(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_environments( - environment.ListEnvironmentsRequest(), parent="parent_value", + environment.ListEnvironmentsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_environments_flattened_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -816,7 +862,9 @@ async def test_list_environments_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_environments(parent="parent_value",) + response = await client.list_environments( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -829,19 +877,23 @@ async def test_list_environments_flattened_async(): @pytest.mark.asyncio async def test_list_environments_flattened_error_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_environments( - environment.ListEnvironmentsRequest(), parent="parent_value", + environment.ListEnvironmentsRequest(), + parent="parent_value", ) def test_list_environments_pager(transport_name: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -859,13 +911,20 @@ def test_list_environments_pager(transport_name: str = "grpc"): next_page_token="abc", ), environment.ListEnvironmentsResponse( - environments=[], next_page_token="def", + environments=[], + next_page_token="def", ), environment.ListEnvironmentsResponse( - environments=[environment.Environment(),], next_page_token="ghi", + environments=[ + environment.Environment(), + ], + next_page_token="ghi", ), environment.ListEnvironmentsResponse( - environments=[environment.Environment(), environment.Environment(),], + environments=[ + environment.Environment(), + environment.Environment(), + ], ), RuntimeError, ) @@ -878,14 +937,15 @@ def test_list_environments_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, environment.Environment) for i in results) def test_list_environments_pages(transport_name: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -903,13 +963,20 @@ def test_list_environments_pages(transport_name: str = "grpc"): next_page_token="abc", ), environment.ListEnvironmentsResponse( - environments=[], next_page_token="def", + environments=[], + next_page_token="def", ), environment.ListEnvironmentsResponse( - environments=[environment.Environment(),], next_page_token="ghi", + environments=[ + environment.Environment(), + ], + next_page_token="ghi", ), environment.ListEnvironmentsResponse( - environments=[environment.Environment(), environment.Environment(),], + environments=[ + environment.Environment(), + environment.Environment(), + ], ), RuntimeError, ) @@ -920,7 +987,9 @@ def test_list_environments_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_environments_async_pager(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -939,20 +1008,29 @@ async def test_list_environments_async_pager(): next_page_token="abc", ), environment.ListEnvironmentsResponse( - environments=[], next_page_token="def", + environments=[], + next_page_token="def", ), environment.ListEnvironmentsResponse( - environments=[environment.Environment(),], next_page_token="ghi", + environments=[ + environment.Environment(), + ], + next_page_token="ghi", ), environment.ListEnvironmentsResponse( - environments=[environment.Environment(), environment.Environment(),], + environments=[ + environment.Environment(), + environment.Environment(), + ], ), RuntimeError, ) - async_pager = await client.list_environments(request={},) + async_pager = await client.list_environments( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -961,7 +1039,9 @@ async def test_list_environments_async_pager(): @pytest.mark.asyncio async def test_list_environments_async_pages(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -980,27 +1060,43 @@ async def test_list_environments_async_pages(): next_page_token="abc", ), environment.ListEnvironmentsResponse( - environments=[], next_page_token="def", + environments=[], + next_page_token="def", ), environment.ListEnvironmentsResponse( - environments=[environment.Environment(),], next_page_token="ghi", + environments=[ + environment.Environment(), + ], + next_page_token="ghi", ), environment.ListEnvironmentsResponse( - environments=[environment.Environment(), environment.Environment(),], + environments=[ + environment.Environment(), + environment.Environment(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_environments(request={})).pages: + async for page_ in ( + await client.list_environments(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [environment.GetEnvironmentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + environment.GetEnvironmentRequest, + dict, + ], +) def test_get_environment(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1033,7 +1129,8 @@ def test_get_environment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1049,7 +1146,8 @@ async def test_get_environment_async( transport: str = "grpc_asyncio", request_type=environment.GetEnvironmentRequest ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1086,13 +1184,15 @@ async def test_get_environment_async_from_dict(): def test_get_environment_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.GetEnvironmentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_environment), "__call__") as call: @@ -1106,18 +1206,23 @@ def test_get_environment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_environment_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.GetEnvironmentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_environment), "__call__") as call: @@ -1133,11 +1238,16 @@ async def test_get_environment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_environment_flattened(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_environment), "__call__") as call: @@ -1145,7 +1255,9 @@ def test_get_environment_flattened(): call.return_value = environment.Environment() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_environment(name="name_value",) + client.get_environment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1157,19 +1269,24 @@ def test_get_environment_flattened(): def test_get_environment_flattened_error(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_environment( - environment.GetEnvironmentRequest(), name="name_value", + environment.GetEnvironmentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_environment_flattened_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_environment), "__call__") as call: @@ -1181,7 +1298,9 @@ async def test_get_environment_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_environment(name="name_value",) + response = await client.get_environment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1194,22 +1313,30 @@ async def test_get_environment_flattened_async(): @pytest.mark.asyncio async def test_get_environment_flattened_error_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_environment( - environment.GetEnvironmentRequest(), name="name_value", + environment.GetEnvironmentRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [gcdc_environment.CreateEnvironmentRequest, dict,] + "request_type", + [ + gcdc_environment.CreateEnvironmentRequest, + dict, + ], ) def test_create_environment(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1237,7 +1364,8 @@ def test_create_environment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1256,7 +1384,8 @@ async def test_create_environment_async( request_type=gcdc_environment.CreateEnvironmentRequest, ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1288,13 +1417,15 @@ async def test_create_environment_async_from_dict(): def test_create_environment_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_environment.CreateEnvironmentRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1310,18 +1441,23 @@ def test_create_environment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_environment_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_environment.CreateEnvironmentRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1339,11 +1475,16 @@ async def test_create_environment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_environment_flattened(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1371,7 +1512,9 @@ def test_create_environment_flattened(): def test_create_environment_flattened_error(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1385,7 +1528,9 @@ def test_create_environment_flattened_error(): @pytest.mark.asyncio async def test_create_environment_flattened_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1418,7 +1563,9 @@ async def test_create_environment_flattened_async(): @pytest.mark.asyncio async def test_create_environment_flattened_error_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1431,11 +1578,16 @@ async def test_create_environment_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [gcdc_environment.UpdateEnvironmentRequest, dict,] + "request_type", + [ + gcdc_environment.UpdateEnvironmentRequest, + dict, + ], ) def test_update_environment(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1463,7 +1615,8 @@ def test_update_environment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1482,7 +1635,8 @@ async def test_update_environment_async( request_type=gcdc_environment.UpdateEnvironmentRequest, ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1514,13 +1668,15 @@ async def test_update_environment_async_from_dict(): def test_update_environment_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_environment.UpdateEnvironmentRequest() - request.environment.name = "environment.name/value" + request.environment.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1536,20 +1692,23 @@ def test_update_environment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "environment.name=environment.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "environment.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_environment_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_environment.UpdateEnvironmentRequest() - request.environment.name = "environment.name/value" + request.environment.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1567,13 +1726,16 @@ async def test_update_environment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "environment.name=environment.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "environment.name=name_value", + ) in kw["metadata"] def test_update_environment_flattened(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1601,7 +1763,9 @@ def test_update_environment_flattened(): def test_update_environment_flattened_error(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1615,7 +1779,9 @@ def test_update_environment_flattened_error(): @pytest.mark.asyncio async def test_update_environment_flattened_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1648,7 +1814,9 @@ async def test_update_environment_flattened_async(): @pytest.mark.asyncio async def test_update_environment_flattened_error_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1660,10 +1828,17 @@ async def test_update_environment_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [environment.DeleteEnvironmentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + environment.DeleteEnvironmentRequest, + dict, + ], +) def test_delete_environment(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1691,7 +1866,8 @@ def test_delete_environment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1709,7 +1885,8 @@ async def test_delete_environment_async( transport: str = "grpc_asyncio", request_type=environment.DeleteEnvironmentRequest ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1739,13 +1916,15 @@ async def test_delete_environment_async_from_dict(): def test_delete_environment_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.DeleteEnvironmentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1761,18 +1940,23 @@ def test_delete_environment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_environment_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.DeleteEnvironmentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1788,11 +1972,16 @@ async def test_delete_environment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_environment_flattened(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1802,7 +1991,9 @@ def test_delete_environment_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_environment(name="name_value",) + client.delete_environment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1814,19 +2005,24 @@ def test_delete_environment_flattened(): def test_delete_environment_flattened_error(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_environment( - environment.DeleteEnvironmentRequest(), name="name_value", + environment.DeleteEnvironmentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_environment_flattened_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1838,7 +2034,9 @@ async def test_delete_environment_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_environment(name="name_value",) + response = await client.delete_environment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1851,22 +2049,30 @@ async def test_delete_environment_flattened_async(): @pytest.mark.asyncio async def test_delete_environment_flattened_error_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_environment( - environment.DeleteEnvironmentRequest(), name="name_value", + environment.DeleteEnvironmentRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [environment.LookupEnvironmentHistoryRequest, dict,] + "request_type", + [ + environment.LookupEnvironmentHistoryRequest, + dict, + ], ) def test_lookup_environment_history(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1897,7 +2103,8 @@ def test_lookup_environment_history_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1916,7 +2123,8 @@ async def test_lookup_environment_history_async( request_type=environment.LookupEnvironmentHistoryRequest, ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1951,13 +2159,15 @@ async def test_lookup_environment_history_async_from_dict(): def test_lookup_environment_history_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.LookupEnvironmentHistoryRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1973,18 +2183,23 @@ def test_lookup_environment_history_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_lookup_environment_history_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.LookupEnvironmentHistoryRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2002,11 +2217,16 @@ async def test_lookup_environment_history_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_lookup_environment_history_flattened(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2016,7 +2236,9 @@ def test_lookup_environment_history_flattened(): call.return_value = environment.LookupEnvironmentHistoryResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.lookup_environment_history(name="name_value",) + client.lookup_environment_history( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2028,19 +2250,24 @@ def test_lookup_environment_history_flattened(): def test_lookup_environment_history_flattened_error(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.lookup_environment_history( - environment.LookupEnvironmentHistoryRequest(), name="name_value", + environment.LookupEnvironmentHistoryRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_lookup_environment_history_flattened_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2054,7 +2281,9 @@ async def test_lookup_environment_history_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.lookup_environment_history(name="name_value",) + response = await client.lookup_environment_history( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2067,19 +2296,23 @@ async def test_lookup_environment_history_flattened_async(): @pytest.mark.asyncio async def test_lookup_environment_history_flattened_error_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.lookup_environment_history( - environment.LookupEnvironmentHistoryRequest(), name="name_value", + environment.LookupEnvironmentHistoryRequest(), + name="name_value", ) def test_lookup_environment_history_pager(transport_name: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2097,13 +2330,20 @@ def test_lookup_environment_history_pager(transport_name: str = "grpc"): next_page_token="abc", ), environment.LookupEnvironmentHistoryResponse( - environments=[], next_page_token="def", + environments=[], + next_page_token="def", ), environment.LookupEnvironmentHistoryResponse( - environments=[environment.Environment(),], next_page_token="ghi", + environments=[ + environment.Environment(), + ], + next_page_token="ghi", ), environment.LookupEnvironmentHistoryResponse( - environments=[environment.Environment(), environment.Environment(),], + environments=[ + environment.Environment(), + environment.Environment(), + ], ), RuntimeError, ) @@ -2116,14 +2356,15 @@ def test_lookup_environment_history_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, environment.Environment) for i in results) def test_lookup_environment_history_pages(transport_name: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2141,13 +2382,20 @@ def test_lookup_environment_history_pages(transport_name: str = "grpc"): next_page_token="abc", ), environment.LookupEnvironmentHistoryResponse( - environments=[], next_page_token="def", + environments=[], + next_page_token="def", ), environment.LookupEnvironmentHistoryResponse( - environments=[environment.Environment(),], next_page_token="ghi", + environments=[ + environment.Environment(), + ], + next_page_token="ghi", ), environment.LookupEnvironmentHistoryResponse( - environments=[environment.Environment(), environment.Environment(),], + environments=[ + environment.Environment(), + environment.Environment(), + ], ), RuntimeError, ) @@ -2158,7 +2406,9 @@ def test_lookup_environment_history_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_lookup_environment_history_async_pager(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2177,20 +2427,29 @@ async def test_lookup_environment_history_async_pager(): next_page_token="abc", ), environment.LookupEnvironmentHistoryResponse( - environments=[], next_page_token="def", + environments=[], + next_page_token="def", ), environment.LookupEnvironmentHistoryResponse( - environments=[environment.Environment(),], next_page_token="ghi", + environments=[ + environment.Environment(), + ], + next_page_token="ghi", ), environment.LookupEnvironmentHistoryResponse( - environments=[environment.Environment(), environment.Environment(),], + environments=[ + environment.Environment(), + environment.Environment(), + ], ), RuntimeError, ) - async_pager = await client.lookup_environment_history(request={},) + async_pager = await client.lookup_environment_history( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2199,7 +2458,9 @@ async def test_lookup_environment_history_async_pager(): @pytest.mark.asyncio async def test_lookup_environment_history_async_pages(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2218,27 +2479,43 @@ async def test_lookup_environment_history_async_pages(): next_page_token="abc", ), environment.LookupEnvironmentHistoryResponse( - environments=[], next_page_token="def", + environments=[], + next_page_token="def", ), environment.LookupEnvironmentHistoryResponse( - environments=[environment.Environment(),], next_page_token="ghi", + environments=[ + environment.Environment(), + ], + next_page_token="ghi", ), environment.LookupEnvironmentHistoryResponse( - environments=[environment.Environment(), environment.Environment(),], + environments=[ + environment.Environment(), + environment.Environment(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.lookup_environment_history(request={})).pages: + async for page_ in ( + await client.lookup_environment_history(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [environment.RunContinuousTestRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + environment.RunContinuousTestRequest, + dict, + ], +) def test_run_continuous_test(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2266,7 +2543,8 @@ def test_run_continuous_test_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2284,7 +2562,8 @@ async def test_run_continuous_test_async( transport: str = "grpc_asyncio", request_type=environment.RunContinuousTestRequest ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2316,13 +2595,15 @@ async def test_run_continuous_test_async_from_dict(): def test_run_continuous_test_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.RunContinuousTestRequest() - request.environment = "environment/value" + request.environment = "environment_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2338,18 +2619,23 @@ def test_run_continuous_test_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "environment=environment/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "environment=environment_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_run_continuous_test_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.RunContinuousTestRequest() - request.environment = "environment/value" + request.environment = "environment_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2367,15 +2653,23 @@ async def test_run_continuous_test_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "environment=environment/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "environment=environment_value", + ) in kw["metadata"] @pytest.mark.parametrize( - "request_type", [environment.ListContinuousTestResultsRequest, dict,] + "request_type", + [ + environment.ListContinuousTestResultsRequest, + dict, + ], ) def test_list_continuous_test_results(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2406,7 +2700,8 @@ def test_list_continuous_test_results_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2425,7 +2720,8 @@ async def test_list_continuous_test_results_async( request_type=environment.ListContinuousTestResultsRequest, ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2460,13 +2756,15 @@ async def test_list_continuous_test_results_async_from_dict(): def test_list_continuous_test_results_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.ListContinuousTestResultsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2482,18 +2780,23 @@ def test_list_continuous_test_results_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_continuous_test_results_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.ListContinuousTestResultsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2511,11 +2814,16 @@ async def test_list_continuous_test_results_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_continuous_test_results_flattened(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2525,7 +2833,9 @@ def test_list_continuous_test_results_flattened(): call.return_value = environment.ListContinuousTestResultsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_continuous_test_results(parent="parent_value",) + client.list_continuous_test_results( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2537,19 +2847,24 @@ def test_list_continuous_test_results_flattened(): def test_list_continuous_test_results_flattened_error(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_continuous_test_results( - environment.ListContinuousTestResultsRequest(), parent="parent_value", + environment.ListContinuousTestResultsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_continuous_test_results_flattened_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2563,7 +2878,9 @@ async def test_list_continuous_test_results_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_continuous_test_results(parent="parent_value",) + response = await client.list_continuous_test_results( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2576,19 +2893,23 @@ async def test_list_continuous_test_results_flattened_async(): @pytest.mark.asyncio async def test_list_continuous_test_results_flattened_error_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_continuous_test_results( - environment.ListContinuousTestResultsRequest(), parent="parent_value", + environment.ListContinuousTestResultsRequest(), + parent="parent_value", ) def test_list_continuous_test_results_pager(transport_name: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2606,10 +2927,13 @@ def test_list_continuous_test_results_pager(transport_name: str = "grpc"): next_page_token="abc", ), environment.ListContinuousTestResultsResponse( - continuous_test_results=[], next_page_token="def", + continuous_test_results=[], + next_page_token="def", ), environment.ListContinuousTestResultsResponse( - continuous_test_results=[environment.ContinuousTestResult(),], + continuous_test_results=[ + environment.ContinuousTestResult(), + ], next_page_token="ghi", ), environment.ListContinuousTestResultsResponse( @@ -2629,14 +2953,15 @@ def test_list_continuous_test_results_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, environment.ContinuousTestResult) for i in results) def test_list_continuous_test_results_pages(transport_name: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2654,10 +2979,13 @@ def test_list_continuous_test_results_pages(transport_name: str = "grpc"): next_page_token="abc", ), environment.ListContinuousTestResultsResponse( - continuous_test_results=[], next_page_token="def", + continuous_test_results=[], + next_page_token="def", ), environment.ListContinuousTestResultsResponse( - continuous_test_results=[environment.ContinuousTestResult(),], + continuous_test_results=[ + environment.ContinuousTestResult(), + ], next_page_token="ghi", ), environment.ListContinuousTestResultsResponse( @@ -2675,7 +3003,9 @@ def test_list_continuous_test_results_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_continuous_test_results_async_pager(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2694,10 +3024,13 @@ async def test_list_continuous_test_results_async_pager(): next_page_token="abc", ), environment.ListContinuousTestResultsResponse( - continuous_test_results=[], next_page_token="def", + continuous_test_results=[], + next_page_token="def", ), environment.ListContinuousTestResultsResponse( - continuous_test_results=[environment.ContinuousTestResult(),], + continuous_test_results=[ + environment.ContinuousTestResult(), + ], next_page_token="ghi", ), environment.ListContinuousTestResultsResponse( @@ -2708,10 +3041,12 @@ async def test_list_continuous_test_results_async_pager(): ), RuntimeError, ) - async_pager = await client.list_continuous_test_results(request={},) + async_pager = await client.list_continuous_test_results( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2720,7 +3055,9 @@ async def test_list_continuous_test_results_async_pager(): @pytest.mark.asyncio async def test_list_continuous_test_results_async_pages(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2739,10 +3076,13 @@ async def test_list_continuous_test_results_async_pages(): next_page_token="abc", ), environment.ListContinuousTestResultsResponse( - continuous_test_results=[], next_page_token="def", + continuous_test_results=[], + next_page_token="def", ), environment.ListContinuousTestResultsResponse( - continuous_test_results=[environment.ContinuousTestResult(),], + continuous_test_results=[ + environment.ContinuousTestResult(), + ], next_page_token="ghi", ), environment.ListContinuousTestResultsResponse( @@ -2756,16 +3096,23 @@ async def test_list_continuous_test_results_async_pages(): pages = [] async for page_ in ( await client.list_continuous_test_results(request={}) - ).pages: + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [environment.DeployFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + environment.DeployFlowRequest, + dict, + ], +) def test_deploy_flow(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2791,7 +3138,8 @@ def test_deploy_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2807,7 +3155,8 @@ async def test_deploy_flow_async( transport: str = "grpc_asyncio", request_type=environment.DeployFlowRequest ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2837,13 +3186,15 @@ async def test_deploy_flow_async_from_dict(): def test_deploy_flow_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.DeployFlowRequest() - request.environment = "environment/value" + request.environment = "environment_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.deploy_flow), "__call__") as call: @@ -2857,18 +3208,23 @@ def test_deploy_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "environment=environment/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "environment=environment_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_deploy_flow_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.DeployFlowRequest() - request.environment = "environment/value" + request.environment = "environment_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.deploy_flow), "__call__") as call: @@ -2884,7 +3240,10 @@ async def test_deploy_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "environment=environment/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "environment=environment_value", + ) in kw["metadata"] def test_credentials_transport_error(): @@ -2894,7 +3253,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2914,7 +3274,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = EnvironmentsClient(client_options=options, transport=transport,) + client = EnvironmentsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2930,7 +3293,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = EnvironmentsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2973,10 +3337,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = EnvironmentsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.EnvironmentsGrpcTransport,) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.EnvironmentsGrpcTransport, + ) def test_environments_base_transport_error(): @@ -3023,6 +3405,14 @@ def test_environments_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_environments_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -3034,7 +3424,8 @@ def test_environments_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.EnvironmentsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3176,24 +3567,40 @@ def test_environments_grpc_transport_client_cert_source_for_mtls(transport_class ) -def test_environments_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_environments_host_no_port(transport_name): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_environments_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_environments_host_with_port(transport_name): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_environments_grpc_transport_channel(): @@ -3201,7 +3608,8 @@ def test_environments_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.EnvironmentsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -3213,7 +3621,8 @@ def test_environments_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.EnvironmentsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -3314,12 +3723,16 @@ def test_environments_transport_channel_mtls_with_adc(transport_class): def test_environments_grpc_lro_client(): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -3327,12 +3740,16 @@ def test_environments_grpc_lro_client(): def test_environments_grpc_lro_async_client(): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -3378,7 +3795,10 @@ def test_environment_path(): agent = "squid" environment = "clam" expected = "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}".format( - project=project, location=location, agent=agent, environment=environment, + project=project, + location=location, + agent=agent, + environment=environment, ) actual = EnvironmentsClient.environment_path(project, location, agent, environment) assert expected == actual @@ -3404,7 +3824,10 @@ def test_test_case_path(): agent = "winkle" test_case = "nautilus" expected = "projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}".format( - project=project, location=location, agent=agent, test_case=test_case, + project=project, + location=location, + agent=agent, + test_case=test_case, ) actual = EnvironmentsClient.test_case_path(project, location, agent, test_case) assert expected == actual @@ -3465,7 +3888,11 @@ def test_version_path(): flow = "octopus" version = "oyster" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) actual = EnvironmentsClient.version_path(project, location, agent, flow, version) assert expected == actual @@ -3508,7 +3935,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "squid" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = EnvironmentsClient.common_folder_path(folder) assert expected == actual @@ -3526,7 +3955,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "whelk" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = EnvironmentsClient.common_organization_path(organization) assert expected == actual @@ -3544,7 +3975,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "oyster" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = EnvironmentsClient.common_project_path(project) assert expected == actual @@ -3564,7 +3997,8 @@ def test_common_location_path(): project = "cuttlefish" location = "mussel" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = EnvironmentsClient.common_location_path(project, location) assert expected == actual @@ -3589,7 +4023,8 @@ def test_client_with_default_client_info(): transports.EnvironmentsTransport, "_prep_wrapped_messages" ) as prep: client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3598,7 +4033,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = EnvironmentsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3606,7 +4042,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3/test_experiments.py b/tests/unit/gapic/dialogflowcx_v3/test_experiments.py index aa139075..49ee9734 100644 --- a/tests/unit/gapic/dialogflowcx_v3/test_experiments.py +++ b/tests/unit/gapic/dialogflowcx_v3/test_experiments.py @@ -85,19 +85,25 @@ def test__get_default_mtls_endpoint(): assert ExperimentsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [ExperimentsClient, ExperimentsAsyncClient,]) -def test_experiments_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ExperimentsClient, "grpc"), + (ExperimentsAsyncClient, "grpc_asyncio"), + ], +) +def test_experiments_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -125,22 +131,32 @@ def test_experiments_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [ExperimentsClient, ExperimentsAsyncClient,]) -def test_experiments_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ExperimentsClient, "grpc"), + (ExperimentsAsyncClient, "grpc_asyncio"), + ], +) +def test_experiments_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_experiments_client_get_transport_class(): @@ -480,7 +496,9 @@ def test_experiments_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -611,10 +629,17 @@ def test_experiments_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [experiment.ListExperimentsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + experiment.ListExperimentsRequest, + dict, + ], +) def test_list_experiments(request_type, transport: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -643,7 +668,8 @@ def test_list_experiments_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -659,7 +685,8 @@ async def test_list_experiments_async( transport: str = "grpc_asyncio", request_type=experiment.ListExperimentsRequest ): client = ExperimentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -670,7 +697,9 @@ async def test_list_experiments_async( with mock.patch.object(type(client.transport.list_experiments), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - experiment.ListExperimentsResponse(next_page_token="next_page_token_value",) + experiment.ListExperimentsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_experiments(request) @@ -690,13 +719,15 @@ async def test_list_experiments_async_from_dict(): def test_list_experiments_field_headers(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.ListExperimentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_experiments), "__call__") as call: @@ -710,18 +741,23 @@ def test_list_experiments_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_experiments_field_headers_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.ListExperimentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_experiments), "__call__") as call: @@ -737,11 +773,16 @@ async def test_list_experiments_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_experiments_flattened(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_experiments), "__call__") as call: @@ -749,7 +790,9 @@ def test_list_experiments_flattened(): call.return_value = experiment.ListExperimentsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_experiments(parent="parent_value",) + client.list_experiments( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -761,19 +804,24 @@ def test_list_experiments_flattened(): def test_list_experiments_flattened_error(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_experiments( - experiment.ListExperimentsRequest(), parent="parent_value", + experiment.ListExperimentsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_experiments_flattened_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_experiments), "__call__") as call: @@ -785,7 +833,9 @@ async def test_list_experiments_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_experiments(parent="parent_value",) + response = await client.list_experiments( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -798,19 +848,23 @@ async def test_list_experiments_flattened_async(): @pytest.mark.asyncio async def test_list_experiments_flattened_error_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_experiments( - experiment.ListExperimentsRequest(), parent="parent_value", + experiment.ListExperimentsRequest(), + parent="parent_value", ) def test_list_experiments_pager(transport_name: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -825,12 +879,21 @@ def test_list_experiments_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - experiment.ListExperimentsResponse(experiments=[], next_page_token="def",), experiment.ListExperimentsResponse( - experiments=[experiment.Experiment(),], next_page_token="ghi", + experiments=[], + next_page_token="def", ), experiment.ListExperimentsResponse( - experiments=[experiment.Experiment(), experiment.Experiment(),], + experiments=[ + experiment.Experiment(), + ], + next_page_token="ghi", + ), + experiment.ListExperimentsResponse( + experiments=[ + experiment.Experiment(), + experiment.Experiment(), + ], ), RuntimeError, ) @@ -843,14 +906,15 @@ def test_list_experiments_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, experiment.Experiment) for i in results) def test_list_experiments_pages(transport_name: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -865,12 +929,21 @@ def test_list_experiments_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - experiment.ListExperimentsResponse(experiments=[], next_page_token="def",), experiment.ListExperimentsResponse( - experiments=[experiment.Experiment(),], next_page_token="ghi", + experiments=[], + next_page_token="def", ), experiment.ListExperimentsResponse( - experiments=[experiment.Experiment(), experiment.Experiment(),], + experiments=[ + experiment.Experiment(), + ], + next_page_token="ghi", + ), + experiment.ListExperimentsResponse( + experiments=[ + experiment.Experiment(), + experiment.Experiment(), + ], ), RuntimeError, ) @@ -881,7 +954,9 @@ def test_list_experiments_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_experiments_async_pager(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -897,19 +972,30 @@ async def test_list_experiments_async_pager(): ], next_page_token="abc", ), - experiment.ListExperimentsResponse(experiments=[], next_page_token="def",), experiment.ListExperimentsResponse( - experiments=[experiment.Experiment(),], next_page_token="ghi", + experiments=[], + next_page_token="def", + ), + experiment.ListExperimentsResponse( + experiments=[ + experiment.Experiment(), + ], + next_page_token="ghi", ), experiment.ListExperimentsResponse( - experiments=[experiment.Experiment(), experiment.Experiment(),], + experiments=[ + experiment.Experiment(), + experiment.Experiment(), + ], ), RuntimeError, ) - async_pager = await client.list_experiments(request={},) + async_pager = await client.list_experiments( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -918,7 +1004,9 @@ async def test_list_experiments_async_pager(): @pytest.mark.asyncio async def test_list_experiments_async_pages(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -934,26 +1022,44 @@ async def test_list_experiments_async_pages(): ], next_page_token="abc", ), - experiment.ListExperimentsResponse(experiments=[], next_page_token="def",), experiment.ListExperimentsResponse( - experiments=[experiment.Experiment(),], next_page_token="ghi", + experiments=[], + next_page_token="def", ), experiment.ListExperimentsResponse( - experiments=[experiment.Experiment(), experiment.Experiment(),], + experiments=[ + experiment.Experiment(), + ], + next_page_token="ghi", + ), + experiment.ListExperimentsResponse( + experiments=[ + experiment.Experiment(), + experiment.Experiment(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_experiments(request={})).pages: + async for page_ in ( + await client.list_experiments(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [experiment.GetExperimentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + experiment.GetExperimentRequest, + dict, + ], +) def test_get_experiment(request_type, transport: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -990,7 +1096,8 @@ def test_get_experiment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1006,7 +1113,8 @@ async def test_get_experiment_async( transport: str = "grpc_asyncio", request_type=experiment.GetExperimentRequest ): client = ExperimentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1047,13 +1155,15 @@ async def test_get_experiment_async_from_dict(): def test_get_experiment_field_headers(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.GetExperimentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_experiment), "__call__") as call: @@ -1067,18 +1177,23 @@ def test_get_experiment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_experiment_field_headers_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.GetExperimentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_experiment), "__call__") as call: @@ -1094,11 +1209,16 @@ async def test_get_experiment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_experiment_flattened(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_experiment), "__call__") as call: @@ -1106,7 +1226,9 @@ def test_get_experiment_flattened(): call.return_value = experiment.Experiment() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_experiment(name="name_value",) + client.get_experiment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1118,19 +1240,24 @@ def test_get_experiment_flattened(): def test_get_experiment_flattened_error(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_experiment( - experiment.GetExperimentRequest(), name="name_value", + experiment.GetExperimentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_experiment_flattened_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_experiment), "__call__") as call: @@ -1142,7 +1269,9 @@ async def test_get_experiment_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_experiment(name="name_value",) + response = await client.get_experiment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1155,22 +1284,30 @@ async def test_get_experiment_flattened_async(): @pytest.mark.asyncio async def test_get_experiment_flattened_error_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_experiment( - experiment.GetExperimentRequest(), name="name_value", + experiment.GetExperimentRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [gcdc_experiment.CreateExperimentRequest, dict,] + "request_type", + [ + gcdc_experiment.CreateExperimentRequest, + dict, + ], ) def test_create_experiment(request_type, transport: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1209,7 +1346,8 @@ def test_create_experiment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1228,7 +1366,8 @@ async def test_create_experiment_async( request_type=gcdc_experiment.CreateExperimentRequest, ): client = ExperimentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1271,13 +1410,15 @@ async def test_create_experiment_async_from_dict(): def test_create_experiment_field_headers(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_experiment.CreateExperimentRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1293,18 +1434,23 @@ def test_create_experiment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_experiment_field_headers_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_experiment.CreateExperimentRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1322,11 +1468,16 @@ async def test_create_experiment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_experiment_flattened(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1354,7 +1505,9 @@ def test_create_experiment_flattened(): def test_create_experiment_flattened_error(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1368,7 +1521,9 @@ def test_create_experiment_flattened_error(): @pytest.mark.asyncio async def test_create_experiment_flattened_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1401,7 +1556,9 @@ async def test_create_experiment_flattened_async(): @pytest.mark.asyncio async def test_create_experiment_flattened_error_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1414,11 +1571,16 @@ async def test_create_experiment_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [gcdc_experiment.UpdateExperimentRequest, dict,] + "request_type", + [ + gcdc_experiment.UpdateExperimentRequest, + dict, + ], ) def test_update_experiment(request_type, transport: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1457,7 +1619,8 @@ def test_update_experiment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1476,7 +1639,8 @@ async def test_update_experiment_async( request_type=gcdc_experiment.UpdateExperimentRequest, ): client = ExperimentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1519,13 +1683,15 @@ async def test_update_experiment_async_from_dict(): def test_update_experiment_field_headers(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_experiment.UpdateExperimentRequest() - request.experiment.name = "experiment.name/value" + request.experiment.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1541,20 +1707,23 @@ def test_update_experiment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "experiment.name=experiment.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "experiment.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_experiment_field_headers_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_experiment.UpdateExperimentRequest() - request.experiment.name = "experiment.name/value" + request.experiment.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1572,13 +1741,16 @@ async def test_update_experiment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "experiment.name=experiment.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "experiment.name=name_value", + ) in kw["metadata"] def test_update_experiment_flattened(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1606,7 +1778,9 @@ def test_update_experiment_flattened(): def test_update_experiment_flattened_error(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1620,7 +1794,9 @@ def test_update_experiment_flattened_error(): @pytest.mark.asyncio async def test_update_experiment_flattened_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1653,7 +1829,9 @@ async def test_update_experiment_flattened_async(): @pytest.mark.asyncio async def test_update_experiment_flattened_error_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1665,10 +1843,17 @@ async def test_update_experiment_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [experiment.DeleteExperimentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + experiment.DeleteExperimentRequest, + dict, + ], +) def test_delete_experiment(request_type, transport: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1696,7 +1881,8 @@ def test_delete_experiment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1714,7 +1900,8 @@ async def test_delete_experiment_async( transport: str = "grpc_asyncio", request_type=experiment.DeleteExperimentRequest ): client = ExperimentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1744,13 +1931,15 @@ async def test_delete_experiment_async_from_dict(): def test_delete_experiment_field_headers(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.DeleteExperimentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1766,18 +1955,23 @@ def test_delete_experiment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_experiment_field_headers_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.DeleteExperimentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1793,11 +1987,16 @@ async def test_delete_experiment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_experiment_flattened(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1807,7 +2006,9 @@ def test_delete_experiment_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_experiment(name="name_value",) + client.delete_experiment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1819,19 +2020,24 @@ def test_delete_experiment_flattened(): def test_delete_experiment_flattened_error(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_experiment( - experiment.DeleteExperimentRequest(), name="name_value", + experiment.DeleteExperimentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_experiment_flattened_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1843,7 +2049,9 @@ async def test_delete_experiment_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_experiment(name="name_value",) + response = await client.delete_experiment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1856,20 +2064,30 @@ async def test_delete_experiment_flattened_async(): @pytest.mark.asyncio async def test_delete_experiment_flattened_error_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_experiment( - experiment.DeleteExperimentRequest(), name="name_value", + experiment.DeleteExperimentRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [experiment.StartExperimentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + experiment.StartExperimentRequest, + dict, + ], +) def test_start_experiment(request_type, transport: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1906,7 +2124,8 @@ def test_start_experiment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1922,7 +2141,8 @@ async def test_start_experiment_async( transport: str = "grpc_asyncio", request_type=experiment.StartExperimentRequest ): client = ExperimentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1963,13 +2183,15 @@ async def test_start_experiment_async_from_dict(): def test_start_experiment_field_headers(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.StartExperimentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.start_experiment), "__call__") as call: @@ -1983,18 +2205,23 @@ def test_start_experiment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_start_experiment_field_headers_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.StartExperimentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.start_experiment), "__call__") as call: @@ -2010,11 +2237,16 @@ async def test_start_experiment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_start_experiment_flattened(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.start_experiment), "__call__") as call: @@ -2022,7 +2254,9 @@ def test_start_experiment_flattened(): call.return_value = experiment.Experiment() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.start_experiment(name="name_value",) + client.start_experiment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2034,19 +2268,24 @@ def test_start_experiment_flattened(): def test_start_experiment_flattened_error(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.start_experiment( - experiment.StartExperimentRequest(), name="name_value", + experiment.StartExperimentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_start_experiment_flattened_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.start_experiment), "__call__") as call: @@ -2058,7 +2297,9 @@ async def test_start_experiment_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.start_experiment(name="name_value",) + response = await client.start_experiment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2071,20 +2312,30 @@ async def test_start_experiment_flattened_async(): @pytest.mark.asyncio async def test_start_experiment_flattened_error_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.start_experiment( - experiment.StartExperimentRequest(), name="name_value", + experiment.StartExperimentRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [experiment.StopExperimentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + experiment.StopExperimentRequest, + dict, + ], +) def test_stop_experiment(request_type, transport: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2121,7 +2372,8 @@ def test_stop_experiment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2137,7 +2389,8 @@ async def test_stop_experiment_async( transport: str = "grpc_asyncio", request_type=experiment.StopExperimentRequest ): client = ExperimentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2178,13 +2431,15 @@ async def test_stop_experiment_async_from_dict(): def test_stop_experiment_field_headers(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.StopExperimentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.stop_experiment), "__call__") as call: @@ -2198,18 +2453,23 @@ def test_stop_experiment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_stop_experiment_field_headers_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.StopExperimentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.stop_experiment), "__call__") as call: @@ -2225,11 +2485,16 @@ async def test_stop_experiment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_stop_experiment_flattened(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.stop_experiment), "__call__") as call: @@ -2237,7 +2502,9 @@ def test_stop_experiment_flattened(): call.return_value = experiment.Experiment() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.stop_experiment(name="name_value",) + client.stop_experiment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2249,19 +2516,24 @@ def test_stop_experiment_flattened(): def test_stop_experiment_flattened_error(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.stop_experiment( - experiment.StopExperimentRequest(), name="name_value", + experiment.StopExperimentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_stop_experiment_flattened_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.stop_experiment), "__call__") as call: @@ -2273,7 +2545,9 @@ async def test_stop_experiment_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.stop_experiment(name="name_value",) + response = await client.stop_experiment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2286,13 +2560,16 @@ async def test_stop_experiment_flattened_async(): @pytest.mark.asyncio async def test_stop_experiment_flattened_error_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.stop_experiment( - experiment.StopExperimentRequest(), name="name_value", + experiment.StopExperimentRequest(), + name="name_value", ) @@ -2303,7 +2580,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2323,7 +2601,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ExperimentsClient(client_options=options, transport=transport,) + client = ExperimentsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2339,7 +2620,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ExperimentsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2369,7 +2651,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.ExperimentsGrpcTransport, transports.ExperimentsGrpcAsyncIOTransport,], + [ + transports.ExperimentsGrpcTransport, + transports.ExperimentsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2379,10 +2664,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ExperimentsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ExperimentsGrpcTransport,) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ExperimentsGrpcTransport, + ) def test_experiments_base_transport_error(): @@ -2422,6 +2725,14 @@ def test_experiments_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_experiments_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2433,7 +2744,8 @@ def test_experiments_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ExperimentsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2474,7 +2786,10 @@ def test_experiments_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.ExperimentsGrpcTransport, transports.ExperimentsGrpcAsyncIOTransport,], + [ + transports.ExperimentsGrpcTransport, + transports.ExperimentsGrpcAsyncIOTransport, + ], ) def test_experiments_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2572,24 +2887,40 @@ def test_experiments_grpc_transport_client_cert_source_for_mtls(transport_class) ) -def test_experiments_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_experiments_host_no_port(transport_name): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_experiments_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_experiments_host_with_port(transport_name): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_experiments_grpc_transport_channel(): @@ -2597,7 +2928,8 @@ def test_experiments_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ExperimentsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2609,7 +2941,8 @@ def test_experiments_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ExperimentsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2749,7 +3082,11 @@ def test_version_path(): flow = "clam" version = "whelk" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) actual = ExperimentsClient.version_path(project, location, agent, flow, version) assert expected == actual @@ -2792,7 +3129,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ExperimentsClient.common_folder_path(folder) assert expected == actual @@ -2810,7 +3149,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ExperimentsClient.common_organization_path(organization) assert expected == actual @@ -2828,7 +3169,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ExperimentsClient.common_project_path(project) assert expected == actual @@ -2848,7 +3191,8 @@ def test_common_location_path(): project = "oyster" location = "nudibranch" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ExperimentsClient.common_location_path(project, location) assert expected == actual @@ -2873,7 +3217,8 @@ def test_client_with_default_client_info(): transports.ExperimentsTransport, "_prep_wrapped_messages" ) as prep: client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2882,7 +3227,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ExperimentsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2890,7 +3236,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ExperimentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3/test_flows.py b/tests/unit/gapic/dialogflowcx_v3/test_flows.py index d1ebff7e..9c9c07f0 100644 --- a/tests/unit/gapic/dialogflowcx_v3/test_flows.py +++ b/tests/unit/gapic/dialogflowcx_v3/test_flows.py @@ -91,19 +91,25 @@ def test__get_default_mtls_endpoint(): assert FlowsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [FlowsClient, FlowsAsyncClient,]) -def test_flows_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (FlowsClient, "grpc"), + (FlowsAsyncClient, "grpc_asyncio"), + ], +) +def test_flows_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -129,22 +135,32 @@ def test_flows_client_service_account_always_use_jwt(transport_class, transport_ use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [FlowsClient, FlowsAsyncClient,]) -def test_flows_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (FlowsClient, "grpc"), + (FlowsAsyncClient, "grpc_asyncio"), + ], +) +def test_flows_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_flows_client_get_transport_class(): @@ -468,7 +484,9 @@ def test_flows_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -599,10 +617,17 @@ def test_flows_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [gcdc_flow.CreateFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_flow.CreateFlowRequest, + dict, + ], +) def test_create_flow(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -637,7 +662,8 @@ def test_create_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -653,7 +679,8 @@ async def test_create_flow_async( transport: str = "grpc_asyncio", request_type=gcdc_flow.CreateFlowRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -692,13 +719,15 @@ async def test_create_flow_async_from_dict(): def test_create_flow_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_flow.CreateFlowRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_flow), "__call__") as call: @@ -712,18 +741,23 @@ def test_create_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_flow_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_flow.CreateFlowRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_flow), "__call__") as call: @@ -737,11 +771,16 @@ async def test_create_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_flow_flattened(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_flow), "__call__") as call: @@ -750,7 +789,8 @@ def test_create_flow_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_flow( - parent="parent_value", flow=gcdc_flow.Flow(name="name_value"), + parent="parent_value", + flow=gcdc_flow.Flow(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -766,7 +806,9 @@ def test_create_flow_flattened(): def test_create_flow_flattened_error(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -780,7 +822,9 @@ def test_create_flow_flattened_error(): @pytest.mark.asyncio async def test_create_flow_flattened_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_flow), "__call__") as call: @@ -791,7 +835,8 @@ async def test_create_flow_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_flow( - parent="parent_value", flow=gcdc_flow.Flow(name="name_value"), + parent="parent_value", + flow=gcdc_flow.Flow(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -808,7 +853,9 @@ async def test_create_flow_flattened_async(): @pytest.mark.asyncio async def test_create_flow_flattened_error_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -820,10 +867,17 @@ async def test_create_flow_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [flow.DeleteFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + flow.DeleteFlowRequest, + dict, + ], +) def test_delete_flow(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -849,7 +903,8 @@ def test_delete_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -865,7 +920,8 @@ async def test_delete_flow_async( transport: str = "grpc_asyncio", request_type=flow.DeleteFlowRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -893,13 +949,15 @@ async def test_delete_flow_async_from_dict(): def test_delete_flow_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.DeleteFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_flow), "__call__") as call: @@ -913,18 +971,23 @@ def test_delete_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_flow_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.DeleteFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_flow), "__call__") as call: @@ -938,11 +1001,16 @@ async def test_delete_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_flow_flattened(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_flow), "__call__") as call: @@ -950,7 +1018,9 @@ def test_delete_flow_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_flow(name="name_value",) + client.delete_flow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -962,19 +1032,24 @@ def test_delete_flow_flattened(): def test_delete_flow_flattened_error(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_flow( - flow.DeleteFlowRequest(), name="name_value", + flow.DeleteFlowRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_flow_flattened_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_flow), "__call__") as call: @@ -984,7 +1059,9 @@ async def test_delete_flow_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_flow(name="name_value",) + response = await client.delete_flow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -997,20 +1074,30 @@ async def test_delete_flow_flattened_async(): @pytest.mark.asyncio async def test_delete_flow_flattened_error_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_flow( - flow.DeleteFlowRequest(), name="name_value", + flow.DeleteFlowRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [flow.ListFlowsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + flow.ListFlowsRequest, + dict, + ], +) def test_list_flows(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1039,7 +1126,8 @@ def test_list_flows_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1055,7 +1143,8 @@ async def test_list_flows_async( transport: str = "grpc_asyncio", request_type=flow.ListFlowsRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1066,7 +1155,9 @@ async def test_list_flows_async( with mock.patch.object(type(client.transport.list_flows), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - flow.ListFlowsResponse(next_page_token="next_page_token_value",) + flow.ListFlowsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_flows(request) @@ -1086,13 +1177,15 @@ async def test_list_flows_async_from_dict(): def test_list_flows_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.ListFlowsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_flows), "__call__") as call: @@ -1106,18 +1199,23 @@ def test_list_flows_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_flows_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.ListFlowsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_flows), "__call__") as call: @@ -1133,11 +1231,16 @@ async def test_list_flows_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_flows_flattened(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_flows), "__call__") as call: @@ -1145,7 +1248,9 @@ def test_list_flows_flattened(): call.return_value = flow.ListFlowsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_flows(parent="parent_value",) + client.list_flows( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1157,19 +1262,24 @@ def test_list_flows_flattened(): def test_list_flows_flattened_error(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_flows( - flow.ListFlowsRequest(), parent="parent_value", + flow.ListFlowsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_flows_flattened_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_flows), "__call__") as call: @@ -1181,7 +1291,9 @@ async def test_list_flows_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_flows(parent="parent_value",) + response = await client.list_flows( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1194,19 +1306,23 @@ async def test_list_flows_flattened_async(): @pytest.mark.asyncio async def test_list_flows_flattened_error_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_flows( - flow.ListFlowsRequest(), parent="parent_value", + flow.ListFlowsRequest(), + parent="parent_value", ) def test_list_flows_pager(transport_name: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1214,11 +1330,29 @@ def test_list_flows_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( flow.ListFlowsResponse( - flows=[flow.Flow(), flow.Flow(), flow.Flow(),], next_page_token="abc", + flows=[ + flow.Flow(), + flow.Flow(), + flow.Flow(), + ], + next_page_token="abc", + ), + flow.ListFlowsResponse( + flows=[], + next_page_token="def", + ), + flow.ListFlowsResponse( + flows=[ + flow.Flow(), + ], + next_page_token="ghi", + ), + flow.ListFlowsResponse( + flows=[ + flow.Flow(), + flow.Flow(), + ], ), - flow.ListFlowsResponse(flows=[], next_page_token="def",), - flow.ListFlowsResponse(flows=[flow.Flow(),], next_page_token="ghi",), - flow.ListFlowsResponse(flows=[flow.Flow(), flow.Flow(),],), RuntimeError, ) @@ -1230,14 +1364,15 @@ def test_list_flows_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, flow.Flow) for i in results) def test_list_flows_pages(transport_name: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1245,11 +1380,29 @@ def test_list_flows_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( flow.ListFlowsResponse( - flows=[flow.Flow(), flow.Flow(), flow.Flow(),], next_page_token="abc", + flows=[ + flow.Flow(), + flow.Flow(), + flow.Flow(), + ], + next_page_token="abc", + ), + flow.ListFlowsResponse( + flows=[], + next_page_token="def", + ), + flow.ListFlowsResponse( + flows=[ + flow.Flow(), + ], + next_page_token="ghi", + ), + flow.ListFlowsResponse( + flows=[ + flow.Flow(), + flow.Flow(), + ], ), - flow.ListFlowsResponse(flows=[], next_page_token="def",), - flow.ListFlowsResponse(flows=[flow.Flow(),], next_page_token="ghi",), - flow.ListFlowsResponse(flows=[flow.Flow(), flow.Flow(),],), RuntimeError, ) pages = list(client.list_flows(request={}).pages) @@ -1259,7 +1412,9 @@ def test_list_flows_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_flows_async_pager(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1268,17 +1423,37 @@ async def test_list_flows_async_pager(): # Set the response to a series of pages. call.side_effect = ( flow.ListFlowsResponse( - flows=[flow.Flow(), flow.Flow(), flow.Flow(),], next_page_token="abc", + flows=[ + flow.Flow(), + flow.Flow(), + flow.Flow(), + ], + next_page_token="abc", + ), + flow.ListFlowsResponse( + flows=[], + next_page_token="def", + ), + flow.ListFlowsResponse( + flows=[ + flow.Flow(), + ], + next_page_token="ghi", + ), + flow.ListFlowsResponse( + flows=[ + flow.Flow(), + flow.Flow(), + ], ), - flow.ListFlowsResponse(flows=[], next_page_token="def",), - flow.ListFlowsResponse(flows=[flow.Flow(),], next_page_token="ghi",), - flow.ListFlowsResponse(flows=[flow.Flow(), flow.Flow(),],), RuntimeError, ) - async_pager = await client.list_flows(request={},) + async_pager = await client.list_flows( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1287,7 +1462,9 @@ async def test_list_flows_async_pager(): @pytest.mark.asyncio async def test_list_flows_async_pages(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1296,24 +1473,51 @@ async def test_list_flows_async_pages(): # Set the response to a series of pages. call.side_effect = ( flow.ListFlowsResponse( - flows=[flow.Flow(), flow.Flow(), flow.Flow(),], next_page_token="abc", + flows=[ + flow.Flow(), + flow.Flow(), + flow.Flow(), + ], + next_page_token="abc", + ), + flow.ListFlowsResponse( + flows=[], + next_page_token="def", + ), + flow.ListFlowsResponse( + flows=[ + flow.Flow(), + ], + next_page_token="ghi", + ), + flow.ListFlowsResponse( + flows=[ + flow.Flow(), + flow.Flow(), + ], ), - flow.ListFlowsResponse(flows=[], next_page_token="def",), - flow.ListFlowsResponse(flows=[flow.Flow(),], next_page_token="ghi",), - flow.ListFlowsResponse(flows=[flow.Flow(), flow.Flow(),],), RuntimeError, ) pages = [] - async for page_ in (await client.list_flows(request={})).pages: + async for page_ in ( + await client.list_flows(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [flow.GetFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + flow.GetFlowRequest, + dict, + ], +) def test_get_flow(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1348,7 +1552,8 @@ def test_get_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1364,7 +1569,8 @@ async def test_get_flow_async( transport: str = "grpc_asyncio", request_type=flow.GetFlowRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1403,13 +1609,15 @@ async def test_get_flow_async_from_dict(): def test_get_flow_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.GetFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_flow), "__call__") as call: @@ -1423,18 +1631,23 @@ def test_get_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_flow_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.GetFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_flow), "__call__") as call: @@ -1448,11 +1661,16 @@ async def test_get_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_flow_flattened(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_flow), "__call__") as call: @@ -1460,7 +1678,9 @@ def test_get_flow_flattened(): call.return_value = flow.Flow() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_flow(name="name_value",) + client.get_flow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1472,19 +1692,24 @@ def test_get_flow_flattened(): def test_get_flow_flattened_error(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_flow( - flow.GetFlowRequest(), name="name_value", + flow.GetFlowRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_flow_flattened_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_flow), "__call__") as call: @@ -1494,7 +1719,9 @@ async def test_get_flow_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(flow.Flow()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_flow(name="name_value",) + response = await client.get_flow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1507,20 +1734,30 @@ async def test_get_flow_flattened_async(): @pytest.mark.asyncio async def test_get_flow_flattened_error_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_flow( - flow.GetFlowRequest(), name="name_value", + flow.GetFlowRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [gcdc_flow.UpdateFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_flow.UpdateFlowRequest, + dict, + ], +) def test_update_flow(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1555,7 +1792,8 @@ def test_update_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1571,7 +1809,8 @@ async def test_update_flow_async( transport: str = "grpc_asyncio", request_type=gcdc_flow.UpdateFlowRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1610,13 +1849,15 @@ async def test_update_flow_async_from_dict(): def test_update_flow_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_flow.UpdateFlowRequest() - request.flow.name = "flow.name/value" + request.flow.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_flow), "__call__") as call: @@ -1630,18 +1871,23 @@ def test_update_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "flow.name=flow.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "flow.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_flow_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_flow.UpdateFlowRequest() - request.flow.name = "flow.name/value" + request.flow.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_flow), "__call__") as call: @@ -1655,11 +1901,16 @@ async def test_update_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "flow.name=flow.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "flow.name=name_value", + ) in kw["metadata"] def test_update_flow_flattened(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_flow), "__call__") as call: @@ -1685,7 +1936,9 @@ def test_update_flow_flattened(): def test_update_flow_flattened_error(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1699,7 +1952,9 @@ def test_update_flow_flattened_error(): @pytest.mark.asyncio async def test_update_flow_flattened_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_flow), "__call__") as call: @@ -1728,7 +1983,9 @@ async def test_update_flow_flattened_async(): @pytest.mark.asyncio async def test_update_flow_flattened_error_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1740,10 +1997,17 @@ async def test_update_flow_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [flow.TrainFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + flow.TrainFlowRequest, + dict, + ], +) def test_train_flow(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1769,7 +2033,8 @@ def test_train_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1785,7 +2050,8 @@ async def test_train_flow_async( transport: str = "grpc_asyncio", request_type=flow.TrainFlowRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1815,13 +2081,15 @@ async def test_train_flow_async_from_dict(): def test_train_flow_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.TrainFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.train_flow), "__call__") as call: @@ -1835,18 +2103,23 @@ def test_train_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_train_flow_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.TrainFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.train_flow), "__call__") as call: @@ -1862,11 +2135,16 @@ async def test_train_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_train_flow_flattened(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.train_flow), "__call__") as call: @@ -1874,7 +2152,9 @@ def test_train_flow_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.train_flow(name="name_value",) + client.train_flow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1886,19 +2166,24 @@ def test_train_flow_flattened(): def test_train_flow_flattened_error(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.train_flow( - flow.TrainFlowRequest(), name="name_value", + flow.TrainFlowRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_train_flow_flattened_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.train_flow), "__call__") as call: @@ -1910,7 +2195,9 @@ async def test_train_flow_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.train_flow(name="name_value",) + response = await client.train_flow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1923,20 +2210,30 @@ async def test_train_flow_flattened_async(): @pytest.mark.asyncio async def test_train_flow_flattened_error_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.train_flow( - flow.TrainFlowRequest(), name="name_value", + flow.TrainFlowRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [flow.ValidateFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + flow.ValidateFlowRequest, + dict, + ], +) def test_validate_flow(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1946,7 +2243,9 @@ def test_validate_flow(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.validate_flow), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = flow.FlowValidationResult(name="name_value",) + call.return_value = flow.FlowValidationResult( + name="name_value", + ) response = client.validate_flow(request) # Establish that the underlying gRPC stub method was called. @@ -1963,7 +2262,8 @@ def test_validate_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1979,7 +2279,8 @@ async def test_validate_flow_async( transport: str = "grpc_asyncio", request_type=flow.ValidateFlowRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1990,7 +2291,9 @@ async def test_validate_flow_async( with mock.patch.object(type(client.transport.validate_flow), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - flow.FlowValidationResult(name="name_value",) + flow.FlowValidationResult( + name="name_value", + ) ) response = await client.validate_flow(request) @@ -2010,13 +2313,15 @@ async def test_validate_flow_async_from_dict(): def test_validate_flow_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.ValidateFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.validate_flow), "__call__") as call: @@ -2030,18 +2335,23 @@ def test_validate_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_validate_flow_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.ValidateFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.validate_flow), "__call__") as call: @@ -2057,13 +2367,23 @@ async def test_validate_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [flow.GetFlowValidationResultRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + flow.GetFlowValidationResultRequest, + dict, + ], +) def test_get_flow_validation_result(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2075,7 +2395,9 @@ def test_get_flow_validation_result(request_type, transport: str = "grpc"): type(client.transport.get_flow_validation_result), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = flow.FlowValidationResult(name="name_value",) + call.return_value = flow.FlowValidationResult( + name="name_value", + ) response = client.get_flow_validation_result(request) # Establish that the underlying gRPC stub method was called. @@ -2092,7 +2414,8 @@ def test_get_flow_validation_result_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2110,7 +2433,8 @@ async def test_get_flow_validation_result_async( transport: str = "grpc_asyncio", request_type=flow.GetFlowValidationResultRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2123,7 +2447,9 @@ async def test_get_flow_validation_result_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - flow.FlowValidationResult(name="name_value",) + flow.FlowValidationResult( + name="name_value", + ) ) response = await client.get_flow_validation_result(request) @@ -2143,13 +2469,15 @@ async def test_get_flow_validation_result_async_from_dict(): def test_get_flow_validation_result_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.GetFlowValidationResultRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2165,18 +2493,23 @@ def test_get_flow_validation_result_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_flow_validation_result_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.GetFlowValidationResultRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2194,11 +2527,16 @@ async def test_get_flow_validation_result_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_flow_validation_result_flattened(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2208,7 +2546,9 @@ def test_get_flow_validation_result_flattened(): call.return_value = flow.FlowValidationResult() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_flow_validation_result(name="name_value",) + client.get_flow_validation_result( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2220,19 +2560,24 @@ def test_get_flow_validation_result_flattened(): def test_get_flow_validation_result_flattened_error(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_flow_validation_result( - flow.GetFlowValidationResultRequest(), name="name_value", + flow.GetFlowValidationResultRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_flow_validation_result_flattened_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2246,7 +2591,9 @@ async def test_get_flow_validation_result_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_flow_validation_result(name="name_value",) + response = await client.get_flow_validation_result( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2259,20 +2606,30 @@ async def test_get_flow_validation_result_flattened_async(): @pytest.mark.asyncio async def test_get_flow_validation_result_flattened_error_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_flow_validation_result( - flow.GetFlowValidationResultRequest(), name="name_value", + flow.GetFlowValidationResultRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [flow.ImportFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + flow.ImportFlowRequest, + dict, + ], +) def test_import_flow(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2298,7 +2655,8 @@ def test_import_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2314,7 +2672,8 @@ async def test_import_flow_async( transport: str = "grpc_asyncio", request_type=flow.ImportFlowRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2344,13 +2703,15 @@ async def test_import_flow_async_from_dict(): def test_import_flow_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.ImportFlowRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.import_flow), "__call__") as call: @@ -2364,18 +2725,23 @@ def test_import_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_import_flow_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.ImportFlowRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.import_flow), "__call__") as call: @@ -2391,13 +2757,23 @@ async def test_import_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [flow.ExportFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + flow.ExportFlowRequest, + dict, + ], +) def test_export_flow(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2423,7 +2799,8 @@ def test_export_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2439,7 +2816,8 @@ async def test_export_flow_async( transport: str = "grpc_asyncio", request_type=flow.ExportFlowRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2469,13 +2847,15 @@ async def test_export_flow_async_from_dict(): def test_export_flow_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.ExportFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.export_flow), "__call__") as call: @@ -2489,18 +2869,23 @@ def test_export_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_export_flow_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.ExportFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.export_flow), "__call__") as call: @@ -2516,7 +2901,10 @@ async def test_export_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_credentials_transport_error(): @@ -2526,7 +2914,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2546,7 +2935,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = FlowsClient(client_options=options, transport=transport,) + client = FlowsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2562,7 +2954,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = FlowsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2592,7 +2985,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.FlowsGrpcTransport, transports.FlowsGrpcAsyncIOTransport,], + [ + transports.FlowsGrpcTransport, + transports.FlowsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2602,10 +2998,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = FlowsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.FlowsGrpcTransport,) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.FlowsGrpcTransport, + ) def test_flows_base_transport_error(): @@ -2653,6 +3067,14 @@ def test_flows_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_flows_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2664,7 +3086,8 @@ def test_flows_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.FlowsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2705,7 +3128,10 @@ def test_flows_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.FlowsGrpcTransport, transports.FlowsGrpcAsyncIOTransport,], + [ + transports.FlowsGrpcTransport, + transports.FlowsGrpcAsyncIOTransport, + ], ) def test_flows_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2803,31 +3229,50 @@ def test_flows_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_flows_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_flows_host_no_port(transport_name): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_flows_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_flows_host_with_port(transport_name): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_flows_grpc_transport_channel(): channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. - transport = transports.FlowsGrpcTransport(host="squid.clam.whelk", channel=channel,) + transport = transports.FlowsGrpcTransport( + host="squid.clam.whelk", + channel=channel, + ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" assert transport._ssl_channel_credentials == None @@ -2838,7 +3283,8 @@ def test_flows_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.FlowsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2939,12 +3385,16 @@ def test_flows_transport_channel_mtls_with_adc(transport_class): def test_flows_grpc_lro_client(): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2952,12 +3402,16 @@ def test_flows_grpc_lro_client(): def test_flows_grpc_lro_async_client(): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2968,8 +3422,13 @@ def test_flow_path(): location = "clam" agent = "whelk" flow = "octopus" - expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + expected = ( + "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( + project=project, + location=location, + agent=agent, + flow=flow, + ) ) actual = FlowsClient.flow_path(project, location, agent, flow) assert expected == actual @@ -2995,7 +3454,10 @@ def test_flow_validation_result_path(): agent = "scallop" flow = "abalone" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/validationResult".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) actual = FlowsClient.flow_validation_result_path(project, location, agent, flow) assert expected == actual @@ -3021,7 +3483,10 @@ def test_intent_path(): agent = "cuttlefish" intent = "mussel" expected = "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) actual = FlowsClient.intent_path(project, location, agent, intent) assert expected == actual @@ -3048,7 +3513,11 @@ def test_page_path(): flow = "octopus" page = "oyster" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) actual = FlowsClient.page_path(project, location, agent, flow, page) assert expected == actual @@ -3109,7 +3578,10 @@ def test_webhook_path(): agent = "scallop" webhook = "abalone" expected = "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) actual = FlowsClient.webhook_path(project, location, agent, webhook) assert expected == actual @@ -3151,7 +3623,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = FlowsClient.common_folder_path(folder) assert expected == actual @@ -3169,7 +3643,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "winkle" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = FlowsClient.common_organization_path(organization) assert expected == actual @@ -3187,7 +3663,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "scallop" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = FlowsClient.common_project_path(project) assert expected == actual @@ -3207,7 +3685,8 @@ def test_common_location_path(): project = "squid" location = "clam" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = FlowsClient.common_location_path(project, location) assert expected == actual @@ -3230,14 +3709,16 @@ def test_client_with_default_client_info(): with mock.patch.object(transports.FlowsTransport, "_prep_wrapped_messages") as prep: client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) with mock.patch.object(transports.FlowsTransport, "_prep_wrapped_messages") as prep: transport_class = FlowsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3245,7 +3726,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3/test_intents.py b/tests/unit/gapic/dialogflowcx_v3/test_intents.py index 52358b5f..627b92fc 100644 --- a/tests/unit/gapic/dialogflowcx_v3/test_intents.py +++ b/tests/unit/gapic/dialogflowcx_v3/test_intents.py @@ -80,19 +80,25 @@ def test__get_default_mtls_endpoint(): assert IntentsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [IntentsClient, IntentsAsyncClient,]) -def test_intents_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (IntentsClient, "grpc"), + (IntentsAsyncClient, "grpc_asyncio"), + ], +) +def test_intents_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -118,22 +124,32 @@ def test_intents_client_service_account_always_use_jwt(transport_class, transpor use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [IntentsClient, IntentsAsyncClient,]) -def test_intents_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (IntentsClient, "grpc"), + (IntentsAsyncClient, "grpc_asyncio"), + ], +) +def test_intents_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_intents_client_get_transport_class(): @@ -457,7 +473,9 @@ def test_intents_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -588,10 +606,17 @@ def test_intents_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [intent.ListIntentsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + intent.ListIntentsRequest, + dict, + ], +) def test_list_intents(request_type, transport: str = "grpc"): client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -620,7 +645,8 @@ def test_list_intents_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -636,7 +662,8 @@ async def test_list_intents_async( transport: str = "grpc_asyncio", request_type=intent.ListIntentsRequest ): client = IntentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -647,7 +674,9 @@ async def test_list_intents_async( with mock.patch.object(type(client.transport.list_intents), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - intent.ListIntentsResponse(next_page_token="next_page_token_value",) + intent.ListIntentsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_intents(request) @@ -667,13 +696,15 @@ async def test_list_intents_async_from_dict(): def test_list_intents_field_headers(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = intent.ListIntentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_intents), "__call__") as call: @@ -687,18 +718,23 @@ def test_list_intents_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_intents_field_headers_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = intent.ListIntentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_intents), "__call__") as call: @@ -714,11 +750,16 @@ async def test_list_intents_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_intents_flattened(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_intents), "__call__") as call: @@ -726,7 +767,9 @@ def test_list_intents_flattened(): call.return_value = intent.ListIntentsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_intents(parent="parent_value",) + client.list_intents( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -738,19 +781,24 @@ def test_list_intents_flattened(): def test_list_intents_flattened_error(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_intents( - intent.ListIntentsRequest(), parent="parent_value", + intent.ListIntentsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_intents_flattened_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_intents), "__call__") as call: @@ -762,7 +810,9 @@ async def test_list_intents_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_intents(parent="parent_value",) + response = await client.list_intents( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -775,19 +825,23 @@ async def test_list_intents_flattened_async(): @pytest.mark.asyncio async def test_list_intents_flattened_error_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_intents( - intent.ListIntentsRequest(), parent="parent_value", + intent.ListIntentsRequest(), + parent="parent_value", ) def test_list_intents_pager(transport_name: str = "grpc"): client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -795,14 +849,29 @@ def test_list_intents_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( intent.ListIntentsResponse( - intents=[intent.Intent(), intent.Intent(), intent.Intent(),], + intents=[ + intent.Intent(), + intent.Intent(), + intent.Intent(), + ], next_page_token="abc", ), - intent.ListIntentsResponse(intents=[], next_page_token="def",), intent.ListIntentsResponse( - intents=[intent.Intent(),], next_page_token="ghi", + intents=[], + next_page_token="def", + ), + intent.ListIntentsResponse( + intents=[ + intent.Intent(), + ], + next_page_token="ghi", + ), + intent.ListIntentsResponse( + intents=[ + intent.Intent(), + intent.Intent(), + ], ), - intent.ListIntentsResponse(intents=[intent.Intent(), intent.Intent(),],), RuntimeError, ) @@ -814,14 +883,15 @@ def test_list_intents_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, intent.Intent) for i in results) def test_list_intents_pages(transport_name: str = "grpc"): client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -829,14 +899,29 @@ def test_list_intents_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( intent.ListIntentsResponse( - intents=[intent.Intent(), intent.Intent(), intent.Intent(),], + intents=[ + intent.Intent(), + intent.Intent(), + intent.Intent(), + ], next_page_token="abc", ), - intent.ListIntentsResponse(intents=[], next_page_token="def",), intent.ListIntentsResponse( - intents=[intent.Intent(),], next_page_token="ghi", + intents=[], + next_page_token="def", + ), + intent.ListIntentsResponse( + intents=[ + intent.Intent(), + ], + next_page_token="ghi", + ), + intent.ListIntentsResponse( + intents=[ + intent.Intent(), + intent.Intent(), + ], ), - intent.ListIntentsResponse(intents=[intent.Intent(), intent.Intent(),],), RuntimeError, ) pages = list(client.list_intents(request={}).pages) @@ -846,7 +931,9 @@ def test_list_intents_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_intents_async_pager(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -855,20 +942,37 @@ async def test_list_intents_async_pager(): # Set the response to a series of pages. call.side_effect = ( intent.ListIntentsResponse( - intents=[intent.Intent(), intent.Intent(), intent.Intent(),], + intents=[ + intent.Intent(), + intent.Intent(), + intent.Intent(), + ], next_page_token="abc", ), - intent.ListIntentsResponse(intents=[], next_page_token="def",), intent.ListIntentsResponse( - intents=[intent.Intent(),], next_page_token="ghi", + intents=[], + next_page_token="def", + ), + intent.ListIntentsResponse( + intents=[ + intent.Intent(), + ], + next_page_token="ghi", + ), + intent.ListIntentsResponse( + intents=[ + intent.Intent(), + intent.Intent(), + ], ), - intent.ListIntentsResponse(intents=[intent.Intent(), intent.Intent(),],), RuntimeError, ) - async_pager = await client.list_intents(request={},) + async_pager = await client.list_intents( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -877,7 +981,9 @@ async def test_list_intents_async_pager(): @pytest.mark.asyncio async def test_list_intents_async_pages(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -886,27 +992,51 @@ async def test_list_intents_async_pages(): # Set the response to a series of pages. call.side_effect = ( intent.ListIntentsResponse( - intents=[intent.Intent(), intent.Intent(), intent.Intent(),], + intents=[ + intent.Intent(), + intent.Intent(), + intent.Intent(), + ], next_page_token="abc", ), - intent.ListIntentsResponse(intents=[], next_page_token="def",), intent.ListIntentsResponse( - intents=[intent.Intent(),], next_page_token="ghi", + intents=[], + next_page_token="def", + ), + intent.ListIntentsResponse( + intents=[ + intent.Intent(), + ], + next_page_token="ghi", + ), + intent.ListIntentsResponse( + intents=[ + intent.Intent(), + intent.Intent(), + ], ), - intent.ListIntentsResponse(intents=[intent.Intent(), intent.Intent(),],), RuntimeError, ) pages = [] - async for page_ in (await client.list_intents(request={})).pages: + async for page_ in ( + await client.list_intents(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [intent.GetIntentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + intent.GetIntentRequest, + dict, + ], +) def test_get_intent(request_type, transport: str = "grpc"): client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -943,7 +1073,8 @@ def test_get_intent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -959,7 +1090,8 @@ async def test_get_intent_async( transport: str = "grpc_asyncio", request_type=intent.GetIntentRequest ): client = IntentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1000,13 +1132,15 @@ async def test_get_intent_async_from_dict(): def test_get_intent_field_headers(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = intent.GetIntentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_intent), "__call__") as call: @@ -1020,18 +1154,23 @@ def test_get_intent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_intent_field_headers_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = intent.GetIntentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_intent), "__call__") as call: @@ -1045,11 +1184,16 @@ async def test_get_intent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_intent_flattened(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_intent), "__call__") as call: @@ -1057,7 +1201,9 @@ def test_get_intent_flattened(): call.return_value = intent.Intent() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_intent(name="name_value",) + client.get_intent( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1069,19 +1215,24 @@ def test_get_intent_flattened(): def test_get_intent_flattened_error(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_intent( - intent.GetIntentRequest(), name="name_value", + intent.GetIntentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_intent_flattened_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_intent), "__call__") as call: @@ -1091,7 +1242,9 @@ async def test_get_intent_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(intent.Intent()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_intent(name="name_value",) + response = await client.get_intent( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1104,20 +1257,30 @@ async def test_get_intent_flattened_async(): @pytest.mark.asyncio async def test_get_intent_flattened_error_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_intent( - intent.GetIntentRequest(), name="name_value", + intent.GetIntentRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [gcdc_intent.CreateIntentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_intent.CreateIntentRequest, + dict, + ], +) def test_create_intent(request_type, transport: str = "grpc"): client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1154,7 +1317,8 @@ def test_create_intent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1170,7 +1334,8 @@ async def test_create_intent_async( transport: str = "grpc_asyncio", request_type=gcdc_intent.CreateIntentRequest ): client = IntentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1211,13 +1376,15 @@ async def test_create_intent_async_from_dict(): def test_create_intent_field_headers(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_intent.CreateIntentRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_intent), "__call__") as call: @@ -1231,18 +1398,23 @@ def test_create_intent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_intent_field_headers_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_intent.CreateIntentRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_intent), "__call__") as call: @@ -1256,11 +1428,16 @@ async def test_create_intent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_intent_flattened(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_intent), "__call__") as call: @@ -1269,7 +1446,8 @@ def test_create_intent_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_intent( - parent="parent_value", intent=gcdc_intent.Intent(name="name_value"), + parent="parent_value", + intent=gcdc_intent.Intent(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1285,7 +1463,9 @@ def test_create_intent_flattened(): def test_create_intent_flattened_error(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1299,7 +1479,9 @@ def test_create_intent_flattened_error(): @pytest.mark.asyncio async def test_create_intent_flattened_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_intent), "__call__") as call: @@ -1310,7 +1492,8 @@ async def test_create_intent_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_intent( - parent="parent_value", intent=gcdc_intent.Intent(name="name_value"), + parent="parent_value", + intent=gcdc_intent.Intent(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1327,7 +1510,9 @@ async def test_create_intent_flattened_async(): @pytest.mark.asyncio async def test_create_intent_flattened_error_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1339,10 +1524,17 @@ async def test_create_intent_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [gcdc_intent.UpdateIntentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_intent.UpdateIntentRequest, + dict, + ], +) def test_update_intent(request_type, transport: str = "grpc"): client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1379,7 +1571,8 @@ def test_update_intent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1395,7 +1588,8 @@ async def test_update_intent_async( transport: str = "grpc_asyncio", request_type=gcdc_intent.UpdateIntentRequest ): client = IntentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1436,13 +1630,15 @@ async def test_update_intent_async_from_dict(): def test_update_intent_field_headers(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_intent.UpdateIntentRequest() - request.intent.name = "intent.name/value" + request.intent.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_intent), "__call__") as call: @@ -1456,18 +1652,23 @@ def test_update_intent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "intent.name=intent.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "intent.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_intent_field_headers_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_intent.UpdateIntentRequest() - request.intent.name = "intent.name/value" + request.intent.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_intent), "__call__") as call: @@ -1481,11 +1682,16 @@ async def test_update_intent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "intent.name=intent.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "intent.name=name_value", + ) in kw["metadata"] def test_update_intent_flattened(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_intent), "__call__") as call: @@ -1511,7 +1717,9 @@ def test_update_intent_flattened(): def test_update_intent_flattened_error(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1525,7 +1733,9 @@ def test_update_intent_flattened_error(): @pytest.mark.asyncio async def test_update_intent_flattened_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_intent), "__call__") as call: @@ -1554,7 +1764,9 @@ async def test_update_intent_flattened_async(): @pytest.mark.asyncio async def test_update_intent_flattened_error_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1566,10 +1778,17 @@ async def test_update_intent_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [intent.DeleteIntentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + intent.DeleteIntentRequest, + dict, + ], +) def test_delete_intent(request_type, transport: str = "grpc"): client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1595,7 +1814,8 @@ def test_delete_intent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1611,7 +1831,8 @@ async def test_delete_intent_async( transport: str = "grpc_asyncio", request_type=intent.DeleteIntentRequest ): client = IntentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1639,13 +1860,15 @@ async def test_delete_intent_async_from_dict(): def test_delete_intent_field_headers(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = intent.DeleteIntentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_intent), "__call__") as call: @@ -1659,18 +1882,23 @@ def test_delete_intent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_intent_field_headers_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = intent.DeleteIntentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_intent), "__call__") as call: @@ -1684,11 +1912,16 @@ async def test_delete_intent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_intent_flattened(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_intent), "__call__") as call: @@ -1696,7 +1929,9 @@ def test_delete_intent_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_intent(name="name_value",) + client.delete_intent( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1708,19 +1943,24 @@ def test_delete_intent_flattened(): def test_delete_intent_flattened_error(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_intent( - intent.DeleteIntentRequest(), name="name_value", + intent.DeleteIntentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_intent_flattened_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_intent), "__call__") as call: @@ -1730,7 +1970,9 @@ async def test_delete_intent_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_intent(name="name_value",) + response = await client.delete_intent( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1743,13 +1985,16 @@ async def test_delete_intent_flattened_async(): @pytest.mark.asyncio async def test_delete_intent_flattened_error_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_intent( - intent.DeleteIntentRequest(), name="name_value", + intent.DeleteIntentRequest(), + name="name_value", ) @@ -1760,7 +2005,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1780,7 +2026,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = IntentsClient(client_options=options, transport=transport,) + client = IntentsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1796,7 +2045,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = IntentsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1826,7 +2076,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.IntentsGrpcTransport, transports.IntentsGrpcAsyncIOTransport,], + [ + transports.IntentsGrpcTransport, + transports.IntentsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1836,10 +2089,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = IntentsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.IntentsGrpcTransport,) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.IntentsGrpcTransport, + ) def test_intents_base_transport_error(): @@ -1877,6 +2148,14 @@ def test_intents_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_intents_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1888,7 +2167,8 @@ def test_intents_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.IntentsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1929,7 +2209,10 @@ def test_intents_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.IntentsGrpcTransport, transports.IntentsGrpcAsyncIOTransport,], + [ + transports.IntentsGrpcTransport, + transports.IntentsGrpcAsyncIOTransport, + ], ) def test_intents_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2027,24 +2310,40 @@ def test_intents_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_intents_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_intents_host_no_port(transport_name): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_intents_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_intents_host_with_port(transport_name): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_intents_grpc_transport_channel(): @@ -2052,7 +2351,8 @@ def test_intents_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.IntentsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2064,7 +2364,8 @@ def test_intents_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.IntentsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2169,7 +2470,10 @@ def test_entity_type_path(): agent = "whelk" entity_type = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) actual = IntentsClient.entity_type_path(project, location, agent, entity_type) assert expected == actual @@ -2195,7 +2499,10 @@ def test_intent_path(): agent = "scallop" intent = "abalone" expected = "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) actual = IntentsClient.intent_path(project, location, agent, intent) assert expected == actual @@ -2237,7 +2544,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = IntentsClient.common_folder_path(folder) assert expected == actual @@ -2255,7 +2564,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "winkle" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = IntentsClient.common_organization_path(organization) assert expected == actual @@ -2273,7 +2584,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "scallop" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = IntentsClient.common_project_path(project) assert expected == actual @@ -2293,7 +2606,8 @@ def test_common_location_path(): project = "squid" location = "clam" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = IntentsClient.common_location_path(project, location) assert expected == actual @@ -2318,7 +2632,8 @@ def test_client_with_default_client_info(): transports.IntentsTransport, "_prep_wrapped_messages" ) as prep: client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2327,7 +2642,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = IntentsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2335,7 +2651,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = IntentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3/test_pages.py b/tests/unit/gapic/dialogflowcx_v3/test_pages.py index 0ad0b4a3..8086a804 100644 --- a/tests/unit/gapic/dialogflowcx_v3/test_pages.py +++ b/tests/unit/gapic/dialogflowcx_v3/test_pages.py @@ -83,19 +83,25 @@ def test__get_default_mtls_endpoint(): assert PagesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [PagesClient, PagesAsyncClient,]) -def test_pages_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (PagesClient, "grpc"), + (PagesAsyncClient, "grpc_asyncio"), + ], +) +def test_pages_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -121,22 +127,32 @@ def test_pages_client_service_account_always_use_jwt(transport_class, transport_ use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [PagesClient, PagesAsyncClient,]) -def test_pages_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (PagesClient, "grpc"), + (PagesAsyncClient, "grpc_asyncio"), + ], +) +def test_pages_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_pages_client_get_transport_class(): @@ -460,7 +476,9 @@ def test_pages_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -591,10 +609,17 @@ def test_pages_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [page.ListPagesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + page.ListPagesRequest, + dict, + ], +) def test_list_pages(request_type, transport: str = "grpc"): client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -623,7 +648,8 @@ def test_list_pages_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -639,7 +665,8 @@ async def test_list_pages_async( transport: str = "grpc_asyncio", request_type=page.ListPagesRequest ): client = PagesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -650,7 +677,9 @@ async def test_list_pages_async( with mock.patch.object(type(client.transport.list_pages), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - page.ListPagesResponse(next_page_token="next_page_token_value",) + page.ListPagesResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_pages(request) @@ -670,13 +699,15 @@ async def test_list_pages_async_from_dict(): def test_list_pages_field_headers(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = page.ListPagesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_pages), "__call__") as call: @@ -690,18 +721,23 @@ def test_list_pages_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_pages_field_headers_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = page.ListPagesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_pages), "__call__") as call: @@ -717,11 +753,16 @@ async def test_list_pages_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_pages_flattened(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_pages), "__call__") as call: @@ -729,7 +770,9 @@ def test_list_pages_flattened(): call.return_value = page.ListPagesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_pages(parent="parent_value",) + client.list_pages( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -741,19 +784,24 @@ def test_list_pages_flattened(): def test_list_pages_flattened_error(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_pages( - page.ListPagesRequest(), parent="parent_value", + page.ListPagesRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_pages_flattened_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_pages), "__call__") as call: @@ -765,7 +813,9 @@ async def test_list_pages_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_pages(parent="parent_value",) + response = await client.list_pages( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -778,19 +828,23 @@ async def test_list_pages_flattened_async(): @pytest.mark.asyncio async def test_list_pages_flattened_error_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_pages( - page.ListPagesRequest(), parent="parent_value", + page.ListPagesRequest(), + parent="parent_value", ) def test_list_pages_pager(transport_name: str = "grpc"): client = PagesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -798,11 +852,29 @@ def test_list_pages_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( page.ListPagesResponse( - pages=[page.Page(), page.Page(), page.Page(),], next_page_token="abc", + pages=[ + page.Page(), + page.Page(), + page.Page(), + ], + next_page_token="abc", + ), + page.ListPagesResponse( + pages=[], + next_page_token="def", + ), + page.ListPagesResponse( + pages=[ + page.Page(), + ], + next_page_token="ghi", + ), + page.ListPagesResponse( + pages=[ + page.Page(), + page.Page(), + ], ), - page.ListPagesResponse(pages=[], next_page_token="def",), - page.ListPagesResponse(pages=[page.Page(),], next_page_token="ghi",), - page.ListPagesResponse(pages=[page.Page(), page.Page(),],), RuntimeError, ) @@ -814,14 +886,15 @@ def test_list_pages_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, page.Page) for i in results) def test_list_pages_pages(transport_name: str = "grpc"): client = PagesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -829,11 +902,29 @@ def test_list_pages_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( page.ListPagesResponse( - pages=[page.Page(), page.Page(), page.Page(),], next_page_token="abc", + pages=[ + page.Page(), + page.Page(), + page.Page(), + ], + next_page_token="abc", + ), + page.ListPagesResponse( + pages=[], + next_page_token="def", + ), + page.ListPagesResponse( + pages=[ + page.Page(), + ], + next_page_token="ghi", + ), + page.ListPagesResponse( + pages=[ + page.Page(), + page.Page(), + ], ), - page.ListPagesResponse(pages=[], next_page_token="def",), - page.ListPagesResponse(pages=[page.Page(),], next_page_token="ghi",), - page.ListPagesResponse(pages=[page.Page(), page.Page(),],), RuntimeError, ) pages = list(client.list_pages(request={}).pages) @@ -843,7 +934,9 @@ def test_list_pages_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_pages_async_pager(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -852,17 +945,37 @@ async def test_list_pages_async_pager(): # Set the response to a series of pages. call.side_effect = ( page.ListPagesResponse( - pages=[page.Page(), page.Page(), page.Page(),], next_page_token="abc", + pages=[ + page.Page(), + page.Page(), + page.Page(), + ], + next_page_token="abc", + ), + page.ListPagesResponse( + pages=[], + next_page_token="def", + ), + page.ListPagesResponse( + pages=[ + page.Page(), + ], + next_page_token="ghi", + ), + page.ListPagesResponse( + pages=[ + page.Page(), + page.Page(), + ], ), - page.ListPagesResponse(pages=[], next_page_token="def",), - page.ListPagesResponse(pages=[page.Page(),], next_page_token="ghi",), - page.ListPagesResponse(pages=[page.Page(), page.Page(),],), RuntimeError, ) - async_pager = await client.list_pages(request={},) + async_pager = await client.list_pages( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -871,7 +984,9 @@ async def test_list_pages_async_pager(): @pytest.mark.asyncio async def test_list_pages_async_pages(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -880,24 +995,51 @@ async def test_list_pages_async_pages(): # Set the response to a series of pages. call.side_effect = ( page.ListPagesResponse( - pages=[page.Page(), page.Page(), page.Page(),], next_page_token="abc", + pages=[ + page.Page(), + page.Page(), + page.Page(), + ], + next_page_token="abc", + ), + page.ListPagesResponse( + pages=[], + next_page_token="def", + ), + page.ListPagesResponse( + pages=[ + page.Page(), + ], + next_page_token="ghi", + ), + page.ListPagesResponse( + pages=[ + page.Page(), + page.Page(), + ], ), - page.ListPagesResponse(pages=[], next_page_token="def",), - page.ListPagesResponse(pages=[page.Page(),], next_page_token="ghi",), - page.ListPagesResponse(pages=[page.Page(), page.Page(),],), RuntimeError, ) pages = [] - async for page_ in (await client.list_pages(request={})).pages: + async for page_ in ( + await client.list_pages(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [page.GetPageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + page.GetPageRequest, + dict, + ], +) def test_get_page(request_type, transport: str = "grpc"): client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -930,7 +1072,8 @@ def test_get_page_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -946,7 +1089,8 @@ async def test_get_page_async( transport: str = "grpc_asyncio", request_type=page.GetPageRequest ): client = PagesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -983,13 +1127,15 @@ async def test_get_page_async_from_dict(): def test_get_page_field_headers(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = page.GetPageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_page), "__call__") as call: @@ -1003,18 +1149,23 @@ def test_get_page_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_page_field_headers_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = page.GetPageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_page), "__call__") as call: @@ -1028,11 +1179,16 @@ async def test_get_page_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_page_flattened(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_page), "__call__") as call: @@ -1040,7 +1196,9 @@ def test_get_page_flattened(): call.return_value = page.Page() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_page(name="name_value",) + client.get_page( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1052,19 +1210,24 @@ def test_get_page_flattened(): def test_get_page_flattened_error(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_page( - page.GetPageRequest(), name="name_value", + page.GetPageRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_page_flattened_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_page), "__call__") as call: @@ -1074,7 +1237,9 @@ async def test_get_page_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(page.Page()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_page(name="name_value",) + response = await client.get_page( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1087,20 +1252,30 @@ async def test_get_page_flattened_async(): @pytest.mark.asyncio async def test_get_page_flattened_error_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_page( - page.GetPageRequest(), name="name_value", + page.GetPageRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [gcdc_page.CreatePageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_page.CreatePageRequest, + dict, + ], +) def test_create_page(request_type, transport: str = "grpc"): client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1133,7 +1308,8 @@ def test_create_page_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1149,7 +1325,8 @@ async def test_create_page_async( transport: str = "grpc_asyncio", request_type=gcdc_page.CreatePageRequest ): client = PagesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1186,13 +1363,15 @@ async def test_create_page_async_from_dict(): def test_create_page_field_headers(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_page.CreatePageRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_page), "__call__") as call: @@ -1206,18 +1385,23 @@ def test_create_page_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_page_field_headers_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_page.CreatePageRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_page), "__call__") as call: @@ -1231,11 +1415,16 @@ async def test_create_page_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_page_flattened(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_page), "__call__") as call: @@ -1244,7 +1433,8 @@ def test_create_page_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_page( - parent="parent_value", page=gcdc_page.Page(name="name_value"), + parent="parent_value", + page=gcdc_page.Page(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1260,7 +1450,9 @@ def test_create_page_flattened(): def test_create_page_flattened_error(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1274,7 +1466,9 @@ def test_create_page_flattened_error(): @pytest.mark.asyncio async def test_create_page_flattened_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_page), "__call__") as call: @@ -1285,7 +1479,8 @@ async def test_create_page_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_page( - parent="parent_value", page=gcdc_page.Page(name="name_value"), + parent="parent_value", + page=gcdc_page.Page(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1302,7 +1497,9 @@ async def test_create_page_flattened_async(): @pytest.mark.asyncio async def test_create_page_flattened_error_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1314,10 +1511,17 @@ async def test_create_page_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [gcdc_page.UpdatePageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_page.UpdatePageRequest, + dict, + ], +) def test_update_page(request_type, transport: str = "grpc"): client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1350,7 +1554,8 @@ def test_update_page_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1366,7 +1571,8 @@ async def test_update_page_async( transport: str = "grpc_asyncio", request_type=gcdc_page.UpdatePageRequest ): client = PagesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1403,13 +1609,15 @@ async def test_update_page_async_from_dict(): def test_update_page_field_headers(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_page.UpdatePageRequest() - request.page.name = "page.name/value" + request.page.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_page), "__call__") as call: @@ -1423,18 +1631,23 @@ def test_update_page_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "page.name=page.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "page.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_page_field_headers_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_page.UpdatePageRequest() - request.page.name = "page.name/value" + request.page.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_page), "__call__") as call: @@ -1448,11 +1661,16 @@ async def test_update_page_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "page.name=page.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "page.name=name_value", + ) in kw["metadata"] def test_update_page_flattened(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_page), "__call__") as call: @@ -1478,7 +1696,9 @@ def test_update_page_flattened(): def test_update_page_flattened_error(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1492,7 +1712,9 @@ def test_update_page_flattened_error(): @pytest.mark.asyncio async def test_update_page_flattened_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_page), "__call__") as call: @@ -1521,7 +1743,9 @@ async def test_update_page_flattened_async(): @pytest.mark.asyncio async def test_update_page_flattened_error_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1533,10 +1757,17 @@ async def test_update_page_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [page.DeletePageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + page.DeletePageRequest, + dict, + ], +) def test_delete_page(request_type, transport: str = "grpc"): client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1562,7 +1793,8 @@ def test_delete_page_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1578,7 +1810,8 @@ async def test_delete_page_async( transport: str = "grpc_asyncio", request_type=page.DeletePageRequest ): client = PagesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1606,13 +1839,15 @@ async def test_delete_page_async_from_dict(): def test_delete_page_field_headers(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = page.DeletePageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_page), "__call__") as call: @@ -1626,18 +1861,23 @@ def test_delete_page_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_page_field_headers_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = page.DeletePageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_page), "__call__") as call: @@ -1651,11 +1891,16 @@ async def test_delete_page_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_page_flattened(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_page), "__call__") as call: @@ -1663,7 +1908,9 @@ def test_delete_page_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_page(name="name_value",) + client.delete_page( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1675,19 +1922,24 @@ def test_delete_page_flattened(): def test_delete_page_flattened_error(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_page( - page.DeletePageRequest(), name="name_value", + page.DeletePageRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_page_flattened_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_page), "__call__") as call: @@ -1697,7 +1949,9 @@ async def test_delete_page_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_page(name="name_value",) + response = await client.delete_page( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1710,13 +1964,16 @@ async def test_delete_page_flattened_async(): @pytest.mark.asyncio async def test_delete_page_flattened_error_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_page( - page.DeletePageRequest(), name="name_value", + page.DeletePageRequest(), + name="name_value", ) @@ -1727,7 +1984,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1747,7 +2005,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = PagesClient(client_options=options, transport=transport,) + client = PagesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1763,7 +2024,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = PagesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1793,7 +2055,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.PagesGrpcTransport, transports.PagesGrpcAsyncIOTransport,], + [ + transports.PagesGrpcTransport, + transports.PagesGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1803,10 +2068,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = PagesClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.PagesGrpcTransport,) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.PagesGrpcTransport, + ) def test_pages_base_transport_error(): @@ -1844,6 +2127,14 @@ def test_pages_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_pages_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1855,7 +2146,8 @@ def test_pages_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.PagesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1896,7 +2188,10 @@ def test_pages_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.PagesGrpcTransport, transports.PagesGrpcAsyncIOTransport,], + [ + transports.PagesGrpcTransport, + transports.PagesGrpcAsyncIOTransport, + ], ) def test_pages_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -1994,31 +2289,50 @@ def test_pages_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_pages_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_pages_host_no_port(transport_name): client = PagesClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_pages_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_pages_host_with_port(transport_name): client = PagesClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_pages_grpc_transport_channel(): channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. - transport = transports.PagesGrpcTransport(host="squid.clam.whelk", channel=channel,) + transport = transports.PagesGrpcTransport( + host="squid.clam.whelk", + channel=channel, + ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" assert transport._ssl_channel_credentials == None @@ -2029,7 +2343,8 @@ def test_pages_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.PagesGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2134,7 +2449,10 @@ def test_entity_type_path(): agent = "whelk" entity_type = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) actual = PagesClient.entity_type_path(project, location, agent, entity_type) assert expected == actual @@ -2159,8 +2477,13 @@ def test_flow_path(): location = "nautilus" agent = "scallop" flow = "abalone" - expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + expected = ( + "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( + project=project, + location=location, + agent=agent, + flow=flow, + ) ) actual = PagesClient.flow_path(project, location, agent, flow) assert expected == actual @@ -2186,7 +2509,10 @@ def test_intent_path(): agent = "cuttlefish" intent = "mussel" expected = "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) actual = PagesClient.intent_path(project, location, agent, intent) assert expected == actual @@ -2213,7 +2539,11 @@ def test_page_path(): flow = "octopus" page = "oyster" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) actual = PagesClient.page_path(project, location, agent, flow, page) assert expected == actual @@ -2274,7 +2604,10 @@ def test_webhook_path(): agent = "scallop" webhook = "abalone" expected = "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) actual = PagesClient.webhook_path(project, location, agent, webhook) assert expected == actual @@ -2316,7 +2649,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = PagesClient.common_folder_path(folder) assert expected == actual @@ -2334,7 +2669,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "winkle" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = PagesClient.common_organization_path(organization) assert expected == actual @@ -2352,7 +2689,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "scallop" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = PagesClient.common_project_path(project) assert expected == actual @@ -2372,7 +2711,8 @@ def test_common_location_path(): project = "squid" location = "clam" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = PagesClient.common_location_path(project, location) assert expected == actual @@ -2395,14 +2735,16 @@ def test_client_with_default_client_info(): with mock.patch.object(transports.PagesTransport, "_prep_wrapped_messages") as prep: client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) with mock.patch.object(transports.PagesTransport, "_prep_wrapped_messages") as prep: transport_class = PagesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2410,7 +2752,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = PagesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3/test_security_settings_service.py b/tests/unit/gapic/dialogflowcx_v3/test_security_settings_service.py index f0328241..c8745cbb 100644 --- a/tests/unit/gapic/dialogflowcx_v3/test_security_settings_service.py +++ b/tests/unit/gapic/dialogflowcx_v3/test_security_settings_service.py @@ -94,20 +94,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [SecuritySettingsServiceClient, SecuritySettingsServiceAsyncClient,] + "client_class,transport_name", + [ + (SecuritySettingsServiceClient, "grpc"), + (SecuritySettingsServiceAsyncClient, "grpc_asyncio"), + ], ) -def test_security_settings_service_client_from_service_account_info(client_class): +def test_security_settings_service_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -136,23 +142,33 @@ def test_security_settings_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [SecuritySettingsServiceClient, SecuritySettingsServiceAsyncClient,] + "client_class,transport_name", + [ + (SecuritySettingsServiceClient, "grpc"), + (SecuritySettingsServiceAsyncClient, "grpc_asyncio"), + ], ) -def test_security_settings_service_client_from_service_account_file(client_class): +def test_security_settings_service_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_security_settings_service_client_get_transport_class(): @@ -520,7 +536,9 @@ def test_security_settings_service_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -664,11 +682,16 @@ def test_security_settings_service_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [gcdc_security_settings.CreateSecuritySettingsRequest, dict,] + "request_type", + [ + gcdc_security_settings.CreateSecuritySettingsRequest, + dict, + ], ) def test_create_security_settings(request_type, transport: str = "grpc"): client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -722,7 +745,8 @@ def test_create_security_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -741,7 +765,8 @@ async def test_create_security_settings_async( request_type=gcdc_security_settings.CreateSecuritySettingsRequest, ): client = SecuritySettingsServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -806,7 +831,7 @@ def test_create_security_settings_field_headers(): # a field header. Set these to a non-empty value. request = gcdc_security_settings.CreateSecuritySettingsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -822,7 +847,10 @@ def test_create_security_settings_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -835,7 +863,7 @@ async def test_create_security_settings_field_headers_async(): # a field header. Set these to a non-empty value. request = gcdc_security_settings.CreateSecuritySettingsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -853,7 +881,10 @@ async def test_create_security_settings_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_security_settings_flattened(): @@ -961,11 +992,16 @@ async def test_create_security_settings_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [security_settings.GetSecuritySettingsRequest, dict,] + "request_type", + [ + security_settings.GetSecuritySettingsRequest, + dict, + ], ) def test_get_security_settings(request_type, transport: str = "grpc"): client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1019,7 +1055,8 @@ def test_get_security_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1038,7 +1075,8 @@ async def test_get_security_settings_async( request_type=security_settings.GetSecuritySettingsRequest, ): client = SecuritySettingsServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1103,7 +1141,7 @@ def test_get_security_settings_field_headers(): # a field header. Set these to a non-empty value. request = security_settings.GetSecuritySettingsRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1119,7 +1157,10 @@ def test_get_security_settings_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1132,7 +1173,7 @@ async def test_get_security_settings_field_headers_async(): # a field header. Set these to a non-empty value. request = security_settings.GetSecuritySettingsRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1150,7 +1191,10 @@ async def test_get_security_settings_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_security_settings_flattened(): @@ -1166,7 +1210,9 @@ def test_get_security_settings_flattened(): call.return_value = security_settings.SecuritySettings() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_security_settings(name="name_value",) + client.get_security_settings( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1186,7 +1232,8 @@ def test_get_security_settings_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_security_settings( - security_settings.GetSecuritySettingsRequest(), name="name_value", + security_settings.GetSecuritySettingsRequest(), + name="name_value", ) @@ -1208,7 +1255,9 @@ async def test_get_security_settings_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_security_settings(name="name_value",) + response = await client.get_security_settings( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1229,16 +1278,22 @@ async def test_get_security_settings_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_security_settings( - security_settings.GetSecuritySettingsRequest(), name="name_value", + security_settings.GetSecuritySettingsRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [gcdc_security_settings.UpdateSecuritySettingsRequest, dict,] + "request_type", + [ + gcdc_security_settings.UpdateSecuritySettingsRequest, + dict, + ], ) def test_update_security_settings(request_type, transport: str = "grpc"): client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1292,7 +1347,8 @@ def test_update_security_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1311,7 +1367,8 @@ async def test_update_security_settings_async( request_type=gcdc_security_settings.UpdateSecuritySettingsRequest, ): client = SecuritySettingsServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1376,7 +1433,7 @@ def test_update_security_settings_field_headers(): # a field header. Set these to a non-empty value. request = gcdc_security_settings.UpdateSecuritySettingsRequest() - request.security_settings.name = "security_settings.name/value" + request.security_settings.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1394,7 +1451,7 @@ def test_update_security_settings_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "security_settings.name=security_settings.name/value", + "security_settings.name=name_value", ) in kw["metadata"] @@ -1408,7 +1465,7 @@ async def test_update_security_settings_field_headers_async(): # a field header. Set these to a non-empty value. request = gcdc_security_settings.UpdateSecuritySettingsRequest() - request.security_settings.name = "security_settings.name/value" + request.security_settings.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1428,7 +1485,7 @@ async def test_update_security_settings_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "security_settings.name=security_settings.name/value", + "security_settings.name=name_value", ) in kw["metadata"] @@ -1537,11 +1594,16 @@ async def test_update_security_settings_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [security_settings.ListSecuritySettingsRequest, dict,] + "request_type", + [ + security_settings.ListSecuritySettingsRequest, + dict, + ], ) def test_list_security_settings(request_type, transport: str = "grpc"): client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1572,7 +1634,8 @@ def test_list_security_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1591,7 +1654,8 @@ async def test_list_security_settings_async( request_type=security_settings.ListSecuritySettingsRequest, ): client = SecuritySettingsServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1634,7 +1698,7 @@ def test_list_security_settings_field_headers(): # a field header. Set these to a non-empty value. request = security_settings.ListSecuritySettingsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1650,7 +1714,10 @@ def test_list_security_settings_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1663,7 +1730,7 @@ async def test_list_security_settings_field_headers_async(): # a field header. Set these to a non-empty value. request = security_settings.ListSecuritySettingsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1681,7 +1748,10 @@ async def test_list_security_settings_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_security_settings_flattened(): @@ -1697,7 +1767,9 @@ def test_list_security_settings_flattened(): call.return_value = security_settings.ListSecuritySettingsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_security_settings(parent="parent_value",) + client.list_security_settings( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1717,7 +1789,8 @@ def test_list_security_settings_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_security_settings( - security_settings.ListSecuritySettingsRequest(), parent="parent_value", + security_settings.ListSecuritySettingsRequest(), + parent="parent_value", ) @@ -1739,7 +1812,9 @@ async def test_list_security_settings_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_security_settings(parent="parent_value",) + response = await client.list_security_settings( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1760,13 +1835,15 @@ async def test_list_security_settings_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_security_settings( - security_settings.ListSecuritySettingsRequest(), parent="parent_value", + security_settings.ListSecuritySettingsRequest(), + parent="parent_value", ) def test_list_security_settings_pager(transport_name: str = "grpc"): client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1784,10 +1861,13 @@ def test_list_security_settings_pager(transport_name: str = "grpc"): next_page_token="abc", ), security_settings.ListSecuritySettingsResponse( - security_settings=[], next_page_token="def", + security_settings=[], + next_page_token="def", ), security_settings.ListSecuritySettingsResponse( - security_settings=[security_settings.SecuritySettings(),], + security_settings=[ + security_settings.SecuritySettings(), + ], next_page_token="ghi", ), security_settings.ListSecuritySettingsResponse( @@ -1807,14 +1887,15 @@ def test_list_security_settings_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, security_settings.SecuritySettings) for i in results) def test_list_security_settings_pages(transport_name: str = "grpc"): client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1832,10 +1913,13 @@ def test_list_security_settings_pages(transport_name: str = "grpc"): next_page_token="abc", ), security_settings.ListSecuritySettingsResponse( - security_settings=[], next_page_token="def", + security_settings=[], + next_page_token="def", ), security_settings.ListSecuritySettingsResponse( - security_settings=[security_settings.SecuritySettings(),], + security_settings=[ + security_settings.SecuritySettings(), + ], next_page_token="ghi", ), security_settings.ListSecuritySettingsResponse( @@ -1874,10 +1958,13 @@ async def test_list_security_settings_async_pager(): next_page_token="abc", ), security_settings.ListSecuritySettingsResponse( - security_settings=[], next_page_token="def", + security_settings=[], + next_page_token="def", ), security_settings.ListSecuritySettingsResponse( - security_settings=[security_settings.SecuritySettings(),], + security_settings=[ + security_settings.SecuritySettings(), + ], next_page_token="ghi", ), security_settings.ListSecuritySettingsResponse( @@ -1888,10 +1975,12 @@ async def test_list_security_settings_async_pager(): ), RuntimeError, ) - async_pager = await client.list_security_settings(request={},) + async_pager = await client.list_security_settings( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1921,10 +2010,13 @@ async def test_list_security_settings_async_pages(): next_page_token="abc", ), security_settings.ListSecuritySettingsResponse( - security_settings=[], next_page_token="def", + security_settings=[], + next_page_token="def", ), security_settings.ListSecuritySettingsResponse( - security_settings=[security_settings.SecuritySettings(),], + security_settings=[ + security_settings.SecuritySettings(), + ], next_page_token="ghi", ), security_settings.ListSecuritySettingsResponse( @@ -1936,18 +2028,25 @@ async def test_list_security_settings_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_security_settings(request={})).pages: + async for page_ in ( + await client.list_security_settings(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [security_settings.DeleteSecuritySettingsRequest, dict,] + "request_type", + [ + security_settings.DeleteSecuritySettingsRequest, + dict, + ], ) def test_delete_security_settings(request_type, transport: str = "grpc"): client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1975,7 +2074,8 @@ def test_delete_security_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1994,7 +2094,8 @@ async def test_delete_security_settings_async( request_type=security_settings.DeleteSecuritySettingsRequest, ): client = SecuritySettingsServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2032,7 +2133,7 @@ def test_delete_security_settings_field_headers(): # a field header. Set these to a non-empty value. request = security_settings.DeleteSecuritySettingsRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2048,7 +2149,10 @@ def test_delete_security_settings_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2061,7 +2165,7 @@ async def test_delete_security_settings_field_headers_async(): # a field header. Set these to a non-empty value. request = security_settings.DeleteSecuritySettingsRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2077,7 +2181,10 @@ async def test_delete_security_settings_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_security_settings_flattened(): @@ -2093,7 +2200,9 @@ def test_delete_security_settings_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_security_settings(name="name_value",) + client.delete_security_settings( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2113,7 +2222,8 @@ def test_delete_security_settings_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_security_settings( - security_settings.DeleteSecuritySettingsRequest(), name="name_value", + security_settings.DeleteSecuritySettingsRequest(), + name="name_value", ) @@ -2133,7 +2243,9 @@ async def test_delete_security_settings_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_security_settings(name="name_value",) + response = await client.delete_security_settings( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2154,7 +2266,8 @@ async def test_delete_security_settings_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_security_settings( - security_settings.DeleteSecuritySettingsRequest(), name="name_value", + security_settings.DeleteSecuritySettingsRequest(), + name="name_value", ) @@ -2165,7 +2278,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2186,7 +2300,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = SecuritySettingsServiceClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2203,7 +2318,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SecuritySettingsServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2246,13 +2362,27 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = SecuritySettingsServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SecuritySettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( - client.transport, transports.SecuritySettingsServiceGrpcTransport, + client.transport, + transports.SecuritySettingsServiceGrpcTransport, ) @@ -2291,6 +2421,14 @@ def test_security_settings_service_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_security_settings_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2302,7 +2440,8 @@ def test_security_settings_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecuritySettingsServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2451,24 +2590,40 @@ def test_security_settings_service_grpc_transport_client_cert_source_for_mtls( ) -def test_security_settings_service_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_security_settings_service_host_no_port(transport_name): client = SecuritySettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_security_settings_service_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_security_settings_service_host_with_port(transport_name): client = SecuritySettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_security_settings_service_grpc_transport_channel(): @@ -2476,7 +2631,8 @@ def test_security_settings_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.SecuritySettingsServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2488,7 +2644,8 @@ def test_security_settings_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.SecuritySettingsServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2628,7 +2785,9 @@ def test_inspect_template_path(): location = "mussel" inspect_template = "winkle" expected = "organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}".format( - organization=organization, location=location, inspect_template=inspect_template, + organization=organization, + location=location, + inspect_template=inspect_template, ) actual = SecuritySettingsServiceClient.inspect_template_path( organization, location, inspect_template @@ -2654,7 +2813,9 @@ def test_security_settings_path(): location = "clam" security_settings = "whelk" expected = "projects/{project}/locations/{location}/securitySettings/{security_settings}".format( - project=project, location=location, security_settings=security_settings, + project=project, + location=location, + security_settings=security_settings, ) actual = SecuritySettingsServiceClient.security_settings_path( project, location, security_settings @@ -2697,7 +2858,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "winkle" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = SecuritySettingsServiceClient.common_folder_path(folder) assert expected == actual @@ -2715,7 +2878,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "scallop" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = SecuritySettingsServiceClient.common_organization_path(organization) assert expected == actual @@ -2733,7 +2898,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "squid" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = SecuritySettingsServiceClient.common_project_path(project) assert expected == actual @@ -2753,7 +2920,8 @@ def test_common_location_path(): project = "whelk" location = "octopus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = SecuritySettingsServiceClient.common_location_path(project, location) assert expected == actual @@ -2778,7 +2946,8 @@ def test_client_with_default_client_info(): transports.SecuritySettingsServiceTransport, "_prep_wrapped_messages" ) as prep: client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2787,7 +2956,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SecuritySettingsServiceClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2795,7 +2965,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SecuritySettingsServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3/test_session_entity_types.py b/tests/unit/gapic/dialogflowcx_v3/test_session_entity_types.py index dee340fd..d73fc941 100644 --- a/tests/unit/gapic/dialogflowcx_v3/test_session_entity_types.py +++ b/tests/unit/gapic/dialogflowcx_v3/test_session_entity_types.py @@ -95,20 +95,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [SessionEntityTypesClient, SessionEntityTypesAsyncClient,] + "client_class,transport_name", + [ + (SessionEntityTypesClient, "grpc"), + (SessionEntityTypesAsyncClient, "grpc_asyncio"), + ], ) -def test_session_entity_types_client_from_service_account_info(client_class): +def test_session_entity_types_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -137,23 +143,33 @@ def test_session_entity_types_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [SessionEntityTypesClient, SessionEntityTypesAsyncClient,] + "client_class,transport_name", + [ + (SessionEntityTypesClient, "grpc"), + (SessionEntityTypesAsyncClient, "grpc_asyncio"), + ], ) -def test_session_entity_types_client_from_service_account_file(client_class): +def test_session_entity_types_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_session_entity_types_client_get_transport_class(): @@ -511,7 +527,9 @@ def test_session_entity_types_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -655,11 +673,16 @@ def test_session_entity_types_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [session_entity_type.ListSessionEntityTypesRequest, dict,] + "request_type", + [ + session_entity_type.ListSessionEntityTypesRequest, + dict, + ], ) def test_list_session_entity_types(request_type, transport: str = "grpc"): client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -690,7 +713,8 @@ def test_list_session_entity_types_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -709,7 +733,8 @@ async def test_list_session_entity_types_async( request_type=session_entity_type.ListSessionEntityTypesRequest, ): client = SessionEntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -752,7 +777,7 @@ def test_list_session_entity_types_field_headers(): # a field header. Set these to a non-empty value. request = session_entity_type.ListSessionEntityTypesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -768,7 +793,10 @@ def test_list_session_entity_types_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -781,7 +809,7 @@ async def test_list_session_entity_types_field_headers_async(): # a field header. Set these to a non-empty value. request = session_entity_type.ListSessionEntityTypesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -799,7 +827,10 @@ async def test_list_session_entity_types_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_session_entity_types_flattened(): @@ -815,7 +846,9 @@ def test_list_session_entity_types_flattened(): call.return_value = session_entity_type.ListSessionEntityTypesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_session_entity_types(parent="parent_value",) + client.list_session_entity_types( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -835,7 +868,8 @@ def test_list_session_entity_types_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_session_entity_types( - session_entity_type.ListSessionEntityTypesRequest(), parent="parent_value", + session_entity_type.ListSessionEntityTypesRequest(), + parent="parent_value", ) @@ -857,7 +891,9 @@ async def test_list_session_entity_types_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_session_entity_types(parent="parent_value",) + response = await client.list_session_entity_types( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -878,13 +914,15 @@ async def test_list_session_entity_types_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_session_entity_types( - session_entity_type.ListSessionEntityTypesRequest(), parent="parent_value", + session_entity_type.ListSessionEntityTypesRequest(), + parent="parent_value", ) def test_list_session_entity_types_pager(transport_name: str = "grpc"): client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -902,10 +940,13 @@ def test_list_session_entity_types_pager(transport_name: str = "grpc"): next_page_token="abc", ), session_entity_type.ListSessionEntityTypesResponse( - session_entity_types=[], next_page_token="def", + session_entity_types=[], + next_page_token="def", ), session_entity_type.ListSessionEntityTypesResponse( - session_entity_types=[session_entity_type.SessionEntityType(),], + session_entity_types=[ + session_entity_type.SessionEntityType(), + ], next_page_token="ghi", ), session_entity_type.ListSessionEntityTypesResponse( @@ -925,7 +966,7 @@ def test_list_session_entity_types_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all( isinstance(i, session_entity_type.SessionEntityType) for i in results @@ -934,7 +975,8 @@ def test_list_session_entity_types_pager(transport_name: str = "grpc"): def test_list_session_entity_types_pages(transport_name: str = "grpc"): client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -952,10 +994,13 @@ def test_list_session_entity_types_pages(transport_name: str = "grpc"): next_page_token="abc", ), session_entity_type.ListSessionEntityTypesResponse( - session_entity_types=[], next_page_token="def", + session_entity_types=[], + next_page_token="def", ), session_entity_type.ListSessionEntityTypesResponse( - session_entity_types=[session_entity_type.SessionEntityType(),], + session_entity_types=[ + session_entity_type.SessionEntityType(), + ], next_page_token="ghi", ), session_entity_type.ListSessionEntityTypesResponse( @@ -994,10 +1039,13 @@ async def test_list_session_entity_types_async_pager(): next_page_token="abc", ), session_entity_type.ListSessionEntityTypesResponse( - session_entity_types=[], next_page_token="def", + session_entity_types=[], + next_page_token="def", ), session_entity_type.ListSessionEntityTypesResponse( - session_entity_types=[session_entity_type.SessionEntityType(),], + session_entity_types=[ + session_entity_type.SessionEntityType(), + ], next_page_token="ghi", ), session_entity_type.ListSessionEntityTypesResponse( @@ -1008,10 +1056,12 @@ async def test_list_session_entity_types_async_pager(): ), RuntimeError, ) - async_pager = await client.list_session_entity_types(request={},) + async_pager = await client.list_session_entity_types( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1043,10 +1093,13 @@ async def test_list_session_entity_types_async_pages(): next_page_token="abc", ), session_entity_type.ListSessionEntityTypesResponse( - session_entity_types=[], next_page_token="def", + session_entity_types=[], + next_page_token="def", ), session_entity_type.ListSessionEntityTypesResponse( - session_entity_types=[session_entity_type.SessionEntityType(),], + session_entity_types=[ + session_entity_type.SessionEntityType(), + ], next_page_token="ghi", ), session_entity_type.ListSessionEntityTypesResponse( @@ -1058,18 +1111,25 @@ async def test_list_session_entity_types_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_session_entity_types(request={})).pages: + async for page_ in ( + await client.list_session_entity_types(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [session_entity_type.GetSessionEntityTypeRequest, dict,] + "request_type", + [ + session_entity_type.GetSessionEntityTypeRequest, + dict, + ], ) def test_get_session_entity_type(request_type, transport: str = "grpc"): client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1105,7 +1165,8 @@ def test_get_session_entity_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1124,7 +1185,8 @@ async def test_get_session_entity_type_async( request_type=session_entity_type.GetSessionEntityTypeRequest, ): client = SessionEntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1172,7 +1234,7 @@ def test_get_session_entity_type_field_headers(): # a field header. Set these to a non-empty value. request = session_entity_type.GetSessionEntityTypeRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1188,7 +1250,10 @@ def test_get_session_entity_type_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1201,7 +1266,7 @@ async def test_get_session_entity_type_field_headers_async(): # a field header. Set these to a non-empty value. request = session_entity_type.GetSessionEntityTypeRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1219,7 +1284,10 @@ async def test_get_session_entity_type_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_session_entity_type_flattened(): @@ -1235,7 +1303,9 @@ def test_get_session_entity_type_flattened(): call.return_value = session_entity_type.SessionEntityType() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_session_entity_type(name="name_value",) + client.get_session_entity_type( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1255,7 +1325,8 @@ def test_get_session_entity_type_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_session_entity_type( - session_entity_type.GetSessionEntityTypeRequest(), name="name_value", + session_entity_type.GetSessionEntityTypeRequest(), + name="name_value", ) @@ -1277,7 +1348,9 @@ async def test_get_session_entity_type_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_session_entity_type(name="name_value",) + response = await client.get_session_entity_type( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1298,16 +1371,22 @@ async def test_get_session_entity_type_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_session_entity_type( - session_entity_type.GetSessionEntityTypeRequest(), name="name_value", + session_entity_type.GetSessionEntityTypeRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [gcdc_session_entity_type.CreateSessionEntityTypeRequest, dict,] + "request_type", + [ + gcdc_session_entity_type.CreateSessionEntityTypeRequest, + dict, + ], ) def test_create_session_entity_type(request_type, transport: str = "grpc"): client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1343,7 +1422,8 @@ def test_create_session_entity_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1362,7 +1442,8 @@ async def test_create_session_entity_type_async( request_type=gcdc_session_entity_type.CreateSessionEntityTypeRequest, ): client = SessionEntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1410,7 +1491,7 @@ def test_create_session_entity_type_field_headers(): # a field header. Set these to a non-empty value. request = gcdc_session_entity_type.CreateSessionEntityTypeRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1426,7 +1507,10 @@ def test_create_session_entity_type_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1439,7 +1523,7 @@ async def test_create_session_entity_type_field_headers_async(): # a field header. Set these to a non-empty value. request = gcdc_session_entity_type.CreateSessionEntityTypeRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1457,7 +1541,10 @@ async def test_create_session_entity_type_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_session_entity_type_flattened(): @@ -1565,11 +1652,16 @@ async def test_create_session_entity_type_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [gcdc_session_entity_type.UpdateSessionEntityTypeRequest, dict,] + "request_type", + [ + gcdc_session_entity_type.UpdateSessionEntityTypeRequest, + dict, + ], ) def test_update_session_entity_type(request_type, transport: str = "grpc"): client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1605,7 +1697,8 @@ def test_update_session_entity_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1624,7 +1717,8 @@ async def test_update_session_entity_type_async( request_type=gcdc_session_entity_type.UpdateSessionEntityTypeRequest, ): client = SessionEntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1672,7 +1766,7 @@ def test_update_session_entity_type_field_headers(): # a field header. Set these to a non-empty value. request = gcdc_session_entity_type.UpdateSessionEntityTypeRequest() - request.session_entity_type.name = "session_entity_type.name/value" + request.session_entity_type.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1690,7 +1784,7 @@ def test_update_session_entity_type_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "session_entity_type.name=session_entity_type.name/value", + "session_entity_type.name=name_value", ) in kw["metadata"] @@ -1704,7 +1798,7 @@ async def test_update_session_entity_type_field_headers_async(): # a field header. Set these to a non-empty value. request = gcdc_session_entity_type.UpdateSessionEntityTypeRequest() - request.session_entity_type.name = "session_entity_type.name/value" + request.session_entity_type.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1724,7 +1818,7 @@ async def test_update_session_entity_type_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "session_entity_type.name=session_entity_type.name/value", + "session_entity_type.name=name_value", ) in kw["metadata"] @@ -1833,11 +1927,16 @@ async def test_update_session_entity_type_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [session_entity_type.DeleteSessionEntityTypeRequest, dict,] + "request_type", + [ + session_entity_type.DeleteSessionEntityTypeRequest, + dict, + ], ) def test_delete_session_entity_type(request_type, transport: str = "grpc"): client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1865,7 +1964,8 @@ def test_delete_session_entity_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1884,7 +1984,8 @@ async def test_delete_session_entity_type_async( request_type=session_entity_type.DeleteSessionEntityTypeRequest, ): client = SessionEntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1922,7 +2023,7 @@ def test_delete_session_entity_type_field_headers(): # a field header. Set these to a non-empty value. request = session_entity_type.DeleteSessionEntityTypeRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1938,7 +2039,10 @@ def test_delete_session_entity_type_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1951,7 +2055,7 @@ async def test_delete_session_entity_type_field_headers_async(): # a field header. Set these to a non-empty value. request = session_entity_type.DeleteSessionEntityTypeRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1967,7 +2071,10 @@ async def test_delete_session_entity_type_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_session_entity_type_flattened(): @@ -1983,7 +2090,9 @@ def test_delete_session_entity_type_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_session_entity_type(name="name_value",) + client.delete_session_entity_type( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2003,7 +2112,8 @@ def test_delete_session_entity_type_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_session_entity_type( - session_entity_type.DeleteSessionEntityTypeRequest(), name="name_value", + session_entity_type.DeleteSessionEntityTypeRequest(), + name="name_value", ) @@ -2023,7 +2133,9 @@ async def test_delete_session_entity_type_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_session_entity_type(name="name_value",) + response = await client.delete_session_entity_type( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2044,7 +2156,8 @@ async def test_delete_session_entity_type_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_session_entity_type( - session_entity_type.DeleteSessionEntityTypeRequest(), name="name_value", + session_entity_type.DeleteSessionEntityTypeRequest(), + name="name_value", ) @@ -2055,7 +2168,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2075,7 +2189,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = SessionEntityTypesClient(client_options=options, transport=transport,) + client = SessionEntityTypesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2091,7 +2208,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SessionEntityTypesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2134,12 +2252,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = SessionEntityTypesClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), ) - assert isinstance(client.transport, transports.SessionEntityTypesGrpcTransport,) + assert isinstance( + client.transport, + transports.SessionEntityTypesGrpcTransport, + ) def test_session_entity_types_base_transport_error(): @@ -2177,6 +2311,14 @@ def test_session_entity_types_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_session_entity_types_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2188,7 +2330,8 @@ def test_session_entity_types_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SessionEntityTypesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2335,24 +2478,40 @@ def test_session_entity_types_grpc_transport_client_cert_source_for_mtls( ) -def test_session_entity_types_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_session_entity_types_host_no_port(transport_name): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_session_entity_types_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_session_entity_types_host_with_port(transport_name): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_session_entity_types_grpc_transport_channel(): @@ -2360,7 +2519,8 @@ def test_session_entity_types_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.SessionEntityTypesGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2372,7 +2532,8 @@ def test_session_entity_types_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.SessionEntityTypesGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2535,7 +2696,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "squid" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = SessionEntityTypesClient.common_folder_path(folder) assert expected == actual @@ -2553,7 +2716,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "whelk" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = SessionEntityTypesClient.common_organization_path(organization) assert expected == actual @@ -2571,7 +2736,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "oyster" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = SessionEntityTypesClient.common_project_path(project) assert expected == actual @@ -2591,7 +2758,8 @@ def test_common_location_path(): project = "cuttlefish" location = "mussel" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = SessionEntityTypesClient.common_location_path(project, location) assert expected == actual @@ -2616,7 +2784,8 @@ def test_client_with_default_client_info(): transports.SessionEntityTypesTransport, "_prep_wrapped_messages" ) as prep: client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2625,7 +2794,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SessionEntityTypesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2633,7 +2803,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SessionEntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3/test_sessions.py b/tests/unit/gapic/dialogflowcx_v3/test_sessions.py index 7cd204e5..30b7fde9 100644 --- a/tests/unit/gapic/dialogflowcx_v3/test_sessions.py +++ b/tests/unit/gapic/dialogflowcx_v3/test_sessions.py @@ -85,19 +85,25 @@ def test__get_default_mtls_endpoint(): assert SessionsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [SessionsClient, SessionsAsyncClient,]) -def test_sessions_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (SessionsClient, "grpc"), + (SessionsAsyncClient, "grpc_asyncio"), + ], +) +def test_sessions_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -125,22 +131,32 @@ def test_sessions_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [SessionsClient, SessionsAsyncClient,]) -def test_sessions_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (SessionsClient, "grpc"), + (SessionsAsyncClient, "grpc_asyncio"), + ], +) +def test_sessions_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_sessions_client_get_transport_class(): @@ -470,7 +486,9 @@ def test_sessions_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -601,10 +619,17 @@ def test_sessions_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [session.DetectIntentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + session.DetectIntentRequest, + dict, + ], +) def test_detect_intent(request_type, transport: str = "grpc"): client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -639,7 +664,8 @@ def test_detect_intent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -655,7 +681,8 @@ async def test_detect_intent_async( transport: str = "grpc_asyncio", request_type=session.DetectIntentRequest ): client = SessionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -694,13 +721,15 @@ async def test_detect_intent_async_from_dict(): def test_detect_intent_field_headers(): - client = SessionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = SessionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = session.DetectIntentRequest() - request.session = "session/value" + request.session = "session_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.detect_intent), "__call__") as call: @@ -714,18 +743,23 @@ def test_detect_intent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "session=session/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "session=session_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_detect_intent_field_headers_async(): - client = SessionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = SessionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = session.DetectIntentRequest() - request.session = "session/value" + request.session = "session_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.detect_intent), "__call__") as call: @@ -741,13 +775,23 @@ async def test_detect_intent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "session=session/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "session=session_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [session.StreamingDetectIntentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + session.StreamingDetectIntentRequest, + dict, + ], +) def test_streaming_detect_intent(request_type, transport: str = "grpc"): client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -778,7 +822,8 @@ async def test_streaming_detect_intent_async( transport: str = "grpc_asyncio", request_type=session.StreamingDetectIntentRequest ): client = SessionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -812,10 +857,17 @@ async def test_streaming_detect_intent_async_from_dict(): await test_streaming_detect_intent_async(request_type=dict) -@pytest.mark.parametrize("request_type", [session.MatchIntentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + session.MatchIntentRequest, + dict, + ], +) def test_match_intent(request_type, transport: str = "grpc"): client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -825,7 +877,9 @@ def test_match_intent(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.match_intent), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = session.MatchIntentResponse(text="text_value",) + call.return_value = session.MatchIntentResponse( + text="text_value", + ) response = client.match_intent(request) # Establish that the underlying gRPC stub method was called. @@ -841,7 +895,8 @@ def test_match_intent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -857,7 +912,8 @@ async def test_match_intent_async( transport: str = "grpc_asyncio", request_type=session.MatchIntentRequest ): client = SessionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -887,13 +943,15 @@ async def test_match_intent_async_from_dict(): def test_match_intent_field_headers(): - client = SessionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = SessionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = session.MatchIntentRequest() - request.session = "session/value" + request.session = "session_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.match_intent), "__call__") as call: @@ -907,18 +965,23 @@ def test_match_intent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "session=session/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "session=session_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_match_intent_field_headers_async(): - client = SessionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = SessionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = session.MatchIntentRequest() - request.session = "session/value" + request.session = "session_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.match_intent), "__call__") as call: @@ -934,13 +997,23 @@ async def test_match_intent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "session=session/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "session=session_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [session.FulfillIntentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + session.FulfillIntentRequest, + dict, + ], +) def test_fulfill_intent(request_type, transport: str = "grpc"): client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -951,7 +1024,8 @@ def test_fulfill_intent(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.fulfill_intent), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = session.FulfillIntentResponse( - response_id="response_id_value", output_audio=b"output_audio_blob", + response_id="response_id_value", + output_audio=b"output_audio_blob", ) response = client.fulfill_intent(request) @@ -970,7 +1044,8 @@ def test_fulfill_intent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -986,7 +1061,8 @@ async def test_fulfill_intent_async( transport: str = "grpc_asyncio", request_type=session.FulfillIntentRequest ): client = SessionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -998,7 +1074,8 @@ async def test_fulfill_intent_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( session.FulfillIntentResponse( - response_id="response_id_value", output_audio=b"output_audio_blob", + response_id="response_id_value", + output_audio=b"output_audio_blob", ) ) response = await client.fulfill_intent(request) @@ -1020,13 +1097,15 @@ async def test_fulfill_intent_async_from_dict(): def test_fulfill_intent_field_headers(): - client = SessionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = SessionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = session.FulfillIntentRequest() - request.match_intent_request.session = "match_intent_request.session/value" + request.match_intent_request.session = "session_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.fulfill_intent), "__call__") as call: @@ -1042,19 +1121,21 @@ def test_fulfill_intent_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "match_intent_request.session=match_intent_request.session/value", + "match_intent_request.session=session_value", ) in kw["metadata"] @pytest.mark.asyncio async def test_fulfill_intent_field_headers_async(): - client = SessionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = SessionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = session.FulfillIntentRequest() - request.match_intent_request.session = "match_intent_request.session/value" + request.match_intent_request.session = "session_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.fulfill_intent), "__call__") as call: @@ -1072,7 +1153,7 @@ async def test_fulfill_intent_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "match_intent_request.session=match_intent_request.session/value", + "match_intent_request.session=session_value", ) in kw["metadata"] @@ -1083,7 +1164,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1103,7 +1185,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = SessionsClient(client_options=options, transport=transport,) + client = SessionsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1119,7 +1204,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SessionsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1149,7 +1235,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.SessionsGrpcTransport, transports.SessionsGrpcAsyncIOTransport,], + [ + transports.SessionsGrpcTransport, + transports.SessionsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1159,10 +1248,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = SessionsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = SessionsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.SessionsGrpcTransport,) + client = SessionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.SessionsGrpcTransport, + ) def test_sessions_base_transport_error(): @@ -1199,6 +1306,14 @@ def test_sessions_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_sessions_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1210,7 +1325,8 @@ def test_sessions_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SessionsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1251,7 +1367,10 @@ def test_sessions_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.SessionsGrpcTransport, transports.SessionsGrpcAsyncIOTransport,], + [ + transports.SessionsGrpcTransport, + transports.SessionsGrpcAsyncIOTransport, + ], ) def test_sessions_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -1349,24 +1468,40 @@ def test_sessions_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_sessions_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_sessions_host_no_port(transport_name): client = SessionsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_sessions_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_sessions_host_with_port(transport_name): client = SessionsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_sessions_grpc_transport_channel(): @@ -1374,7 +1509,8 @@ def test_sessions_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.SessionsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1386,7 +1522,8 @@ def test_sessions_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.SessionsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1491,7 +1628,10 @@ def test_entity_type_path(): agent = "whelk" entity_type = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) actual = SessionsClient.entity_type_path(project, location, agent, entity_type) assert expected == actual @@ -1516,8 +1656,13 @@ def test_flow_path(): location = "nautilus" agent = "scallop" flow = "abalone" - expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + expected = ( + "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( + project=project, + location=location, + agent=agent, + flow=flow, + ) ) actual = SessionsClient.flow_path(project, location, agent, flow) assert expected == actual @@ -1543,7 +1688,10 @@ def test_intent_path(): agent = "cuttlefish" intent = "mussel" expected = "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) actual = SessionsClient.intent_path(project, location, agent, intent) assert expected == actual @@ -1570,7 +1718,11 @@ def test_page_path(): flow = "octopus" page = "oyster" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) actual = SessionsClient.page_path(project, location, agent, flow, page) assert expected == actual @@ -1597,7 +1749,10 @@ def test_session_path(): agent = "squid" session = "clam" expected = "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}".format( - project=project, location=location, agent=agent, session=session, + project=project, + location=location, + agent=agent, + session=session, ) actual = SessionsClient.session_path(project, location, agent, session) assert expected == actual @@ -1692,7 +1847,11 @@ def test_version_path(): flow = "nudibranch" version = "cuttlefish" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) actual = SessionsClient.version_path(project, location, agent, flow, version) assert expected == actual @@ -1719,7 +1878,10 @@ def test_webhook_path(): agent = "whelk" webhook = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) actual = SessionsClient.webhook_path(project, location, agent, webhook) assert expected == actual @@ -1761,7 +1923,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = SessionsClient.common_folder_path(folder) assert expected == actual @@ -1779,7 +1943,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = SessionsClient.common_organization_path(organization) assert expected == actual @@ -1797,7 +1963,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = SessionsClient.common_project_path(project) assert expected == actual @@ -1817,7 +1985,8 @@ def test_common_location_path(): project = "oyster" location = "nudibranch" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = SessionsClient.common_location_path(project, location) assert expected == actual @@ -1842,7 +2011,8 @@ def test_client_with_default_client_info(): transports.SessionsTransport, "_prep_wrapped_messages" ) as prep: client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1851,7 +2021,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SessionsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1859,7 +2030,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SessionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3/test_test_cases.py b/tests/unit/gapic/dialogflowcx_v3/test_test_cases.py index 701db3d4..8b897c0b 100644 --- a/tests/unit/gapic/dialogflowcx_v3/test_test_cases.py +++ b/tests/unit/gapic/dialogflowcx_v3/test_test_cases.py @@ -96,19 +96,25 @@ def test__get_default_mtls_endpoint(): assert TestCasesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [TestCasesClient, TestCasesAsyncClient,]) -def test_test_cases_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (TestCasesClient, "grpc"), + (TestCasesAsyncClient, "grpc_asyncio"), + ], +) +def test_test_cases_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -136,22 +142,32 @@ def test_test_cases_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [TestCasesClient, TestCasesAsyncClient,]) -def test_test_cases_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (TestCasesClient, "grpc"), + (TestCasesAsyncClient, "grpc_asyncio"), + ], +) +def test_test_cases_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_test_cases_client_get_transport_class(): @@ -491,7 +507,9 @@ def test_test_cases_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -622,10 +640,17 @@ def test_test_cases_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [test_case.ListTestCasesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.ListTestCasesRequest, + dict, + ], +) def test_list_test_cases(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -654,7 +679,8 @@ def test_list_test_cases_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -670,7 +696,8 @@ async def test_list_test_cases_async( transport: str = "grpc_asyncio", request_type=test_case.ListTestCasesRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -681,7 +708,9 @@ async def test_list_test_cases_async( with mock.patch.object(type(client.transport.list_test_cases), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - test_case.ListTestCasesResponse(next_page_token="next_page_token_value",) + test_case.ListTestCasesResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_test_cases(request) @@ -701,13 +730,15 @@ async def test_list_test_cases_async_from_dict(): def test_list_test_cases_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.ListTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_test_cases), "__call__") as call: @@ -721,18 +752,23 @@ def test_list_test_cases_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_test_cases_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.ListTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_test_cases), "__call__") as call: @@ -748,11 +784,16 @@ async def test_list_test_cases_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_test_cases_flattened(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_test_cases), "__call__") as call: @@ -760,7 +801,9 @@ def test_list_test_cases_flattened(): call.return_value = test_case.ListTestCasesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_test_cases(parent="parent_value",) + client.list_test_cases( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -772,19 +815,24 @@ def test_list_test_cases_flattened(): def test_list_test_cases_flattened_error(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_test_cases( - test_case.ListTestCasesRequest(), parent="parent_value", + test_case.ListTestCasesRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_test_cases_flattened_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_test_cases), "__call__") as call: @@ -796,7 +844,9 @@ async def test_list_test_cases_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_test_cases(parent="parent_value",) + response = await client.list_test_cases( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -809,19 +859,23 @@ async def test_list_test_cases_flattened_async(): @pytest.mark.asyncio async def test_list_test_cases_flattened_error_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_test_cases( - test_case.ListTestCasesRequest(), parent="parent_value", + test_case.ListTestCasesRequest(), + parent="parent_value", ) def test_list_test_cases_pager(transport_name: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -836,12 +890,21 @@ def test_list_test_cases_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - test_case.ListTestCasesResponse(test_cases=[], next_page_token="def",), test_case.ListTestCasesResponse( - test_cases=[test_case.TestCase(),], next_page_token="ghi", + test_cases=[], + next_page_token="def", + ), + test_case.ListTestCasesResponse( + test_cases=[ + test_case.TestCase(), + ], + next_page_token="ghi", ), test_case.ListTestCasesResponse( - test_cases=[test_case.TestCase(), test_case.TestCase(),], + test_cases=[ + test_case.TestCase(), + test_case.TestCase(), + ], ), RuntimeError, ) @@ -854,14 +917,15 @@ def test_list_test_cases_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, test_case.TestCase) for i in results) def test_list_test_cases_pages(transport_name: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -876,12 +940,21 @@ def test_list_test_cases_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - test_case.ListTestCasesResponse(test_cases=[], next_page_token="def",), test_case.ListTestCasesResponse( - test_cases=[test_case.TestCase(),], next_page_token="ghi", + test_cases=[], + next_page_token="def", ), test_case.ListTestCasesResponse( - test_cases=[test_case.TestCase(), test_case.TestCase(),], + test_cases=[ + test_case.TestCase(), + ], + next_page_token="ghi", + ), + test_case.ListTestCasesResponse( + test_cases=[ + test_case.TestCase(), + test_case.TestCase(), + ], ), RuntimeError, ) @@ -892,7 +965,9 @@ def test_list_test_cases_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_test_cases_async_pager(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -908,19 +983,30 @@ async def test_list_test_cases_async_pager(): ], next_page_token="abc", ), - test_case.ListTestCasesResponse(test_cases=[], next_page_token="def",), test_case.ListTestCasesResponse( - test_cases=[test_case.TestCase(),], next_page_token="ghi", + test_cases=[], + next_page_token="def", ), test_case.ListTestCasesResponse( - test_cases=[test_case.TestCase(), test_case.TestCase(),], + test_cases=[ + test_case.TestCase(), + ], + next_page_token="ghi", + ), + test_case.ListTestCasesResponse( + test_cases=[ + test_case.TestCase(), + test_case.TestCase(), + ], ), RuntimeError, ) - async_pager = await client.list_test_cases(request={},) + async_pager = await client.list_test_cases( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -929,7 +1015,9 @@ async def test_list_test_cases_async_pager(): @pytest.mark.asyncio async def test_list_test_cases_async_pages(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -945,26 +1033,44 @@ async def test_list_test_cases_async_pages(): ], next_page_token="abc", ), - test_case.ListTestCasesResponse(test_cases=[], next_page_token="def",), test_case.ListTestCasesResponse( - test_cases=[test_case.TestCase(),], next_page_token="ghi", + test_cases=[], + next_page_token="def", ), test_case.ListTestCasesResponse( - test_cases=[test_case.TestCase(), test_case.TestCase(),], + test_cases=[ + test_case.TestCase(), + ], + next_page_token="ghi", + ), + test_case.ListTestCasesResponse( + test_cases=[ + test_case.TestCase(), + test_case.TestCase(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_test_cases(request={})).pages: + async for page_ in ( + await client.list_test_cases(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [test_case.BatchDeleteTestCasesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.BatchDeleteTestCasesRequest, + dict, + ], +) def test_batch_delete_test_cases(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -992,7 +1098,8 @@ def test_batch_delete_test_cases_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1010,7 +1117,8 @@ async def test_batch_delete_test_cases_async( transport: str = "grpc_asyncio", request_type=test_case.BatchDeleteTestCasesRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1040,13 +1148,15 @@ async def test_batch_delete_test_cases_async_from_dict(): def test_batch_delete_test_cases_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.BatchDeleteTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1062,18 +1172,23 @@ def test_batch_delete_test_cases_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_batch_delete_test_cases_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.BatchDeleteTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1089,11 +1204,16 @@ async def test_batch_delete_test_cases_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_batch_delete_test_cases_flattened(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1103,7 +1223,9 @@ def test_batch_delete_test_cases_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.batch_delete_test_cases(parent="parent_value",) + client.batch_delete_test_cases( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1115,19 +1237,24 @@ def test_batch_delete_test_cases_flattened(): def test_batch_delete_test_cases_flattened_error(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.batch_delete_test_cases( - test_case.BatchDeleteTestCasesRequest(), parent="parent_value", + test_case.BatchDeleteTestCasesRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_batch_delete_test_cases_flattened_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1139,7 +1266,9 @@ async def test_batch_delete_test_cases_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.batch_delete_test_cases(parent="parent_value",) + response = await client.batch_delete_test_cases( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1152,20 +1281,30 @@ async def test_batch_delete_test_cases_flattened_async(): @pytest.mark.asyncio async def test_batch_delete_test_cases_flattened_error_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.batch_delete_test_cases( - test_case.BatchDeleteTestCasesRequest(), parent="parent_value", + test_case.BatchDeleteTestCasesRequest(), + parent="parent_value", ) -@pytest.mark.parametrize("request_type", [test_case.GetTestCaseRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.GetTestCaseRequest, + dict, + ], +) def test_get_test_case(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1200,7 +1339,8 @@ def test_get_test_case_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1216,7 +1356,8 @@ async def test_get_test_case_async( transport: str = "grpc_asyncio", request_type=test_case.GetTestCaseRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1255,13 +1396,15 @@ async def test_get_test_case_async_from_dict(): def test_get_test_case_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.GetTestCaseRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_test_case), "__call__") as call: @@ -1275,18 +1418,23 @@ def test_get_test_case_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_test_case_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.GetTestCaseRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_test_case), "__call__") as call: @@ -1300,11 +1448,16 @@ async def test_get_test_case_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_test_case_flattened(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_test_case), "__call__") as call: @@ -1312,7 +1465,9 @@ def test_get_test_case_flattened(): call.return_value = test_case.TestCase() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_test_case(name="name_value",) + client.get_test_case( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1324,19 +1479,24 @@ def test_get_test_case_flattened(): def test_get_test_case_flattened_error(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_test_case( - test_case.GetTestCaseRequest(), name="name_value", + test_case.GetTestCaseRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_test_case_flattened_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_test_case), "__call__") as call: @@ -1346,7 +1506,9 @@ async def test_get_test_case_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(test_case.TestCase()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_test_case(name="name_value",) + response = await client.get_test_case( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1359,20 +1521,30 @@ async def test_get_test_case_flattened_async(): @pytest.mark.asyncio async def test_get_test_case_flattened_error_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_test_case( - test_case.GetTestCaseRequest(), name="name_value", + test_case.GetTestCaseRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [gcdc_test_case.CreateTestCaseRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_test_case.CreateTestCaseRequest, + dict, + ], +) def test_create_test_case(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1407,7 +1579,8 @@ def test_create_test_case_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1423,7 +1596,8 @@ async def test_create_test_case_async( transport: str = "grpc_asyncio", request_type=gcdc_test_case.CreateTestCaseRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1462,13 +1636,15 @@ async def test_create_test_case_async_from_dict(): def test_create_test_case_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_test_case.CreateTestCaseRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_test_case), "__call__") as call: @@ -1482,18 +1658,23 @@ def test_create_test_case_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_test_case_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_test_case.CreateTestCaseRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_test_case), "__call__") as call: @@ -1509,11 +1690,16 @@ async def test_create_test_case_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_test_case_flattened(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_test_case), "__call__") as call: @@ -1522,7 +1708,8 @@ def test_create_test_case_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_test_case( - parent="parent_value", test_case=gcdc_test_case.TestCase(name="name_value"), + parent="parent_value", + test_case=gcdc_test_case.TestCase(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1538,7 +1725,9 @@ def test_create_test_case_flattened(): def test_create_test_case_flattened_error(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1552,7 +1741,9 @@ def test_create_test_case_flattened_error(): @pytest.mark.asyncio async def test_create_test_case_flattened_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_test_case), "__call__") as call: @@ -1565,7 +1756,8 @@ async def test_create_test_case_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_test_case( - parent="parent_value", test_case=gcdc_test_case.TestCase(name="name_value"), + parent="parent_value", + test_case=gcdc_test_case.TestCase(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1582,7 +1774,9 @@ async def test_create_test_case_flattened_async(): @pytest.mark.asyncio async def test_create_test_case_flattened_error_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1594,10 +1788,17 @@ async def test_create_test_case_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [gcdc_test_case.UpdateTestCaseRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_test_case.UpdateTestCaseRequest, + dict, + ], +) def test_update_test_case(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1632,7 +1833,8 @@ def test_update_test_case_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1648,7 +1850,8 @@ async def test_update_test_case_async( transport: str = "grpc_asyncio", request_type=gcdc_test_case.UpdateTestCaseRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1687,13 +1890,15 @@ async def test_update_test_case_async_from_dict(): def test_update_test_case_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_test_case.UpdateTestCaseRequest() - request.test_case.name = "test_case.name/value" + request.test_case.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_test_case), "__call__") as call: @@ -1707,20 +1912,23 @@ def test_update_test_case_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "test_case.name=test_case.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "test_case.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_test_case_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_test_case.UpdateTestCaseRequest() - request.test_case.name = "test_case.name/value" + request.test_case.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_test_case), "__call__") as call: @@ -1736,13 +1944,16 @@ async def test_update_test_case_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "test_case.name=test_case.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "test_case.name=name_value", + ) in kw["metadata"] def test_update_test_case_flattened(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_test_case), "__call__") as call: @@ -1768,7 +1979,9 @@ def test_update_test_case_flattened(): def test_update_test_case_flattened_error(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1782,7 +1995,9 @@ def test_update_test_case_flattened_error(): @pytest.mark.asyncio async def test_update_test_case_flattened_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_test_case), "__call__") as call: @@ -1813,7 +2028,9 @@ async def test_update_test_case_flattened_async(): @pytest.mark.asyncio async def test_update_test_case_flattened_error_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1825,10 +2042,17 @@ async def test_update_test_case_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [test_case.RunTestCaseRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.RunTestCaseRequest, + dict, + ], +) def test_run_test_case(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1854,7 +2078,8 @@ def test_run_test_case_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1870,7 +2095,8 @@ async def test_run_test_case_async( transport: str = "grpc_asyncio", request_type=test_case.RunTestCaseRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1900,13 +2126,15 @@ async def test_run_test_case_async_from_dict(): def test_run_test_case_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.RunTestCaseRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.run_test_case), "__call__") as call: @@ -1920,18 +2148,23 @@ def test_run_test_case_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_run_test_case_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.RunTestCaseRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.run_test_case), "__call__") as call: @@ -1947,13 +2180,23 @@ async def test_run_test_case_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [test_case.BatchRunTestCasesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.BatchRunTestCasesRequest, + dict, + ], +) def test_batch_run_test_cases(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1981,7 +2224,8 @@ def test_batch_run_test_cases_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1999,7 +2243,8 @@ async def test_batch_run_test_cases_async( transport: str = "grpc_asyncio", request_type=test_case.BatchRunTestCasesRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2031,13 +2276,15 @@ async def test_batch_run_test_cases_async_from_dict(): def test_batch_run_test_cases_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.BatchRunTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2053,18 +2300,23 @@ def test_batch_run_test_cases_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_batch_run_test_cases_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.BatchRunTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2082,13 +2334,23 @@ async def test_batch_run_test_cases_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [test_case.CalculateCoverageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.CalculateCoverageRequest, + dict, + ], +) def test_calculate_coverage(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2122,7 +2384,8 @@ def test_calculate_coverage_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2140,7 +2403,8 @@ async def test_calculate_coverage_async( transport: str = "grpc_asyncio", request_type=test_case.CalculateCoverageRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2153,7 +2417,9 @@ async def test_calculate_coverage_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - test_case.CalculateCoverageResponse(agent="agent_value",) + test_case.CalculateCoverageResponse( + agent="agent_value", + ) ) response = await client.calculate_coverage(request) @@ -2173,13 +2439,15 @@ async def test_calculate_coverage_async_from_dict(): def test_calculate_coverage_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.CalculateCoverageRequest() - request.agent = "agent/value" + request.agent = "agent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2195,18 +2463,23 @@ def test_calculate_coverage_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "agent=agent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "agent=agent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_calculate_coverage_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.CalculateCoverageRequest() - request.agent = "agent/value" + request.agent = "agent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2224,13 +2497,23 @@ async def test_calculate_coverage_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "agent=agent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "agent=agent_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [test_case.ImportTestCasesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.ImportTestCasesRequest, + dict, + ], +) def test_import_test_cases(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2258,7 +2541,8 @@ def test_import_test_cases_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2276,7 +2560,8 @@ async def test_import_test_cases_async( transport: str = "grpc_asyncio", request_type=test_case.ImportTestCasesRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2308,13 +2593,15 @@ async def test_import_test_cases_async_from_dict(): def test_import_test_cases_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.ImportTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2330,18 +2617,23 @@ def test_import_test_cases_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_import_test_cases_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.ImportTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2359,13 +2651,23 @@ async def test_import_test_cases_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [test_case.ExportTestCasesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.ExportTestCasesRequest, + dict, + ], +) def test_export_test_cases(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2393,7 +2695,8 @@ def test_export_test_cases_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2411,7 +2714,8 @@ async def test_export_test_cases_async( transport: str = "grpc_asyncio", request_type=test_case.ExportTestCasesRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2443,13 +2747,15 @@ async def test_export_test_cases_async_from_dict(): def test_export_test_cases_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.ExportTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2465,18 +2771,23 @@ def test_export_test_cases_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_export_test_cases_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.ExportTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2494,13 +2805,23 @@ async def test_export_test_cases_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [test_case.ListTestCaseResultsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.ListTestCaseResultsRequest, + dict, + ], +) def test_list_test_case_results(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2531,7 +2852,8 @@ def test_list_test_case_results_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2549,7 +2871,8 @@ async def test_list_test_case_results_async( transport: str = "grpc_asyncio", request_type=test_case.ListTestCaseResultsRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2584,13 +2907,15 @@ async def test_list_test_case_results_async_from_dict(): def test_list_test_case_results_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.ListTestCaseResultsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2606,18 +2931,23 @@ def test_list_test_case_results_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_test_case_results_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.ListTestCaseResultsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2635,11 +2965,16 @@ async def test_list_test_case_results_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_test_case_results_flattened(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2649,7 +2984,9 @@ def test_list_test_case_results_flattened(): call.return_value = test_case.ListTestCaseResultsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_test_case_results(parent="parent_value",) + client.list_test_case_results( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2661,19 +2998,24 @@ def test_list_test_case_results_flattened(): def test_list_test_case_results_flattened_error(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_test_case_results( - test_case.ListTestCaseResultsRequest(), parent="parent_value", + test_case.ListTestCaseResultsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_test_case_results_flattened_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2687,7 +3029,9 @@ async def test_list_test_case_results_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_test_case_results(parent="parent_value",) + response = await client.list_test_case_results( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2700,19 +3044,23 @@ async def test_list_test_case_results_flattened_async(): @pytest.mark.asyncio async def test_list_test_case_results_flattened_error_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_test_case_results( - test_case.ListTestCaseResultsRequest(), parent="parent_value", + test_case.ListTestCaseResultsRequest(), + parent="parent_value", ) def test_list_test_case_results_pager(transport_name: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2730,10 +3078,14 @@ def test_list_test_case_results_pager(transport_name: str = "grpc"): next_page_token="abc", ), test_case.ListTestCaseResultsResponse( - test_case_results=[], next_page_token="def", + test_case_results=[], + next_page_token="def", ), test_case.ListTestCaseResultsResponse( - test_case_results=[test_case.TestCaseResult(),], next_page_token="ghi", + test_case_results=[ + test_case.TestCaseResult(), + ], + next_page_token="ghi", ), test_case.ListTestCaseResultsResponse( test_case_results=[ @@ -2752,14 +3104,15 @@ def test_list_test_case_results_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, test_case.TestCaseResult) for i in results) def test_list_test_case_results_pages(transport_name: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2777,10 +3130,14 @@ def test_list_test_case_results_pages(transport_name: str = "grpc"): next_page_token="abc", ), test_case.ListTestCaseResultsResponse( - test_case_results=[], next_page_token="def", + test_case_results=[], + next_page_token="def", ), test_case.ListTestCaseResultsResponse( - test_case_results=[test_case.TestCaseResult(),], next_page_token="ghi", + test_case_results=[ + test_case.TestCaseResult(), + ], + next_page_token="ghi", ), test_case.ListTestCaseResultsResponse( test_case_results=[ @@ -2797,7 +3154,9 @@ def test_list_test_case_results_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_test_case_results_async_pager(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2816,10 +3175,14 @@ async def test_list_test_case_results_async_pager(): next_page_token="abc", ), test_case.ListTestCaseResultsResponse( - test_case_results=[], next_page_token="def", + test_case_results=[], + next_page_token="def", ), test_case.ListTestCaseResultsResponse( - test_case_results=[test_case.TestCaseResult(),], next_page_token="ghi", + test_case_results=[ + test_case.TestCaseResult(), + ], + next_page_token="ghi", ), test_case.ListTestCaseResultsResponse( test_case_results=[ @@ -2829,10 +3192,12 @@ async def test_list_test_case_results_async_pager(): ), RuntimeError, ) - async_pager = await client.list_test_case_results(request={},) + async_pager = await client.list_test_case_results( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2841,7 +3206,9 @@ async def test_list_test_case_results_async_pager(): @pytest.mark.asyncio async def test_list_test_case_results_async_pages(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2860,10 +3227,14 @@ async def test_list_test_case_results_async_pages(): next_page_token="abc", ), test_case.ListTestCaseResultsResponse( - test_case_results=[], next_page_token="def", + test_case_results=[], + next_page_token="def", ), test_case.ListTestCaseResultsResponse( - test_case_results=[test_case.TestCaseResult(),], next_page_token="ghi", + test_case_results=[ + test_case.TestCaseResult(), + ], + next_page_token="ghi", ), test_case.ListTestCaseResultsResponse( test_case_results=[ @@ -2874,16 +3245,25 @@ async def test_list_test_case_results_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_test_case_results(request={})).pages: + async for page_ in ( + await client.list_test_case_results(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [test_case.GetTestCaseResultRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.GetTestCaseResultRequest, + dict, + ], +) def test_get_test_case_result(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2918,7 +3298,8 @@ def test_get_test_case_result_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2936,7 +3317,8 @@ async def test_get_test_case_result_async( transport: str = "grpc_asyncio", request_type=test_case.GetTestCaseResultRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2975,13 +3357,15 @@ async def test_get_test_case_result_async_from_dict(): def test_get_test_case_result_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.GetTestCaseResultRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2997,18 +3381,23 @@ def test_get_test_case_result_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_test_case_result_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.GetTestCaseResultRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3026,11 +3415,16 @@ async def test_get_test_case_result_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_test_case_result_flattened(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3040,7 +3434,9 @@ def test_get_test_case_result_flattened(): call.return_value = test_case.TestCaseResult() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_test_case_result(name="name_value",) + client.get_test_case_result( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3052,19 +3448,24 @@ def test_get_test_case_result_flattened(): def test_get_test_case_result_flattened_error(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_test_case_result( - test_case.GetTestCaseResultRequest(), name="name_value", + test_case.GetTestCaseResultRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_test_case_result_flattened_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3078,7 +3479,9 @@ async def test_get_test_case_result_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_test_case_result(name="name_value",) + response = await client.get_test_case_result( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3091,13 +3494,16 @@ async def test_get_test_case_result_flattened_async(): @pytest.mark.asyncio async def test_get_test_case_result_flattened_error_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_test_case_result( - test_case.GetTestCaseResultRequest(), name="name_value", + test_case.GetTestCaseResultRequest(), + name="name_value", ) @@ -3108,7 +3514,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3128,7 +3535,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = TestCasesClient(client_options=options, transport=transport,) + client = TestCasesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3144,7 +3554,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TestCasesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3174,7 +3585,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.TestCasesGrpcTransport, transports.TestCasesGrpcAsyncIOTransport,], + [ + transports.TestCasesGrpcTransport, + transports.TestCasesGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -3184,10 +3598,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = TestCasesClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.TestCasesGrpcTransport,) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.TestCasesGrpcTransport, + ) def test_test_cases_base_transport_error(): @@ -3237,6 +3669,14 @@ def test_test_cases_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_test_cases_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -3248,7 +3688,8 @@ def test_test_cases_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TestCasesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3289,7 +3730,10 @@ def test_test_cases_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.TestCasesGrpcTransport, transports.TestCasesGrpcAsyncIOTransport,], + [ + transports.TestCasesGrpcTransport, + transports.TestCasesGrpcAsyncIOTransport, + ], ) def test_test_cases_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -3387,24 +3831,40 @@ def test_test_cases_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_test_cases_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_test_cases_host_no_port(transport_name): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_test_cases_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_test_cases_host_with_port(transport_name): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_test_cases_grpc_transport_channel(): @@ -3412,7 +3872,8 @@ def test_test_cases_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.TestCasesGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -3424,7 +3885,8 @@ def test_test_cases_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.TestCasesGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -3525,12 +3987,16 @@ def test_test_cases_transport_channel_mtls_with_adc(transport_class): def test_test_cases_grpc_lro_client(): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -3538,12 +4004,16 @@ def test_test_cases_grpc_lro_client(): def test_test_cases_grpc_lro_async_client(): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -3554,7 +4024,9 @@ def test_agent_path(): location = "clam" agent = "whelk" expected = "projects/{project}/locations/{location}/agents/{agent}".format( - project=project, location=location, agent=agent, + project=project, + location=location, + agent=agent, ) actual = TestCasesClient.agent_path(project, location, agent) assert expected == actual @@ -3579,7 +4051,10 @@ def test_entity_type_path(): agent = "winkle" entity_type = "nautilus" expected = "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) actual = TestCasesClient.entity_type_path(project, location, agent, entity_type) assert expected == actual @@ -3605,7 +4080,10 @@ def test_environment_path(): agent = "oyster" environment = "nudibranch" expected = "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}".format( - project=project, location=location, agent=agent, environment=environment, + project=project, + location=location, + agent=agent, + environment=environment, ) actual = TestCasesClient.environment_path(project, location, agent, environment) assert expected == actual @@ -3630,8 +4108,13 @@ def test_flow_path(): location = "abalone" agent = "squid" flow = "clam" - expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + expected = ( + "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( + project=project, + location=location, + agent=agent, + flow=flow, + ) ) actual = TestCasesClient.flow_path(project, location, agent, flow) assert expected == actual @@ -3657,7 +4140,10 @@ def test_intent_path(): agent = "winkle" intent = "nautilus" expected = "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) actual = TestCasesClient.intent_path(project, location, agent, intent) assert expected == actual @@ -3684,7 +4170,11 @@ def test_page_path(): flow = "nudibranch" page = "cuttlefish" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) actual = TestCasesClient.page_path(project, location, agent, flow, page) assert expected == actual @@ -3711,7 +4201,10 @@ def test_test_case_path(): agent = "whelk" test_case = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}".format( - project=project, location=location, agent=agent, test_case=test_case, + project=project, + location=location, + agent=agent, + test_case=test_case, ) actual = TestCasesClient.test_case_path(project, location, agent, test_case) assert expected == actual @@ -3805,7 +4298,10 @@ def test_webhook_path(): agent = "cuttlefish" webhook = "mussel" expected = "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) actual = TestCasesClient.webhook_path(project, location, agent, webhook) assert expected == actual @@ -3847,7 +4343,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = TestCasesClient.common_folder_path(folder) assert expected == actual @@ -3865,7 +4363,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = TestCasesClient.common_organization_path(organization) assert expected == actual @@ -3883,7 +4383,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = TestCasesClient.common_project_path(project) assert expected == actual @@ -3903,7 +4405,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = TestCasesClient.common_location_path(project, location) assert expected == actual @@ -3928,7 +4431,8 @@ def test_client_with_default_client_info(): transports.TestCasesTransport, "_prep_wrapped_messages" ) as prep: client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3937,7 +4441,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = TestCasesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3945,7 +4450,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3/test_transition_route_groups.py b/tests/unit/gapic/dialogflowcx_v3/test_transition_route_groups.py index 28e75e2c..bb104847 100644 --- a/tests/unit/gapic/dialogflowcx_v3/test_transition_route_groups.py +++ b/tests/unit/gapic/dialogflowcx_v3/test_transition_route_groups.py @@ -98,20 +98,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [TransitionRouteGroupsClient, TransitionRouteGroupsAsyncClient,] + "client_class,transport_name", + [ + (TransitionRouteGroupsClient, "grpc"), + (TransitionRouteGroupsAsyncClient, "grpc_asyncio"), + ], ) -def test_transition_route_groups_client_from_service_account_info(client_class): +def test_transition_route_groups_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -140,23 +146,33 @@ def test_transition_route_groups_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [TransitionRouteGroupsClient, TransitionRouteGroupsAsyncClient,] + "client_class,transport_name", + [ + (TransitionRouteGroupsClient, "grpc"), + (TransitionRouteGroupsAsyncClient, "grpc_asyncio"), + ], ) -def test_transition_route_groups_client_from_service_account_file(client_class): +def test_transition_route_groups_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_transition_route_groups_client_get_transport_class(): @@ -522,7 +538,9 @@ def test_transition_route_groups_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -666,11 +684,16 @@ def test_transition_route_groups_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [transition_route_group.ListTransitionRouteGroupsRequest, dict,] + "request_type", + [ + transition_route_group.ListTransitionRouteGroupsRequest, + dict, + ], ) def test_list_transition_route_groups(request_type, transport: str = "grpc"): client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -701,7 +724,8 @@ def test_list_transition_route_groups_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -720,7 +744,8 @@ async def test_list_transition_route_groups_async( request_type=transition_route_group.ListTransitionRouteGroupsRequest, ): client = TransitionRouteGroupsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -763,7 +788,7 @@ def test_list_transition_route_groups_field_headers(): # a field header. Set these to a non-empty value. request = transition_route_group.ListTransitionRouteGroupsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -779,7 +804,10 @@ def test_list_transition_route_groups_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -792,7 +820,7 @@ async def test_list_transition_route_groups_field_headers_async(): # a field header. Set these to a non-empty value. request = transition_route_group.ListTransitionRouteGroupsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -810,7 +838,10 @@ async def test_list_transition_route_groups_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_transition_route_groups_flattened(): @@ -826,7 +857,9 @@ def test_list_transition_route_groups_flattened(): call.return_value = transition_route_group.ListTransitionRouteGroupsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_transition_route_groups(parent="parent_value",) + client.list_transition_route_groups( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -869,7 +902,9 @@ async def test_list_transition_route_groups_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_transition_route_groups(parent="parent_value",) + response = await client.list_transition_route_groups( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -897,7 +932,8 @@ async def test_list_transition_route_groups_flattened_error_async(): def test_list_transition_route_groups_pager(transport_name: str = "grpc"): client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -915,7 +951,8 @@ def test_list_transition_route_groups_pager(transport_name: str = "grpc"): next_page_token="abc", ), transition_route_group.ListTransitionRouteGroupsResponse( - transition_route_groups=[], next_page_token="def", + transition_route_groups=[], + next_page_token="def", ), transition_route_group.ListTransitionRouteGroupsResponse( transition_route_groups=[ @@ -940,7 +977,7 @@ def test_list_transition_route_groups_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all( isinstance(i, transition_route_group.TransitionRouteGroup) for i in results @@ -949,7 +986,8 @@ def test_list_transition_route_groups_pager(transport_name: str = "grpc"): def test_list_transition_route_groups_pages(transport_name: str = "grpc"): client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -967,7 +1005,8 @@ def test_list_transition_route_groups_pages(transport_name: str = "grpc"): next_page_token="abc", ), transition_route_group.ListTransitionRouteGroupsResponse( - transition_route_groups=[], next_page_token="def", + transition_route_groups=[], + next_page_token="def", ), transition_route_group.ListTransitionRouteGroupsResponse( transition_route_groups=[ @@ -1011,7 +1050,8 @@ async def test_list_transition_route_groups_async_pager(): next_page_token="abc", ), transition_route_group.ListTransitionRouteGroupsResponse( - transition_route_groups=[], next_page_token="def", + transition_route_groups=[], + next_page_token="def", ), transition_route_group.ListTransitionRouteGroupsResponse( transition_route_groups=[ @@ -1027,10 +1067,12 @@ async def test_list_transition_route_groups_async_pager(): ), RuntimeError, ) - async_pager = await client.list_transition_route_groups(request={},) + async_pager = await client.list_transition_route_groups( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1063,7 +1105,8 @@ async def test_list_transition_route_groups_async_pages(): next_page_token="abc", ), transition_route_group.ListTransitionRouteGroupsResponse( - transition_route_groups=[], next_page_token="def", + transition_route_groups=[], + next_page_token="def", ), transition_route_group.ListTransitionRouteGroupsResponse( transition_route_groups=[ @@ -1082,18 +1125,23 @@ async def test_list_transition_route_groups_async_pages(): pages = [] async for page_ in ( await client.list_transition_route_groups(request={}) - ).pages: + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [transition_route_group.GetTransitionRouteGroupRequest, dict,] + "request_type", + [ + transition_route_group.GetTransitionRouteGroupRequest, + dict, + ], ) def test_get_transition_route_group(request_type, transport: str = "grpc"): client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1106,7 +1154,8 @@ def test_get_transition_route_group(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = transition_route_group.TransitionRouteGroup( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.get_transition_route_group(request) @@ -1125,7 +1174,8 @@ def test_get_transition_route_group_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1144,7 +1194,8 @@ async def test_get_transition_route_group_async( request_type=transition_route_group.GetTransitionRouteGroupRequest, ): client = TransitionRouteGroupsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1158,7 +1209,8 @@ async def test_get_transition_route_group_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( transition_route_group.TransitionRouteGroup( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.get_transition_route_group(request) @@ -1188,7 +1240,7 @@ def test_get_transition_route_group_field_headers(): # a field header. Set these to a non-empty value. request = transition_route_group.GetTransitionRouteGroupRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1204,7 +1256,10 @@ def test_get_transition_route_group_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1217,7 +1272,7 @@ async def test_get_transition_route_group_field_headers_async(): # a field header. Set these to a non-empty value. request = transition_route_group.GetTransitionRouteGroupRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1235,7 +1290,10 @@ async def test_get_transition_route_group_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_transition_route_group_flattened(): @@ -1251,7 +1309,9 @@ def test_get_transition_route_group_flattened(): call.return_value = transition_route_group.TransitionRouteGroup() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_transition_route_group(name="name_value",) + client.get_transition_route_group( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1271,7 +1331,8 @@ def test_get_transition_route_group_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_transition_route_group( - transition_route_group.GetTransitionRouteGroupRequest(), name="name_value", + transition_route_group.GetTransitionRouteGroupRequest(), + name="name_value", ) @@ -1293,7 +1354,9 @@ async def test_get_transition_route_group_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_transition_route_group(name="name_value",) + response = await client.get_transition_route_group( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1314,17 +1377,22 @@ async def test_get_transition_route_group_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_transition_route_group( - transition_route_group.GetTransitionRouteGroupRequest(), name="name_value", + transition_route_group.GetTransitionRouteGroupRequest(), + name="name_value", ) @pytest.mark.parametrize( "request_type", - [gcdc_transition_route_group.CreateTransitionRouteGroupRequest, dict,], + [ + gcdc_transition_route_group.CreateTransitionRouteGroupRequest, + dict, + ], ) def test_create_transition_route_group(request_type, transport: str = "grpc"): client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1337,7 +1405,8 @@ def test_create_transition_route_group(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = gcdc_transition_route_group.TransitionRouteGroup( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.create_transition_route_group(request) @@ -1358,7 +1427,8 @@ def test_create_transition_route_group_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1379,7 +1449,8 @@ async def test_create_transition_route_group_async( request_type=gcdc_transition_route_group.CreateTransitionRouteGroupRequest, ): client = TransitionRouteGroupsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1393,7 +1464,8 @@ async def test_create_transition_route_group_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( gcdc_transition_route_group.TransitionRouteGroup( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.create_transition_route_group(request) @@ -1425,7 +1497,7 @@ def test_create_transition_route_group_field_headers(): # a field header. Set these to a non-empty value. request = gcdc_transition_route_group.CreateTransitionRouteGroupRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1441,7 +1513,10 @@ def test_create_transition_route_group_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1454,7 +1529,7 @@ async def test_create_transition_route_group_field_headers_async(): # a field header. Set these to a non-empty value. request = gcdc_transition_route_group.CreateTransitionRouteGroupRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1472,7 +1547,10 @@ async def test_create_transition_route_group_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_transition_route_group_flattened(): @@ -1581,11 +1659,15 @@ async def test_create_transition_route_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", - [gcdc_transition_route_group.UpdateTransitionRouteGroupRequest, dict,], + [ + gcdc_transition_route_group.UpdateTransitionRouteGroupRequest, + dict, + ], ) def test_update_transition_route_group(request_type, transport: str = "grpc"): client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1598,7 +1680,8 @@ def test_update_transition_route_group(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = gcdc_transition_route_group.TransitionRouteGroup( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.update_transition_route_group(request) @@ -1619,7 +1702,8 @@ def test_update_transition_route_group_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1640,7 +1724,8 @@ async def test_update_transition_route_group_async( request_type=gcdc_transition_route_group.UpdateTransitionRouteGroupRequest, ): client = TransitionRouteGroupsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1654,7 +1739,8 @@ async def test_update_transition_route_group_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( gcdc_transition_route_group.TransitionRouteGroup( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.update_transition_route_group(request) @@ -1686,7 +1772,7 @@ def test_update_transition_route_group_field_headers(): # a field header. Set these to a non-empty value. request = gcdc_transition_route_group.UpdateTransitionRouteGroupRequest() - request.transition_route_group.name = "transition_route_group.name/value" + request.transition_route_group.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1704,7 +1790,7 @@ def test_update_transition_route_group_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "transition_route_group.name=transition_route_group.name/value", + "transition_route_group.name=name_value", ) in kw["metadata"] @@ -1718,7 +1804,7 @@ async def test_update_transition_route_group_field_headers_async(): # a field header. Set these to a non-empty value. request = gcdc_transition_route_group.UpdateTransitionRouteGroupRequest() - request.transition_route_group.name = "transition_route_group.name/value" + request.transition_route_group.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1738,7 +1824,7 @@ async def test_update_transition_route_group_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "transition_route_group.name=transition_route_group.name/value", + "transition_route_group.name=name_value", ) in kw["metadata"] @@ -1847,11 +1933,16 @@ async def test_update_transition_route_group_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [transition_route_group.DeleteTransitionRouteGroupRequest, dict,] + "request_type", + [ + transition_route_group.DeleteTransitionRouteGroupRequest, + dict, + ], ) def test_delete_transition_route_group(request_type, transport: str = "grpc"): client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1879,7 +1970,8 @@ def test_delete_transition_route_group_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1898,7 +1990,8 @@ async def test_delete_transition_route_group_async( request_type=transition_route_group.DeleteTransitionRouteGroupRequest, ): client = TransitionRouteGroupsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1936,7 +2029,7 @@ def test_delete_transition_route_group_field_headers(): # a field header. Set these to a non-empty value. request = transition_route_group.DeleteTransitionRouteGroupRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1952,7 +2045,10 @@ def test_delete_transition_route_group_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1965,7 +2061,7 @@ async def test_delete_transition_route_group_field_headers_async(): # a field header. Set these to a non-empty value. request = transition_route_group.DeleteTransitionRouteGroupRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1981,7 +2077,10 @@ async def test_delete_transition_route_group_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_transition_route_group_flattened(): @@ -1997,7 +2096,9 @@ def test_delete_transition_route_group_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_transition_route_group(name="name_value",) + client.delete_transition_route_group( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2038,7 +2139,9 @@ async def test_delete_transition_route_group_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_transition_route_group(name="name_value",) + response = await client.delete_transition_route_group( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2071,7 +2174,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2092,7 +2196,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = TransitionRouteGroupsClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2109,7 +2214,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TransitionRouteGroupsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2152,12 +2258,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = TransitionRouteGroupsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = TransitionRouteGroupsClient( credentials=ga_credentials.AnonymousCredentials(), ) - assert isinstance(client.transport, transports.TransitionRouteGroupsGrpcTransport,) + assert isinstance( + client.transport, + transports.TransitionRouteGroupsGrpcTransport, + ) def test_transition_route_groups_base_transport_error(): @@ -2195,6 +2317,14 @@ def test_transition_route_groups_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_transition_route_groups_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2206,7 +2336,8 @@ def test_transition_route_groups_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TransitionRouteGroupsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2355,24 +2486,40 @@ def test_transition_route_groups_grpc_transport_client_cert_source_for_mtls( ) -def test_transition_route_groups_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_transition_route_groups_host_no_port(transport_name): client = TransitionRouteGroupsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_transition_route_groups_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_transition_route_groups_host_with_port(transport_name): client = TransitionRouteGroupsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_transition_route_groups_grpc_transport_channel(): @@ -2380,7 +2527,8 @@ def test_transition_route_groups_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.TransitionRouteGroupsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2392,7 +2540,8 @@ def test_transition_route_groups_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.TransitionRouteGroupsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2504,8 +2653,13 @@ def test_flow_path(): location = "clam" agent = "whelk" flow = "octopus" - expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + expected = ( + "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( + project=project, + location=location, + agent=agent, + flow=flow, + ) ) actual = TransitionRouteGroupsClient.flow_path(project, location, agent, flow) assert expected == actual @@ -2531,7 +2685,10 @@ def test_intent_path(): agent = "scallop" intent = "abalone" expected = "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) actual = TransitionRouteGroupsClient.intent_path(project, location, agent, intent) assert expected == actual @@ -2558,7 +2715,11 @@ def test_page_path(): flow = "mussel" page = "winkle" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) actual = TransitionRouteGroupsClient.page_path(project, location, agent, flow, page) assert expected == actual @@ -2619,7 +2780,10 @@ def test_webhook_path(): agent = "whelk" webhook = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) actual = TransitionRouteGroupsClient.webhook_path(project, location, agent, webhook) assert expected == actual @@ -2661,7 +2825,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = TransitionRouteGroupsClient.common_folder_path(folder) assert expected == actual @@ -2679,7 +2845,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = TransitionRouteGroupsClient.common_organization_path(organization) assert expected == actual @@ -2697,7 +2865,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = TransitionRouteGroupsClient.common_project_path(project) assert expected == actual @@ -2717,7 +2887,8 @@ def test_common_location_path(): project = "oyster" location = "nudibranch" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = TransitionRouteGroupsClient.common_location_path(project, location) assert expected == actual @@ -2742,7 +2913,8 @@ def test_client_with_default_client_info(): transports.TransitionRouteGroupsTransport, "_prep_wrapped_messages" ) as prep: client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2751,7 +2923,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = TransitionRouteGroupsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2759,7 +2932,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = TransitionRouteGroupsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3/test_versions.py b/tests/unit/gapic/dialogflowcx_v3/test_versions.py index 8fac0e1c..cdf25596 100644 --- a/tests/unit/gapic/dialogflowcx_v3/test_versions.py +++ b/tests/unit/gapic/dialogflowcx_v3/test_versions.py @@ -89,19 +89,25 @@ def test__get_default_mtls_endpoint(): assert VersionsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [VersionsClient, VersionsAsyncClient,]) -def test_versions_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (VersionsClient, "grpc"), + (VersionsAsyncClient, "grpc_asyncio"), + ], +) +def test_versions_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -129,22 +135,32 @@ def test_versions_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [VersionsClient, VersionsAsyncClient,]) -def test_versions_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (VersionsClient, "grpc"), + (VersionsAsyncClient, "grpc_asyncio"), + ], +) +def test_versions_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_versions_client_get_transport_class(): @@ -474,7 +490,9 @@ def test_versions_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -605,10 +623,17 @@ def test_versions_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [version.ListVersionsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + version.ListVersionsRequest, + dict, + ], +) def test_list_versions(request_type, transport: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -637,7 +662,8 @@ def test_list_versions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -653,7 +679,8 @@ async def test_list_versions_async( transport: str = "grpc_asyncio", request_type=version.ListVersionsRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -664,7 +691,9 @@ async def test_list_versions_async( with mock.patch.object(type(client.transport.list_versions), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - version.ListVersionsResponse(next_page_token="next_page_token_value",) + version.ListVersionsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_versions(request) @@ -684,13 +713,15 @@ async def test_list_versions_async_from_dict(): def test_list_versions_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.ListVersionsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_versions), "__call__") as call: @@ -704,18 +735,23 @@ def test_list_versions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_versions_field_headers_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.ListVersionsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_versions), "__call__") as call: @@ -731,11 +767,16 @@ async def test_list_versions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_versions_flattened(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_versions), "__call__") as call: @@ -743,7 +784,9 @@ def test_list_versions_flattened(): call.return_value = version.ListVersionsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_versions(parent="parent_value",) + client.list_versions( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -755,19 +798,24 @@ def test_list_versions_flattened(): def test_list_versions_flattened_error(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_versions( - version.ListVersionsRequest(), parent="parent_value", + version.ListVersionsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_versions_flattened_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_versions), "__call__") as call: @@ -779,7 +827,9 @@ async def test_list_versions_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_versions(parent="parent_value",) + response = await client.list_versions( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -792,19 +842,23 @@ async def test_list_versions_flattened_async(): @pytest.mark.asyncio async def test_list_versions_flattened_error_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_versions( - version.ListVersionsRequest(), parent="parent_value", + version.ListVersionsRequest(), + parent="parent_value", ) def test_list_versions_pager(transport_name: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -812,15 +866,28 @@ def test_list_versions_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( version.ListVersionsResponse( - versions=[version.Version(), version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], next_page_token="abc", ), - version.ListVersionsResponse(versions=[], next_page_token="def",), version.ListVersionsResponse( - versions=[version.Version(),], next_page_token="ghi", + versions=[], + next_page_token="def", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + ], + next_page_token="ghi", ), version.ListVersionsResponse( - versions=[version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + ], ), RuntimeError, ) @@ -833,14 +900,15 @@ def test_list_versions_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, version.Version) for i in results) def test_list_versions_pages(transport_name: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -848,15 +916,28 @@ def test_list_versions_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( version.ListVersionsResponse( - versions=[version.Version(), version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], next_page_token="abc", ), - version.ListVersionsResponse(versions=[], next_page_token="def",), version.ListVersionsResponse( - versions=[version.Version(),], next_page_token="ghi", + versions=[], + next_page_token="def", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + ], + next_page_token="ghi", ), version.ListVersionsResponse( - versions=[version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + ], ), RuntimeError, ) @@ -867,7 +948,9 @@ def test_list_versions_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_versions_async_pager(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -876,22 +959,37 @@ async def test_list_versions_async_pager(): # Set the response to a series of pages. call.side_effect = ( version.ListVersionsResponse( - versions=[version.Version(), version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], next_page_token="abc", ), - version.ListVersionsResponse(versions=[], next_page_token="def",), version.ListVersionsResponse( - versions=[version.Version(),], next_page_token="ghi", + versions=[], + next_page_token="def", ), version.ListVersionsResponse( - versions=[version.Version(), version.Version(),], + versions=[ + version.Version(), + ], + next_page_token="ghi", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + ], ), RuntimeError, ) - async_pager = await client.list_versions(request={},) + async_pager = await client.list_versions( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -900,7 +998,9 @@ async def test_list_versions_async_pager(): @pytest.mark.asyncio async def test_list_versions_async_pages(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -909,29 +1009,51 @@ async def test_list_versions_async_pages(): # Set the response to a series of pages. call.side_effect = ( version.ListVersionsResponse( - versions=[version.Version(), version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], next_page_token="abc", ), - version.ListVersionsResponse(versions=[], next_page_token="def",), version.ListVersionsResponse( - versions=[version.Version(),], next_page_token="ghi", + versions=[], + next_page_token="def", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + ], + next_page_token="ghi", ), version.ListVersionsResponse( - versions=[version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_versions(request={})).pages: + async for page_ in ( + await client.list_versions(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [version.GetVersionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + version.GetVersionRequest, + dict, + ], +) def test_get_version(request_type, transport: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -966,7 +1088,8 @@ def test_get_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -982,7 +1105,8 @@ async def test_get_version_async( transport: str = "grpc_asyncio", request_type=version.GetVersionRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1021,13 +1145,15 @@ async def test_get_version_async_from_dict(): def test_get_version_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.GetVersionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_version), "__call__") as call: @@ -1041,18 +1167,23 @@ def test_get_version_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_version_field_headers_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.GetVersionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_version), "__call__") as call: @@ -1066,11 +1197,16 @@ async def test_get_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_version_flattened(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_version), "__call__") as call: @@ -1078,7 +1214,9 @@ def test_get_version_flattened(): call.return_value = version.Version() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_version(name="name_value",) + client.get_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1090,19 +1228,24 @@ def test_get_version_flattened(): def test_get_version_flattened_error(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_version( - version.GetVersionRequest(), name="name_value", + version.GetVersionRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_version_flattened_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_version), "__call__") as call: @@ -1112,7 +1255,9 @@ async def test_get_version_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(version.Version()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_version(name="name_value",) + response = await client.get_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1125,20 +1270,30 @@ async def test_get_version_flattened_async(): @pytest.mark.asyncio async def test_get_version_flattened_error_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_version( - version.GetVersionRequest(), name="name_value", + version.GetVersionRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [gcdc_version.CreateVersionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_version.CreateVersionRequest, + dict, + ], +) def test_create_version(request_type, transport: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1164,7 +1319,8 @@ def test_create_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1180,7 +1336,8 @@ async def test_create_version_async( transport: str = "grpc_asyncio", request_type=gcdc_version.CreateVersionRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1210,13 +1367,15 @@ async def test_create_version_async_from_dict(): def test_create_version_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_version.CreateVersionRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_version), "__call__") as call: @@ -1230,18 +1389,23 @@ def test_create_version_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_version_field_headers_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_version.CreateVersionRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_version), "__call__") as call: @@ -1257,11 +1421,16 @@ async def test_create_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_version_flattened(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_version), "__call__") as call: @@ -1270,7 +1439,8 @@ def test_create_version_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_version( - parent="parent_value", version=gcdc_version.Version(name="name_value"), + parent="parent_value", + version=gcdc_version.Version(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1286,7 +1456,9 @@ def test_create_version_flattened(): def test_create_version_flattened_error(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1300,7 +1472,9 @@ def test_create_version_flattened_error(): @pytest.mark.asyncio async def test_create_version_flattened_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_version), "__call__") as call: @@ -1313,7 +1487,8 @@ async def test_create_version_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_version( - parent="parent_value", version=gcdc_version.Version(name="name_value"), + parent="parent_value", + version=gcdc_version.Version(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1330,7 +1505,9 @@ async def test_create_version_flattened_async(): @pytest.mark.asyncio async def test_create_version_flattened_error_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1342,10 +1519,17 @@ async def test_create_version_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [gcdc_version.UpdateVersionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_version.UpdateVersionRequest, + dict, + ], +) def test_update_version(request_type, transport: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1380,7 +1564,8 @@ def test_update_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1396,7 +1581,8 @@ async def test_update_version_async( transport: str = "grpc_asyncio", request_type=gcdc_version.UpdateVersionRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1435,13 +1621,15 @@ async def test_update_version_async_from_dict(): def test_update_version_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_version.UpdateVersionRequest() - request.version.name = "version.name/value" + request.version.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_version), "__call__") as call: @@ -1455,20 +1643,23 @@ def test_update_version_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "version.name=version.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "version.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_version_field_headers_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_version.UpdateVersionRequest() - request.version.name = "version.name/value" + request.version.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_version), "__call__") as call: @@ -1484,13 +1675,16 @@ async def test_update_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "version.name=version.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "version.name=name_value", + ) in kw["metadata"] def test_update_version_flattened(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_version), "__call__") as call: @@ -1516,7 +1710,9 @@ def test_update_version_flattened(): def test_update_version_flattened_error(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1530,7 +1726,9 @@ def test_update_version_flattened_error(): @pytest.mark.asyncio async def test_update_version_flattened_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_version), "__call__") as call: @@ -1561,7 +1759,9 @@ async def test_update_version_flattened_async(): @pytest.mark.asyncio async def test_update_version_flattened_error_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1573,10 +1773,17 @@ async def test_update_version_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [version.DeleteVersionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + version.DeleteVersionRequest, + dict, + ], +) def test_delete_version(request_type, transport: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1602,7 +1809,8 @@ def test_delete_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1618,7 +1826,8 @@ async def test_delete_version_async( transport: str = "grpc_asyncio", request_type=version.DeleteVersionRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1646,13 +1855,15 @@ async def test_delete_version_async_from_dict(): def test_delete_version_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.DeleteVersionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_version), "__call__") as call: @@ -1666,18 +1877,23 @@ def test_delete_version_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_version_field_headers_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.DeleteVersionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_version), "__call__") as call: @@ -1691,11 +1907,16 @@ async def test_delete_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_version_flattened(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_version), "__call__") as call: @@ -1703,7 +1924,9 @@ def test_delete_version_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_version(name="name_value",) + client.delete_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1715,19 +1938,24 @@ def test_delete_version_flattened(): def test_delete_version_flattened_error(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_version( - version.DeleteVersionRequest(), name="name_value", + version.DeleteVersionRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_version_flattened_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_version), "__call__") as call: @@ -1737,7 +1965,9 @@ async def test_delete_version_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_version(name="name_value",) + response = await client.delete_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1750,20 +1980,30 @@ async def test_delete_version_flattened_async(): @pytest.mark.asyncio async def test_delete_version_flattened_error_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_version( - version.DeleteVersionRequest(), name="name_value", + version.DeleteVersionRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [version.LoadVersionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + version.LoadVersionRequest, + dict, + ], +) def test_load_version(request_type, transport: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1789,7 +2029,8 @@ def test_load_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1805,7 +2046,8 @@ async def test_load_version_async( transport: str = "grpc_asyncio", request_type=version.LoadVersionRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1835,13 +2077,15 @@ async def test_load_version_async_from_dict(): def test_load_version_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.LoadVersionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.load_version), "__call__") as call: @@ -1855,18 +2099,23 @@ def test_load_version_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_load_version_field_headers_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.LoadVersionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.load_version), "__call__") as call: @@ -1882,11 +2131,16 @@ async def test_load_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_load_version_flattened(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.load_version), "__call__") as call: @@ -1894,7 +2148,9 @@ def test_load_version_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.load_version(name="name_value",) + client.load_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1906,19 +2162,24 @@ def test_load_version_flattened(): def test_load_version_flattened_error(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.load_version( - version.LoadVersionRequest(), name="name_value", + version.LoadVersionRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_load_version_flattened_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.load_version), "__call__") as call: @@ -1930,7 +2191,9 @@ async def test_load_version_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.load_version(name="name_value",) + response = await client.load_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1943,20 +2206,30 @@ async def test_load_version_flattened_async(): @pytest.mark.asyncio async def test_load_version_flattened_error_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.load_version( - version.LoadVersionRequest(), name="name_value", + version.LoadVersionRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [version.CompareVersionsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + version.CompareVersionsRequest, + dict, + ], +) def test_compare_versions(request_type, transport: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1987,7 +2260,8 @@ def test_compare_versions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2003,7 +2277,8 @@ async def test_compare_versions_async( transport: str = "grpc_asyncio", request_type=version.CompareVersionsRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2038,13 +2313,15 @@ async def test_compare_versions_async_from_dict(): def test_compare_versions_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.CompareVersionsRequest() - request.base_version = "base_version/value" + request.base_version = "base_version_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.compare_versions), "__call__") as call: @@ -2058,20 +2335,23 @@ def test_compare_versions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "base_version=base_version/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "base_version=base_version_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_compare_versions_field_headers_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.CompareVersionsRequest() - request.base_version = "base_version/value" + request.base_version = "base_version_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.compare_versions), "__call__") as call: @@ -2087,13 +2367,16 @@ async def test_compare_versions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "base_version=base_version/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "base_version=base_version_value", + ) in kw["metadata"] def test_compare_versions_flattened(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.compare_versions), "__call__") as call: @@ -2101,7 +2384,9 @@ def test_compare_versions_flattened(): call.return_value = version.CompareVersionsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.compare_versions(base_version="base_version_value",) + client.compare_versions( + base_version="base_version_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2113,19 +2398,24 @@ def test_compare_versions_flattened(): def test_compare_versions_flattened_error(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.compare_versions( - version.CompareVersionsRequest(), base_version="base_version_value", + version.CompareVersionsRequest(), + base_version="base_version_value", ) @pytest.mark.asyncio async def test_compare_versions_flattened_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.compare_versions), "__call__") as call: @@ -2137,7 +2427,9 @@ async def test_compare_versions_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.compare_versions(base_version="base_version_value",) + response = await client.compare_versions( + base_version="base_version_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2150,13 +2442,16 @@ async def test_compare_versions_flattened_async(): @pytest.mark.asyncio async def test_compare_versions_flattened_error_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.compare_versions( - version.CompareVersionsRequest(), base_version="base_version_value", + version.CompareVersionsRequest(), + base_version="base_version_value", ) @@ -2167,7 +2462,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2187,7 +2483,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = VersionsClient(client_options=options, transport=transport,) + client = VersionsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2203,7 +2502,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = VersionsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2233,7 +2533,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.VersionsGrpcTransport, transports.VersionsGrpcAsyncIOTransport,], + [ + transports.VersionsGrpcTransport, + transports.VersionsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2243,10 +2546,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = VersionsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.VersionsGrpcTransport,) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.VersionsGrpcTransport, + ) def test_versions_base_transport_error(): @@ -2291,6 +2612,14 @@ def test_versions_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_versions_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2302,7 +2631,8 @@ def test_versions_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.VersionsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2343,7 +2673,10 @@ def test_versions_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.VersionsGrpcTransport, transports.VersionsGrpcAsyncIOTransport,], + [ + transports.VersionsGrpcTransport, + transports.VersionsGrpcAsyncIOTransport, + ], ) def test_versions_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2441,24 +2774,40 @@ def test_versions_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_versions_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_versions_host_no_port(transport_name): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_versions_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_versions_host_with_port(transport_name): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_versions_grpc_transport_channel(): @@ -2466,7 +2815,8 @@ def test_versions_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.VersionsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2478,7 +2828,8 @@ def test_versions_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.VersionsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2579,12 +2930,16 @@ def test_versions_transport_channel_mtls_with_adc(transport_class): def test_versions_grpc_lro_client(): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2592,12 +2947,16 @@ def test_versions_grpc_lro_client(): def test_versions_grpc_lro_async_client(): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2610,7 +2969,11 @@ def test_version_path(): flow = "octopus" version = "oyster" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) actual = VersionsClient.version_path(project, location, agent, flow, version) assert expected == actual @@ -2653,7 +3016,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "squid" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = VersionsClient.common_folder_path(folder) assert expected == actual @@ -2671,7 +3036,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "whelk" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = VersionsClient.common_organization_path(organization) assert expected == actual @@ -2689,7 +3056,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "oyster" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = VersionsClient.common_project_path(project) assert expected == actual @@ -2709,7 +3078,8 @@ def test_common_location_path(): project = "cuttlefish" location = "mussel" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = VersionsClient.common_location_path(project, location) assert expected == actual @@ -2734,7 +3104,8 @@ def test_client_with_default_client_info(): transports.VersionsTransport, "_prep_wrapped_messages" ) as prep: client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2743,7 +3114,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = VersionsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2751,7 +3123,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3/test_webhooks.py b/tests/unit/gapic/dialogflowcx_v3/test_webhooks.py index 4cdbc9e7..d135a78c 100644 --- a/tests/unit/gapic/dialogflowcx_v3/test_webhooks.py +++ b/tests/unit/gapic/dialogflowcx_v3/test_webhooks.py @@ -82,19 +82,25 @@ def test__get_default_mtls_endpoint(): assert WebhooksClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [WebhooksClient, WebhooksAsyncClient,]) -def test_webhooks_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (WebhooksClient, "grpc"), + (WebhooksAsyncClient, "grpc_asyncio"), + ], +) +def test_webhooks_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -122,22 +128,32 @@ def test_webhooks_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [WebhooksClient, WebhooksAsyncClient,]) -def test_webhooks_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (WebhooksClient, "grpc"), + (WebhooksAsyncClient, "grpc_asyncio"), + ], +) +def test_webhooks_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_webhooks_client_get_transport_class(): @@ -467,7 +483,9 @@ def test_webhooks_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -598,10 +616,17 @@ def test_webhooks_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [webhook.ListWebhooksRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + webhook.ListWebhooksRequest, + dict, + ], +) def test_list_webhooks(request_type, transport: str = "grpc"): client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -630,7 +655,8 @@ def test_list_webhooks_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -646,7 +672,8 @@ async def test_list_webhooks_async( transport: str = "grpc_asyncio", request_type=webhook.ListWebhooksRequest ): client = WebhooksAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -657,7 +684,9 @@ async def test_list_webhooks_async( with mock.patch.object(type(client.transport.list_webhooks), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - webhook.ListWebhooksResponse(next_page_token="next_page_token_value",) + webhook.ListWebhooksResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_webhooks(request) @@ -677,13 +706,15 @@ async def test_list_webhooks_async_from_dict(): def test_list_webhooks_field_headers(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = webhook.ListWebhooksRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_webhooks), "__call__") as call: @@ -697,18 +728,23 @@ def test_list_webhooks_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_webhooks_field_headers_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = webhook.ListWebhooksRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_webhooks), "__call__") as call: @@ -724,11 +760,16 @@ async def test_list_webhooks_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_webhooks_flattened(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_webhooks), "__call__") as call: @@ -736,7 +777,9 @@ def test_list_webhooks_flattened(): call.return_value = webhook.ListWebhooksResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_webhooks(parent="parent_value",) + client.list_webhooks( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -748,19 +791,24 @@ def test_list_webhooks_flattened(): def test_list_webhooks_flattened_error(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_webhooks( - webhook.ListWebhooksRequest(), parent="parent_value", + webhook.ListWebhooksRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_webhooks_flattened_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_webhooks), "__call__") as call: @@ -772,7 +820,9 @@ async def test_list_webhooks_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_webhooks(parent="parent_value",) + response = await client.list_webhooks( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -785,19 +835,23 @@ async def test_list_webhooks_flattened_async(): @pytest.mark.asyncio async def test_list_webhooks_flattened_error_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_webhooks( - webhook.ListWebhooksRequest(), parent="parent_value", + webhook.ListWebhooksRequest(), + parent="parent_value", ) def test_list_webhooks_pager(transport_name: str = "grpc"): client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -805,15 +859,28 @@ def test_list_webhooks_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(), webhook.Webhook(), webhook.Webhook(),], + webhooks=[ + webhook.Webhook(), + webhook.Webhook(), + webhook.Webhook(), + ], next_page_token="abc", ), - webhook.ListWebhooksResponse(webhooks=[], next_page_token="def",), webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(),], next_page_token="ghi", + webhooks=[], + next_page_token="def", + ), + webhook.ListWebhooksResponse( + webhooks=[ + webhook.Webhook(), + ], + next_page_token="ghi", ), webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(), webhook.Webhook(),], + webhooks=[ + webhook.Webhook(), + webhook.Webhook(), + ], ), RuntimeError, ) @@ -826,14 +893,15 @@ def test_list_webhooks_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, webhook.Webhook) for i in results) def test_list_webhooks_pages(transport_name: str = "grpc"): client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -841,15 +909,28 @@ def test_list_webhooks_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(), webhook.Webhook(), webhook.Webhook(),], + webhooks=[ + webhook.Webhook(), + webhook.Webhook(), + webhook.Webhook(), + ], next_page_token="abc", ), - webhook.ListWebhooksResponse(webhooks=[], next_page_token="def",), webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(),], next_page_token="ghi", + webhooks=[], + next_page_token="def", ), webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(), webhook.Webhook(),], + webhooks=[ + webhook.Webhook(), + ], + next_page_token="ghi", + ), + webhook.ListWebhooksResponse( + webhooks=[ + webhook.Webhook(), + webhook.Webhook(), + ], ), RuntimeError, ) @@ -860,7 +941,9 @@ def test_list_webhooks_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_webhooks_async_pager(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -869,22 +952,37 @@ async def test_list_webhooks_async_pager(): # Set the response to a series of pages. call.side_effect = ( webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(), webhook.Webhook(), webhook.Webhook(),], + webhooks=[ + webhook.Webhook(), + webhook.Webhook(), + webhook.Webhook(), + ], next_page_token="abc", ), - webhook.ListWebhooksResponse(webhooks=[], next_page_token="def",), webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(),], next_page_token="ghi", + webhooks=[], + next_page_token="def", + ), + webhook.ListWebhooksResponse( + webhooks=[ + webhook.Webhook(), + ], + next_page_token="ghi", ), webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(), webhook.Webhook(),], + webhooks=[ + webhook.Webhook(), + webhook.Webhook(), + ], ), RuntimeError, ) - async_pager = await client.list_webhooks(request={},) + async_pager = await client.list_webhooks( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -893,7 +991,9 @@ async def test_list_webhooks_async_pager(): @pytest.mark.asyncio async def test_list_webhooks_async_pages(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -902,29 +1002,51 @@ async def test_list_webhooks_async_pages(): # Set the response to a series of pages. call.side_effect = ( webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(), webhook.Webhook(), webhook.Webhook(),], + webhooks=[ + webhook.Webhook(), + webhook.Webhook(), + webhook.Webhook(), + ], next_page_token="abc", ), - webhook.ListWebhooksResponse(webhooks=[], next_page_token="def",), webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(),], next_page_token="ghi", + webhooks=[], + next_page_token="def", + ), + webhook.ListWebhooksResponse( + webhooks=[ + webhook.Webhook(), + ], + next_page_token="ghi", ), webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(), webhook.Webhook(),], + webhooks=[ + webhook.Webhook(), + webhook.Webhook(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_webhooks(request={})).pages: + async for page_ in ( + await client.list_webhooks(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [webhook.GetWebhookRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + webhook.GetWebhookRequest, + dict, + ], +) def test_get_webhook(request_type, transport: str = "grpc"): client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -958,7 +1080,8 @@ def test_get_webhook_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -974,7 +1097,8 @@ async def test_get_webhook_async( transport: str = "grpc_asyncio", request_type=webhook.GetWebhookRequest ): client = WebhooksAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -986,7 +1110,9 @@ async def test_get_webhook_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( webhook.Webhook( - name="name_value", display_name="display_name_value", disabled=True, + name="name_value", + display_name="display_name_value", + disabled=True, ) ) response = await client.get_webhook(request) @@ -1009,13 +1135,15 @@ async def test_get_webhook_async_from_dict(): def test_get_webhook_field_headers(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = webhook.GetWebhookRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_webhook), "__call__") as call: @@ -1029,18 +1157,23 @@ def test_get_webhook_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_webhook_field_headers_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = webhook.GetWebhookRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_webhook), "__call__") as call: @@ -1054,11 +1187,16 @@ async def test_get_webhook_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_webhook_flattened(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_webhook), "__call__") as call: @@ -1066,7 +1204,9 @@ def test_get_webhook_flattened(): call.return_value = webhook.Webhook() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_webhook(name="name_value",) + client.get_webhook( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1078,19 +1218,24 @@ def test_get_webhook_flattened(): def test_get_webhook_flattened_error(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_webhook( - webhook.GetWebhookRequest(), name="name_value", + webhook.GetWebhookRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_webhook_flattened_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_webhook), "__call__") as call: @@ -1100,7 +1245,9 @@ async def test_get_webhook_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(webhook.Webhook()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_webhook(name="name_value",) + response = await client.get_webhook( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1113,20 +1260,30 @@ async def test_get_webhook_flattened_async(): @pytest.mark.asyncio async def test_get_webhook_flattened_error_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_webhook( - webhook.GetWebhookRequest(), name="name_value", + webhook.GetWebhookRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [gcdc_webhook.CreateWebhookRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_webhook.CreateWebhookRequest, + dict, + ], +) def test_create_webhook(request_type, transport: str = "grpc"): client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1160,7 +1317,8 @@ def test_create_webhook_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1176,7 +1334,8 @@ async def test_create_webhook_async( transport: str = "grpc_asyncio", request_type=gcdc_webhook.CreateWebhookRequest ): client = WebhooksAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1188,7 +1347,9 @@ async def test_create_webhook_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( gcdc_webhook.Webhook( - name="name_value", display_name="display_name_value", disabled=True, + name="name_value", + display_name="display_name_value", + disabled=True, ) ) response = await client.create_webhook(request) @@ -1211,13 +1372,15 @@ async def test_create_webhook_async_from_dict(): def test_create_webhook_field_headers(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_webhook.CreateWebhookRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_webhook), "__call__") as call: @@ -1231,18 +1394,23 @@ def test_create_webhook_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_webhook_field_headers_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_webhook.CreateWebhookRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_webhook), "__call__") as call: @@ -1258,11 +1426,16 @@ async def test_create_webhook_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_webhook_flattened(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_webhook), "__call__") as call: @@ -1271,7 +1444,8 @@ def test_create_webhook_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_webhook( - parent="parent_value", webhook=gcdc_webhook.Webhook(name="name_value"), + parent="parent_value", + webhook=gcdc_webhook.Webhook(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1287,7 +1461,9 @@ def test_create_webhook_flattened(): def test_create_webhook_flattened_error(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1301,7 +1477,9 @@ def test_create_webhook_flattened_error(): @pytest.mark.asyncio async def test_create_webhook_flattened_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_webhook), "__call__") as call: @@ -1314,7 +1492,8 @@ async def test_create_webhook_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_webhook( - parent="parent_value", webhook=gcdc_webhook.Webhook(name="name_value"), + parent="parent_value", + webhook=gcdc_webhook.Webhook(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1331,7 +1510,9 @@ async def test_create_webhook_flattened_async(): @pytest.mark.asyncio async def test_create_webhook_flattened_error_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1343,10 +1524,17 @@ async def test_create_webhook_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [gcdc_webhook.UpdateWebhookRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_webhook.UpdateWebhookRequest, + dict, + ], +) def test_update_webhook(request_type, transport: str = "grpc"): client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1380,7 +1568,8 @@ def test_update_webhook_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1396,7 +1585,8 @@ async def test_update_webhook_async( transport: str = "grpc_asyncio", request_type=gcdc_webhook.UpdateWebhookRequest ): client = WebhooksAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1408,7 +1598,9 @@ async def test_update_webhook_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( gcdc_webhook.Webhook( - name="name_value", display_name="display_name_value", disabled=True, + name="name_value", + display_name="display_name_value", + disabled=True, ) ) response = await client.update_webhook(request) @@ -1431,13 +1623,15 @@ async def test_update_webhook_async_from_dict(): def test_update_webhook_field_headers(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_webhook.UpdateWebhookRequest() - request.webhook.name = "webhook.name/value" + request.webhook.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_webhook), "__call__") as call: @@ -1451,20 +1645,23 @@ def test_update_webhook_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "webhook.name=webhook.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "webhook.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_webhook_field_headers_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_webhook.UpdateWebhookRequest() - request.webhook.name = "webhook.name/value" + request.webhook.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_webhook), "__call__") as call: @@ -1480,13 +1677,16 @@ async def test_update_webhook_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "webhook.name=webhook.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "webhook.name=name_value", + ) in kw["metadata"] def test_update_webhook_flattened(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_webhook), "__call__") as call: @@ -1512,7 +1712,9 @@ def test_update_webhook_flattened(): def test_update_webhook_flattened_error(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1526,7 +1728,9 @@ def test_update_webhook_flattened_error(): @pytest.mark.asyncio async def test_update_webhook_flattened_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_webhook), "__call__") as call: @@ -1557,7 +1761,9 @@ async def test_update_webhook_flattened_async(): @pytest.mark.asyncio async def test_update_webhook_flattened_error_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1569,10 +1775,17 @@ async def test_update_webhook_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [webhook.DeleteWebhookRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + webhook.DeleteWebhookRequest, + dict, + ], +) def test_delete_webhook(request_type, transport: str = "grpc"): client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1598,7 +1811,8 @@ def test_delete_webhook_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1614,7 +1828,8 @@ async def test_delete_webhook_async( transport: str = "grpc_asyncio", request_type=webhook.DeleteWebhookRequest ): client = WebhooksAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1642,13 +1857,15 @@ async def test_delete_webhook_async_from_dict(): def test_delete_webhook_field_headers(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = webhook.DeleteWebhookRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_webhook), "__call__") as call: @@ -1662,18 +1879,23 @@ def test_delete_webhook_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_webhook_field_headers_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = webhook.DeleteWebhookRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_webhook), "__call__") as call: @@ -1687,11 +1909,16 @@ async def test_delete_webhook_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_webhook_flattened(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_webhook), "__call__") as call: @@ -1699,7 +1926,9 @@ def test_delete_webhook_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_webhook(name="name_value",) + client.delete_webhook( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1711,19 +1940,24 @@ def test_delete_webhook_flattened(): def test_delete_webhook_flattened_error(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_webhook( - webhook.DeleteWebhookRequest(), name="name_value", + webhook.DeleteWebhookRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_webhook_flattened_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_webhook), "__call__") as call: @@ -1733,7 +1967,9 @@ async def test_delete_webhook_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_webhook(name="name_value",) + response = await client.delete_webhook( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1746,13 +1982,16 @@ async def test_delete_webhook_flattened_async(): @pytest.mark.asyncio async def test_delete_webhook_flattened_error_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_webhook( - webhook.DeleteWebhookRequest(), name="name_value", + webhook.DeleteWebhookRequest(), + name="name_value", ) @@ -1763,7 +2002,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1783,7 +2023,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = WebhooksClient(client_options=options, transport=transport,) + client = WebhooksClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1799,7 +2042,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = WebhooksClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1829,7 +2073,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.WebhooksGrpcTransport, transports.WebhooksGrpcAsyncIOTransport,], + [ + transports.WebhooksGrpcTransport, + transports.WebhooksGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1839,10 +2086,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = WebhooksClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.WebhooksGrpcTransport,) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.WebhooksGrpcTransport, + ) def test_webhooks_base_transport_error(): @@ -1880,6 +2145,14 @@ def test_webhooks_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_webhooks_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1891,7 +2164,8 @@ def test_webhooks_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.WebhooksTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1932,7 +2206,10 @@ def test_webhooks_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.WebhooksGrpcTransport, transports.WebhooksGrpcAsyncIOTransport,], + [ + transports.WebhooksGrpcTransport, + transports.WebhooksGrpcAsyncIOTransport, + ], ) def test_webhooks_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2030,24 +2307,40 @@ def test_webhooks_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_webhooks_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_webhooks_host_no_port(transport_name): client = WebhooksClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_webhooks_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_webhooks_host_with_port(transport_name): client = WebhooksClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_webhooks_grpc_transport_channel(): @@ -2055,7 +2348,8 @@ def test_webhooks_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.WebhooksGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2067,7 +2361,8 @@ def test_webhooks_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.WebhooksGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2172,7 +2467,10 @@ def test_service_path(): namespace = "whelk" service = "octopus" expected = "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}".format( - project=project, location=location, namespace=namespace, service=service, + project=project, + location=location, + namespace=namespace, + service=service, ) actual = WebhooksClient.service_path(project, location, namespace, service) assert expected == actual @@ -2198,7 +2496,10 @@ def test_webhook_path(): agent = "scallop" webhook = "abalone" expected = "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) actual = WebhooksClient.webhook_path(project, location, agent, webhook) assert expected == actual @@ -2240,7 +2541,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = WebhooksClient.common_folder_path(folder) assert expected == actual @@ -2258,7 +2561,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "winkle" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = WebhooksClient.common_organization_path(organization) assert expected == actual @@ -2276,7 +2581,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "scallop" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = WebhooksClient.common_project_path(project) assert expected == actual @@ -2296,7 +2603,8 @@ def test_common_location_path(): project = "squid" location = "clam" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = WebhooksClient.common_location_path(project, location) assert expected == actual @@ -2321,7 +2629,8 @@ def test_client_with_default_client_info(): transports.WebhooksTransport, "_prep_wrapped_messages" ) as prep: client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2330,7 +2639,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = WebhooksClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2338,7 +2648,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = WebhooksAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_agents.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_agents.py index 1a4331c5..a2d1735e 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_agents.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_agents.py @@ -88,19 +88,25 @@ def test__get_default_mtls_endpoint(): assert AgentsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [AgentsClient, AgentsAsyncClient,]) -def test_agents_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (AgentsClient, "grpc"), + (AgentsAsyncClient, "grpc_asyncio"), + ], +) +def test_agents_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -126,22 +132,32 @@ def test_agents_client_service_account_always_use_jwt(transport_class, transport use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [AgentsClient, AgentsAsyncClient,]) -def test_agents_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (AgentsClient, "grpc"), + (AgentsAsyncClient, "grpc_asyncio"), + ], +) +def test_agents_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_agents_client_get_transport_class(): @@ -465,7 +481,9 @@ def test_agents_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -596,10 +614,17 @@ def test_agents_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [agent.ListAgentsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + agent.ListAgentsRequest, + dict, + ], +) def test_list_agents(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -628,7 +653,8 @@ def test_list_agents_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -644,7 +670,8 @@ async def test_list_agents_async( transport: str = "grpc_asyncio", request_type=agent.ListAgentsRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -655,7 +682,9 @@ async def test_list_agents_async( with mock.patch.object(type(client.transport.list_agents), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - agent.ListAgentsResponse(next_page_token="next_page_token_value",) + agent.ListAgentsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_agents(request) @@ -675,13 +704,15 @@ async def test_list_agents_async_from_dict(): def test_list_agents_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.ListAgentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_agents), "__call__") as call: @@ -695,18 +726,23 @@ def test_list_agents_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_agents_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.ListAgentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_agents), "__call__") as call: @@ -722,11 +758,16 @@ async def test_list_agents_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_agents_flattened(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_agents), "__call__") as call: @@ -734,7 +775,9 @@ def test_list_agents_flattened(): call.return_value = agent.ListAgentsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_agents(parent="parent_value",) + client.list_agents( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -746,19 +789,24 @@ def test_list_agents_flattened(): def test_list_agents_flattened_error(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_agents( - agent.ListAgentsRequest(), parent="parent_value", + agent.ListAgentsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_agents_flattened_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_agents), "__call__") as call: @@ -770,7 +818,9 @@ async def test_list_agents_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_agents(parent="parent_value",) + response = await client.list_agents( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -783,19 +833,23 @@ async def test_list_agents_flattened_async(): @pytest.mark.asyncio async def test_list_agents_flattened_error_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_agents( - agent.ListAgentsRequest(), parent="parent_value", + agent.ListAgentsRequest(), + parent="parent_value", ) def test_list_agents_pager(transport_name: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -803,12 +857,29 @@ def test_list_agents_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( agent.ListAgentsResponse( - agents=[agent.Agent(), agent.Agent(), agent.Agent(),], + agents=[ + agent.Agent(), + agent.Agent(), + agent.Agent(), + ], next_page_token="abc", ), - agent.ListAgentsResponse(agents=[], next_page_token="def",), - agent.ListAgentsResponse(agents=[agent.Agent(),], next_page_token="ghi",), - agent.ListAgentsResponse(agents=[agent.Agent(), agent.Agent(),],), + agent.ListAgentsResponse( + agents=[], + next_page_token="def", + ), + agent.ListAgentsResponse( + agents=[ + agent.Agent(), + ], + next_page_token="ghi", + ), + agent.ListAgentsResponse( + agents=[ + agent.Agent(), + agent.Agent(), + ], + ), RuntimeError, ) @@ -820,14 +891,15 @@ def test_list_agents_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, agent.Agent) for i in results) def test_list_agents_pages(transport_name: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -835,12 +907,29 @@ def test_list_agents_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( agent.ListAgentsResponse( - agents=[agent.Agent(), agent.Agent(), agent.Agent(),], + agents=[ + agent.Agent(), + agent.Agent(), + agent.Agent(), + ], next_page_token="abc", ), - agent.ListAgentsResponse(agents=[], next_page_token="def",), - agent.ListAgentsResponse(agents=[agent.Agent(),], next_page_token="ghi",), - agent.ListAgentsResponse(agents=[agent.Agent(), agent.Agent(),],), + agent.ListAgentsResponse( + agents=[], + next_page_token="def", + ), + agent.ListAgentsResponse( + agents=[ + agent.Agent(), + ], + next_page_token="ghi", + ), + agent.ListAgentsResponse( + agents=[ + agent.Agent(), + agent.Agent(), + ], + ), RuntimeError, ) pages = list(client.list_agents(request={}).pages) @@ -850,7 +939,9 @@ def test_list_agents_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_agents_async_pager(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -859,18 +950,37 @@ async def test_list_agents_async_pager(): # Set the response to a series of pages. call.side_effect = ( agent.ListAgentsResponse( - agents=[agent.Agent(), agent.Agent(), agent.Agent(),], + agents=[ + agent.Agent(), + agent.Agent(), + agent.Agent(), + ], next_page_token="abc", ), - agent.ListAgentsResponse(agents=[], next_page_token="def",), - agent.ListAgentsResponse(agents=[agent.Agent(),], next_page_token="ghi",), - agent.ListAgentsResponse(agents=[agent.Agent(), agent.Agent(),],), + agent.ListAgentsResponse( + agents=[], + next_page_token="def", + ), + agent.ListAgentsResponse( + agents=[ + agent.Agent(), + ], + next_page_token="ghi", + ), + agent.ListAgentsResponse( + agents=[ + agent.Agent(), + agent.Agent(), + ], + ), RuntimeError, ) - async_pager = await client.list_agents(request={},) + async_pager = await client.list_agents( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -879,7 +989,9 @@ async def test_list_agents_async_pager(): @pytest.mark.asyncio async def test_list_agents_async_pages(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -888,25 +1000,51 @@ async def test_list_agents_async_pages(): # Set the response to a series of pages. call.side_effect = ( agent.ListAgentsResponse( - agents=[agent.Agent(), agent.Agent(), agent.Agent(),], + agents=[ + agent.Agent(), + agent.Agent(), + agent.Agent(), + ], next_page_token="abc", ), - agent.ListAgentsResponse(agents=[], next_page_token="def",), - agent.ListAgentsResponse(agents=[agent.Agent(),], next_page_token="ghi",), - agent.ListAgentsResponse(agents=[agent.Agent(), agent.Agent(),],), + agent.ListAgentsResponse( + agents=[], + next_page_token="def", + ), + agent.ListAgentsResponse( + agents=[ + agent.Agent(), + ], + next_page_token="ghi", + ), + agent.ListAgentsResponse( + agents=[ + agent.Agent(), + agent.Agent(), + ], + ), RuntimeError, ) pages = [] - async for page_ in (await client.list_agents(request={})).pages: + async for page_ in ( + await client.list_agents(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [agent.GetAgentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + agent.GetAgentRequest, + dict, + ], +) def test_get_agent(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -928,6 +1066,7 @@ def test_get_agent(request_type, transport: str = "grpc"): security_settings="security_settings_value", enable_stackdriver_logging=True, enable_spell_correction=True, + locked=True, ) response = client.get_agent(request) @@ -949,13 +1088,15 @@ def test_get_agent(request_type, transport: str = "grpc"): assert response.security_settings == "security_settings_value" assert response.enable_stackdriver_logging is True assert response.enable_spell_correction is True + assert response.locked is True def test_get_agent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -971,7 +1112,8 @@ async def test_get_agent_async( transport: str = "grpc_asyncio", request_type=agent.GetAgentRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -994,6 +1136,7 @@ async def test_get_agent_async( security_settings="security_settings_value", enable_stackdriver_logging=True, enable_spell_correction=True, + locked=True, ) ) response = await client.get_agent(request) @@ -1016,6 +1159,7 @@ async def test_get_agent_async( assert response.security_settings == "security_settings_value" assert response.enable_stackdriver_logging is True assert response.enable_spell_correction is True + assert response.locked is True @pytest.mark.asyncio @@ -1024,13 +1168,15 @@ async def test_get_agent_async_from_dict(): def test_get_agent_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.GetAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_agent), "__call__") as call: @@ -1044,18 +1190,23 @@ def test_get_agent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_agent_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.GetAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_agent), "__call__") as call: @@ -1069,11 +1220,16 @@ async def test_get_agent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_agent_flattened(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_agent), "__call__") as call: @@ -1081,7 +1237,9 @@ def test_get_agent_flattened(): call.return_value = agent.Agent() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_agent(name="name_value",) + client.get_agent( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1093,19 +1251,24 @@ def test_get_agent_flattened(): def test_get_agent_flattened_error(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_agent( - agent.GetAgentRequest(), name="name_value", + agent.GetAgentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_agent_flattened_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_agent), "__call__") as call: @@ -1115,7 +1278,9 @@ async def test_get_agent_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(agent.Agent()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_agent(name="name_value",) + response = await client.get_agent( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1128,20 +1293,30 @@ async def test_get_agent_flattened_async(): @pytest.mark.asyncio async def test_get_agent_flattened_error_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_agent( - agent.GetAgentRequest(), name="name_value", + agent.GetAgentRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [gcdc_agent.CreateAgentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_agent.CreateAgentRequest, + dict, + ], +) def test_create_agent(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1163,6 +1338,7 @@ def test_create_agent(request_type, transport: str = "grpc"): security_settings="security_settings_value", enable_stackdriver_logging=True, enable_spell_correction=True, + locked=True, ) response = client.create_agent(request) @@ -1184,13 +1360,15 @@ def test_create_agent(request_type, transport: str = "grpc"): assert response.security_settings == "security_settings_value" assert response.enable_stackdriver_logging is True assert response.enable_spell_correction is True + assert response.locked is True def test_create_agent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1206,7 +1384,8 @@ async def test_create_agent_async( transport: str = "grpc_asyncio", request_type=gcdc_agent.CreateAgentRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1229,6 +1408,7 @@ async def test_create_agent_async( security_settings="security_settings_value", enable_stackdriver_logging=True, enable_spell_correction=True, + locked=True, ) ) response = await client.create_agent(request) @@ -1251,6 +1431,7 @@ async def test_create_agent_async( assert response.security_settings == "security_settings_value" assert response.enable_stackdriver_logging is True assert response.enable_spell_correction is True + assert response.locked is True @pytest.mark.asyncio @@ -1259,13 +1440,15 @@ async def test_create_agent_async_from_dict(): def test_create_agent_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_agent.CreateAgentRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_agent), "__call__") as call: @@ -1279,18 +1462,23 @@ def test_create_agent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_agent_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_agent.CreateAgentRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_agent), "__call__") as call: @@ -1304,11 +1492,16 @@ async def test_create_agent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_agent_flattened(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_agent), "__call__") as call: @@ -1317,7 +1510,8 @@ def test_create_agent_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_agent( - parent="parent_value", agent=gcdc_agent.Agent(name="name_value"), + parent="parent_value", + agent=gcdc_agent.Agent(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1333,7 +1527,9 @@ def test_create_agent_flattened(): def test_create_agent_flattened_error(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1347,7 +1543,9 @@ def test_create_agent_flattened_error(): @pytest.mark.asyncio async def test_create_agent_flattened_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_agent), "__call__") as call: @@ -1358,7 +1556,8 @@ async def test_create_agent_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_agent( - parent="parent_value", agent=gcdc_agent.Agent(name="name_value"), + parent="parent_value", + agent=gcdc_agent.Agent(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1375,7 +1574,9 @@ async def test_create_agent_flattened_async(): @pytest.mark.asyncio async def test_create_agent_flattened_error_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1387,10 +1588,17 @@ async def test_create_agent_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [gcdc_agent.UpdateAgentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_agent.UpdateAgentRequest, + dict, + ], +) def test_update_agent(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1412,6 +1620,7 @@ def test_update_agent(request_type, transport: str = "grpc"): security_settings="security_settings_value", enable_stackdriver_logging=True, enable_spell_correction=True, + locked=True, ) response = client.update_agent(request) @@ -1433,13 +1642,15 @@ def test_update_agent(request_type, transport: str = "grpc"): assert response.security_settings == "security_settings_value" assert response.enable_stackdriver_logging is True assert response.enable_spell_correction is True + assert response.locked is True def test_update_agent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1455,7 +1666,8 @@ async def test_update_agent_async( transport: str = "grpc_asyncio", request_type=gcdc_agent.UpdateAgentRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1478,6 +1690,7 @@ async def test_update_agent_async( security_settings="security_settings_value", enable_stackdriver_logging=True, enable_spell_correction=True, + locked=True, ) ) response = await client.update_agent(request) @@ -1500,6 +1713,7 @@ async def test_update_agent_async( assert response.security_settings == "security_settings_value" assert response.enable_stackdriver_logging is True assert response.enable_spell_correction is True + assert response.locked is True @pytest.mark.asyncio @@ -1508,13 +1722,15 @@ async def test_update_agent_async_from_dict(): def test_update_agent_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_agent.UpdateAgentRequest() - request.agent.name = "agent.name/value" + request.agent.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_agent), "__call__") as call: @@ -1528,18 +1744,23 @@ def test_update_agent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "agent.name=agent.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "agent.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_agent_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_agent.UpdateAgentRequest() - request.agent.name = "agent.name/value" + request.agent.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_agent), "__call__") as call: @@ -1553,11 +1774,16 @@ async def test_update_agent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "agent.name=agent.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "agent.name=name_value", + ) in kw["metadata"] def test_update_agent_flattened(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_agent), "__call__") as call: @@ -1583,7 +1809,9 @@ def test_update_agent_flattened(): def test_update_agent_flattened_error(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1597,7 +1825,9 @@ def test_update_agent_flattened_error(): @pytest.mark.asyncio async def test_update_agent_flattened_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_agent), "__call__") as call: @@ -1626,7 +1856,9 @@ async def test_update_agent_flattened_async(): @pytest.mark.asyncio async def test_update_agent_flattened_error_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1638,10 +1870,17 @@ async def test_update_agent_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [agent.DeleteAgentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + agent.DeleteAgentRequest, + dict, + ], +) def test_delete_agent(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1667,7 +1906,8 @@ def test_delete_agent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1683,7 +1923,8 @@ async def test_delete_agent_async( transport: str = "grpc_asyncio", request_type=agent.DeleteAgentRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1711,13 +1952,15 @@ async def test_delete_agent_async_from_dict(): def test_delete_agent_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.DeleteAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_agent), "__call__") as call: @@ -1731,18 +1974,23 @@ def test_delete_agent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_agent_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.DeleteAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_agent), "__call__") as call: @@ -1756,11 +2004,16 @@ async def test_delete_agent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_agent_flattened(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_agent), "__call__") as call: @@ -1768,7 +2021,9 @@ def test_delete_agent_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_agent(name="name_value",) + client.delete_agent( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1780,19 +2035,24 @@ def test_delete_agent_flattened(): def test_delete_agent_flattened_error(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_agent( - agent.DeleteAgentRequest(), name="name_value", + agent.DeleteAgentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_agent_flattened_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_agent), "__call__") as call: @@ -1802,7 +2062,9 @@ async def test_delete_agent_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_agent(name="name_value",) + response = await client.delete_agent( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1815,20 +2077,30 @@ async def test_delete_agent_flattened_async(): @pytest.mark.asyncio async def test_delete_agent_flattened_error_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_agent( - agent.DeleteAgentRequest(), name="name_value", + agent.DeleteAgentRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [agent.ExportAgentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + agent.ExportAgentRequest, + dict, + ], +) def test_export_agent(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1854,7 +2126,8 @@ def test_export_agent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1870,7 +2143,8 @@ async def test_export_agent_async( transport: str = "grpc_asyncio", request_type=agent.ExportAgentRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1900,13 +2174,15 @@ async def test_export_agent_async_from_dict(): def test_export_agent_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.ExportAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.export_agent), "__call__") as call: @@ -1920,18 +2196,23 @@ def test_export_agent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_export_agent_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.ExportAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.export_agent), "__call__") as call: @@ -1947,13 +2228,23 @@ async def test_export_agent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [agent.RestoreAgentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + agent.RestoreAgentRequest, + dict, + ], +) def test_restore_agent(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1979,7 +2270,8 @@ def test_restore_agent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1995,7 +2287,8 @@ async def test_restore_agent_async( transport: str = "grpc_asyncio", request_type=agent.RestoreAgentRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2025,13 +2318,15 @@ async def test_restore_agent_async_from_dict(): def test_restore_agent_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.RestoreAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.restore_agent), "__call__") as call: @@ -2045,18 +2340,23 @@ def test_restore_agent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_restore_agent_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.RestoreAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.restore_agent), "__call__") as call: @@ -2072,13 +2372,23 @@ async def test_restore_agent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [agent.ValidateAgentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + agent.ValidateAgentRequest, + dict, + ], +) def test_validate_agent(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2088,7 +2398,9 @@ def test_validate_agent(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.validate_agent), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = agent.AgentValidationResult(name="name_value",) + call.return_value = agent.AgentValidationResult( + name="name_value", + ) response = client.validate_agent(request) # Establish that the underlying gRPC stub method was called. @@ -2105,7 +2417,8 @@ def test_validate_agent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2121,7 +2434,8 @@ async def test_validate_agent_async( transport: str = "grpc_asyncio", request_type=agent.ValidateAgentRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2132,7 +2446,9 @@ async def test_validate_agent_async( with mock.patch.object(type(client.transport.validate_agent), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - agent.AgentValidationResult(name="name_value",) + agent.AgentValidationResult( + name="name_value", + ) ) response = await client.validate_agent(request) @@ -2152,13 +2468,15 @@ async def test_validate_agent_async_from_dict(): def test_validate_agent_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.ValidateAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.validate_agent), "__call__") as call: @@ -2172,18 +2490,23 @@ def test_validate_agent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_validate_agent_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.ValidateAgentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.validate_agent), "__call__") as call: @@ -2199,13 +2522,23 @@ async def test_validate_agent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [agent.GetAgentValidationResultRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + agent.GetAgentValidationResultRequest, + dict, + ], +) def test_get_agent_validation_result(request_type, transport: str = "grpc"): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2217,7 +2550,9 @@ def test_get_agent_validation_result(request_type, transport: str = "grpc"): type(client.transport.get_agent_validation_result), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = agent.AgentValidationResult(name="name_value",) + call.return_value = agent.AgentValidationResult( + name="name_value", + ) response = client.get_agent_validation_result(request) # Establish that the underlying gRPC stub method was called. @@ -2234,7 +2569,8 @@ def test_get_agent_validation_result_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2252,7 +2588,8 @@ async def test_get_agent_validation_result_async( transport: str = "grpc_asyncio", request_type=agent.GetAgentValidationResultRequest ): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2265,7 +2602,9 @@ async def test_get_agent_validation_result_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - agent.AgentValidationResult(name="name_value",) + agent.AgentValidationResult( + name="name_value", + ) ) response = await client.get_agent_validation_result(request) @@ -2285,13 +2624,15 @@ async def test_get_agent_validation_result_async_from_dict(): def test_get_agent_validation_result_field_headers(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.GetAgentValidationResultRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2307,18 +2648,23 @@ def test_get_agent_validation_result_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_agent_validation_result_field_headers_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = agent.GetAgentValidationResultRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2336,11 +2682,16 @@ async def test_get_agent_validation_result_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_agent_validation_result_flattened(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2350,7 +2701,9 @@ def test_get_agent_validation_result_flattened(): call.return_value = agent.AgentValidationResult() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_agent_validation_result(name="name_value",) + client.get_agent_validation_result( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2362,19 +2715,24 @@ def test_get_agent_validation_result_flattened(): def test_get_agent_validation_result_flattened_error(): - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_agent_validation_result( - agent.GetAgentValidationResultRequest(), name="name_value", + agent.GetAgentValidationResultRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_agent_validation_result_flattened_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2388,7 +2746,9 @@ async def test_get_agent_validation_result_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_agent_validation_result(name="name_value",) + response = await client.get_agent_validation_result( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2401,13 +2761,16 @@ async def test_get_agent_validation_result_flattened_async(): @pytest.mark.asyncio async def test_get_agent_validation_result_flattened_error_async(): - client = AgentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = AgentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_agent_validation_result( - agent.GetAgentValidationResultRequest(), name="name_value", + agent.GetAgentValidationResultRequest(), + name="name_value", ) @@ -2418,7 +2781,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2438,7 +2802,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = AgentsClient(client_options=options, transport=transport,) + client = AgentsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2454,7 +2821,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AgentsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2484,7 +2852,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.AgentsGrpcTransport, transports.AgentsGrpcAsyncIOTransport,], + [ + transports.AgentsGrpcTransport, + transports.AgentsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2494,10 +2865,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = AgentsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = AgentsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.AgentsGrpcTransport,) + client = AgentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.AgentsGrpcTransport, + ) def test_agents_base_transport_error(): @@ -2544,6 +2933,14 @@ def test_agents_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_agents_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2555,7 +2952,8 @@ def test_agents_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AgentsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2596,7 +2994,10 @@ def test_agents_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.AgentsGrpcTransport, transports.AgentsGrpcAsyncIOTransport,], + [ + transports.AgentsGrpcTransport, + transports.AgentsGrpcAsyncIOTransport, + ], ) def test_agents_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2694,24 +3095,40 @@ def test_agents_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_agents_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_agents_host_no_port(transport_name): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_agents_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_agents_host_with_port(transport_name): client = AgentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_agents_grpc_transport_channel(): @@ -2719,7 +3136,8 @@ def test_agents_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.AgentsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2731,7 +3149,8 @@ def test_agents_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.AgentsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2832,12 +3251,16 @@ def test_agents_transport_channel_mtls_with_adc(transport_class): def test_agents_grpc_lro_client(): client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2845,12 +3268,16 @@ def test_agents_grpc_lro_client(): def test_agents_grpc_lro_async_client(): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2861,7 +3288,9 @@ def test_agent_path(): location = "clam" agent = "whelk" expected = "projects/{project}/locations/{location}/agents/{agent}".format( - project=project, location=location, agent=agent, + project=project, + location=location, + agent=agent, ) actual = AgentsClient.agent_path(project, location, agent) assert expected == actual @@ -2885,7 +3314,9 @@ def test_agent_validation_result_path(): location = "mussel" agent = "winkle" expected = "projects/{project}/locations/{location}/agents/{agent}/validationResult".format( - project=project, location=location, agent=agent, + project=project, + location=location, + agent=agent, ) actual = AgentsClient.agent_validation_result_path(project, location, agent) assert expected == actual @@ -2910,7 +3341,10 @@ def test_environment_path(): agent = "whelk" environment = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}".format( - project=project, location=location, agent=agent, environment=environment, + project=project, + location=location, + agent=agent, + environment=environment, ) actual = AgentsClient.environment_path(project, location, agent, environment) assert expected == actual @@ -2935,8 +3369,13 @@ def test_flow_path(): location = "nautilus" agent = "scallop" flow = "abalone" - expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + expected = ( + "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( + project=project, + location=location, + agent=agent, + flow=flow, + ) ) actual = AgentsClient.flow_path(project, location, agent, flow) assert expected == actual @@ -2962,7 +3401,10 @@ def test_flow_validation_result_path(): agent = "cuttlefish" flow = "mussel" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/validationResult".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) actual = AgentsClient.flow_validation_result_path(project, location, agent, flow) assert expected == actual @@ -2987,7 +3429,9 @@ def test_security_settings_path(): location = "clam" security_settings = "whelk" expected = "projects/{project}/locations/{location}/securitySettings/{security_settings}".format( - project=project, location=location, security_settings=security_settings, + project=project, + location=location, + security_settings=security_settings, ) actual = AgentsClient.security_settings_path(project, location, security_settings) assert expected == actual @@ -3028,7 +3472,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "winkle" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = AgentsClient.common_folder_path(folder) assert expected == actual @@ -3046,7 +3492,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "scallop" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = AgentsClient.common_organization_path(organization) assert expected == actual @@ -3064,7 +3512,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "squid" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = AgentsClient.common_project_path(project) assert expected == actual @@ -3084,7 +3534,8 @@ def test_common_location_path(): project = "whelk" location = "octopus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = AgentsClient.common_location_path(project, location) assert expected == actual @@ -3109,7 +3560,8 @@ def test_client_with_default_client_info(): transports.AgentsTransport, "_prep_wrapped_messages" ) as prep: client = AgentsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3118,7 +3570,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AgentsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3126,7 +3579,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = AgentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_changelogs.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_changelogs.py index 2fd0d217..e8504693 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_changelogs.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_changelogs.py @@ -82,19 +82,25 @@ def test__get_default_mtls_endpoint(): assert ChangelogsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [ChangelogsClient, ChangelogsAsyncClient,]) -def test_changelogs_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ChangelogsClient, "grpc"), + (ChangelogsAsyncClient, "grpc_asyncio"), + ], +) +def test_changelogs_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -122,22 +128,32 @@ def test_changelogs_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [ChangelogsClient, ChangelogsAsyncClient,]) -def test_changelogs_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ChangelogsClient, "grpc"), + (ChangelogsAsyncClient, "grpc_asyncio"), + ], +) +def test_changelogs_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_changelogs_client_get_transport_class(): @@ -477,7 +493,9 @@ def test_changelogs_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -608,10 +626,17 @@ def test_changelogs_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [changelog.ListChangelogsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + changelog.ListChangelogsRequest, + dict, + ], +) def test_list_changelogs(request_type, transport: str = "grpc"): client = ChangelogsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -640,7 +665,8 @@ def test_list_changelogs_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ChangelogsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -656,7 +682,8 @@ async def test_list_changelogs_async( transport: str = "grpc_asyncio", request_type=changelog.ListChangelogsRequest ): client = ChangelogsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -667,7 +694,9 @@ async def test_list_changelogs_async( with mock.patch.object(type(client.transport.list_changelogs), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - changelog.ListChangelogsResponse(next_page_token="next_page_token_value",) + changelog.ListChangelogsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_changelogs(request) @@ -687,13 +716,15 @@ async def test_list_changelogs_async_from_dict(): def test_list_changelogs_field_headers(): - client = ChangelogsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = changelog.ListChangelogsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_changelogs), "__call__") as call: @@ -707,18 +738,23 @@ def test_list_changelogs_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_changelogs_field_headers_async(): - client = ChangelogsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = changelog.ListChangelogsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_changelogs), "__call__") as call: @@ -734,11 +770,16 @@ async def test_list_changelogs_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_changelogs_flattened(): - client = ChangelogsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_changelogs), "__call__") as call: @@ -746,7 +787,9 @@ def test_list_changelogs_flattened(): call.return_value = changelog.ListChangelogsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_changelogs(parent="parent_value",) + client.list_changelogs( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -758,19 +801,24 @@ def test_list_changelogs_flattened(): def test_list_changelogs_flattened_error(): - client = ChangelogsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_changelogs( - changelog.ListChangelogsRequest(), parent="parent_value", + changelog.ListChangelogsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_changelogs_flattened_async(): - client = ChangelogsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_changelogs), "__call__") as call: @@ -782,7 +830,9 @@ async def test_list_changelogs_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_changelogs(parent="parent_value",) + response = await client.list_changelogs( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -795,19 +845,23 @@ async def test_list_changelogs_flattened_async(): @pytest.mark.asyncio async def test_list_changelogs_flattened_error_async(): - client = ChangelogsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_changelogs( - changelog.ListChangelogsRequest(), parent="parent_value", + changelog.ListChangelogsRequest(), + parent="parent_value", ) def test_list_changelogs_pager(transport_name: str = "grpc"): client = ChangelogsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -822,12 +876,21 @@ def test_list_changelogs_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - changelog.ListChangelogsResponse(changelogs=[], next_page_token="def",), changelog.ListChangelogsResponse( - changelogs=[changelog.Changelog(),], next_page_token="ghi", + changelogs=[], + next_page_token="def", ), changelog.ListChangelogsResponse( - changelogs=[changelog.Changelog(), changelog.Changelog(),], + changelogs=[ + changelog.Changelog(), + ], + next_page_token="ghi", + ), + changelog.ListChangelogsResponse( + changelogs=[ + changelog.Changelog(), + changelog.Changelog(), + ], ), RuntimeError, ) @@ -840,14 +903,15 @@ def test_list_changelogs_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, changelog.Changelog) for i in results) def test_list_changelogs_pages(transport_name: str = "grpc"): client = ChangelogsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -862,12 +926,21 @@ def test_list_changelogs_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - changelog.ListChangelogsResponse(changelogs=[], next_page_token="def",), changelog.ListChangelogsResponse( - changelogs=[changelog.Changelog(),], next_page_token="ghi", + changelogs=[], + next_page_token="def", ), changelog.ListChangelogsResponse( - changelogs=[changelog.Changelog(), changelog.Changelog(),], + changelogs=[ + changelog.Changelog(), + ], + next_page_token="ghi", + ), + changelog.ListChangelogsResponse( + changelogs=[ + changelog.Changelog(), + changelog.Changelog(), + ], ), RuntimeError, ) @@ -878,7 +951,9 @@ def test_list_changelogs_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_changelogs_async_pager(): - client = ChangelogsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ChangelogsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -894,19 +969,30 @@ async def test_list_changelogs_async_pager(): ], next_page_token="abc", ), - changelog.ListChangelogsResponse(changelogs=[], next_page_token="def",), changelog.ListChangelogsResponse( - changelogs=[changelog.Changelog(),], next_page_token="ghi", + changelogs=[], + next_page_token="def", ), changelog.ListChangelogsResponse( - changelogs=[changelog.Changelog(), changelog.Changelog(),], + changelogs=[ + changelog.Changelog(), + ], + next_page_token="ghi", + ), + changelog.ListChangelogsResponse( + changelogs=[ + changelog.Changelog(), + changelog.Changelog(), + ], ), RuntimeError, ) - async_pager = await client.list_changelogs(request={},) + async_pager = await client.list_changelogs( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -915,7 +1001,9 @@ async def test_list_changelogs_async_pager(): @pytest.mark.asyncio async def test_list_changelogs_async_pages(): - client = ChangelogsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ChangelogsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -931,26 +1019,44 @@ async def test_list_changelogs_async_pages(): ], next_page_token="abc", ), - changelog.ListChangelogsResponse(changelogs=[], next_page_token="def",), changelog.ListChangelogsResponse( - changelogs=[changelog.Changelog(),], next_page_token="ghi", + changelogs=[], + next_page_token="def", ), changelog.ListChangelogsResponse( - changelogs=[changelog.Changelog(), changelog.Changelog(),], + changelogs=[ + changelog.Changelog(), + ], + next_page_token="ghi", + ), + changelog.ListChangelogsResponse( + changelogs=[ + changelog.Changelog(), + changelog.Changelog(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_changelogs(request={})).pages: + async for page_ in ( + await client.list_changelogs(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [changelog.GetChangelogRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + changelog.GetChangelogRequest, + dict, + ], +) def test_get_changelog(request_type, transport: str = "grpc"): client = ChangelogsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -989,7 +1095,8 @@ def test_get_changelog_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ChangelogsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1005,7 +1112,8 @@ async def test_get_changelog_async( transport: str = "grpc_asyncio", request_type=changelog.GetChangelogRequest ): client = ChangelogsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1048,13 +1156,15 @@ async def test_get_changelog_async_from_dict(): def test_get_changelog_field_headers(): - client = ChangelogsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = changelog.GetChangelogRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_changelog), "__call__") as call: @@ -1068,18 +1178,23 @@ def test_get_changelog_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_changelog_field_headers_async(): - client = ChangelogsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = changelog.GetChangelogRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_changelog), "__call__") as call: @@ -1093,11 +1208,16 @@ async def test_get_changelog_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_changelog_flattened(): - client = ChangelogsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_changelog), "__call__") as call: @@ -1105,7 +1225,9 @@ def test_get_changelog_flattened(): call.return_value = changelog.Changelog() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_changelog(name="name_value",) + client.get_changelog( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1117,19 +1239,24 @@ def test_get_changelog_flattened(): def test_get_changelog_flattened_error(): - client = ChangelogsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_changelog( - changelog.GetChangelogRequest(), name="name_value", + changelog.GetChangelogRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_changelog_flattened_async(): - client = ChangelogsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_changelog), "__call__") as call: @@ -1139,7 +1266,9 @@ async def test_get_changelog_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(changelog.Changelog()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_changelog(name="name_value",) + response = await client.get_changelog( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1152,13 +1281,16 @@ async def test_get_changelog_flattened_async(): @pytest.mark.asyncio async def test_get_changelog_flattened_error_async(): - client = ChangelogsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ChangelogsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_changelog( - changelog.GetChangelogRequest(), name="name_value", + changelog.GetChangelogRequest(), + name="name_value", ) @@ -1169,7 +1301,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ChangelogsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1189,7 +1322,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ChangelogsClient(client_options=options, transport=transport,) + client = ChangelogsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1205,7 +1341,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ChangelogsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1235,7 +1372,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.ChangelogsGrpcTransport, transports.ChangelogsGrpcAsyncIOTransport,], + [ + transports.ChangelogsGrpcTransport, + transports.ChangelogsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1245,10 +1385,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ChangelogsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ChangelogsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ChangelogsGrpcTransport,) + client = ChangelogsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ChangelogsGrpcTransport, + ) def test_changelogs_base_transport_error(): @@ -1283,6 +1441,14 @@ def test_changelogs_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_changelogs_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1294,7 +1460,8 @@ def test_changelogs_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ChangelogsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1335,7 +1502,10 @@ def test_changelogs_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.ChangelogsGrpcTransport, transports.ChangelogsGrpcAsyncIOTransport,], + [ + transports.ChangelogsGrpcTransport, + transports.ChangelogsGrpcAsyncIOTransport, + ], ) def test_changelogs_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -1433,24 +1603,40 @@ def test_changelogs_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_changelogs_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_changelogs_host_no_port(transport_name): client = ChangelogsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_changelogs_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_changelogs_host_with_port(transport_name): client = ChangelogsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_changelogs_grpc_transport_channel(): @@ -1458,7 +1644,8 @@ def test_changelogs_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ChangelogsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1470,7 +1657,8 @@ def test_changelogs_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ChangelogsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1575,7 +1763,10 @@ def test_changelog_path(): agent = "whelk" changelog = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/changelogs/{changelog}".format( - project=project, location=location, agent=agent, changelog=changelog, + project=project, + location=location, + agent=agent, + changelog=changelog, ) actual = ChangelogsClient.changelog_path(project, location, agent, changelog) assert expected == actual @@ -1617,7 +1808,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ChangelogsClient.common_folder_path(folder) assert expected == actual @@ -1635,7 +1828,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ChangelogsClient.common_organization_path(organization) assert expected == actual @@ -1653,7 +1848,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ChangelogsClient.common_project_path(project) assert expected == actual @@ -1673,7 +1870,8 @@ def test_common_location_path(): project = "oyster" location = "nudibranch" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ChangelogsClient.common_location_path(project, location) assert expected == actual @@ -1698,7 +1896,8 @@ def test_client_with_default_client_info(): transports.ChangelogsTransport, "_prep_wrapped_messages" ) as prep: client = ChangelogsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1707,7 +1906,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ChangelogsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1715,7 +1915,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ChangelogsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_deployments.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_deployments.py index 75b600dc..12653ba6 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_deployments.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_deployments.py @@ -84,19 +84,25 @@ def test__get_default_mtls_endpoint(): assert DeploymentsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [DeploymentsClient, DeploymentsAsyncClient,]) -def test_deployments_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (DeploymentsClient, "grpc"), + (DeploymentsAsyncClient, "grpc_asyncio"), + ], +) +def test_deployments_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -124,22 +130,32 @@ def test_deployments_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [DeploymentsClient, DeploymentsAsyncClient,]) -def test_deployments_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (DeploymentsClient, "grpc"), + (DeploymentsAsyncClient, "grpc_asyncio"), + ], +) +def test_deployments_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_deployments_client_get_transport_class(): @@ -479,7 +495,9 @@ def test_deployments_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -610,10 +628,17 @@ def test_deployments_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [deployment.ListDeploymentsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + deployment.ListDeploymentsRequest, + dict, + ], +) def test_list_deployments(request_type, transport: str = "grpc"): client = DeploymentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -642,7 +667,8 @@ def test_list_deployments_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeploymentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -658,7 +684,8 @@ async def test_list_deployments_async( transport: str = "grpc_asyncio", request_type=deployment.ListDeploymentsRequest ): client = DeploymentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -669,7 +696,9 @@ async def test_list_deployments_async( with mock.patch.object(type(client.transport.list_deployments), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - deployment.ListDeploymentsResponse(next_page_token="next_page_token_value",) + deployment.ListDeploymentsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_deployments(request) @@ -689,13 +718,15 @@ async def test_list_deployments_async_from_dict(): def test_list_deployments_field_headers(): - client = DeploymentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = deployment.ListDeploymentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_deployments), "__call__") as call: @@ -709,18 +740,23 @@ def test_list_deployments_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_deployments_field_headers_async(): - client = DeploymentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = deployment.ListDeploymentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_deployments), "__call__") as call: @@ -736,11 +772,16 @@ async def test_list_deployments_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_deployments_flattened(): - client = DeploymentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_deployments), "__call__") as call: @@ -748,7 +789,9 @@ def test_list_deployments_flattened(): call.return_value = deployment.ListDeploymentsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_deployments(parent="parent_value",) + client.list_deployments( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -760,19 +803,24 @@ def test_list_deployments_flattened(): def test_list_deployments_flattened_error(): - client = DeploymentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_deployments( - deployment.ListDeploymentsRequest(), parent="parent_value", + deployment.ListDeploymentsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_deployments_flattened_async(): - client = DeploymentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_deployments), "__call__") as call: @@ -784,7 +832,9 @@ async def test_list_deployments_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_deployments(parent="parent_value",) + response = await client.list_deployments( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -797,19 +847,23 @@ async def test_list_deployments_flattened_async(): @pytest.mark.asyncio async def test_list_deployments_flattened_error_async(): - client = DeploymentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_deployments( - deployment.ListDeploymentsRequest(), parent="parent_value", + deployment.ListDeploymentsRequest(), + parent="parent_value", ) def test_list_deployments_pager(transport_name: str = "grpc"): client = DeploymentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -824,12 +878,21 @@ def test_list_deployments_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - deployment.ListDeploymentsResponse(deployments=[], next_page_token="def",), deployment.ListDeploymentsResponse( - deployments=[deployment.Deployment(),], next_page_token="ghi", + deployments=[], + next_page_token="def", ), deployment.ListDeploymentsResponse( - deployments=[deployment.Deployment(), deployment.Deployment(),], + deployments=[ + deployment.Deployment(), + ], + next_page_token="ghi", + ), + deployment.ListDeploymentsResponse( + deployments=[ + deployment.Deployment(), + deployment.Deployment(), + ], ), RuntimeError, ) @@ -842,14 +905,15 @@ def test_list_deployments_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, deployment.Deployment) for i in results) def test_list_deployments_pages(transport_name: str = "grpc"): client = DeploymentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -864,12 +928,21 @@ def test_list_deployments_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - deployment.ListDeploymentsResponse(deployments=[], next_page_token="def",), deployment.ListDeploymentsResponse( - deployments=[deployment.Deployment(),], next_page_token="ghi", + deployments=[], + next_page_token="def", + ), + deployment.ListDeploymentsResponse( + deployments=[ + deployment.Deployment(), + ], + next_page_token="ghi", ), deployment.ListDeploymentsResponse( - deployments=[deployment.Deployment(), deployment.Deployment(),], + deployments=[ + deployment.Deployment(), + deployment.Deployment(), + ], ), RuntimeError, ) @@ -880,7 +953,9 @@ def test_list_deployments_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_deployments_async_pager(): - client = DeploymentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DeploymentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -896,19 +971,30 @@ async def test_list_deployments_async_pager(): ], next_page_token="abc", ), - deployment.ListDeploymentsResponse(deployments=[], next_page_token="def",), deployment.ListDeploymentsResponse( - deployments=[deployment.Deployment(),], next_page_token="ghi", + deployments=[], + next_page_token="def", ), deployment.ListDeploymentsResponse( - deployments=[deployment.Deployment(), deployment.Deployment(),], + deployments=[ + deployment.Deployment(), + ], + next_page_token="ghi", + ), + deployment.ListDeploymentsResponse( + deployments=[ + deployment.Deployment(), + deployment.Deployment(), + ], ), RuntimeError, ) - async_pager = await client.list_deployments(request={},) + async_pager = await client.list_deployments( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -917,7 +1003,9 @@ async def test_list_deployments_async_pager(): @pytest.mark.asyncio async def test_list_deployments_async_pages(): - client = DeploymentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DeploymentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -933,26 +1021,44 @@ async def test_list_deployments_async_pages(): ], next_page_token="abc", ), - deployment.ListDeploymentsResponse(deployments=[], next_page_token="def",), deployment.ListDeploymentsResponse( - deployments=[deployment.Deployment(),], next_page_token="ghi", + deployments=[], + next_page_token="def", ), deployment.ListDeploymentsResponse( - deployments=[deployment.Deployment(), deployment.Deployment(),], + deployments=[ + deployment.Deployment(), + ], + next_page_token="ghi", + ), + deployment.ListDeploymentsResponse( + deployments=[ + deployment.Deployment(), + deployment.Deployment(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_deployments(request={})).pages: + async for page_ in ( + await client.list_deployments(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [deployment.GetDeploymentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + deployment.GetDeploymentRequest, + dict, + ], +) def test_get_deployment(request_type, transport: str = "grpc"): client = DeploymentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -985,7 +1091,8 @@ def test_get_deployment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeploymentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1001,7 +1108,8 @@ async def test_get_deployment_async( transport: str = "grpc_asyncio", request_type=deployment.GetDeploymentRequest ): client = DeploymentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1038,13 +1146,15 @@ async def test_get_deployment_async_from_dict(): def test_get_deployment_field_headers(): - client = DeploymentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = deployment.GetDeploymentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_deployment), "__call__") as call: @@ -1058,18 +1168,23 @@ def test_get_deployment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_deployment_field_headers_async(): - client = DeploymentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = deployment.GetDeploymentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_deployment), "__call__") as call: @@ -1085,11 +1200,16 @@ async def test_get_deployment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_deployment_flattened(): - client = DeploymentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_deployment), "__call__") as call: @@ -1097,7 +1217,9 @@ def test_get_deployment_flattened(): call.return_value = deployment.Deployment() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_deployment(name="name_value",) + client.get_deployment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1109,19 +1231,24 @@ def test_get_deployment_flattened(): def test_get_deployment_flattened_error(): - client = DeploymentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_deployment( - deployment.GetDeploymentRequest(), name="name_value", + deployment.GetDeploymentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_deployment_flattened_async(): - client = DeploymentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_deployment), "__call__") as call: @@ -1133,7 +1260,9 @@ async def test_get_deployment_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_deployment(name="name_value",) + response = await client.get_deployment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1146,13 +1275,16 @@ async def test_get_deployment_flattened_async(): @pytest.mark.asyncio async def test_get_deployment_flattened_error_async(): - client = DeploymentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeploymentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_deployment( - deployment.GetDeploymentRequest(), name="name_value", + deployment.GetDeploymentRequest(), + name="name_value", ) @@ -1163,7 +1295,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = DeploymentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1183,7 +1316,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = DeploymentsClient(client_options=options, transport=transport,) + client = DeploymentsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1199,7 +1335,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = DeploymentsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1229,7 +1366,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.DeploymentsGrpcTransport, transports.DeploymentsGrpcAsyncIOTransport,], + [ + transports.DeploymentsGrpcTransport, + transports.DeploymentsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1239,10 +1379,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = DeploymentsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = DeploymentsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.DeploymentsGrpcTransport,) + client = DeploymentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.DeploymentsGrpcTransport, + ) def test_deployments_base_transport_error(): @@ -1277,6 +1435,14 @@ def test_deployments_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_deployments_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1288,7 +1454,8 @@ def test_deployments_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.DeploymentsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1329,7 +1496,10 @@ def test_deployments_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.DeploymentsGrpcTransport, transports.DeploymentsGrpcAsyncIOTransport,], + [ + transports.DeploymentsGrpcTransport, + transports.DeploymentsGrpcAsyncIOTransport, + ], ) def test_deployments_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -1427,24 +1597,40 @@ def test_deployments_grpc_transport_client_cert_source_for_mtls(transport_class) ) -def test_deployments_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_deployments_host_no_port(transport_name): client = DeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_deployments_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_deployments_host_with_port(transport_name): client = DeploymentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_deployments_grpc_transport_channel(): @@ -1452,7 +1638,8 @@ def test_deployments_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.DeploymentsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1464,7 +1651,8 @@ def test_deployments_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.DeploymentsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1672,7 +1860,11 @@ def test_version_path(): flow = "nautilus" version = "scallop" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) actual = DeploymentsClient.version_path(project, location, agent, flow, version) assert expected == actual @@ -1715,7 +1907,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = DeploymentsClient.common_folder_path(folder) assert expected == actual @@ -1733,7 +1927,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "winkle" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = DeploymentsClient.common_organization_path(organization) assert expected == actual @@ -1751,7 +1947,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "scallop" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = DeploymentsClient.common_project_path(project) assert expected == actual @@ -1771,7 +1969,8 @@ def test_common_location_path(): project = "squid" location = "clam" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = DeploymentsClient.common_location_path(project, location) assert expected == actual @@ -1796,7 +1995,8 @@ def test_client_with_default_client_info(): transports.DeploymentsTransport, "_prep_wrapped_messages" ) as prep: client = DeploymentsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1805,7 +2005,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = DeploymentsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1813,7 +2014,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = DeploymentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_entity_types.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_entity_types.py index 66d1db42..1f7c14f9 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_entity_types.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_entity_types.py @@ -85,19 +85,25 @@ def test__get_default_mtls_endpoint(): assert EntityTypesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [EntityTypesClient, EntityTypesAsyncClient,]) -def test_entity_types_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (EntityTypesClient, "grpc"), + (EntityTypesAsyncClient, "grpc_asyncio"), + ], +) +def test_entity_types_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -125,22 +131,32 @@ def test_entity_types_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [EntityTypesClient, EntityTypesAsyncClient,]) -def test_entity_types_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (EntityTypesClient, "grpc"), + (EntityTypesAsyncClient, "grpc_asyncio"), + ], +) +def test_entity_types_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_entity_types_client_get_transport_class(): @@ -480,7 +496,9 @@ def test_entity_types_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -611,10 +629,17 @@ def test_entity_types_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [entity_type.ListEntityTypesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + entity_type.ListEntityTypesRequest, + dict, + ], +) def test_list_entity_types(request_type, transport: str = "grpc"): client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -645,7 +670,8 @@ def test_list_entity_types_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -663,7 +689,8 @@ async def test_list_entity_types_async( transport: str = "grpc_asyncio", request_type=entity_type.ListEntityTypesRequest ): client = EntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -698,13 +725,15 @@ async def test_list_entity_types_async_from_dict(): def test_list_entity_types_field_headers(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = entity_type.ListEntityTypesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -720,18 +749,23 @@ def test_list_entity_types_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_entity_types_field_headers_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = entity_type.ListEntityTypesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -749,11 +783,16 @@ async def test_list_entity_types_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_entity_types_flattened(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -763,7 +802,9 @@ def test_list_entity_types_flattened(): call.return_value = entity_type.ListEntityTypesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_entity_types(parent="parent_value",) + client.list_entity_types( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -775,19 +816,24 @@ def test_list_entity_types_flattened(): def test_list_entity_types_flattened_error(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_entity_types( - entity_type.ListEntityTypesRequest(), parent="parent_value", + entity_type.ListEntityTypesRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_entity_types_flattened_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -801,7 +847,9 @@ async def test_list_entity_types_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_entity_types(parent="parent_value",) + response = await client.list_entity_types( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -814,19 +862,23 @@ async def test_list_entity_types_flattened_async(): @pytest.mark.asyncio async def test_list_entity_types_flattened_error_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_entity_types( - entity_type.ListEntityTypesRequest(), parent="parent_value", + entity_type.ListEntityTypesRequest(), + parent="parent_value", ) def test_list_entity_types_pager(transport_name: str = "grpc"): client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -844,13 +896,20 @@ def test_list_entity_types_pager(transport_name: str = "grpc"): next_page_token="abc", ), entity_type.ListEntityTypesResponse( - entity_types=[], next_page_token="def", + entity_types=[], + next_page_token="def", ), entity_type.ListEntityTypesResponse( - entity_types=[entity_type.EntityType(),], next_page_token="ghi", + entity_types=[ + entity_type.EntityType(), + ], + next_page_token="ghi", ), entity_type.ListEntityTypesResponse( - entity_types=[entity_type.EntityType(), entity_type.EntityType(),], + entity_types=[ + entity_type.EntityType(), + entity_type.EntityType(), + ], ), RuntimeError, ) @@ -863,14 +922,15 @@ def test_list_entity_types_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, entity_type.EntityType) for i in results) def test_list_entity_types_pages(transport_name: str = "grpc"): client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -888,13 +948,20 @@ def test_list_entity_types_pages(transport_name: str = "grpc"): next_page_token="abc", ), entity_type.ListEntityTypesResponse( - entity_types=[], next_page_token="def", + entity_types=[], + next_page_token="def", ), entity_type.ListEntityTypesResponse( - entity_types=[entity_type.EntityType(),], next_page_token="ghi", + entity_types=[ + entity_type.EntityType(), + ], + next_page_token="ghi", ), entity_type.ListEntityTypesResponse( - entity_types=[entity_type.EntityType(), entity_type.EntityType(),], + entity_types=[ + entity_type.EntityType(), + entity_type.EntityType(), + ], ), RuntimeError, ) @@ -905,7 +972,9 @@ def test_list_entity_types_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_entity_types_async_pager(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -924,20 +993,29 @@ async def test_list_entity_types_async_pager(): next_page_token="abc", ), entity_type.ListEntityTypesResponse( - entity_types=[], next_page_token="def", + entity_types=[], + next_page_token="def", ), entity_type.ListEntityTypesResponse( - entity_types=[entity_type.EntityType(),], next_page_token="ghi", + entity_types=[ + entity_type.EntityType(), + ], + next_page_token="ghi", ), entity_type.ListEntityTypesResponse( - entity_types=[entity_type.EntityType(), entity_type.EntityType(),], + entity_types=[ + entity_type.EntityType(), + entity_type.EntityType(), + ], ), RuntimeError, ) - async_pager = await client.list_entity_types(request={},) + async_pager = await client.list_entity_types( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -946,7 +1024,9 @@ async def test_list_entity_types_async_pager(): @pytest.mark.asyncio async def test_list_entity_types_async_pages(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -965,27 +1045,43 @@ async def test_list_entity_types_async_pages(): next_page_token="abc", ), entity_type.ListEntityTypesResponse( - entity_types=[], next_page_token="def", + entity_types=[], + next_page_token="def", ), entity_type.ListEntityTypesResponse( - entity_types=[entity_type.EntityType(),], next_page_token="ghi", + entity_types=[ + entity_type.EntityType(), + ], + next_page_token="ghi", ), entity_type.ListEntityTypesResponse( - entity_types=[entity_type.EntityType(), entity_type.EntityType(),], + entity_types=[ + entity_type.EntityType(), + entity_type.EntityType(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_entity_types(request={})).pages: + async for page_ in ( + await client.list_entity_types(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [entity_type.GetEntityTypeRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + entity_type.GetEntityTypeRequest, + dict, + ], +) def test_get_entity_type(request_type, transport: str = "grpc"): client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1027,7 +1123,8 @@ def test_get_entity_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1043,7 +1140,8 @@ async def test_get_entity_type_async( transport: str = "grpc_asyncio", request_type=entity_type.GetEntityTypeRequest ): client = EntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1089,13 +1187,15 @@ async def test_get_entity_type_async_from_dict(): def test_get_entity_type_field_headers(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = entity_type.GetEntityTypeRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_entity_type), "__call__") as call: @@ -1109,18 +1209,23 @@ def test_get_entity_type_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_entity_type_field_headers_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = entity_type.GetEntityTypeRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_entity_type), "__call__") as call: @@ -1136,11 +1241,16 @@ async def test_get_entity_type_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_entity_type_flattened(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_entity_type), "__call__") as call: @@ -1148,7 +1258,9 @@ def test_get_entity_type_flattened(): call.return_value = entity_type.EntityType() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_entity_type(name="name_value",) + client.get_entity_type( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1160,19 +1272,24 @@ def test_get_entity_type_flattened(): def test_get_entity_type_flattened_error(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_entity_type( - entity_type.GetEntityTypeRequest(), name="name_value", + entity_type.GetEntityTypeRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_entity_type_flattened_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_entity_type), "__call__") as call: @@ -1184,7 +1301,9 @@ async def test_get_entity_type_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_entity_type(name="name_value",) + response = await client.get_entity_type( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1197,22 +1316,30 @@ async def test_get_entity_type_flattened_async(): @pytest.mark.asyncio async def test_get_entity_type_flattened_error_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_entity_type( - entity_type.GetEntityTypeRequest(), name="name_value", + entity_type.GetEntityTypeRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [gcdc_entity_type.CreateEntityTypeRequest, dict,] + "request_type", + [ + gcdc_entity_type.CreateEntityTypeRequest, + dict, + ], ) def test_create_entity_type(request_type, transport: str = "grpc"): client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1256,7 +1383,8 @@ def test_create_entity_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1275,7 +1403,8 @@ async def test_create_entity_type_async( request_type=gcdc_entity_type.CreateEntityTypeRequest, ): client = EntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1323,13 +1452,15 @@ async def test_create_entity_type_async_from_dict(): def test_create_entity_type_field_headers(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_entity_type.CreateEntityTypeRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1345,18 +1476,23 @@ def test_create_entity_type_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_entity_type_field_headers_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_entity_type.CreateEntityTypeRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1374,11 +1510,16 @@ async def test_create_entity_type_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_entity_type_flattened(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1406,7 +1547,9 @@ def test_create_entity_type_flattened(): def test_create_entity_type_flattened_error(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1420,7 +1563,9 @@ def test_create_entity_type_flattened_error(): @pytest.mark.asyncio async def test_create_entity_type_flattened_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1453,7 +1598,9 @@ async def test_create_entity_type_flattened_async(): @pytest.mark.asyncio async def test_create_entity_type_flattened_error_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1466,11 +1613,16 @@ async def test_create_entity_type_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [gcdc_entity_type.UpdateEntityTypeRequest, dict,] + "request_type", + [ + gcdc_entity_type.UpdateEntityTypeRequest, + dict, + ], ) def test_update_entity_type(request_type, transport: str = "grpc"): client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1514,7 +1666,8 @@ def test_update_entity_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1533,7 +1686,8 @@ async def test_update_entity_type_async( request_type=gcdc_entity_type.UpdateEntityTypeRequest, ): client = EntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1581,13 +1735,15 @@ async def test_update_entity_type_async_from_dict(): def test_update_entity_type_field_headers(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_entity_type.UpdateEntityTypeRequest() - request.entity_type.name = "entity_type.name/value" + request.entity_type.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1603,20 +1759,23 @@ def test_update_entity_type_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "entity_type.name=entity_type.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "entity_type.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_entity_type_field_headers_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_entity_type.UpdateEntityTypeRequest() - request.entity_type.name = "entity_type.name/value" + request.entity_type.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1634,13 +1793,16 @@ async def test_update_entity_type_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "entity_type.name=entity_type.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "entity_type.name=name_value", + ) in kw["metadata"] def test_update_entity_type_flattened(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1668,7 +1830,9 @@ def test_update_entity_type_flattened(): def test_update_entity_type_flattened_error(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1682,7 +1846,9 @@ def test_update_entity_type_flattened_error(): @pytest.mark.asyncio async def test_update_entity_type_flattened_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1715,7 +1881,9 @@ async def test_update_entity_type_flattened_async(): @pytest.mark.asyncio async def test_update_entity_type_flattened_error_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1727,10 +1895,17 @@ async def test_update_entity_type_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [entity_type.DeleteEntityTypeRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + entity_type.DeleteEntityTypeRequest, + dict, + ], +) def test_delete_entity_type(request_type, transport: str = "grpc"): client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1758,7 +1933,8 @@ def test_delete_entity_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1776,7 +1952,8 @@ async def test_delete_entity_type_async( transport: str = "grpc_asyncio", request_type=entity_type.DeleteEntityTypeRequest ): client = EntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1806,13 +1983,15 @@ async def test_delete_entity_type_async_from_dict(): def test_delete_entity_type_field_headers(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = entity_type.DeleteEntityTypeRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1828,18 +2007,23 @@ def test_delete_entity_type_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_entity_type_field_headers_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = entity_type.DeleteEntityTypeRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1855,11 +2039,16 @@ async def test_delete_entity_type_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_entity_type_flattened(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1869,7 +2058,9 @@ def test_delete_entity_type_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_entity_type(name="name_value",) + client.delete_entity_type( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1881,19 +2072,24 @@ def test_delete_entity_type_flattened(): def test_delete_entity_type_flattened_error(): - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_entity_type( - entity_type.DeleteEntityTypeRequest(), name="name_value", + entity_type.DeleteEntityTypeRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_entity_type_flattened_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1905,7 +2101,9 @@ async def test_delete_entity_type_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_entity_type(name="name_value",) + response = await client.delete_entity_type( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1918,13 +2116,16 @@ async def test_delete_entity_type_flattened_async(): @pytest.mark.asyncio async def test_delete_entity_type_flattened_error_async(): - client = EntityTypesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EntityTypesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_entity_type( - entity_type.DeleteEntityTypeRequest(), name="name_value", + entity_type.DeleteEntityTypeRequest(), + name="name_value", ) @@ -1935,7 +2136,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1955,7 +2157,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = EntityTypesClient(client_options=options, transport=transport,) + client = EntityTypesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1971,7 +2176,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = EntityTypesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2001,7 +2207,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.EntityTypesGrpcTransport, transports.EntityTypesGrpcAsyncIOTransport,], + [ + transports.EntityTypesGrpcTransport, + transports.EntityTypesGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2011,10 +2220,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = EntityTypesClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = EntityTypesClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.EntityTypesGrpcTransport,) + client = EntityTypesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.EntityTypesGrpcTransport, + ) def test_entity_types_base_transport_error(): @@ -2052,6 +2279,14 @@ def test_entity_types_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_entity_types_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2063,7 +2298,8 @@ def test_entity_types_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.EntityTypesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2104,7 +2340,10 @@ def test_entity_types_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.EntityTypesGrpcTransport, transports.EntityTypesGrpcAsyncIOTransport,], + [ + transports.EntityTypesGrpcTransport, + transports.EntityTypesGrpcAsyncIOTransport, + ], ) def test_entity_types_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2202,24 +2441,40 @@ def test_entity_types_grpc_transport_client_cert_source_for_mtls(transport_class ) -def test_entity_types_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_entity_types_host_no_port(transport_name): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_entity_types_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_entity_types_host_with_port(transport_name): client = EntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_entity_types_grpc_transport_channel(): @@ -2227,7 +2482,8 @@ def test_entity_types_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.EntityTypesGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2239,7 +2495,8 @@ def test_entity_types_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.EntityTypesGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2344,7 +2601,10 @@ def test_entity_type_path(): agent = "whelk" entity_type = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) actual = EntityTypesClient.entity_type_path(project, location, agent, entity_type) assert expected == actual @@ -2386,7 +2646,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = EntityTypesClient.common_folder_path(folder) assert expected == actual @@ -2404,7 +2666,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = EntityTypesClient.common_organization_path(organization) assert expected == actual @@ -2422,7 +2686,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = EntityTypesClient.common_project_path(project) assert expected == actual @@ -2442,7 +2708,8 @@ def test_common_location_path(): project = "oyster" location = "nudibranch" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = EntityTypesClient.common_location_path(project, location) assert expected == actual @@ -2467,7 +2734,8 @@ def test_client_with_default_client_info(): transports.EntityTypesTransport, "_prep_wrapped_messages" ) as prep: client = EntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2476,7 +2744,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = EntityTypesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2484,7 +2753,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = EntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_environments.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_environments.py index 9b229c72..74605d99 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_environments.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_environments.py @@ -92,19 +92,25 @@ def test__get_default_mtls_endpoint(): assert EnvironmentsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [EnvironmentsClient, EnvironmentsAsyncClient,]) -def test_environments_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (EnvironmentsClient, "grpc"), + (EnvironmentsAsyncClient, "grpc_asyncio"), + ], +) +def test_environments_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -132,22 +138,32 @@ def test_environments_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [EnvironmentsClient, EnvironmentsAsyncClient,]) -def test_environments_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (EnvironmentsClient, "grpc"), + (EnvironmentsAsyncClient, "grpc_asyncio"), + ], +) +def test_environments_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_environments_client_get_transport_class(): @@ -487,7 +503,9 @@ def test_environments_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -628,10 +646,17 @@ def test_environments_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [environment.ListEnvironmentsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + environment.ListEnvironmentsRequest, + dict, + ], +) def test_list_environments(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -662,7 +687,8 @@ def test_list_environments_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -680,7 +706,8 @@ async def test_list_environments_async( transport: str = "grpc_asyncio", request_type=environment.ListEnvironmentsRequest ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -715,13 +742,15 @@ async def test_list_environments_async_from_dict(): def test_list_environments_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.ListEnvironmentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -737,18 +766,23 @@ def test_list_environments_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_environments_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.ListEnvironmentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -766,11 +800,16 @@ async def test_list_environments_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_environments_flattened(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -780,7 +819,9 @@ def test_list_environments_flattened(): call.return_value = environment.ListEnvironmentsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_environments(parent="parent_value",) + client.list_environments( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -792,19 +833,24 @@ def test_list_environments_flattened(): def test_list_environments_flattened_error(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_environments( - environment.ListEnvironmentsRequest(), parent="parent_value", + environment.ListEnvironmentsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_environments_flattened_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -818,7 +864,9 @@ async def test_list_environments_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_environments(parent="parent_value",) + response = await client.list_environments( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -831,19 +879,23 @@ async def test_list_environments_flattened_async(): @pytest.mark.asyncio async def test_list_environments_flattened_error_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_environments( - environment.ListEnvironmentsRequest(), parent="parent_value", + environment.ListEnvironmentsRequest(), + parent="parent_value", ) def test_list_environments_pager(transport_name: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -861,13 +913,20 @@ def test_list_environments_pager(transport_name: str = "grpc"): next_page_token="abc", ), environment.ListEnvironmentsResponse( - environments=[], next_page_token="def", + environments=[], + next_page_token="def", ), environment.ListEnvironmentsResponse( - environments=[environment.Environment(),], next_page_token="ghi", + environments=[ + environment.Environment(), + ], + next_page_token="ghi", ), environment.ListEnvironmentsResponse( - environments=[environment.Environment(), environment.Environment(),], + environments=[ + environment.Environment(), + environment.Environment(), + ], ), RuntimeError, ) @@ -880,14 +939,15 @@ def test_list_environments_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, environment.Environment) for i in results) def test_list_environments_pages(transport_name: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -905,13 +965,20 @@ def test_list_environments_pages(transport_name: str = "grpc"): next_page_token="abc", ), environment.ListEnvironmentsResponse( - environments=[], next_page_token="def", + environments=[], + next_page_token="def", ), environment.ListEnvironmentsResponse( - environments=[environment.Environment(),], next_page_token="ghi", + environments=[ + environment.Environment(), + ], + next_page_token="ghi", ), environment.ListEnvironmentsResponse( - environments=[environment.Environment(), environment.Environment(),], + environments=[ + environment.Environment(), + environment.Environment(), + ], ), RuntimeError, ) @@ -922,7 +989,9 @@ def test_list_environments_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_environments_async_pager(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -941,20 +1010,29 @@ async def test_list_environments_async_pager(): next_page_token="abc", ), environment.ListEnvironmentsResponse( - environments=[], next_page_token="def", + environments=[], + next_page_token="def", ), environment.ListEnvironmentsResponse( - environments=[environment.Environment(),], next_page_token="ghi", + environments=[ + environment.Environment(), + ], + next_page_token="ghi", ), environment.ListEnvironmentsResponse( - environments=[environment.Environment(), environment.Environment(),], + environments=[ + environment.Environment(), + environment.Environment(), + ], ), RuntimeError, ) - async_pager = await client.list_environments(request={},) + async_pager = await client.list_environments( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -963,7 +1041,9 @@ async def test_list_environments_async_pager(): @pytest.mark.asyncio async def test_list_environments_async_pages(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -982,27 +1062,43 @@ async def test_list_environments_async_pages(): next_page_token="abc", ), environment.ListEnvironmentsResponse( - environments=[], next_page_token="def", + environments=[], + next_page_token="def", ), environment.ListEnvironmentsResponse( - environments=[environment.Environment(),], next_page_token="ghi", + environments=[ + environment.Environment(), + ], + next_page_token="ghi", ), environment.ListEnvironmentsResponse( - environments=[environment.Environment(), environment.Environment(),], + environments=[ + environment.Environment(), + environment.Environment(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_environments(request={})).pages: + async for page_ in ( + await client.list_environments(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [environment.GetEnvironmentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + environment.GetEnvironmentRequest, + dict, + ], +) def test_get_environment(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1035,7 +1131,8 @@ def test_get_environment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1051,7 +1148,8 @@ async def test_get_environment_async( transport: str = "grpc_asyncio", request_type=environment.GetEnvironmentRequest ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1088,13 +1186,15 @@ async def test_get_environment_async_from_dict(): def test_get_environment_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.GetEnvironmentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_environment), "__call__") as call: @@ -1108,18 +1208,23 @@ def test_get_environment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_environment_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.GetEnvironmentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_environment), "__call__") as call: @@ -1135,11 +1240,16 @@ async def test_get_environment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_environment_flattened(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_environment), "__call__") as call: @@ -1147,7 +1257,9 @@ def test_get_environment_flattened(): call.return_value = environment.Environment() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_environment(name="name_value",) + client.get_environment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1159,19 +1271,24 @@ def test_get_environment_flattened(): def test_get_environment_flattened_error(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_environment( - environment.GetEnvironmentRequest(), name="name_value", + environment.GetEnvironmentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_environment_flattened_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_environment), "__call__") as call: @@ -1183,7 +1300,9 @@ async def test_get_environment_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_environment(name="name_value",) + response = await client.get_environment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1196,22 +1315,30 @@ async def test_get_environment_flattened_async(): @pytest.mark.asyncio async def test_get_environment_flattened_error_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_environment( - environment.GetEnvironmentRequest(), name="name_value", + environment.GetEnvironmentRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [gcdc_environment.CreateEnvironmentRequest, dict,] + "request_type", + [ + gcdc_environment.CreateEnvironmentRequest, + dict, + ], ) def test_create_environment(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1239,7 +1366,8 @@ def test_create_environment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1258,7 +1386,8 @@ async def test_create_environment_async( request_type=gcdc_environment.CreateEnvironmentRequest, ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1290,13 +1419,15 @@ async def test_create_environment_async_from_dict(): def test_create_environment_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_environment.CreateEnvironmentRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1312,18 +1443,23 @@ def test_create_environment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_environment_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_environment.CreateEnvironmentRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1341,11 +1477,16 @@ async def test_create_environment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_environment_flattened(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1373,7 +1514,9 @@ def test_create_environment_flattened(): def test_create_environment_flattened_error(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1387,7 +1530,9 @@ def test_create_environment_flattened_error(): @pytest.mark.asyncio async def test_create_environment_flattened_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1420,7 +1565,9 @@ async def test_create_environment_flattened_async(): @pytest.mark.asyncio async def test_create_environment_flattened_error_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1433,11 +1580,16 @@ async def test_create_environment_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [gcdc_environment.UpdateEnvironmentRequest, dict,] + "request_type", + [ + gcdc_environment.UpdateEnvironmentRequest, + dict, + ], ) def test_update_environment(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1465,7 +1617,8 @@ def test_update_environment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1484,7 +1637,8 @@ async def test_update_environment_async( request_type=gcdc_environment.UpdateEnvironmentRequest, ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1516,13 +1670,15 @@ async def test_update_environment_async_from_dict(): def test_update_environment_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_environment.UpdateEnvironmentRequest() - request.environment.name = "environment.name/value" + request.environment.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1538,20 +1694,23 @@ def test_update_environment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "environment.name=environment.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "environment.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_environment_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_environment.UpdateEnvironmentRequest() - request.environment.name = "environment.name/value" + request.environment.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1569,13 +1728,16 @@ async def test_update_environment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "environment.name=environment.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "environment.name=name_value", + ) in kw["metadata"] def test_update_environment_flattened(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1603,7 +1765,9 @@ def test_update_environment_flattened(): def test_update_environment_flattened_error(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1617,7 +1781,9 @@ def test_update_environment_flattened_error(): @pytest.mark.asyncio async def test_update_environment_flattened_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1650,7 +1816,9 @@ async def test_update_environment_flattened_async(): @pytest.mark.asyncio async def test_update_environment_flattened_error_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1662,10 +1830,17 @@ async def test_update_environment_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [environment.DeleteEnvironmentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + environment.DeleteEnvironmentRequest, + dict, + ], +) def test_delete_environment(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1693,7 +1868,8 @@ def test_delete_environment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1711,7 +1887,8 @@ async def test_delete_environment_async( transport: str = "grpc_asyncio", request_type=environment.DeleteEnvironmentRequest ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1741,13 +1918,15 @@ async def test_delete_environment_async_from_dict(): def test_delete_environment_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.DeleteEnvironmentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1763,18 +1942,23 @@ def test_delete_environment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_environment_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.DeleteEnvironmentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1790,11 +1974,16 @@ async def test_delete_environment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_environment_flattened(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1804,7 +1993,9 @@ def test_delete_environment_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_environment(name="name_value",) + client.delete_environment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1816,19 +2007,24 @@ def test_delete_environment_flattened(): def test_delete_environment_flattened_error(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_environment( - environment.DeleteEnvironmentRequest(), name="name_value", + environment.DeleteEnvironmentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_environment_flattened_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1840,7 +2036,9 @@ async def test_delete_environment_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_environment(name="name_value",) + response = await client.delete_environment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1853,22 +2051,30 @@ async def test_delete_environment_flattened_async(): @pytest.mark.asyncio async def test_delete_environment_flattened_error_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_environment( - environment.DeleteEnvironmentRequest(), name="name_value", + environment.DeleteEnvironmentRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [environment.LookupEnvironmentHistoryRequest, dict,] + "request_type", + [ + environment.LookupEnvironmentHistoryRequest, + dict, + ], ) def test_lookup_environment_history(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1899,7 +2105,8 @@ def test_lookup_environment_history_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1918,7 +2125,8 @@ async def test_lookup_environment_history_async( request_type=environment.LookupEnvironmentHistoryRequest, ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1953,13 +2161,15 @@ async def test_lookup_environment_history_async_from_dict(): def test_lookup_environment_history_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.LookupEnvironmentHistoryRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1975,18 +2185,23 @@ def test_lookup_environment_history_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_lookup_environment_history_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.LookupEnvironmentHistoryRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2004,11 +2219,16 @@ async def test_lookup_environment_history_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_lookup_environment_history_flattened(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2018,7 +2238,9 @@ def test_lookup_environment_history_flattened(): call.return_value = environment.LookupEnvironmentHistoryResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.lookup_environment_history(name="name_value",) + client.lookup_environment_history( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2030,19 +2252,24 @@ def test_lookup_environment_history_flattened(): def test_lookup_environment_history_flattened_error(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.lookup_environment_history( - environment.LookupEnvironmentHistoryRequest(), name="name_value", + environment.LookupEnvironmentHistoryRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_lookup_environment_history_flattened_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2056,7 +2283,9 @@ async def test_lookup_environment_history_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.lookup_environment_history(name="name_value",) + response = await client.lookup_environment_history( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2069,19 +2298,23 @@ async def test_lookup_environment_history_flattened_async(): @pytest.mark.asyncio async def test_lookup_environment_history_flattened_error_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.lookup_environment_history( - environment.LookupEnvironmentHistoryRequest(), name="name_value", + environment.LookupEnvironmentHistoryRequest(), + name="name_value", ) def test_lookup_environment_history_pager(transport_name: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2099,13 +2332,20 @@ def test_lookup_environment_history_pager(transport_name: str = "grpc"): next_page_token="abc", ), environment.LookupEnvironmentHistoryResponse( - environments=[], next_page_token="def", + environments=[], + next_page_token="def", ), environment.LookupEnvironmentHistoryResponse( - environments=[environment.Environment(),], next_page_token="ghi", + environments=[ + environment.Environment(), + ], + next_page_token="ghi", ), environment.LookupEnvironmentHistoryResponse( - environments=[environment.Environment(), environment.Environment(),], + environments=[ + environment.Environment(), + environment.Environment(), + ], ), RuntimeError, ) @@ -2118,14 +2358,15 @@ def test_lookup_environment_history_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, environment.Environment) for i in results) def test_lookup_environment_history_pages(transport_name: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2143,13 +2384,20 @@ def test_lookup_environment_history_pages(transport_name: str = "grpc"): next_page_token="abc", ), environment.LookupEnvironmentHistoryResponse( - environments=[], next_page_token="def", + environments=[], + next_page_token="def", ), environment.LookupEnvironmentHistoryResponse( - environments=[environment.Environment(),], next_page_token="ghi", + environments=[ + environment.Environment(), + ], + next_page_token="ghi", ), environment.LookupEnvironmentHistoryResponse( - environments=[environment.Environment(), environment.Environment(),], + environments=[ + environment.Environment(), + environment.Environment(), + ], ), RuntimeError, ) @@ -2160,7 +2408,9 @@ def test_lookup_environment_history_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_lookup_environment_history_async_pager(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2179,20 +2429,29 @@ async def test_lookup_environment_history_async_pager(): next_page_token="abc", ), environment.LookupEnvironmentHistoryResponse( - environments=[], next_page_token="def", + environments=[], + next_page_token="def", ), environment.LookupEnvironmentHistoryResponse( - environments=[environment.Environment(),], next_page_token="ghi", + environments=[ + environment.Environment(), + ], + next_page_token="ghi", ), environment.LookupEnvironmentHistoryResponse( - environments=[environment.Environment(), environment.Environment(),], + environments=[ + environment.Environment(), + environment.Environment(), + ], ), RuntimeError, ) - async_pager = await client.lookup_environment_history(request={},) + async_pager = await client.lookup_environment_history( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2201,7 +2460,9 @@ async def test_lookup_environment_history_async_pager(): @pytest.mark.asyncio async def test_lookup_environment_history_async_pages(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2220,27 +2481,43 @@ async def test_lookup_environment_history_async_pages(): next_page_token="abc", ), environment.LookupEnvironmentHistoryResponse( - environments=[], next_page_token="def", + environments=[], + next_page_token="def", ), environment.LookupEnvironmentHistoryResponse( - environments=[environment.Environment(),], next_page_token="ghi", + environments=[ + environment.Environment(), + ], + next_page_token="ghi", ), environment.LookupEnvironmentHistoryResponse( - environments=[environment.Environment(), environment.Environment(),], + environments=[ + environment.Environment(), + environment.Environment(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.lookup_environment_history(request={})).pages: + async for page_ in ( + await client.lookup_environment_history(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [environment.RunContinuousTestRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + environment.RunContinuousTestRequest, + dict, + ], +) def test_run_continuous_test(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2268,7 +2545,8 @@ def test_run_continuous_test_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2286,7 +2564,8 @@ async def test_run_continuous_test_async( transport: str = "grpc_asyncio", request_type=environment.RunContinuousTestRequest ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2318,13 +2597,15 @@ async def test_run_continuous_test_async_from_dict(): def test_run_continuous_test_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.RunContinuousTestRequest() - request.environment = "environment/value" + request.environment = "environment_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2340,18 +2621,23 @@ def test_run_continuous_test_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "environment=environment/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "environment=environment_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_run_continuous_test_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.RunContinuousTestRequest() - request.environment = "environment/value" + request.environment = "environment_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2369,15 +2655,23 @@ async def test_run_continuous_test_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "environment=environment/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "environment=environment_value", + ) in kw["metadata"] @pytest.mark.parametrize( - "request_type", [environment.ListContinuousTestResultsRequest, dict,] + "request_type", + [ + environment.ListContinuousTestResultsRequest, + dict, + ], ) def test_list_continuous_test_results(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2408,7 +2702,8 @@ def test_list_continuous_test_results_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2427,7 +2722,8 @@ async def test_list_continuous_test_results_async( request_type=environment.ListContinuousTestResultsRequest, ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2462,13 +2758,15 @@ async def test_list_continuous_test_results_async_from_dict(): def test_list_continuous_test_results_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.ListContinuousTestResultsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2484,18 +2782,23 @@ def test_list_continuous_test_results_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_continuous_test_results_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.ListContinuousTestResultsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2513,11 +2816,16 @@ async def test_list_continuous_test_results_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_continuous_test_results_flattened(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2527,7 +2835,9 @@ def test_list_continuous_test_results_flattened(): call.return_value = environment.ListContinuousTestResultsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_continuous_test_results(parent="parent_value",) + client.list_continuous_test_results( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2539,19 +2849,24 @@ def test_list_continuous_test_results_flattened(): def test_list_continuous_test_results_flattened_error(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_continuous_test_results( - environment.ListContinuousTestResultsRequest(), parent="parent_value", + environment.ListContinuousTestResultsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_continuous_test_results_flattened_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2565,7 +2880,9 @@ async def test_list_continuous_test_results_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_continuous_test_results(parent="parent_value",) + response = await client.list_continuous_test_results( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2578,19 +2895,23 @@ async def test_list_continuous_test_results_flattened_async(): @pytest.mark.asyncio async def test_list_continuous_test_results_flattened_error_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_continuous_test_results( - environment.ListContinuousTestResultsRequest(), parent="parent_value", + environment.ListContinuousTestResultsRequest(), + parent="parent_value", ) def test_list_continuous_test_results_pager(transport_name: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2608,10 +2929,13 @@ def test_list_continuous_test_results_pager(transport_name: str = "grpc"): next_page_token="abc", ), environment.ListContinuousTestResultsResponse( - continuous_test_results=[], next_page_token="def", + continuous_test_results=[], + next_page_token="def", ), environment.ListContinuousTestResultsResponse( - continuous_test_results=[environment.ContinuousTestResult(),], + continuous_test_results=[ + environment.ContinuousTestResult(), + ], next_page_token="ghi", ), environment.ListContinuousTestResultsResponse( @@ -2631,14 +2955,15 @@ def test_list_continuous_test_results_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, environment.ContinuousTestResult) for i in results) def test_list_continuous_test_results_pages(transport_name: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2656,10 +2981,13 @@ def test_list_continuous_test_results_pages(transport_name: str = "grpc"): next_page_token="abc", ), environment.ListContinuousTestResultsResponse( - continuous_test_results=[], next_page_token="def", + continuous_test_results=[], + next_page_token="def", ), environment.ListContinuousTestResultsResponse( - continuous_test_results=[environment.ContinuousTestResult(),], + continuous_test_results=[ + environment.ContinuousTestResult(), + ], next_page_token="ghi", ), environment.ListContinuousTestResultsResponse( @@ -2677,7 +3005,9 @@ def test_list_continuous_test_results_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_continuous_test_results_async_pager(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2696,10 +3026,13 @@ async def test_list_continuous_test_results_async_pager(): next_page_token="abc", ), environment.ListContinuousTestResultsResponse( - continuous_test_results=[], next_page_token="def", + continuous_test_results=[], + next_page_token="def", ), environment.ListContinuousTestResultsResponse( - continuous_test_results=[environment.ContinuousTestResult(),], + continuous_test_results=[ + environment.ContinuousTestResult(), + ], next_page_token="ghi", ), environment.ListContinuousTestResultsResponse( @@ -2710,10 +3043,12 @@ async def test_list_continuous_test_results_async_pager(): ), RuntimeError, ) - async_pager = await client.list_continuous_test_results(request={},) + async_pager = await client.list_continuous_test_results( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2722,7 +3057,9 @@ async def test_list_continuous_test_results_async_pager(): @pytest.mark.asyncio async def test_list_continuous_test_results_async_pages(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2741,10 +3078,13 @@ async def test_list_continuous_test_results_async_pages(): next_page_token="abc", ), environment.ListContinuousTestResultsResponse( - continuous_test_results=[], next_page_token="def", + continuous_test_results=[], + next_page_token="def", ), environment.ListContinuousTestResultsResponse( - continuous_test_results=[environment.ContinuousTestResult(),], + continuous_test_results=[ + environment.ContinuousTestResult(), + ], next_page_token="ghi", ), environment.ListContinuousTestResultsResponse( @@ -2758,16 +3098,23 @@ async def test_list_continuous_test_results_async_pages(): pages = [] async for page_ in ( await client.list_continuous_test_results(request={}) - ).pages: + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [environment.DeployFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + environment.DeployFlowRequest, + dict, + ], +) def test_deploy_flow(request_type, transport: str = "grpc"): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2793,7 +3140,8 @@ def test_deploy_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2809,7 +3157,8 @@ async def test_deploy_flow_async( transport: str = "grpc_asyncio", request_type=environment.DeployFlowRequest ): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2839,13 +3188,15 @@ async def test_deploy_flow_async_from_dict(): def test_deploy_flow_field_headers(): - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.DeployFlowRequest() - request.environment = "environment/value" + request.environment = "environment_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.deploy_flow), "__call__") as call: @@ -2859,18 +3210,23 @@ def test_deploy_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "environment=environment/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "environment=environment_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_deploy_flow_field_headers_async(): - client = EnvironmentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = EnvironmentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = environment.DeployFlowRequest() - request.environment = "environment/value" + request.environment = "environment_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.deploy_flow), "__call__") as call: @@ -2886,7 +3242,10 @@ async def test_deploy_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "environment=environment/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "environment=environment_value", + ) in kw["metadata"] def test_credentials_transport_error(): @@ -2896,7 +3255,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2916,7 +3276,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = EnvironmentsClient(client_options=options, transport=transport,) + client = EnvironmentsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2932,7 +3295,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = EnvironmentsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2975,10 +3339,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = EnvironmentsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = EnvironmentsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.EnvironmentsGrpcTransport,) + client = EnvironmentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.EnvironmentsGrpcTransport, + ) def test_environments_base_transport_error(): @@ -3025,6 +3407,14 @@ def test_environments_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_environments_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -3036,7 +3426,8 @@ def test_environments_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.EnvironmentsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3178,24 +3569,40 @@ def test_environments_grpc_transport_client_cert_source_for_mtls(transport_class ) -def test_environments_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_environments_host_no_port(transport_name): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_environments_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_environments_host_with_port(transport_name): client = EnvironmentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_environments_grpc_transport_channel(): @@ -3203,7 +3610,8 @@ def test_environments_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.EnvironmentsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -3215,7 +3623,8 @@ def test_environments_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.EnvironmentsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -3316,12 +3725,16 @@ def test_environments_transport_channel_mtls_with_adc(transport_class): def test_environments_grpc_lro_client(): client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -3329,12 +3742,16 @@ def test_environments_grpc_lro_client(): def test_environments_grpc_lro_async_client(): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -3380,7 +3797,10 @@ def test_environment_path(): agent = "squid" environment = "clam" expected = "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}".format( - project=project, location=location, agent=agent, environment=environment, + project=project, + location=location, + agent=agent, + environment=environment, ) actual = EnvironmentsClient.environment_path(project, location, agent, environment) assert expected == actual @@ -3406,7 +3826,10 @@ def test_test_case_path(): agent = "winkle" test_case = "nautilus" expected = "projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}".format( - project=project, location=location, agent=agent, test_case=test_case, + project=project, + location=location, + agent=agent, + test_case=test_case, ) actual = EnvironmentsClient.test_case_path(project, location, agent, test_case) assert expected == actual @@ -3467,7 +3890,11 @@ def test_version_path(): flow = "octopus" version = "oyster" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) actual = EnvironmentsClient.version_path(project, location, agent, flow, version) assert expected == actual @@ -3510,7 +3937,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "squid" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = EnvironmentsClient.common_folder_path(folder) assert expected == actual @@ -3528,7 +3957,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "whelk" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = EnvironmentsClient.common_organization_path(organization) assert expected == actual @@ -3546,7 +3977,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "oyster" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = EnvironmentsClient.common_project_path(project) assert expected == actual @@ -3566,7 +3999,8 @@ def test_common_location_path(): project = "cuttlefish" location = "mussel" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = EnvironmentsClient.common_location_path(project, location) assert expected == actual @@ -3591,7 +4025,8 @@ def test_client_with_default_client_info(): transports.EnvironmentsTransport, "_prep_wrapped_messages" ) as prep: client = EnvironmentsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3600,7 +4035,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = EnvironmentsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3608,7 +4044,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = EnvironmentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_experiments.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_experiments.py index 1079024e..52db5677 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_experiments.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_experiments.py @@ -87,19 +87,25 @@ def test__get_default_mtls_endpoint(): assert ExperimentsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [ExperimentsClient, ExperimentsAsyncClient,]) -def test_experiments_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ExperimentsClient, "grpc"), + (ExperimentsAsyncClient, "grpc_asyncio"), + ], +) +def test_experiments_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -127,22 +133,32 @@ def test_experiments_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [ExperimentsClient, ExperimentsAsyncClient,]) -def test_experiments_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (ExperimentsClient, "grpc"), + (ExperimentsAsyncClient, "grpc_asyncio"), + ], +) +def test_experiments_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_experiments_client_get_transport_class(): @@ -482,7 +498,9 @@ def test_experiments_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -613,10 +631,17 @@ def test_experiments_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [experiment.ListExperimentsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + experiment.ListExperimentsRequest, + dict, + ], +) def test_list_experiments(request_type, transport: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -645,7 +670,8 @@ def test_list_experiments_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -661,7 +687,8 @@ async def test_list_experiments_async( transport: str = "grpc_asyncio", request_type=experiment.ListExperimentsRequest ): client = ExperimentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -672,7 +699,9 @@ async def test_list_experiments_async( with mock.patch.object(type(client.transport.list_experiments), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - experiment.ListExperimentsResponse(next_page_token="next_page_token_value",) + experiment.ListExperimentsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_experiments(request) @@ -692,13 +721,15 @@ async def test_list_experiments_async_from_dict(): def test_list_experiments_field_headers(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.ListExperimentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_experiments), "__call__") as call: @@ -712,18 +743,23 @@ def test_list_experiments_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_experiments_field_headers_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.ListExperimentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_experiments), "__call__") as call: @@ -739,11 +775,16 @@ async def test_list_experiments_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_experiments_flattened(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_experiments), "__call__") as call: @@ -751,7 +792,9 @@ def test_list_experiments_flattened(): call.return_value = experiment.ListExperimentsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_experiments(parent="parent_value",) + client.list_experiments( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -763,19 +806,24 @@ def test_list_experiments_flattened(): def test_list_experiments_flattened_error(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_experiments( - experiment.ListExperimentsRequest(), parent="parent_value", + experiment.ListExperimentsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_experiments_flattened_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_experiments), "__call__") as call: @@ -787,7 +835,9 @@ async def test_list_experiments_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_experiments(parent="parent_value",) + response = await client.list_experiments( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -800,19 +850,23 @@ async def test_list_experiments_flattened_async(): @pytest.mark.asyncio async def test_list_experiments_flattened_error_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_experiments( - experiment.ListExperimentsRequest(), parent="parent_value", + experiment.ListExperimentsRequest(), + parent="parent_value", ) def test_list_experiments_pager(transport_name: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -827,12 +881,21 @@ def test_list_experiments_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - experiment.ListExperimentsResponse(experiments=[], next_page_token="def",), experiment.ListExperimentsResponse( - experiments=[experiment.Experiment(),], next_page_token="ghi", + experiments=[], + next_page_token="def", ), experiment.ListExperimentsResponse( - experiments=[experiment.Experiment(), experiment.Experiment(),], + experiments=[ + experiment.Experiment(), + ], + next_page_token="ghi", + ), + experiment.ListExperimentsResponse( + experiments=[ + experiment.Experiment(), + experiment.Experiment(), + ], ), RuntimeError, ) @@ -845,14 +908,15 @@ def test_list_experiments_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, experiment.Experiment) for i in results) def test_list_experiments_pages(transport_name: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -867,12 +931,21 @@ def test_list_experiments_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - experiment.ListExperimentsResponse(experiments=[], next_page_token="def",), experiment.ListExperimentsResponse( - experiments=[experiment.Experiment(),], next_page_token="ghi", + experiments=[], + next_page_token="def", ), experiment.ListExperimentsResponse( - experiments=[experiment.Experiment(), experiment.Experiment(),], + experiments=[ + experiment.Experiment(), + ], + next_page_token="ghi", + ), + experiment.ListExperimentsResponse( + experiments=[ + experiment.Experiment(), + experiment.Experiment(), + ], ), RuntimeError, ) @@ -883,7 +956,9 @@ def test_list_experiments_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_experiments_async_pager(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -899,19 +974,30 @@ async def test_list_experiments_async_pager(): ], next_page_token="abc", ), - experiment.ListExperimentsResponse(experiments=[], next_page_token="def",), experiment.ListExperimentsResponse( - experiments=[experiment.Experiment(),], next_page_token="ghi", + experiments=[], + next_page_token="def", + ), + experiment.ListExperimentsResponse( + experiments=[ + experiment.Experiment(), + ], + next_page_token="ghi", ), experiment.ListExperimentsResponse( - experiments=[experiment.Experiment(), experiment.Experiment(),], + experiments=[ + experiment.Experiment(), + experiment.Experiment(), + ], ), RuntimeError, ) - async_pager = await client.list_experiments(request={},) + async_pager = await client.list_experiments( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -920,7 +1006,9 @@ async def test_list_experiments_async_pager(): @pytest.mark.asyncio async def test_list_experiments_async_pages(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -936,26 +1024,44 @@ async def test_list_experiments_async_pages(): ], next_page_token="abc", ), - experiment.ListExperimentsResponse(experiments=[], next_page_token="def",), experiment.ListExperimentsResponse( - experiments=[experiment.Experiment(),], next_page_token="ghi", + experiments=[], + next_page_token="def", ), experiment.ListExperimentsResponse( - experiments=[experiment.Experiment(), experiment.Experiment(),], + experiments=[ + experiment.Experiment(), + ], + next_page_token="ghi", + ), + experiment.ListExperimentsResponse( + experiments=[ + experiment.Experiment(), + experiment.Experiment(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_experiments(request={})).pages: + async for page_ in ( + await client.list_experiments(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [experiment.GetExperimentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + experiment.GetExperimentRequest, + dict, + ], +) def test_get_experiment(request_type, transport: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -992,7 +1098,8 @@ def test_get_experiment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1008,7 +1115,8 @@ async def test_get_experiment_async( transport: str = "grpc_asyncio", request_type=experiment.GetExperimentRequest ): client = ExperimentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1049,13 +1157,15 @@ async def test_get_experiment_async_from_dict(): def test_get_experiment_field_headers(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.GetExperimentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_experiment), "__call__") as call: @@ -1069,18 +1179,23 @@ def test_get_experiment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_experiment_field_headers_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.GetExperimentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_experiment), "__call__") as call: @@ -1096,11 +1211,16 @@ async def test_get_experiment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_experiment_flattened(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_experiment), "__call__") as call: @@ -1108,7 +1228,9 @@ def test_get_experiment_flattened(): call.return_value = experiment.Experiment() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_experiment(name="name_value",) + client.get_experiment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1120,19 +1242,24 @@ def test_get_experiment_flattened(): def test_get_experiment_flattened_error(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_experiment( - experiment.GetExperimentRequest(), name="name_value", + experiment.GetExperimentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_experiment_flattened_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_experiment), "__call__") as call: @@ -1144,7 +1271,9 @@ async def test_get_experiment_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_experiment(name="name_value",) + response = await client.get_experiment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1157,22 +1286,30 @@ async def test_get_experiment_flattened_async(): @pytest.mark.asyncio async def test_get_experiment_flattened_error_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_experiment( - experiment.GetExperimentRequest(), name="name_value", + experiment.GetExperimentRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [gcdc_experiment.CreateExperimentRequest, dict,] + "request_type", + [ + gcdc_experiment.CreateExperimentRequest, + dict, + ], ) def test_create_experiment(request_type, transport: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1211,7 +1348,8 @@ def test_create_experiment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1230,7 +1368,8 @@ async def test_create_experiment_async( request_type=gcdc_experiment.CreateExperimentRequest, ): client = ExperimentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1273,13 +1412,15 @@ async def test_create_experiment_async_from_dict(): def test_create_experiment_field_headers(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_experiment.CreateExperimentRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1295,18 +1436,23 @@ def test_create_experiment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_experiment_field_headers_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_experiment.CreateExperimentRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1324,11 +1470,16 @@ async def test_create_experiment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_experiment_flattened(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1356,7 +1507,9 @@ def test_create_experiment_flattened(): def test_create_experiment_flattened_error(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1370,7 +1523,9 @@ def test_create_experiment_flattened_error(): @pytest.mark.asyncio async def test_create_experiment_flattened_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1403,7 +1558,9 @@ async def test_create_experiment_flattened_async(): @pytest.mark.asyncio async def test_create_experiment_flattened_error_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1416,11 +1573,16 @@ async def test_create_experiment_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [gcdc_experiment.UpdateExperimentRequest, dict,] + "request_type", + [ + gcdc_experiment.UpdateExperimentRequest, + dict, + ], ) def test_update_experiment(request_type, transport: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1459,7 +1621,8 @@ def test_update_experiment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1478,7 +1641,8 @@ async def test_update_experiment_async( request_type=gcdc_experiment.UpdateExperimentRequest, ): client = ExperimentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1521,13 +1685,15 @@ async def test_update_experiment_async_from_dict(): def test_update_experiment_field_headers(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_experiment.UpdateExperimentRequest() - request.experiment.name = "experiment.name/value" + request.experiment.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1543,20 +1709,23 @@ def test_update_experiment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "experiment.name=experiment.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "experiment.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_experiment_field_headers_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_experiment.UpdateExperimentRequest() - request.experiment.name = "experiment.name/value" + request.experiment.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1574,13 +1743,16 @@ async def test_update_experiment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "experiment.name=experiment.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "experiment.name=name_value", + ) in kw["metadata"] def test_update_experiment_flattened(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1608,7 +1780,9 @@ def test_update_experiment_flattened(): def test_update_experiment_flattened_error(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1622,7 +1796,9 @@ def test_update_experiment_flattened_error(): @pytest.mark.asyncio async def test_update_experiment_flattened_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1655,7 +1831,9 @@ async def test_update_experiment_flattened_async(): @pytest.mark.asyncio async def test_update_experiment_flattened_error_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1667,10 +1845,17 @@ async def test_update_experiment_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [experiment.DeleteExperimentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + experiment.DeleteExperimentRequest, + dict, + ], +) def test_delete_experiment(request_type, transport: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1698,7 +1883,8 @@ def test_delete_experiment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1716,7 +1902,8 @@ async def test_delete_experiment_async( transport: str = "grpc_asyncio", request_type=experiment.DeleteExperimentRequest ): client = ExperimentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1746,13 +1933,15 @@ async def test_delete_experiment_async_from_dict(): def test_delete_experiment_field_headers(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.DeleteExperimentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1768,18 +1957,23 @@ def test_delete_experiment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_experiment_field_headers_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.DeleteExperimentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1795,11 +1989,16 @@ async def test_delete_experiment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_experiment_flattened(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1809,7 +2008,9 @@ def test_delete_experiment_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_experiment(name="name_value",) + client.delete_experiment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1821,19 +2022,24 @@ def test_delete_experiment_flattened(): def test_delete_experiment_flattened_error(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_experiment( - experiment.DeleteExperimentRequest(), name="name_value", + experiment.DeleteExperimentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_experiment_flattened_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1845,7 +2051,9 @@ async def test_delete_experiment_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_experiment(name="name_value",) + response = await client.delete_experiment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1858,20 +2066,30 @@ async def test_delete_experiment_flattened_async(): @pytest.mark.asyncio async def test_delete_experiment_flattened_error_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_experiment( - experiment.DeleteExperimentRequest(), name="name_value", + experiment.DeleteExperimentRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [experiment.StartExperimentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + experiment.StartExperimentRequest, + dict, + ], +) def test_start_experiment(request_type, transport: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1908,7 +2126,8 @@ def test_start_experiment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1924,7 +2143,8 @@ async def test_start_experiment_async( transport: str = "grpc_asyncio", request_type=experiment.StartExperimentRequest ): client = ExperimentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1965,13 +2185,15 @@ async def test_start_experiment_async_from_dict(): def test_start_experiment_field_headers(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.StartExperimentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.start_experiment), "__call__") as call: @@ -1985,18 +2207,23 @@ def test_start_experiment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_start_experiment_field_headers_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.StartExperimentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.start_experiment), "__call__") as call: @@ -2012,11 +2239,16 @@ async def test_start_experiment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_start_experiment_flattened(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.start_experiment), "__call__") as call: @@ -2024,7 +2256,9 @@ def test_start_experiment_flattened(): call.return_value = experiment.Experiment() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.start_experiment(name="name_value",) + client.start_experiment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2036,19 +2270,24 @@ def test_start_experiment_flattened(): def test_start_experiment_flattened_error(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.start_experiment( - experiment.StartExperimentRequest(), name="name_value", + experiment.StartExperimentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_start_experiment_flattened_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.start_experiment), "__call__") as call: @@ -2060,7 +2299,9 @@ async def test_start_experiment_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.start_experiment(name="name_value",) + response = await client.start_experiment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2073,20 +2314,30 @@ async def test_start_experiment_flattened_async(): @pytest.mark.asyncio async def test_start_experiment_flattened_error_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.start_experiment( - experiment.StartExperimentRequest(), name="name_value", + experiment.StartExperimentRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [experiment.StopExperimentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + experiment.StopExperimentRequest, + dict, + ], +) def test_stop_experiment(request_type, transport: str = "grpc"): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2123,7 +2374,8 @@ def test_stop_experiment_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2139,7 +2391,8 @@ async def test_stop_experiment_async( transport: str = "grpc_asyncio", request_type=experiment.StopExperimentRequest ): client = ExperimentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2180,13 +2433,15 @@ async def test_stop_experiment_async_from_dict(): def test_stop_experiment_field_headers(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.StopExperimentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.stop_experiment), "__call__") as call: @@ -2200,18 +2455,23 @@ def test_stop_experiment_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_stop_experiment_field_headers_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = experiment.StopExperimentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.stop_experiment), "__call__") as call: @@ -2227,11 +2487,16 @@ async def test_stop_experiment_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_stop_experiment_flattened(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.stop_experiment), "__call__") as call: @@ -2239,7 +2504,9 @@ def test_stop_experiment_flattened(): call.return_value = experiment.Experiment() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.stop_experiment(name="name_value",) + client.stop_experiment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2251,19 +2518,24 @@ def test_stop_experiment_flattened(): def test_stop_experiment_flattened_error(): - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.stop_experiment( - experiment.StopExperimentRequest(), name="name_value", + experiment.StopExperimentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_stop_experiment_flattened_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.stop_experiment), "__call__") as call: @@ -2275,7 +2547,9 @@ async def test_stop_experiment_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.stop_experiment(name="name_value",) + response = await client.stop_experiment( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2288,13 +2562,16 @@ async def test_stop_experiment_flattened_async(): @pytest.mark.asyncio async def test_stop_experiment_flattened_error_async(): - client = ExperimentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ExperimentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.stop_experiment( - experiment.StopExperimentRequest(), name="name_value", + experiment.StopExperimentRequest(), + name="name_value", ) @@ -2305,7 +2582,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2325,7 +2603,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ExperimentsClient(client_options=options, transport=transport,) + client = ExperimentsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2341,7 +2622,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ExperimentsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2371,7 +2653,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.ExperimentsGrpcTransport, transports.ExperimentsGrpcAsyncIOTransport,], + [ + transports.ExperimentsGrpcTransport, + transports.ExperimentsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2381,10 +2666,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ExperimentsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ExperimentsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ExperimentsGrpcTransport,) + client = ExperimentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ExperimentsGrpcTransport, + ) def test_experiments_base_transport_error(): @@ -2424,6 +2727,14 @@ def test_experiments_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_experiments_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2435,7 +2746,8 @@ def test_experiments_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ExperimentsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2476,7 +2788,10 @@ def test_experiments_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.ExperimentsGrpcTransport, transports.ExperimentsGrpcAsyncIOTransport,], + [ + transports.ExperimentsGrpcTransport, + transports.ExperimentsGrpcAsyncIOTransport, + ], ) def test_experiments_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2574,24 +2889,40 @@ def test_experiments_grpc_transport_client_cert_source_for_mtls(transport_class) ) -def test_experiments_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_experiments_host_no_port(transport_name): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_experiments_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_experiments_host_with_port(transport_name): client = ExperimentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_experiments_grpc_transport_channel(): @@ -2599,7 +2930,8 @@ def test_experiments_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ExperimentsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2611,7 +2943,8 @@ def test_experiments_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ExperimentsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2751,7 +3084,11 @@ def test_version_path(): flow = "clam" version = "whelk" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) actual = ExperimentsClient.version_path(project, location, agent, flow, version) assert expected == actual @@ -2794,7 +3131,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ExperimentsClient.common_folder_path(folder) assert expected == actual @@ -2812,7 +3151,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ExperimentsClient.common_organization_path(organization) assert expected == actual @@ -2830,7 +3171,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ExperimentsClient.common_project_path(project) assert expected == actual @@ -2850,7 +3193,8 @@ def test_common_location_path(): project = "oyster" location = "nudibranch" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ExperimentsClient.common_location_path(project, location) assert expected == actual @@ -2875,7 +3219,8 @@ def test_client_with_default_client_info(): transports.ExperimentsTransport, "_prep_wrapped_messages" ) as prep: client = ExperimentsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2884,7 +3229,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ExperimentsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2892,7 +3238,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ExperimentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_flows.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_flows.py index 376bd78c..d5c36248 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_flows.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_flows.py @@ -91,19 +91,25 @@ def test__get_default_mtls_endpoint(): assert FlowsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [FlowsClient, FlowsAsyncClient,]) -def test_flows_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (FlowsClient, "grpc"), + (FlowsAsyncClient, "grpc_asyncio"), + ], +) +def test_flows_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -129,22 +135,32 @@ def test_flows_client_service_account_always_use_jwt(transport_class, transport_ use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [FlowsClient, FlowsAsyncClient,]) -def test_flows_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (FlowsClient, "grpc"), + (FlowsAsyncClient, "grpc_asyncio"), + ], +) +def test_flows_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_flows_client_get_transport_class(): @@ -468,7 +484,9 @@ def test_flows_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -599,10 +617,17 @@ def test_flows_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [gcdc_flow.CreateFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_flow.CreateFlowRequest, + dict, + ], +) def test_create_flow(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -637,7 +662,8 @@ def test_create_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -653,7 +679,8 @@ async def test_create_flow_async( transport: str = "grpc_asyncio", request_type=gcdc_flow.CreateFlowRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -692,13 +719,15 @@ async def test_create_flow_async_from_dict(): def test_create_flow_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_flow.CreateFlowRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_flow), "__call__") as call: @@ -712,18 +741,23 @@ def test_create_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_flow_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_flow.CreateFlowRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_flow), "__call__") as call: @@ -737,11 +771,16 @@ async def test_create_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_flow_flattened(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_flow), "__call__") as call: @@ -750,7 +789,8 @@ def test_create_flow_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_flow( - parent="parent_value", flow=gcdc_flow.Flow(name="name_value"), + parent="parent_value", + flow=gcdc_flow.Flow(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -766,7 +806,9 @@ def test_create_flow_flattened(): def test_create_flow_flattened_error(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -780,7 +822,9 @@ def test_create_flow_flattened_error(): @pytest.mark.asyncio async def test_create_flow_flattened_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_flow), "__call__") as call: @@ -791,7 +835,8 @@ async def test_create_flow_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_flow( - parent="parent_value", flow=gcdc_flow.Flow(name="name_value"), + parent="parent_value", + flow=gcdc_flow.Flow(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -808,7 +853,9 @@ async def test_create_flow_flattened_async(): @pytest.mark.asyncio async def test_create_flow_flattened_error_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -820,10 +867,17 @@ async def test_create_flow_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [flow.DeleteFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + flow.DeleteFlowRequest, + dict, + ], +) def test_delete_flow(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -849,7 +903,8 @@ def test_delete_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -865,7 +920,8 @@ async def test_delete_flow_async( transport: str = "grpc_asyncio", request_type=flow.DeleteFlowRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -893,13 +949,15 @@ async def test_delete_flow_async_from_dict(): def test_delete_flow_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.DeleteFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_flow), "__call__") as call: @@ -913,18 +971,23 @@ def test_delete_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_flow_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.DeleteFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_flow), "__call__") as call: @@ -938,11 +1001,16 @@ async def test_delete_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_flow_flattened(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_flow), "__call__") as call: @@ -950,7 +1018,9 @@ def test_delete_flow_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_flow(name="name_value",) + client.delete_flow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -962,19 +1032,24 @@ def test_delete_flow_flattened(): def test_delete_flow_flattened_error(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_flow( - flow.DeleteFlowRequest(), name="name_value", + flow.DeleteFlowRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_flow_flattened_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_flow), "__call__") as call: @@ -984,7 +1059,9 @@ async def test_delete_flow_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_flow(name="name_value",) + response = await client.delete_flow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -997,20 +1074,30 @@ async def test_delete_flow_flattened_async(): @pytest.mark.asyncio async def test_delete_flow_flattened_error_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_flow( - flow.DeleteFlowRequest(), name="name_value", + flow.DeleteFlowRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [flow.ListFlowsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + flow.ListFlowsRequest, + dict, + ], +) def test_list_flows(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1039,7 +1126,8 @@ def test_list_flows_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1055,7 +1143,8 @@ async def test_list_flows_async( transport: str = "grpc_asyncio", request_type=flow.ListFlowsRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1066,7 +1155,9 @@ async def test_list_flows_async( with mock.patch.object(type(client.transport.list_flows), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - flow.ListFlowsResponse(next_page_token="next_page_token_value",) + flow.ListFlowsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_flows(request) @@ -1086,13 +1177,15 @@ async def test_list_flows_async_from_dict(): def test_list_flows_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.ListFlowsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_flows), "__call__") as call: @@ -1106,18 +1199,23 @@ def test_list_flows_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_flows_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.ListFlowsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_flows), "__call__") as call: @@ -1133,11 +1231,16 @@ async def test_list_flows_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_flows_flattened(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_flows), "__call__") as call: @@ -1145,7 +1248,9 @@ def test_list_flows_flattened(): call.return_value = flow.ListFlowsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_flows(parent="parent_value",) + client.list_flows( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1157,19 +1262,24 @@ def test_list_flows_flattened(): def test_list_flows_flattened_error(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_flows( - flow.ListFlowsRequest(), parent="parent_value", + flow.ListFlowsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_flows_flattened_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_flows), "__call__") as call: @@ -1181,7 +1291,9 @@ async def test_list_flows_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_flows(parent="parent_value",) + response = await client.list_flows( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1194,19 +1306,23 @@ async def test_list_flows_flattened_async(): @pytest.mark.asyncio async def test_list_flows_flattened_error_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_flows( - flow.ListFlowsRequest(), parent="parent_value", + flow.ListFlowsRequest(), + parent="parent_value", ) def test_list_flows_pager(transport_name: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1214,11 +1330,29 @@ def test_list_flows_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( flow.ListFlowsResponse( - flows=[flow.Flow(), flow.Flow(), flow.Flow(),], next_page_token="abc", + flows=[ + flow.Flow(), + flow.Flow(), + flow.Flow(), + ], + next_page_token="abc", + ), + flow.ListFlowsResponse( + flows=[], + next_page_token="def", + ), + flow.ListFlowsResponse( + flows=[ + flow.Flow(), + ], + next_page_token="ghi", + ), + flow.ListFlowsResponse( + flows=[ + flow.Flow(), + flow.Flow(), + ], ), - flow.ListFlowsResponse(flows=[], next_page_token="def",), - flow.ListFlowsResponse(flows=[flow.Flow(),], next_page_token="ghi",), - flow.ListFlowsResponse(flows=[flow.Flow(), flow.Flow(),],), RuntimeError, ) @@ -1230,14 +1364,15 @@ def test_list_flows_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, flow.Flow) for i in results) def test_list_flows_pages(transport_name: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1245,11 +1380,29 @@ def test_list_flows_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( flow.ListFlowsResponse( - flows=[flow.Flow(), flow.Flow(), flow.Flow(),], next_page_token="abc", + flows=[ + flow.Flow(), + flow.Flow(), + flow.Flow(), + ], + next_page_token="abc", + ), + flow.ListFlowsResponse( + flows=[], + next_page_token="def", + ), + flow.ListFlowsResponse( + flows=[ + flow.Flow(), + ], + next_page_token="ghi", + ), + flow.ListFlowsResponse( + flows=[ + flow.Flow(), + flow.Flow(), + ], ), - flow.ListFlowsResponse(flows=[], next_page_token="def",), - flow.ListFlowsResponse(flows=[flow.Flow(),], next_page_token="ghi",), - flow.ListFlowsResponse(flows=[flow.Flow(), flow.Flow(),],), RuntimeError, ) pages = list(client.list_flows(request={}).pages) @@ -1259,7 +1412,9 @@ def test_list_flows_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_flows_async_pager(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1268,17 +1423,37 @@ async def test_list_flows_async_pager(): # Set the response to a series of pages. call.side_effect = ( flow.ListFlowsResponse( - flows=[flow.Flow(), flow.Flow(), flow.Flow(),], next_page_token="abc", + flows=[ + flow.Flow(), + flow.Flow(), + flow.Flow(), + ], + next_page_token="abc", + ), + flow.ListFlowsResponse( + flows=[], + next_page_token="def", + ), + flow.ListFlowsResponse( + flows=[ + flow.Flow(), + ], + next_page_token="ghi", + ), + flow.ListFlowsResponse( + flows=[ + flow.Flow(), + flow.Flow(), + ], ), - flow.ListFlowsResponse(flows=[], next_page_token="def",), - flow.ListFlowsResponse(flows=[flow.Flow(),], next_page_token="ghi",), - flow.ListFlowsResponse(flows=[flow.Flow(), flow.Flow(),],), RuntimeError, ) - async_pager = await client.list_flows(request={},) + async_pager = await client.list_flows( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1287,7 +1462,9 @@ async def test_list_flows_async_pager(): @pytest.mark.asyncio async def test_list_flows_async_pages(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1296,24 +1473,51 @@ async def test_list_flows_async_pages(): # Set the response to a series of pages. call.side_effect = ( flow.ListFlowsResponse( - flows=[flow.Flow(), flow.Flow(), flow.Flow(),], next_page_token="abc", + flows=[ + flow.Flow(), + flow.Flow(), + flow.Flow(), + ], + next_page_token="abc", + ), + flow.ListFlowsResponse( + flows=[], + next_page_token="def", + ), + flow.ListFlowsResponse( + flows=[ + flow.Flow(), + ], + next_page_token="ghi", + ), + flow.ListFlowsResponse( + flows=[ + flow.Flow(), + flow.Flow(), + ], ), - flow.ListFlowsResponse(flows=[], next_page_token="def",), - flow.ListFlowsResponse(flows=[flow.Flow(),], next_page_token="ghi",), - flow.ListFlowsResponse(flows=[flow.Flow(), flow.Flow(),],), RuntimeError, ) pages = [] - async for page_ in (await client.list_flows(request={})).pages: + async for page_ in ( + await client.list_flows(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [flow.GetFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + flow.GetFlowRequest, + dict, + ], +) def test_get_flow(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1348,7 +1552,8 @@ def test_get_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1364,7 +1569,8 @@ async def test_get_flow_async( transport: str = "grpc_asyncio", request_type=flow.GetFlowRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1403,13 +1609,15 @@ async def test_get_flow_async_from_dict(): def test_get_flow_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.GetFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_flow), "__call__") as call: @@ -1423,18 +1631,23 @@ def test_get_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_flow_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.GetFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_flow), "__call__") as call: @@ -1448,11 +1661,16 @@ async def test_get_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_flow_flattened(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_flow), "__call__") as call: @@ -1460,7 +1678,9 @@ def test_get_flow_flattened(): call.return_value = flow.Flow() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_flow(name="name_value",) + client.get_flow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1472,19 +1692,24 @@ def test_get_flow_flattened(): def test_get_flow_flattened_error(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_flow( - flow.GetFlowRequest(), name="name_value", + flow.GetFlowRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_flow_flattened_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_flow), "__call__") as call: @@ -1494,7 +1719,9 @@ async def test_get_flow_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(flow.Flow()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_flow(name="name_value",) + response = await client.get_flow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1507,20 +1734,30 @@ async def test_get_flow_flattened_async(): @pytest.mark.asyncio async def test_get_flow_flattened_error_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_flow( - flow.GetFlowRequest(), name="name_value", + flow.GetFlowRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [gcdc_flow.UpdateFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_flow.UpdateFlowRequest, + dict, + ], +) def test_update_flow(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1555,7 +1792,8 @@ def test_update_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1571,7 +1809,8 @@ async def test_update_flow_async( transport: str = "grpc_asyncio", request_type=gcdc_flow.UpdateFlowRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1610,13 +1849,15 @@ async def test_update_flow_async_from_dict(): def test_update_flow_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_flow.UpdateFlowRequest() - request.flow.name = "flow.name/value" + request.flow.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_flow), "__call__") as call: @@ -1630,18 +1871,23 @@ def test_update_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "flow.name=flow.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "flow.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_flow_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_flow.UpdateFlowRequest() - request.flow.name = "flow.name/value" + request.flow.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_flow), "__call__") as call: @@ -1655,11 +1901,16 @@ async def test_update_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "flow.name=flow.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "flow.name=name_value", + ) in kw["metadata"] def test_update_flow_flattened(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_flow), "__call__") as call: @@ -1685,7 +1936,9 @@ def test_update_flow_flattened(): def test_update_flow_flattened_error(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1699,7 +1952,9 @@ def test_update_flow_flattened_error(): @pytest.mark.asyncio async def test_update_flow_flattened_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_flow), "__call__") as call: @@ -1728,7 +1983,9 @@ async def test_update_flow_flattened_async(): @pytest.mark.asyncio async def test_update_flow_flattened_error_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1740,10 +1997,17 @@ async def test_update_flow_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [flow.TrainFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + flow.TrainFlowRequest, + dict, + ], +) def test_train_flow(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1769,7 +2033,8 @@ def test_train_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1785,7 +2050,8 @@ async def test_train_flow_async( transport: str = "grpc_asyncio", request_type=flow.TrainFlowRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1815,13 +2081,15 @@ async def test_train_flow_async_from_dict(): def test_train_flow_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.TrainFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.train_flow), "__call__") as call: @@ -1835,18 +2103,23 @@ def test_train_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_train_flow_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.TrainFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.train_flow), "__call__") as call: @@ -1862,11 +2135,16 @@ async def test_train_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_train_flow_flattened(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.train_flow), "__call__") as call: @@ -1874,7 +2152,9 @@ def test_train_flow_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.train_flow(name="name_value",) + client.train_flow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1886,19 +2166,24 @@ def test_train_flow_flattened(): def test_train_flow_flattened_error(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.train_flow( - flow.TrainFlowRequest(), name="name_value", + flow.TrainFlowRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_train_flow_flattened_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.train_flow), "__call__") as call: @@ -1910,7 +2195,9 @@ async def test_train_flow_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.train_flow(name="name_value",) + response = await client.train_flow( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1923,20 +2210,30 @@ async def test_train_flow_flattened_async(): @pytest.mark.asyncio async def test_train_flow_flattened_error_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.train_flow( - flow.TrainFlowRequest(), name="name_value", + flow.TrainFlowRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [flow.ValidateFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + flow.ValidateFlowRequest, + dict, + ], +) def test_validate_flow(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1946,7 +2243,9 @@ def test_validate_flow(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.validate_flow), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = flow.FlowValidationResult(name="name_value",) + call.return_value = flow.FlowValidationResult( + name="name_value", + ) response = client.validate_flow(request) # Establish that the underlying gRPC stub method was called. @@ -1963,7 +2262,8 @@ def test_validate_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1979,7 +2279,8 @@ async def test_validate_flow_async( transport: str = "grpc_asyncio", request_type=flow.ValidateFlowRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1990,7 +2291,9 @@ async def test_validate_flow_async( with mock.patch.object(type(client.transport.validate_flow), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - flow.FlowValidationResult(name="name_value",) + flow.FlowValidationResult( + name="name_value", + ) ) response = await client.validate_flow(request) @@ -2010,13 +2313,15 @@ async def test_validate_flow_async_from_dict(): def test_validate_flow_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.ValidateFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.validate_flow), "__call__") as call: @@ -2030,18 +2335,23 @@ def test_validate_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_validate_flow_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.ValidateFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.validate_flow), "__call__") as call: @@ -2057,13 +2367,23 @@ async def test_validate_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [flow.GetFlowValidationResultRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + flow.GetFlowValidationResultRequest, + dict, + ], +) def test_get_flow_validation_result(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2075,7 +2395,9 @@ def test_get_flow_validation_result(request_type, transport: str = "grpc"): type(client.transport.get_flow_validation_result), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = flow.FlowValidationResult(name="name_value",) + call.return_value = flow.FlowValidationResult( + name="name_value", + ) response = client.get_flow_validation_result(request) # Establish that the underlying gRPC stub method was called. @@ -2092,7 +2414,8 @@ def test_get_flow_validation_result_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2110,7 +2433,8 @@ async def test_get_flow_validation_result_async( transport: str = "grpc_asyncio", request_type=flow.GetFlowValidationResultRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2123,7 +2447,9 @@ async def test_get_flow_validation_result_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - flow.FlowValidationResult(name="name_value",) + flow.FlowValidationResult( + name="name_value", + ) ) response = await client.get_flow_validation_result(request) @@ -2143,13 +2469,15 @@ async def test_get_flow_validation_result_async_from_dict(): def test_get_flow_validation_result_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.GetFlowValidationResultRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2165,18 +2493,23 @@ def test_get_flow_validation_result_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_flow_validation_result_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.GetFlowValidationResultRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2194,11 +2527,16 @@ async def test_get_flow_validation_result_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_flow_validation_result_flattened(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2208,7 +2546,9 @@ def test_get_flow_validation_result_flattened(): call.return_value = flow.FlowValidationResult() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_flow_validation_result(name="name_value",) + client.get_flow_validation_result( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2220,19 +2560,24 @@ def test_get_flow_validation_result_flattened(): def test_get_flow_validation_result_flattened_error(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_flow_validation_result( - flow.GetFlowValidationResultRequest(), name="name_value", + flow.GetFlowValidationResultRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_flow_validation_result_flattened_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2246,7 +2591,9 @@ async def test_get_flow_validation_result_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_flow_validation_result(name="name_value",) + response = await client.get_flow_validation_result( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2259,20 +2606,30 @@ async def test_get_flow_validation_result_flattened_async(): @pytest.mark.asyncio async def test_get_flow_validation_result_flattened_error_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_flow_validation_result( - flow.GetFlowValidationResultRequest(), name="name_value", + flow.GetFlowValidationResultRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [flow.ImportFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + flow.ImportFlowRequest, + dict, + ], +) def test_import_flow(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2298,7 +2655,8 @@ def test_import_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2314,7 +2672,8 @@ async def test_import_flow_async( transport: str = "grpc_asyncio", request_type=flow.ImportFlowRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2344,13 +2703,15 @@ async def test_import_flow_async_from_dict(): def test_import_flow_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.ImportFlowRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.import_flow), "__call__") as call: @@ -2364,18 +2725,23 @@ def test_import_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_import_flow_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.ImportFlowRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.import_flow), "__call__") as call: @@ -2391,13 +2757,23 @@ async def test_import_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [flow.ExportFlowRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + flow.ExportFlowRequest, + dict, + ], +) def test_export_flow(request_type, transport: str = "grpc"): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2423,7 +2799,8 @@ def test_export_flow_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2439,7 +2816,8 @@ async def test_export_flow_async( transport: str = "grpc_asyncio", request_type=flow.ExportFlowRequest ): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2469,13 +2847,15 @@ async def test_export_flow_async_from_dict(): def test_export_flow_field_headers(): - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.ExportFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.export_flow), "__call__") as call: @@ -2489,18 +2869,23 @@ def test_export_flow_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_export_flow_field_headers_async(): - client = FlowsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = FlowsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = flow.ExportFlowRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.export_flow), "__call__") as call: @@ -2516,7 +2901,10 @@ async def test_export_flow_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_credentials_transport_error(): @@ -2526,7 +2914,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2546,7 +2935,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = FlowsClient(client_options=options, transport=transport,) + client = FlowsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2562,7 +2954,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = FlowsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2592,7 +2985,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.FlowsGrpcTransport, transports.FlowsGrpcAsyncIOTransport,], + [ + transports.FlowsGrpcTransport, + transports.FlowsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2602,10 +2998,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = FlowsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = FlowsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.FlowsGrpcTransport,) + client = FlowsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.FlowsGrpcTransport, + ) def test_flows_base_transport_error(): @@ -2653,6 +3067,14 @@ def test_flows_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_flows_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2664,7 +3086,8 @@ def test_flows_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.FlowsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2705,7 +3128,10 @@ def test_flows_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.FlowsGrpcTransport, transports.FlowsGrpcAsyncIOTransport,], + [ + transports.FlowsGrpcTransport, + transports.FlowsGrpcAsyncIOTransport, + ], ) def test_flows_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2803,31 +3229,50 @@ def test_flows_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_flows_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_flows_host_no_port(transport_name): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_flows_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_flows_host_with_port(transport_name): client = FlowsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_flows_grpc_transport_channel(): channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. - transport = transports.FlowsGrpcTransport(host="squid.clam.whelk", channel=channel,) + transport = transports.FlowsGrpcTransport( + host="squid.clam.whelk", + channel=channel, + ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" assert transport._ssl_channel_credentials == None @@ -2838,7 +3283,8 @@ def test_flows_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.FlowsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2939,12 +3385,16 @@ def test_flows_transport_channel_mtls_with_adc(transport_class): def test_flows_grpc_lro_client(): client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2952,12 +3402,16 @@ def test_flows_grpc_lro_client(): def test_flows_grpc_lro_async_client(): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2968,8 +3422,13 @@ def test_flow_path(): location = "clam" agent = "whelk" flow = "octopus" - expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + expected = ( + "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( + project=project, + location=location, + agent=agent, + flow=flow, + ) ) actual = FlowsClient.flow_path(project, location, agent, flow) assert expected == actual @@ -2995,7 +3454,10 @@ def test_flow_validation_result_path(): agent = "scallop" flow = "abalone" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/validationResult".format( - project=project, location=location, agent=agent, flow=flow, + project=project, + location=location, + agent=agent, + flow=flow, ) actual = FlowsClient.flow_validation_result_path(project, location, agent, flow) assert expected == actual @@ -3021,7 +3483,10 @@ def test_intent_path(): agent = "cuttlefish" intent = "mussel" expected = "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) actual = FlowsClient.intent_path(project, location, agent, intent) assert expected == actual @@ -3048,7 +3513,11 @@ def test_page_path(): flow = "octopus" page = "oyster" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) actual = FlowsClient.page_path(project, location, agent, flow, page) assert expected == actual @@ -3109,7 +3578,10 @@ def test_webhook_path(): agent = "scallop" webhook = "abalone" expected = "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) actual = FlowsClient.webhook_path(project, location, agent, webhook) assert expected == actual @@ -3151,7 +3623,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = FlowsClient.common_folder_path(folder) assert expected == actual @@ -3169,7 +3643,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "winkle" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = FlowsClient.common_organization_path(organization) assert expected == actual @@ -3187,7 +3663,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "scallop" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = FlowsClient.common_project_path(project) assert expected == actual @@ -3207,7 +3685,8 @@ def test_common_location_path(): project = "squid" location = "clam" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = FlowsClient.common_location_path(project, location) assert expected == actual @@ -3230,14 +3709,16 @@ def test_client_with_default_client_info(): with mock.patch.object(transports.FlowsTransport, "_prep_wrapped_messages") as prep: client = FlowsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) with mock.patch.object(transports.FlowsTransport, "_prep_wrapped_messages") as prep: transport_class = FlowsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3245,7 +3726,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = FlowsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_intents.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_intents.py index 4af3d5e1..b124e8ad 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_intents.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_intents.py @@ -80,19 +80,25 @@ def test__get_default_mtls_endpoint(): assert IntentsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [IntentsClient, IntentsAsyncClient,]) -def test_intents_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (IntentsClient, "grpc"), + (IntentsAsyncClient, "grpc_asyncio"), + ], +) +def test_intents_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -118,22 +124,32 @@ def test_intents_client_service_account_always_use_jwt(transport_class, transpor use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [IntentsClient, IntentsAsyncClient,]) -def test_intents_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (IntentsClient, "grpc"), + (IntentsAsyncClient, "grpc_asyncio"), + ], +) +def test_intents_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_intents_client_get_transport_class(): @@ -457,7 +473,9 @@ def test_intents_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -588,10 +606,17 @@ def test_intents_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [intent.ListIntentsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + intent.ListIntentsRequest, + dict, + ], +) def test_list_intents(request_type, transport: str = "grpc"): client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -620,7 +645,8 @@ def test_list_intents_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -636,7 +662,8 @@ async def test_list_intents_async( transport: str = "grpc_asyncio", request_type=intent.ListIntentsRequest ): client = IntentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -647,7 +674,9 @@ async def test_list_intents_async( with mock.patch.object(type(client.transport.list_intents), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - intent.ListIntentsResponse(next_page_token="next_page_token_value",) + intent.ListIntentsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_intents(request) @@ -667,13 +696,15 @@ async def test_list_intents_async_from_dict(): def test_list_intents_field_headers(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = intent.ListIntentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_intents), "__call__") as call: @@ -687,18 +718,23 @@ def test_list_intents_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_intents_field_headers_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = intent.ListIntentsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_intents), "__call__") as call: @@ -714,11 +750,16 @@ async def test_list_intents_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_intents_flattened(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_intents), "__call__") as call: @@ -726,7 +767,9 @@ def test_list_intents_flattened(): call.return_value = intent.ListIntentsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_intents(parent="parent_value",) + client.list_intents( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -738,19 +781,24 @@ def test_list_intents_flattened(): def test_list_intents_flattened_error(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_intents( - intent.ListIntentsRequest(), parent="parent_value", + intent.ListIntentsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_intents_flattened_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_intents), "__call__") as call: @@ -762,7 +810,9 @@ async def test_list_intents_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_intents(parent="parent_value",) + response = await client.list_intents( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -775,19 +825,23 @@ async def test_list_intents_flattened_async(): @pytest.mark.asyncio async def test_list_intents_flattened_error_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_intents( - intent.ListIntentsRequest(), parent="parent_value", + intent.ListIntentsRequest(), + parent="parent_value", ) def test_list_intents_pager(transport_name: str = "grpc"): client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -795,14 +849,29 @@ def test_list_intents_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( intent.ListIntentsResponse( - intents=[intent.Intent(), intent.Intent(), intent.Intent(),], + intents=[ + intent.Intent(), + intent.Intent(), + intent.Intent(), + ], next_page_token="abc", ), - intent.ListIntentsResponse(intents=[], next_page_token="def",), intent.ListIntentsResponse( - intents=[intent.Intent(),], next_page_token="ghi", + intents=[], + next_page_token="def", + ), + intent.ListIntentsResponse( + intents=[ + intent.Intent(), + ], + next_page_token="ghi", + ), + intent.ListIntentsResponse( + intents=[ + intent.Intent(), + intent.Intent(), + ], ), - intent.ListIntentsResponse(intents=[intent.Intent(), intent.Intent(),],), RuntimeError, ) @@ -814,14 +883,15 @@ def test_list_intents_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, intent.Intent) for i in results) def test_list_intents_pages(transport_name: str = "grpc"): client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -829,14 +899,29 @@ def test_list_intents_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( intent.ListIntentsResponse( - intents=[intent.Intent(), intent.Intent(), intent.Intent(),], + intents=[ + intent.Intent(), + intent.Intent(), + intent.Intent(), + ], next_page_token="abc", ), - intent.ListIntentsResponse(intents=[], next_page_token="def",), intent.ListIntentsResponse( - intents=[intent.Intent(),], next_page_token="ghi", + intents=[], + next_page_token="def", + ), + intent.ListIntentsResponse( + intents=[ + intent.Intent(), + ], + next_page_token="ghi", + ), + intent.ListIntentsResponse( + intents=[ + intent.Intent(), + intent.Intent(), + ], ), - intent.ListIntentsResponse(intents=[intent.Intent(), intent.Intent(),],), RuntimeError, ) pages = list(client.list_intents(request={}).pages) @@ -846,7 +931,9 @@ def test_list_intents_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_intents_async_pager(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -855,20 +942,37 @@ async def test_list_intents_async_pager(): # Set the response to a series of pages. call.side_effect = ( intent.ListIntentsResponse( - intents=[intent.Intent(), intent.Intent(), intent.Intent(),], + intents=[ + intent.Intent(), + intent.Intent(), + intent.Intent(), + ], next_page_token="abc", ), - intent.ListIntentsResponse(intents=[], next_page_token="def",), intent.ListIntentsResponse( - intents=[intent.Intent(),], next_page_token="ghi", + intents=[], + next_page_token="def", + ), + intent.ListIntentsResponse( + intents=[ + intent.Intent(), + ], + next_page_token="ghi", + ), + intent.ListIntentsResponse( + intents=[ + intent.Intent(), + intent.Intent(), + ], ), - intent.ListIntentsResponse(intents=[intent.Intent(), intent.Intent(),],), RuntimeError, ) - async_pager = await client.list_intents(request={},) + async_pager = await client.list_intents( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -877,7 +981,9 @@ async def test_list_intents_async_pager(): @pytest.mark.asyncio async def test_list_intents_async_pages(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -886,27 +992,51 @@ async def test_list_intents_async_pages(): # Set the response to a series of pages. call.side_effect = ( intent.ListIntentsResponse( - intents=[intent.Intent(), intent.Intent(), intent.Intent(),], + intents=[ + intent.Intent(), + intent.Intent(), + intent.Intent(), + ], next_page_token="abc", ), - intent.ListIntentsResponse(intents=[], next_page_token="def",), intent.ListIntentsResponse( - intents=[intent.Intent(),], next_page_token="ghi", + intents=[], + next_page_token="def", + ), + intent.ListIntentsResponse( + intents=[ + intent.Intent(), + ], + next_page_token="ghi", + ), + intent.ListIntentsResponse( + intents=[ + intent.Intent(), + intent.Intent(), + ], ), - intent.ListIntentsResponse(intents=[intent.Intent(), intent.Intent(),],), RuntimeError, ) pages = [] - async for page_ in (await client.list_intents(request={})).pages: + async for page_ in ( + await client.list_intents(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [intent.GetIntentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + intent.GetIntentRequest, + dict, + ], +) def test_get_intent(request_type, transport: str = "grpc"): client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -943,7 +1073,8 @@ def test_get_intent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -959,7 +1090,8 @@ async def test_get_intent_async( transport: str = "grpc_asyncio", request_type=intent.GetIntentRequest ): client = IntentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1000,13 +1132,15 @@ async def test_get_intent_async_from_dict(): def test_get_intent_field_headers(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = intent.GetIntentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_intent), "__call__") as call: @@ -1020,18 +1154,23 @@ def test_get_intent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_intent_field_headers_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = intent.GetIntentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_intent), "__call__") as call: @@ -1045,11 +1184,16 @@ async def test_get_intent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_intent_flattened(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_intent), "__call__") as call: @@ -1057,7 +1201,9 @@ def test_get_intent_flattened(): call.return_value = intent.Intent() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_intent(name="name_value",) + client.get_intent( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1069,19 +1215,24 @@ def test_get_intent_flattened(): def test_get_intent_flattened_error(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_intent( - intent.GetIntentRequest(), name="name_value", + intent.GetIntentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_intent_flattened_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_intent), "__call__") as call: @@ -1091,7 +1242,9 @@ async def test_get_intent_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(intent.Intent()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_intent(name="name_value",) + response = await client.get_intent( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1104,20 +1257,30 @@ async def test_get_intent_flattened_async(): @pytest.mark.asyncio async def test_get_intent_flattened_error_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_intent( - intent.GetIntentRequest(), name="name_value", + intent.GetIntentRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [gcdc_intent.CreateIntentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_intent.CreateIntentRequest, + dict, + ], +) def test_create_intent(request_type, transport: str = "grpc"): client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1154,7 +1317,8 @@ def test_create_intent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1170,7 +1334,8 @@ async def test_create_intent_async( transport: str = "grpc_asyncio", request_type=gcdc_intent.CreateIntentRequest ): client = IntentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1211,13 +1376,15 @@ async def test_create_intent_async_from_dict(): def test_create_intent_field_headers(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_intent.CreateIntentRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_intent), "__call__") as call: @@ -1231,18 +1398,23 @@ def test_create_intent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_intent_field_headers_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_intent.CreateIntentRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_intent), "__call__") as call: @@ -1256,11 +1428,16 @@ async def test_create_intent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_intent_flattened(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_intent), "__call__") as call: @@ -1269,7 +1446,8 @@ def test_create_intent_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_intent( - parent="parent_value", intent=gcdc_intent.Intent(name="name_value"), + parent="parent_value", + intent=gcdc_intent.Intent(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1285,7 +1463,9 @@ def test_create_intent_flattened(): def test_create_intent_flattened_error(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1299,7 +1479,9 @@ def test_create_intent_flattened_error(): @pytest.mark.asyncio async def test_create_intent_flattened_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_intent), "__call__") as call: @@ -1310,7 +1492,8 @@ async def test_create_intent_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_intent( - parent="parent_value", intent=gcdc_intent.Intent(name="name_value"), + parent="parent_value", + intent=gcdc_intent.Intent(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1327,7 +1510,9 @@ async def test_create_intent_flattened_async(): @pytest.mark.asyncio async def test_create_intent_flattened_error_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1339,10 +1524,17 @@ async def test_create_intent_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [gcdc_intent.UpdateIntentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_intent.UpdateIntentRequest, + dict, + ], +) def test_update_intent(request_type, transport: str = "grpc"): client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1379,7 +1571,8 @@ def test_update_intent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1395,7 +1588,8 @@ async def test_update_intent_async( transport: str = "grpc_asyncio", request_type=gcdc_intent.UpdateIntentRequest ): client = IntentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1436,13 +1630,15 @@ async def test_update_intent_async_from_dict(): def test_update_intent_field_headers(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_intent.UpdateIntentRequest() - request.intent.name = "intent.name/value" + request.intent.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_intent), "__call__") as call: @@ -1456,18 +1652,23 @@ def test_update_intent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "intent.name=intent.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "intent.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_intent_field_headers_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_intent.UpdateIntentRequest() - request.intent.name = "intent.name/value" + request.intent.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_intent), "__call__") as call: @@ -1481,11 +1682,16 @@ async def test_update_intent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "intent.name=intent.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "intent.name=name_value", + ) in kw["metadata"] def test_update_intent_flattened(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_intent), "__call__") as call: @@ -1511,7 +1717,9 @@ def test_update_intent_flattened(): def test_update_intent_flattened_error(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1525,7 +1733,9 @@ def test_update_intent_flattened_error(): @pytest.mark.asyncio async def test_update_intent_flattened_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_intent), "__call__") as call: @@ -1554,7 +1764,9 @@ async def test_update_intent_flattened_async(): @pytest.mark.asyncio async def test_update_intent_flattened_error_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1566,10 +1778,17 @@ async def test_update_intent_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [intent.DeleteIntentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + intent.DeleteIntentRequest, + dict, + ], +) def test_delete_intent(request_type, transport: str = "grpc"): client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1595,7 +1814,8 @@ def test_delete_intent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1611,7 +1831,8 @@ async def test_delete_intent_async( transport: str = "grpc_asyncio", request_type=intent.DeleteIntentRequest ): client = IntentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1639,13 +1860,15 @@ async def test_delete_intent_async_from_dict(): def test_delete_intent_field_headers(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = intent.DeleteIntentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_intent), "__call__") as call: @@ -1659,18 +1882,23 @@ def test_delete_intent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_intent_field_headers_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = intent.DeleteIntentRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_intent), "__call__") as call: @@ -1684,11 +1912,16 @@ async def test_delete_intent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_intent_flattened(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_intent), "__call__") as call: @@ -1696,7 +1929,9 @@ def test_delete_intent_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_intent(name="name_value",) + client.delete_intent( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1708,19 +1943,24 @@ def test_delete_intent_flattened(): def test_delete_intent_flattened_error(): - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_intent( - intent.DeleteIntentRequest(), name="name_value", + intent.DeleteIntentRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_intent_flattened_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_intent), "__call__") as call: @@ -1730,7 +1970,9 @@ async def test_delete_intent_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_intent(name="name_value",) + response = await client.delete_intent( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1743,13 +1985,16 @@ async def test_delete_intent_flattened_async(): @pytest.mark.asyncio async def test_delete_intent_flattened_error_async(): - client = IntentsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = IntentsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_intent( - intent.DeleteIntentRequest(), name="name_value", + intent.DeleteIntentRequest(), + name="name_value", ) @@ -1760,7 +2005,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1780,7 +2026,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = IntentsClient(client_options=options, transport=transport,) + client = IntentsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1796,7 +2045,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = IntentsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1826,7 +2076,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.IntentsGrpcTransport, transports.IntentsGrpcAsyncIOTransport,], + [ + transports.IntentsGrpcTransport, + transports.IntentsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1836,10 +2089,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = IntentsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = IntentsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.IntentsGrpcTransport,) + client = IntentsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.IntentsGrpcTransport, + ) def test_intents_base_transport_error(): @@ -1877,6 +2148,14 @@ def test_intents_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_intents_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1888,7 +2167,8 @@ def test_intents_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.IntentsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1929,7 +2209,10 @@ def test_intents_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.IntentsGrpcTransport, transports.IntentsGrpcAsyncIOTransport,], + [ + transports.IntentsGrpcTransport, + transports.IntentsGrpcAsyncIOTransport, + ], ) def test_intents_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2027,24 +2310,40 @@ def test_intents_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_intents_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_intents_host_no_port(transport_name): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_intents_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_intents_host_with_port(transport_name): client = IntentsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_intents_grpc_transport_channel(): @@ -2052,7 +2351,8 @@ def test_intents_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.IntentsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2064,7 +2364,8 @@ def test_intents_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.IntentsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2169,7 +2470,10 @@ def test_entity_type_path(): agent = "whelk" entity_type = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) actual = IntentsClient.entity_type_path(project, location, agent, entity_type) assert expected == actual @@ -2195,7 +2499,10 @@ def test_intent_path(): agent = "scallop" intent = "abalone" expected = "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) actual = IntentsClient.intent_path(project, location, agent, intent) assert expected == actual @@ -2237,7 +2544,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = IntentsClient.common_folder_path(folder) assert expected == actual @@ -2255,7 +2564,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "winkle" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = IntentsClient.common_organization_path(organization) assert expected == actual @@ -2273,7 +2584,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "scallop" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = IntentsClient.common_project_path(project) assert expected == actual @@ -2293,7 +2606,8 @@ def test_common_location_path(): project = "squid" location = "clam" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = IntentsClient.common_location_path(project, location) assert expected == actual @@ -2318,7 +2632,8 @@ def test_client_with_default_client_info(): transports.IntentsTransport, "_prep_wrapped_messages" ) as prep: client = IntentsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2327,7 +2642,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = IntentsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2335,7 +2651,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = IntentsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_pages.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_pages.py index dc75a40a..7963e811 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_pages.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_pages.py @@ -83,19 +83,25 @@ def test__get_default_mtls_endpoint(): assert PagesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [PagesClient, PagesAsyncClient,]) -def test_pages_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (PagesClient, "grpc"), + (PagesAsyncClient, "grpc_asyncio"), + ], +) +def test_pages_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -121,22 +127,32 @@ def test_pages_client_service_account_always_use_jwt(transport_class, transport_ use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [PagesClient, PagesAsyncClient,]) -def test_pages_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (PagesClient, "grpc"), + (PagesAsyncClient, "grpc_asyncio"), + ], +) +def test_pages_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_pages_client_get_transport_class(): @@ -460,7 +476,9 @@ def test_pages_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -591,10 +609,17 @@ def test_pages_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [page.ListPagesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + page.ListPagesRequest, + dict, + ], +) def test_list_pages(request_type, transport: str = "grpc"): client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -623,7 +648,8 @@ def test_list_pages_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -639,7 +665,8 @@ async def test_list_pages_async( transport: str = "grpc_asyncio", request_type=page.ListPagesRequest ): client = PagesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -650,7 +677,9 @@ async def test_list_pages_async( with mock.patch.object(type(client.transport.list_pages), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - page.ListPagesResponse(next_page_token="next_page_token_value",) + page.ListPagesResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_pages(request) @@ -670,13 +699,15 @@ async def test_list_pages_async_from_dict(): def test_list_pages_field_headers(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = page.ListPagesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_pages), "__call__") as call: @@ -690,18 +721,23 @@ def test_list_pages_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_pages_field_headers_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = page.ListPagesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_pages), "__call__") as call: @@ -717,11 +753,16 @@ async def test_list_pages_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_pages_flattened(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_pages), "__call__") as call: @@ -729,7 +770,9 @@ def test_list_pages_flattened(): call.return_value = page.ListPagesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_pages(parent="parent_value",) + client.list_pages( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -741,19 +784,24 @@ def test_list_pages_flattened(): def test_list_pages_flattened_error(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_pages( - page.ListPagesRequest(), parent="parent_value", + page.ListPagesRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_pages_flattened_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_pages), "__call__") as call: @@ -765,7 +813,9 @@ async def test_list_pages_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_pages(parent="parent_value",) + response = await client.list_pages( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -778,19 +828,23 @@ async def test_list_pages_flattened_async(): @pytest.mark.asyncio async def test_list_pages_flattened_error_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_pages( - page.ListPagesRequest(), parent="parent_value", + page.ListPagesRequest(), + parent="parent_value", ) def test_list_pages_pager(transport_name: str = "grpc"): client = PagesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -798,11 +852,29 @@ def test_list_pages_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( page.ListPagesResponse( - pages=[page.Page(), page.Page(), page.Page(),], next_page_token="abc", + pages=[ + page.Page(), + page.Page(), + page.Page(), + ], + next_page_token="abc", + ), + page.ListPagesResponse( + pages=[], + next_page_token="def", + ), + page.ListPagesResponse( + pages=[ + page.Page(), + ], + next_page_token="ghi", + ), + page.ListPagesResponse( + pages=[ + page.Page(), + page.Page(), + ], ), - page.ListPagesResponse(pages=[], next_page_token="def",), - page.ListPagesResponse(pages=[page.Page(),], next_page_token="ghi",), - page.ListPagesResponse(pages=[page.Page(), page.Page(),],), RuntimeError, ) @@ -814,14 +886,15 @@ def test_list_pages_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, page.Page) for i in results) def test_list_pages_pages(transport_name: str = "grpc"): client = PagesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -829,11 +902,29 @@ def test_list_pages_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( page.ListPagesResponse( - pages=[page.Page(), page.Page(), page.Page(),], next_page_token="abc", + pages=[ + page.Page(), + page.Page(), + page.Page(), + ], + next_page_token="abc", + ), + page.ListPagesResponse( + pages=[], + next_page_token="def", + ), + page.ListPagesResponse( + pages=[ + page.Page(), + ], + next_page_token="ghi", + ), + page.ListPagesResponse( + pages=[ + page.Page(), + page.Page(), + ], ), - page.ListPagesResponse(pages=[], next_page_token="def",), - page.ListPagesResponse(pages=[page.Page(),], next_page_token="ghi",), - page.ListPagesResponse(pages=[page.Page(), page.Page(),],), RuntimeError, ) pages = list(client.list_pages(request={}).pages) @@ -843,7 +934,9 @@ def test_list_pages_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_pages_async_pager(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -852,17 +945,37 @@ async def test_list_pages_async_pager(): # Set the response to a series of pages. call.side_effect = ( page.ListPagesResponse( - pages=[page.Page(), page.Page(), page.Page(),], next_page_token="abc", + pages=[ + page.Page(), + page.Page(), + page.Page(), + ], + next_page_token="abc", + ), + page.ListPagesResponse( + pages=[], + next_page_token="def", + ), + page.ListPagesResponse( + pages=[ + page.Page(), + ], + next_page_token="ghi", + ), + page.ListPagesResponse( + pages=[ + page.Page(), + page.Page(), + ], ), - page.ListPagesResponse(pages=[], next_page_token="def",), - page.ListPagesResponse(pages=[page.Page(),], next_page_token="ghi",), - page.ListPagesResponse(pages=[page.Page(), page.Page(),],), RuntimeError, ) - async_pager = await client.list_pages(request={},) + async_pager = await client.list_pages( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -871,7 +984,9 @@ async def test_list_pages_async_pager(): @pytest.mark.asyncio async def test_list_pages_async_pages(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -880,24 +995,51 @@ async def test_list_pages_async_pages(): # Set the response to a series of pages. call.side_effect = ( page.ListPagesResponse( - pages=[page.Page(), page.Page(), page.Page(),], next_page_token="abc", + pages=[ + page.Page(), + page.Page(), + page.Page(), + ], + next_page_token="abc", + ), + page.ListPagesResponse( + pages=[], + next_page_token="def", + ), + page.ListPagesResponse( + pages=[ + page.Page(), + ], + next_page_token="ghi", + ), + page.ListPagesResponse( + pages=[ + page.Page(), + page.Page(), + ], ), - page.ListPagesResponse(pages=[], next_page_token="def",), - page.ListPagesResponse(pages=[page.Page(),], next_page_token="ghi",), - page.ListPagesResponse(pages=[page.Page(), page.Page(),],), RuntimeError, ) pages = [] - async for page_ in (await client.list_pages(request={})).pages: + async for page_ in ( + await client.list_pages(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [page.GetPageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + page.GetPageRequest, + dict, + ], +) def test_get_page(request_type, transport: str = "grpc"): client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -930,7 +1072,8 @@ def test_get_page_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -946,7 +1089,8 @@ async def test_get_page_async( transport: str = "grpc_asyncio", request_type=page.GetPageRequest ): client = PagesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -983,13 +1127,15 @@ async def test_get_page_async_from_dict(): def test_get_page_field_headers(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = page.GetPageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_page), "__call__") as call: @@ -1003,18 +1149,23 @@ def test_get_page_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_page_field_headers_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = page.GetPageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_page), "__call__") as call: @@ -1028,11 +1179,16 @@ async def test_get_page_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_page_flattened(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_page), "__call__") as call: @@ -1040,7 +1196,9 @@ def test_get_page_flattened(): call.return_value = page.Page() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_page(name="name_value",) + client.get_page( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1052,19 +1210,24 @@ def test_get_page_flattened(): def test_get_page_flattened_error(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_page( - page.GetPageRequest(), name="name_value", + page.GetPageRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_page_flattened_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_page), "__call__") as call: @@ -1074,7 +1237,9 @@ async def test_get_page_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(page.Page()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_page(name="name_value",) + response = await client.get_page( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1087,20 +1252,30 @@ async def test_get_page_flattened_async(): @pytest.mark.asyncio async def test_get_page_flattened_error_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_page( - page.GetPageRequest(), name="name_value", + page.GetPageRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [gcdc_page.CreatePageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_page.CreatePageRequest, + dict, + ], +) def test_create_page(request_type, transport: str = "grpc"): client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1133,7 +1308,8 @@ def test_create_page_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1149,7 +1325,8 @@ async def test_create_page_async( transport: str = "grpc_asyncio", request_type=gcdc_page.CreatePageRequest ): client = PagesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1186,13 +1363,15 @@ async def test_create_page_async_from_dict(): def test_create_page_field_headers(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_page.CreatePageRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_page), "__call__") as call: @@ -1206,18 +1385,23 @@ def test_create_page_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_page_field_headers_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_page.CreatePageRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_page), "__call__") as call: @@ -1231,11 +1415,16 @@ async def test_create_page_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_page_flattened(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_page), "__call__") as call: @@ -1244,7 +1433,8 @@ def test_create_page_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_page( - parent="parent_value", page=gcdc_page.Page(name="name_value"), + parent="parent_value", + page=gcdc_page.Page(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1260,7 +1450,9 @@ def test_create_page_flattened(): def test_create_page_flattened_error(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1274,7 +1466,9 @@ def test_create_page_flattened_error(): @pytest.mark.asyncio async def test_create_page_flattened_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_page), "__call__") as call: @@ -1285,7 +1479,8 @@ async def test_create_page_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_page( - parent="parent_value", page=gcdc_page.Page(name="name_value"), + parent="parent_value", + page=gcdc_page.Page(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1302,7 +1497,9 @@ async def test_create_page_flattened_async(): @pytest.mark.asyncio async def test_create_page_flattened_error_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1314,10 +1511,17 @@ async def test_create_page_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [gcdc_page.UpdatePageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_page.UpdatePageRequest, + dict, + ], +) def test_update_page(request_type, transport: str = "grpc"): client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1350,7 +1554,8 @@ def test_update_page_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1366,7 +1571,8 @@ async def test_update_page_async( transport: str = "grpc_asyncio", request_type=gcdc_page.UpdatePageRequest ): client = PagesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1403,13 +1609,15 @@ async def test_update_page_async_from_dict(): def test_update_page_field_headers(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_page.UpdatePageRequest() - request.page.name = "page.name/value" + request.page.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_page), "__call__") as call: @@ -1423,18 +1631,23 @@ def test_update_page_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "page.name=page.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "page.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_page_field_headers_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_page.UpdatePageRequest() - request.page.name = "page.name/value" + request.page.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_page), "__call__") as call: @@ -1448,11 +1661,16 @@ async def test_update_page_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "page.name=page.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "page.name=name_value", + ) in kw["metadata"] def test_update_page_flattened(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_page), "__call__") as call: @@ -1478,7 +1696,9 @@ def test_update_page_flattened(): def test_update_page_flattened_error(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1492,7 +1712,9 @@ def test_update_page_flattened_error(): @pytest.mark.asyncio async def test_update_page_flattened_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_page), "__call__") as call: @@ -1521,7 +1743,9 @@ async def test_update_page_flattened_async(): @pytest.mark.asyncio async def test_update_page_flattened_error_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1533,10 +1757,17 @@ async def test_update_page_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [page.DeletePageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + page.DeletePageRequest, + dict, + ], +) def test_delete_page(request_type, transport: str = "grpc"): client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1562,7 +1793,8 @@ def test_delete_page_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1578,7 +1810,8 @@ async def test_delete_page_async( transport: str = "grpc_asyncio", request_type=page.DeletePageRequest ): client = PagesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1606,13 +1839,15 @@ async def test_delete_page_async_from_dict(): def test_delete_page_field_headers(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = page.DeletePageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_page), "__call__") as call: @@ -1626,18 +1861,23 @@ def test_delete_page_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_page_field_headers_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = page.DeletePageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_page), "__call__") as call: @@ -1651,11 +1891,16 @@ async def test_delete_page_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_page_flattened(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_page), "__call__") as call: @@ -1663,7 +1908,9 @@ def test_delete_page_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_page(name="name_value",) + client.delete_page( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1675,19 +1922,24 @@ def test_delete_page_flattened(): def test_delete_page_flattened_error(): - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_page( - page.DeletePageRequest(), name="name_value", + page.DeletePageRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_page_flattened_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_page), "__call__") as call: @@ -1697,7 +1949,9 @@ async def test_delete_page_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_page(name="name_value",) + response = await client.delete_page( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1710,13 +1964,16 @@ async def test_delete_page_flattened_async(): @pytest.mark.asyncio async def test_delete_page_flattened_error_async(): - client = PagesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = PagesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_page( - page.DeletePageRequest(), name="name_value", + page.DeletePageRequest(), + name="name_value", ) @@ -1727,7 +1984,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1747,7 +2005,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = PagesClient(client_options=options, transport=transport,) + client = PagesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1763,7 +2024,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = PagesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1793,7 +2055,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.PagesGrpcTransport, transports.PagesGrpcAsyncIOTransport,], + [ + transports.PagesGrpcTransport, + transports.PagesGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1803,10 +2068,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = PagesClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = PagesClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.PagesGrpcTransport,) + client = PagesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.PagesGrpcTransport, + ) def test_pages_base_transport_error(): @@ -1844,6 +2127,14 @@ def test_pages_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_pages_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1855,7 +2146,8 @@ def test_pages_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.PagesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1896,7 +2188,10 @@ def test_pages_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.PagesGrpcTransport, transports.PagesGrpcAsyncIOTransport,], + [ + transports.PagesGrpcTransport, + transports.PagesGrpcAsyncIOTransport, + ], ) def test_pages_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -1994,31 +2289,50 @@ def test_pages_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_pages_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_pages_host_no_port(transport_name): client = PagesClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_pages_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_pages_host_with_port(transport_name): client = PagesClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_pages_grpc_transport_channel(): channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. - transport = transports.PagesGrpcTransport(host="squid.clam.whelk", channel=channel,) + transport = transports.PagesGrpcTransport( + host="squid.clam.whelk", + channel=channel, + ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" assert transport._ssl_channel_credentials == None @@ -2029,7 +2343,8 @@ def test_pages_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.PagesGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2134,7 +2449,10 @@ def test_entity_type_path(): agent = "whelk" entity_type = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) actual = PagesClient.entity_type_path(project, location, agent, entity_type) assert expected == actual @@ -2159,8 +2477,13 @@ def test_flow_path(): location = "nautilus" agent = "scallop" flow = "abalone" - expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + expected = ( + "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( + project=project, + location=location, + agent=agent, + flow=flow, + ) ) actual = PagesClient.flow_path(project, location, agent, flow) assert expected == actual @@ -2186,7 +2509,10 @@ def test_intent_path(): agent = "cuttlefish" intent = "mussel" expected = "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) actual = PagesClient.intent_path(project, location, agent, intent) assert expected == actual @@ -2213,7 +2539,11 @@ def test_page_path(): flow = "octopus" page = "oyster" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) actual = PagesClient.page_path(project, location, agent, flow, page) assert expected == actual @@ -2274,7 +2604,10 @@ def test_webhook_path(): agent = "scallop" webhook = "abalone" expected = "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) actual = PagesClient.webhook_path(project, location, agent, webhook) assert expected == actual @@ -2316,7 +2649,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = PagesClient.common_folder_path(folder) assert expected == actual @@ -2334,7 +2669,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "winkle" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = PagesClient.common_organization_path(organization) assert expected == actual @@ -2352,7 +2689,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "scallop" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = PagesClient.common_project_path(project) assert expected == actual @@ -2372,7 +2711,8 @@ def test_common_location_path(): project = "squid" location = "clam" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = PagesClient.common_location_path(project, location) assert expected == actual @@ -2395,14 +2735,16 @@ def test_client_with_default_client_info(): with mock.patch.object(transports.PagesTransport, "_prep_wrapped_messages") as prep: client = PagesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) with mock.patch.object(transports.PagesTransport, "_prep_wrapped_messages") as prep: transport_class = PagesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2410,7 +2752,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = PagesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_security_settings_service.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_security_settings_service.py index e07cadc9..14f81030 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_security_settings_service.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_security_settings_service.py @@ -96,20 +96,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [SecuritySettingsServiceClient, SecuritySettingsServiceAsyncClient,] + "client_class,transport_name", + [ + (SecuritySettingsServiceClient, "grpc"), + (SecuritySettingsServiceAsyncClient, "grpc_asyncio"), + ], ) -def test_security_settings_service_client_from_service_account_info(client_class): +def test_security_settings_service_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -138,23 +144,33 @@ def test_security_settings_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [SecuritySettingsServiceClient, SecuritySettingsServiceAsyncClient,] + "client_class,transport_name", + [ + (SecuritySettingsServiceClient, "grpc"), + (SecuritySettingsServiceAsyncClient, "grpc_asyncio"), + ], ) -def test_security_settings_service_client_from_service_account_file(client_class): +def test_security_settings_service_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_security_settings_service_client_get_transport_class(): @@ -522,7 +538,9 @@ def test_security_settings_service_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -666,11 +684,16 @@ def test_security_settings_service_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [gcdc_security_settings.CreateSecuritySettingsRequest, dict,] + "request_type", + [ + gcdc_security_settings.CreateSecuritySettingsRequest, + dict, + ], ) def test_create_security_settings(request_type, transport: str = "grpc"): client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -724,7 +747,8 @@ def test_create_security_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -743,7 +767,8 @@ async def test_create_security_settings_async( request_type=gcdc_security_settings.CreateSecuritySettingsRequest, ): client = SecuritySettingsServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -808,7 +833,7 @@ def test_create_security_settings_field_headers(): # a field header. Set these to a non-empty value. request = gcdc_security_settings.CreateSecuritySettingsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -824,7 +849,10 @@ def test_create_security_settings_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -837,7 +865,7 @@ async def test_create_security_settings_field_headers_async(): # a field header. Set these to a non-empty value. request = gcdc_security_settings.CreateSecuritySettingsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -855,7 +883,10 @@ async def test_create_security_settings_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_security_settings_flattened(): @@ -963,11 +994,16 @@ async def test_create_security_settings_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [security_settings.GetSecuritySettingsRequest, dict,] + "request_type", + [ + security_settings.GetSecuritySettingsRequest, + dict, + ], ) def test_get_security_settings(request_type, transport: str = "grpc"): client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1021,7 +1057,8 @@ def test_get_security_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1040,7 +1077,8 @@ async def test_get_security_settings_async( request_type=security_settings.GetSecuritySettingsRequest, ): client = SecuritySettingsServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1105,7 +1143,7 @@ def test_get_security_settings_field_headers(): # a field header. Set these to a non-empty value. request = security_settings.GetSecuritySettingsRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1121,7 +1159,10 @@ def test_get_security_settings_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1134,7 +1175,7 @@ async def test_get_security_settings_field_headers_async(): # a field header. Set these to a non-empty value. request = security_settings.GetSecuritySettingsRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1152,7 +1193,10 @@ async def test_get_security_settings_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_security_settings_flattened(): @@ -1168,7 +1212,9 @@ def test_get_security_settings_flattened(): call.return_value = security_settings.SecuritySettings() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_security_settings(name="name_value",) + client.get_security_settings( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1188,7 +1234,8 @@ def test_get_security_settings_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_security_settings( - security_settings.GetSecuritySettingsRequest(), name="name_value", + security_settings.GetSecuritySettingsRequest(), + name="name_value", ) @@ -1210,7 +1257,9 @@ async def test_get_security_settings_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_security_settings(name="name_value",) + response = await client.get_security_settings( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1231,16 +1280,22 @@ async def test_get_security_settings_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_security_settings( - security_settings.GetSecuritySettingsRequest(), name="name_value", + security_settings.GetSecuritySettingsRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [gcdc_security_settings.UpdateSecuritySettingsRequest, dict,] + "request_type", + [ + gcdc_security_settings.UpdateSecuritySettingsRequest, + dict, + ], ) def test_update_security_settings(request_type, transport: str = "grpc"): client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1294,7 +1349,8 @@ def test_update_security_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1313,7 +1369,8 @@ async def test_update_security_settings_async( request_type=gcdc_security_settings.UpdateSecuritySettingsRequest, ): client = SecuritySettingsServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1378,7 +1435,7 @@ def test_update_security_settings_field_headers(): # a field header. Set these to a non-empty value. request = gcdc_security_settings.UpdateSecuritySettingsRequest() - request.security_settings.name = "security_settings.name/value" + request.security_settings.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1396,7 +1453,7 @@ def test_update_security_settings_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "security_settings.name=security_settings.name/value", + "security_settings.name=name_value", ) in kw["metadata"] @@ -1410,7 +1467,7 @@ async def test_update_security_settings_field_headers_async(): # a field header. Set these to a non-empty value. request = gcdc_security_settings.UpdateSecuritySettingsRequest() - request.security_settings.name = "security_settings.name/value" + request.security_settings.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1430,7 +1487,7 @@ async def test_update_security_settings_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "security_settings.name=security_settings.name/value", + "security_settings.name=name_value", ) in kw["metadata"] @@ -1539,11 +1596,16 @@ async def test_update_security_settings_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [security_settings.ListSecuritySettingsRequest, dict,] + "request_type", + [ + security_settings.ListSecuritySettingsRequest, + dict, + ], ) def test_list_security_settings(request_type, transport: str = "grpc"): client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1574,7 +1636,8 @@ def test_list_security_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1593,7 +1656,8 @@ async def test_list_security_settings_async( request_type=security_settings.ListSecuritySettingsRequest, ): client = SecuritySettingsServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1636,7 +1700,7 @@ def test_list_security_settings_field_headers(): # a field header. Set these to a non-empty value. request = security_settings.ListSecuritySettingsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1652,7 +1716,10 @@ def test_list_security_settings_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1665,7 +1732,7 @@ async def test_list_security_settings_field_headers_async(): # a field header. Set these to a non-empty value. request = security_settings.ListSecuritySettingsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1683,7 +1750,10 @@ async def test_list_security_settings_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_security_settings_flattened(): @@ -1699,7 +1769,9 @@ def test_list_security_settings_flattened(): call.return_value = security_settings.ListSecuritySettingsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_security_settings(parent="parent_value",) + client.list_security_settings( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1719,7 +1791,8 @@ def test_list_security_settings_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_security_settings( - security_settings.ListSecuritySettingsRequest(), parent="parent_value", + security_settings.ListSecuritySettingsRequest(), + parent="parent_value", ) @@ -1741,7 +1814,9 @@ async def test_list_security_settings_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_security_settings(parent="parent_value",) + response = await client.list_security_settings( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1762,13 +1837,15 @@ async def test_list_security_settings_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_security_settings( - security_settings.ListSecuritySettingsRequest(), parent="parent_value", + security_settings.ListSecuritySettingsRequest(), + parent="parent_value", ) def test_list_security_settings_pager(transport_name: str = "grpc"): client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1786,10 +1863,13 @@ def test_list_security_settings_pager(transport_name: str = "grpc"): next_page_token="abc", ), security_settings.ListSecuritySettingsResponse( - security_settings=[], next_page_token="def", + security_settings=[], + next_page_token="def", ), security_settings.ListSecuritySettingsResponse( - security_settings=[security_settings.SecuritySettings(),], + security_settings=[ + security_settings.SecuritySettings(), + ], next_page_token="ghi", ), security_settings.ListSecuritySettingsResponse( @@ -1809,14 +1889,15 @@ def test_list_security_settings_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, security_settings.SecuritySettings) for i in results) def test_list_security_settings_pages(transport_name: str = "grpc"): client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1834,10 +1915,13 @@ def test_list_security_settings_pages(transport_name: str = "grpc"): next_page_token="abc", ), security_settings.ListSecuritySettingsResponse( - security_settings=[], next_page_token="def", + security_settings=[], + next_page_token="def", ), security_settings.ListSecuritySettingsResponse( - security_settings=[security_settings.SecuritySettings(),], + security_settings=[ + security_settings.SecuritySettings(), + ], next_page_token="ghi", ), security_settings.ListSecuritySettingsResponse( @@ -1876,10 +1960,13 @@ async def test_list_security_settings_async_pager(): next_page_token="abc", ), security_settings.ListSecuritySettingsResponse( - security_settings=[], next_page_token="def", + security_settings=[], + next_page_token="def", ), security_settings.ListSecuritySettingsResponse( - security_settings=[security_settings.SecuritySettings(),], + security_settings=[ + security_settings.SecuritySettings(), + ], next_page_token="ghi", ), security_settings.ListSecuritySettingsResponse( @@ -1890,10 +1977,12 @@ async def test_list_security_settings_async_pager(): ), RuntimeError, ) - async_pager = await client.list_security_settings(request={},) + async_pager = await client.list_security_settings( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1923,10 +2012,13 @@ async def test_list_security_settings_async_pages(): next_page_token="abc", ), security_settings.ListSecuritySettingsResponse( - security_settings=[], next_page_token="def", + security_settings=[], + next_page_token="def", ), security_settings.ListSecuritySettingsResponse( - security_settings=[security_settings.SecuritySettings(),], + security_settings=[ + security_settings.SecuritySettings(), + ], next_page_token="ghi", ), security_settings.ListSecuritySettingsResponse( @@ -1938,18 +2030,25 @@ async def test_list_security_settings_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_security_settings(request={})).pages: + async for page_ in ( + await client.list_security_settings(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [security_settings.DeleteSecuritySettingsRequest, dict,] + "request_type", + [ + security_settings.DeleteSecuritySettingsRequest, + dict, + ], ) def test_delete_security_settings(request_type, transport: str = "grpc"): client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1977,7 +2076,8 @@ def test_delete_security_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1996,7 +2096,8 @@ async def test_delete_security_settings_async( request_type=security_settings.DeleteSecuritySettingsRequest, ): client = SecuritySettingsServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2034,7 +2135,7 @@ def test_delete_security_settings_field_headers(): # a field header. Set these to a non-empty value. request = security_settings.DeleteSecuritySettingsRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2050,7 +2151,10 @@ def test_delete_security_settings_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2063,7 +2167,7 @@ async def test_delete_security_settings_field_headers_async(): # a field header. Set these to a non-empty value. request = security_settings.DeleteSecuritySettingsRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2079,7 +2183,10 @@ async def test_delete_security_settings_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_security_settings_flattened(): @@ -2095,7 +2202,9 @@ def test_delete_security_settings_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_security_settings(name="name_value",) + client.delete_security_settings( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2115,7 +2224,8 @@ def test_delete_security_settings_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_security_settings( - security_settings.DeleteSecuritySettingsRequest(), name="name_value", + security_settings.DeleteSecuritySettingsRequest(), + name="name_value", ) @@ -2135,7 +2245,9 @@ async def test_delete_security_settings_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_security_settings(name="name_value",) + response = await client.delete_security_settings( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2156,7 +2268,8 @@ async def test_delete_security_settings_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_security_settings( - security_settings.DeleteSecuritySettingsRequest(), name="name_value", + security_settings.DeleteSecuritySettingsRequest(), + name="name_value", ) @@ -2167,7 +2280,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2188,7 +2302,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = SecuritySettingsServiceClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2205,7 +2320,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SecuritySettingsServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2248,13 +2364,27 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = SecuritySettingsServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SecuritySettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) assert isinstance( - client.transport, transports.SecuritySettingsServiceGrpcTransport, + client.transport, + transports.SecuritySettingsServiceGrpcTransport, ) @@ -2293,6 +2423,14 @@ def test_security_settings_service_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_security_settings_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2304,7 +2442,8 @@ def test_security_settings_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SecuritySettingsServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2453,24 +2592,40 @@ def test_security_settings_service_grpc_transport_client_cert_source_for_mtls( ) -def test_security_settings_service_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_security_settings_service_host_no_port(transport_name): client = SecuritySettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_security_settings_service_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_security_settings_service_host_with_port(transport_name): client = SecuritySettingsServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_security_settings_service_grpc_transport_channel(): @@ -2478,7 +2633,8 @@ def test_security_settings_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.SecuritySettingsServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2490,7 +2646,8 @@ def test_security_settings_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.SecuritySettingsServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2630,7 +2787,9 @@ def test_inspect_template_path(): location = "mussel" inspect_template = "winkle" expected = "organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}".format( - organization=organization, location=location, inspect_template=inspect_template, + organization=organization, + location=location, + inspect_template=inspect_template, ) actual = SecuritySettingsServiceClient.inspect_template_path( organization, location, inspect_template @@ -2656,7 +2815,9 @@ def test_security_settings_path(): location = "clam" security_settings = "whelk" expected = "projects/{project}/locations/{location}/securitySettings/{security_settings}".format( - project=project, location=location, security_settings=security_settings, + project=project, + location=location, + security_settings=security_settings, ) actual = SecuritySettingsServiceClient.security_settings_path( project, location, security_settings @@ -2699,7 +2860,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "winkle" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = SecuritySettingsServiceClient.common_folder_path(folder) assert expected == actual @@ -2717,7 +2880,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "scallop" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = SecuritySettingsServiceClient.common_organization_path(organization) assert expected == actual @@ -2735,7 +2900,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "squid" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = SecuritySettingsServiceClient.common_project_path(project) assert expected == actual @@ -2755,7 +2922,8 @@ def test_common_location_path(): project = "whelk" location = "octopus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = SecuritySettingsServiceClient.common_location_path(project, location) assert expected == actual @@ -2780,7 +2948,8 @@ def test_client_with_default_client_info(): transports.SecuritySettingsServiceTransport, "_prep_wrapped_messages" ) as prep: client = SecuritySettingsServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2789,7 +2958,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SecuritySettingsServiceClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2797,7 +2967,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SecuritySettingsServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_session_entity_types.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_session_entity_types.py index 01348105..aebb3157 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_session_entity_types.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_session_entity_types.py @@ -95,20 +95,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [SessionEntityTypesClient, SessionEntityTypesAsyncClient,] + "client_class,transport_name", + [ + (SessionEntityTypesClient, "grpc"), + (SessionEntityTypesAsyncClient, "grpc_asyncio"), + ], ) -def test_session_entity_types_client_from_service_account_info(client_class): +def test_session_entity_types_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -137,23 +143,33 @@ def test_session_entity_types_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [SessionEntityTypesClient, SessionEntityTypesAsyncClient,] + "client_class,transport_name", + [ + (SessionEntityTypesClient, "grpc"), + (SessionEntityTypesAsyncClient, "grpc_asyncio"), + ], ) -def test_session_entity_types_client_from_service_account_file(client_class): +def test_session_entity_types_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_session_entity_types_client_get_transport_class(): @@ -511,7 +527,9 @@ def test_session_entity_types_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -655,11 +673,16 @@ def test_session_entity_types_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [session_entity_type.ListSessionEntityTypesRequest, dict,] + "request_type", + [ + session_entity_type.ListSessionEntityTypesRequest, + dict, + ], ) def test_list_session_entity_types(request_type, transport: str = "grpc"): client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -690,7 +713,8 @@ def test_list_session_entity_types_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -709,7 +733,8 @@ async def test_list_session_entity_types_async( request_type=session_entity_type.ListSessionEntityTypesRequest, ): client = SessionEntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -752,7 +777,7 @@ def test_list_session_entity_types_field_headers(): # a field header. Set these to a non-empty value. request = session_entity_type.ListSessionEntityTypesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -768,7 +793,10 @@ def test_list_session_entity_types_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -781,7 +809,7 @@ async def test_list_session_entity_types_field_headers_async(): # a field header. Set these to a non-empty value. request = session_entity_type.ListSessionEntityTypesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -799,7 +827,10 @@ async def test_list_session_entity_types_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_session_entity_types_flattened(): @@ -815,7 +846,9 @@ def test_list_session_entity_types_flattened(): call.return_value = session_entity_type.ListSessionEntityTypesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_session_entity_types(parent="parent_value",) + client.list_session_entity_types( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -835,7 +868,8 @@ def test_list_session_entity_types_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.list_session_entity_types( - session_entity_type.ListSessionEntityTypesRequest(), parent="parent_value", + session_entity_type.ListSessionEntityTypesRequest(), + parent="parent_value", ) @@ -857,7 +891,9 @@ async def test_list_session_entity_types_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_session_entity_types(parent="parent_value",) + response = await client.list_session_entity_types( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -878,13 +914,15 @@ async def test_list_session_entity_types_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_session_entity_types( - session_entity_type.ListSessionEntityTypesRequest(), parent="parent_value", + session_entity_type.ListSessionEntityTypesRequest(), + parent="parent_value", ) def test_list_session_entity_types_pager(transport_name: str = "grpc"): client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -902,10 +940,13 @@ def test_list_session_entity_types_pager(transport_name: str = "grpc"): next_page_token="abc", ), session_entity_type.ListSessionEntityTypesResponse( - session_entity_types=[], next_page_token="def", + session_entity_types=[], + next_page_token="def", ), session_entity_type.ListSessionEntityTypesResponse( - session_entity_types=[session_entity_type.SessionEntityType(),], + session_entity_types=[ + session_entity_type.SessionEntityType(), + ], next_page_token="ghi", ), session_entity_type.ListSessionEntityTypesResponse( @@ -925,7 +966,7 @@ def test_list_session_entity_types_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all( isinstance(i, session_entity_type.SessionEntityType) for i in results @@ -934,7 +975,8 @@ def test_list_session_entity_types_pager(transport_name: str = "grpc"): def test_list_session_entity_types_pages(transport_name: str = "grpc"): client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -952,10 +994,13 @@ def test_list_session_entity_types_pages(transport_name: str = "grpc"): next_page_token="abc", ), session_entity_type.ListSessionEntityTypesResponse( - session_entity_types=[], next_page_token="def", + session_entity_types=[], + next_page_token="def", ), session_entity_type.ListSessionEntityTypesResponse( - session_entity_types=[session_entity_type.SessionEntityType(),], + session_entity_types=[ + session_entity_type.SessionEntityType(), + ], next_page_token="ghi", ), session_entity_type.ListSessionEntityTypesResponse( @@ -994,10 +1039,13 @@ async def test_list_session_entity_types_async_pager(): next_page_token="abc", ), session_entity_type.ListSessionEntityTypesResponse( - session_entity_types=[], next_page_token="def", + session_entity_types=[], + next_page_token="def", ), session_entity_type.ListSessionEntityTypesResponse( - session_entity_types=[session_entity_type.SessionEntityType(),], + session_entity_types=[ + session_entity_type.SessionEntityType(), + ], next_page_token="ghi", ), session_entity_type.ListSessionEntityTypesResponse( @@ -1008,10 +1056,12 @@ async def test_list_session_entity_types_async_pager(): ), RuntimeError, ) - async_pager = await client.list_session_entity_types(request={},) + async_pager = await client.list_session_entity_types( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1043,10 +1093,13 @@ async def test_list_session_entity_types_async_pages(): next_page_token="abc", ), session_entity_type.ListSessionEntityTypesResponse( - session_entity_types=[], next_page_token="def", + session_entity_types=[], + next_page_token="def", ), session_entity_type.ListSessionEntityTypesResponse( - session_entity_types=[session_entity_type.SessionEntityType(),], + session_entity_types=[ + session_entity_type.SessionEntityType(), + ], next_page_token="ghi", ), session_entity_type.ListSessionEntityTypesResponse( @@ -1058,18 +1111,25 @@ async def test_list_session_entity_types_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_session_entity_types(request={})).pages: + async for page_ in ( + await client.list_session_entity_types(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [session_entity_type.GetSessionEntityTypeRequest, dict,] + "request_type", + [ + session_entity_type.GetSessionEntityTypeRequest, + dict, + ], ) def test_get_session_entity_type(request_type, transport: str = "grpc"): client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1105,7 +1165,8 @@ def test_get_session_entity_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1124,7 +1185,8 @@ async def test_get_session_entity_type_async( request_type=session_entity_type.GetSessionEntityTypeRequest, ): client = SessionEntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1172,7 +1234,7 @@ def test_get_session_entity_type_field_headers(): # a field header. Set these to a non-empty value. request = session_entity_type.GetSessionEntityTypeRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1188,7 +1250,10 @@ def test_get_session_entity_type_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1201,7 +1266,7 @@ async def test_get_session_entity_type_field_headers_async(): # a field header. Set these to a non-empty value. request = session_entity_type.GetSessionEntityTypeRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1219,7 +1284,10 @@ async def test_get_session_entity_type_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_session_entity_type_flattened(): @@ -1235,7 +1303,9 @@ def test_get_session_entity_type_flattened(): call.return_value = session_entity_type.SessionEntityType() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_session_entity_type(name="name_value",) + client.get_session_entity_type( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1255,7 +1325,8 @@ def test_get_session_entity_type_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_session_entity_type( - session_entity_type.GetSessionEntityTypeRequest(), name="name_value", + session_entity_type.GetSessionEntityTypeRequest(), + name="name_value", ) @@ -1277,7 +1348,9 @@ async def test_get_session_entity_type_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_session_entity_type(name="name_value",) + response = await client.get_session_entity_type( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1298,16 +1371,22 @@ async def test_get_session_entity_type_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_session_entity_type( - session_entity_type.GetSessionEntityTypeRequest(), name="name_value", + session_entity_type.GetSessionEntityTypeRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [gcdc_session_entity_type.CreateSessionEntityTypeRequest, dict,] + "request_type", + [ + gcdc_session_entity_type.CreateSessionEntityTypeRequest, + dict, + ], ) def test_create_session_entity_type(request_type, transport: str = "grpc"): client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1343,7 +1422,8 @@ def test_create_session_entity_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1362,7 +1442,8 @@ async def test_create_session_entity_type_async( request_type=gcdc_session_entity_type.CreateSessionEntityTypeRequest, ): client = SessionEntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1410,7 +1491,7 @@ def test_create_session_entity_type_field_headers(): # a field header. Set these to a non-empty value. request = gcdc_session_entity_type.CreateSessionEntityTypeRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1426,7 +1507,10 @@ def test_create_session_entity_type_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1439,7 +1523,7 @@ async def test_create_session_entity_type_field_headers_async(): # a field header. Set these to a non-empty value. request = gcdc_session_entity_type.CreateSessionEntityTypeRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1457,7 +1541,10 @@ async def test_create_session_entity_type_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_session_entity_type_flattened(): @@ -1565,11 +1652,16 @@ async def test_create_session_entity_type_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [gcdc_session_entity_type.UpdateSessionEntityTypeRequest, dict,] + "request_type", + [ + gcdc_session_entity_type.UpdateSessionEntityTypeRequest, + dict, + ], ) def test_update_session_entity_type(request_type, transport: str = "grpc"): client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1605,7 +1697,8 @@ def test_update_session_entity_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1624,7 +1717,8 @@ async def test_update_session_entity_type_async( request_type=gcdc_session_entity_type.UpdateSessionEntityTypeRequest, ): client = SessionEntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1672,7 +1766,7 @@ def test_update_session_entity_type_field_headers(): # a field header. Set these to a non-empty value. request = gcdc_session_entity_type.UpdateSessionEntityTypeRequest() - request.session_entity_type.name = "session_entity_type.name/value" + request.session_entity_type.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1690,7 +1784,7 @@ def test_update_session_entity_type_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "session_entity_type.name=session_entity_type.name/value", + "session_entity_type.name=name_value", ) in kw["metadata"] @@ -1704,7 +1798,7 @@ async def test_update_session_entity_type_field_headers_async(): # a field header. Set these to a non-empty value. request = gcdc_session_entity_type.UpdateSessionEntityTypeRequest() - request.session_entity_type.name = "session_entity_type.name/value" + request.session_entity_type.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1724,7 +1818,7 @@ async def test_update_session_entity_type_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "session_entity_type.name=session_entity_type.name/value", + "session_entity_type.name=name_value", ) in kw["metadata"] @@ -1833,11 +1927,16 @@ async def test_update_session_entity_type_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [session_entity_type.DeleteSessionEntityTypeRequest, dict,] + "request_type", + [ + session_entity_type.DeleteSessionEntityTypeRequest, + dict, + ], ) def test_delete_session_entity_type(request_type, transport: str = "grpc"): client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1865,7 +1964,8 @@ def test_delete_session_entity_type_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1884,7 +1984,8 @@ async def test_delete_session_entity_type_async( request_type=session_entity_type.DeleteSessionEntityTypeRequest, ): client = SessionEntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1922,7 +2023,7 @@ def test_delete_session_entity_type_field_headers(): # a field header. Set these to a non-empty value. request = session_entity_type.DeleteSessionEntityTypeRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1938,7 +2039,10 @@ def test_delete_session_entity_type_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1951,7 +2055,7 @@ async def test_delete_session_entity_type_field_headers_async(): # a field header. Set these to a non-empty value. request = session_entity_type.DeleteSessionEntityTypeRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1967,7 +2071,10 @@ async def test_delete_session_entity_type_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_session_entity_type_flattened(): @@ -1983,7 +2090,9 @@ def test_delete_session_entity_type_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_session_entity_type(name="name_value",) + client.delete_session_entity_type( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2003,7 +2112,8 @@ def test_delete_session_entity_type_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.delete_session_entity_type( - session_entity_type.DeleteSessionEntityTypeRequest(), name="name_value", + session_entity_type.DeleteSessionEntityTypeRequest(), + name="name_value", ) @@ -2023,7 +2133,9 @@ async def test_delete_session_entity_type_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_session_entity_type(name="name_value",) + response = await client.delete_session_entity_type( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2044,7 +2156,8 @@ async def test_delete_session_entity_type_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_session_entity_type( - session_entity_type.DeleteSessionEntityTypeRequest(), name="name_value", + session_entity_type.DeleteSessionEntityTypeRequest(), + name="name_value", ) @@ -2055,7 +2168,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2075,7 +2189,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = SessionEntityTypesClient(client_options=options, transport=transport,) + client = SessionEntityTypesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2091,7 +2208,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SessionEntityTypesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2134,12 +2252,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = SessionEntityTypesClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), ) - assert isinstance(client.transport, transports.SessionEntityTypesGrpcTransport,) + assert isinstance( + client.transport, + transports.SessionEntityTypesGrpcTransport, + ) def test_session_entity_types_base_transport_error(): @@ -2177,6 +2311,14 @@ def test_session_entity_types_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_session_entity_types_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2188,7 +2330,8 @@ def test_session_entity_types_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SessionEntityTypesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2335,24 +2478,40 @@ def test_session_entity_types_grpc_transport_client_cert_source_for_mtls( ) -def test_session_entity_types_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_session_entity_types_host_no_port(transport_name): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_session_entity_types_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_session_entity_types_host_with_port(transport_name): client = SessionEntityTypesClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_session_entity_types_grpc_transport_channel(): @@ -2360,7 +2519,8 @@ def test_session_entity_types_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.SessionEntityTypesGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2372,7 +2532,8 @@ def test_session_entity_types_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.SessionEntityTypesGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2535,7 +2696,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "squid" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = SessionEntityTypesClient.common_folder_path(folder) assert expected == actual @@ -2553,7 +2716,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "whelk" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = SessionEntityTypesClient.common_organization_path(organization) assert expected == actual @@ -2571,7 +2736,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "oyster" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = SessionEntityTypesClient.common_project_path(project) assert expected == actual @@ -2591,7 +2758,8 @@ def test_common_location_path(): project = "cuttlefish" location = "mussel" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = SessionEntityTypesClient.common_location_path(project, location) assert expected == actual @@ -2616,7 +2784,8 @@ def test_client_with_default_client_info(): transports.SessionEntityTypesTransport, "_prep_wrapped_messages" ) as prep: client = SessionEntityTypesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2625,7 +2794,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SessionEntityTypesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2633,7 +2803,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SessionEntityTypesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_sessions.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_sessions.py index 65891e48..2bd51d19 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_sessions.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_sessions.py @@ -85,19 +85,25 @@ def test__get_default_mtls_endpoint(): assert SessionsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [SessionsClient, SessionsAsyncClient,]) -def test_sessions_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (SessionsClient, "grpc"), + (SessionsAsyncClient, "grpc_asyncio"), + ], +) +def test_sessions_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -125,22 +131,32 @@ def test_sessions_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [SessionsClient, SessionsAsyncClient,]) -def test_sessions_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (SessionsClient, "grpc"), + (SessionsAsyncClient, "grpc_asyncio"), + ], +) +def test_sessions_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_sessions_client_get_transport_class(): @@ -470,7 +486,9 @@ def test_sessions_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -601,10 +619,17 @@ def test_sessions_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [session.DetectIntentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + session.DetectIntentRequest, + dict, + ], +) def test_detect_intent(request_type, transport: str = "grpc"): client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -639,7 +664,8 @@ def test_detect_intent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -655,7 +681,8 @@ async def test_detect_intent_async( transport: str = "grpc_asyncio", request_type=session.DetectIntentRequest ): client = SessionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -694,13 +721,15 @@ async def test_detect_intent_async_from_dict(): def test_detect_intent_field_headers(): - client = SessionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = SessionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = session.DetectIntentRequest() - request.session = "session/value" + request.session = "session_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.detect_intent), "__call__") as call: @@ -714,18 +743,23 @@ def test_detect_intent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "session=session/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "session=session_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_detect_intent_field_headers_async(): - client = SessionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = SessionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = session.DetectIntentRequest() - request.session = "session/value" + request.session = "session_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.detect_intent), "__call__") as call: @@ -741,13 +775,23 @@ async def test_detect_intent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "session=session/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "session=session_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [session.StreamingDetectIntentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + session.StreamingDetectIntentRequest, + dict, + ], +) def test_streaming_detect_intent(request_type, transport: str = "grpc"): client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -778,7 +822,8 @@ async def test_streaming_detect_intent_async( transport: str = "grpc_asyncio", request_type=session.StreamingDetectIntentRequest ): client = SessionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -812,10 +857,17 @@ async def test_streaming_detect_intent_async_from_dict(): await test_streaming_detect_intent_async(request_type=dict) -@pytest.mark.parametrize("request_type", [session.MatchIntentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + session.MatchIntentRequest, + dict, + ], +) def test_match_intent(request_type, transport: str = "grpc"): client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -825,7 +877,9 @@ def test_match_intent(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.match_intent), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = session.MatchIntentResponse(text="text_value",) + call.return_value = session.MatchIntentResponse( + text="text_value", + ) response = client.match_intent(request) # Establish that the underlying gRPC stub method was called. @@ -841,7 +895,8 @@ def test_match_intent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -857,7 +912,8 @@ async def test_match_intent_async( transport: str = "grpc_asyncio", request_type=session.MatchIntentRequest ): client = SessionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -887,13 +943,15 @@ async def test_match_intent_async_from_dict(): def test_match_intent_field_headers(): - client = SessionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = SessionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = session.MatchIntentRequest() - request.session = "session/value" + request.session = "session_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.match_intent), "__call__") as call: @@ -907,18 +965,23 @@ def test_match_intent_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "session=session/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "session=session_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_match_intent_field_headers_async(): - client = SessionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = SessionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = session.MatchIntentRequest() - request.session = "session/value" + request.session = "session_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.match_intent), "__call__") as call: @@ -934,13 +997,23 @@ async def test_match_intent_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "session=session/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "session=session_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [session.FulfillIntentRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + session.FulfillIntentRequest, + dict, + ], +) def test_fulfill_intent(request_type, transport: str = "grpc"): client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -951,7 +1024,8 @@ def test_fulfill_intent(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.fulfill_intent), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = session.FulfillIntentResponse( - response_id="response_id_value", output_audio=b"output_audio_blob", + response_id="response_id_value", + output_audio=b"output_audio_blob", ) response = client.fulfill_intent(request) @@ -970,7 +1044,8 @@ def test_fulfill_intent_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -986,7 +1061,8 @@ async def test_fulfill_intent_async( transport: str = "grpc_asyncio", request_type=session.FulfillIntentRequest ): client = SessionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -998,7 +1074,8 @@ async def test_fulfill_intent_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( session.FulfillIntentResponse( - response_id="response_id_value", output_audio=b"output_audio_blob", + response_id="response_id_value", + output_audio=b"output_audio_blob", ) ) response = await client.fulfill_intent(request) @@ -1020,13 +1097,15 @@ async def test_fulfill_intent_async_from_dict(): def test_fulfill_intent_field_headers(): - client = SessionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = SessionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = session.FulfillIntentRequest() - request.match_intent_request.session = "match_intent_request.session/value" + request.match_intent_request.session = "session_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.fulfill_intent), "__call__") as call: @@ -1042,19 +1121,21 @@ def test_fulfill_intent_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "match_intent_request.session=match_intent_request.session/value", + "match_intent_request.session=session_value", ) in kw["metadata"] @pytest.mark.asyncio async def test_fulfill_intent_field_headers_async(): - client = SessionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = SessionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = session.FulfillIntentRequest() - request.match_intent_request.session = "match_intent_request.session/value" + request.match_intent_request.session = "session_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.fulfill_intent), "__call__") as call: @@ -1072,7 +1153,7 @@ async def test_fulfill_intent_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "match_intent_request.session=match_intent_request.session/value", + "match_intent_request.session=session_value", ) in kw["metadata"] @@ -1083,7 +1164,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1103,7 +1185,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = SessionsClient(client_options=options, transport=transport,) + client = SessionsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1119,7 +1204,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = SessionsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1149,7 +1235,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.SessionsGrpcTransport, transports.SessionsGrpcAsyncIOTransport,], + [ + transports.SessionsGrpcTransport, + transports.SessionsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1159,10 +1248,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = SessionsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = SessionsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.SessionsGrpcTransport,) + client = SessionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.SessionsGrpcTransport, + ) def test_sessions_base_transport_error(): @@ -1199,6 +1306,14 @@ def test_sessions_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_sessions_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1210,7 +1325,8 @@ def test_sessions_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.SessionsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1251,7 +1367,10 @@ def test_sessions_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.SessionsGrpcTransport, transports.SessionsGrpcAsyncIOTransport,], + [ + transports.SessionsGrpcTransport, + transports.SessionsGrpcAsyncIOTransport, + ], ) def test_sessions_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -1349,24 +1468,40 @@ def test_sessions_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_sessions_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_sessions_host_no_port(transport_name): client = SessionsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_sessions_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_sessions_host_with_port(transport_name): client = SessionsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_sessions_grpc_transport_channel(): @@ -1374,7 +1509,8 @@ def test_sessions_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.SessionsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1386,7 +1522,8 @@ def test_sessions_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.SessionsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1491,7 +1628,10 @@ def test_entity_type_path(): agent = "whelk" entity_type = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) actual = SessionsClient.entity_type_path(project, location, agent, entity_type) assert expected == actual @@ -1516,8 +1656,13 @@ def test_flow_path(): location = "nautilus" agent = "scallop" flow = "abalone" - expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + expected = ( + "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( + project=project, + location=location, + agent=agent, + flow=flow, + ) ) actual = SessionsClient.flow_path(project, location, agent, flow) assert expected == actual @@ -1543,7 +1688,10 @@ def test_intent_path(): agent = "cuttlefish" intent = "mussel" expected = "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) actual = SessionsClient.intent_path(project, location, agent, intent) assert expected == actual @@ -1570,7 +1718,11 @@ def test_page_path(): flow = "octopus" page = "oyster" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) actual = SessionsClient.page_path(project, location, agent, flow, page) assert expected == actual @@ -1597,7 +1749,10 @@ def test_session_path(): agent = "squid" session = "clam" expected = "projects/{project}/locations/{location}/agents/{agent}/sessions/{session}".format( - project=project, location=location, agent=agent, session=session, + project=project, + location=location, + agent=agent, + session=session, ) actual = SessionsClient.session_path(project, location, agent, session) assert expected == actual @@ -1692,7 +1847,11 @@ def test_version_path(): flow = "nudibranch" version = "cuttlefish" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) actual = SessionsClient.version_path(project, location, agent, flow, version) assert expected == actual @@ -1719,7 +1878,10 @@ def test_webhook_path(): agent = "whelk" webhook = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) actual = SessionsClient.webhook_path(project, location, agent, webhook) assert expected == actual @@ -1761,7 +1923,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = SessionsClient.common_folder_path(folder) assert expected == actual @@ -1779,7 +1943,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = SessionsClient.common_organization_path(organization) assert expected == actual @@ -1797,7 +1963,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = SessionsClient.common_project_path(project) assert expected == actual @@ -1817,7 +1985,8 @@ def test_common_location_path(): project = "oyster" location = "nudibranch" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = SessionsClient.common_location_path(project, location) assert expected == actual @@ -1842,7 +2011,8 @@ def test_client_with_default_client_info(): transports.SessionsTransport, "_prep_wrapped_messages" ) as prep: client = SessionsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1851,7 +2021,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = SessionsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1859,7 +2030,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = SessionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_test_cases.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_test_cases.py index 32768937..75e425bf 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_test_cases.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_test_cases.py @@ -96,19 +96,25 @@ def test__get_default_mtls_endpoint(): assert TestCasesClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [TestCasesClient, TestCasesAsyncClient,]) -def test_test_cases_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (TestCasesClient, "grpc"), + (TestCasesAsyncClient, "grpc_asyncio"), + ], +) +def test_test_cases_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -136,22 +142,32 @@ def test_test_cases_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [TestCasesClient, TestCasesAsyncClient,]) -def test_test_cases_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (TestCasesClient, "grpc"), + (TestCasesAsyncClient, "grpc_asyncio"), + ], +) +def test_test_cases_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_test_cases_client_get_transport_class(): @@ -491,7 +507,9 @@ def test_test_cases_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -622,10 +640,17 @@ def test_test_cases_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [test_case.ListTestCasesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.ListTestCasesRequest, + dict, + ], +) def test_list_test_cases(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -654,7 +679,8 @@ def test_list_test_cases_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -670,7 +696,8 @@ async def test_list_test_cases_async( transport: str = "grpc_asyncio", request_type=test_case.ListTestCasesRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -681,7 +708,9 @@ async def test_list_test_cases_async( with mock.patch.object(type(client.transport.list_test_cases), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - test_case.ListTestCasesResponse(next_page_token="next_page_token_value",) + test_case.ListTestCasesResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_test_cases(request) @@ -701,13 +730,15 @@ async def test_list_test_cases_async_from_dict(): def test_list_test_cases_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.ListTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_test_cases), "__call__") as call: @@ -721,18 +752,23 @@ def test_list_test_cases_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_test_cases_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.ListTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_test_cases), "__call__") as call: @@ -748,11 +784,16 @@ async def test_list_test_cases_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_test_cases_flattened(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_test_cases), "__call__") as call: @@ -760,7 +801,9 @@ def test_list_test_cases_flattened(): call.return_value = test_case.ListTestCasesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_test_cases(parent="parent_value",) + client.list_test_cases( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -772,19 +815,24 @@ def test_list_test_cases_flattened(): def test_list_test_cases_flattened_error(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_test_cases( - test_case.ListTestCasesRequest(), parent="parent_value", + test_case.ListTestCasesRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_test_cases_flattened_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_test_cases), "__call__") as call: @@ -796,7 +844,9 @@ async def test_list_test_cases_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_test_cases(parent="parent_value",) + response = await client.list_test_cases( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -809,19 +859,23 @@ async def test_list_test_cases_flattened_async(): @pytest.mark.asyncio async def test_list_test_cases_flattened_error_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_test_cases( - test_case.ListTestCasesRequest(), parent="parent_value", + test_case.ListTestCasesRequest(), + parent="parent_value", ) def test_list_test_cases_pager(transport_name: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -836,12 +890,21 @@ def test_list_test_cases_pager(transport_name: str = "grpc"): ], next_page_token="abc", ), - test_case.ListTestCasesResponse(test_cases=[], next_page_token="def",), test_case.ListTestCasesResponse( - test_cases=[test_case.TestCase(),], next_page_token="ghi", + test_cases=[], + next_page_token="def", + ), + test_case.ListTestCasesResponse( + test_cases=[ + test_case.TestCase(), + ], + next_page_token="ghi", ), test_case.ListTestCasesResponse( - test_cases=[test_case.TestCase(), test_case.TestCase(),], + test_cases=[ + test_case.TestCase(), + test_case.TestCase(), + ], ), RuntimeError, ) @@ -854,14 +917,15 @@ def test_list_test_cases_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, test_case.TestCase) for i in results) def test_list_test_cases_pages(transport_name: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -876,12 +940,21 @@ def test_list_test_cases_pages(transport_name: str = "grpc"): ], next_page_token="abc", ), - test_case.ListTestCasesResponse(test_cases=[], next_page_token="def",), test_case.ListTestCasesResponse( - test_cases=[test_case.TestCase(),], next_page_token="ghi", + test_cases=[], + next_page_token="def", ), test_case.ListTestCasesResponse( - test_cases=[test_case.TestCase(), test_case.TestCase(),], + test_cases=[ + test_case.TestCase(), + ], + next_page_token="ghi", + ), + test_case.ListTestCasesResponse( + test_cases=[ + test_case.TestCase(), + test_case.TestCase(), + ], ), RuntimeError, ) @@ -892,7 +965,9 @@ def test_list_test_cases_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_test_cases_async_pager(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -908,19 +983,30 @@ async def test_list_test_cases_async_pager(): ], next_page_token="abc", ), - test_case.ListTestCasesResponse(test_cases=[], next_page_token="def",), test_case.ListTestCasesResponse( - test_cases=[test_case.TestCase(),], next_page_token="ghi", + test_cases=[], + next_page_token="def", ), test_case.ListTestCasesResponse( - test_cases=[test_case.TestCase(), test_case.TestCase(),], + test_cases=[ + test_case.TestCase(), + ], + next_page_token="ghi", + ), + test_case.ListTestCasesResponse( + test_cases=[ + test_case.TestCase(), + test_case.TestCase(), + ], ), RuntimeError, ) - async_pager = await client.list_test_cases(request={},) + async_pager = await client.list_test_cases( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -929,7 +1015,9 @@ async def test_list_test_cases_async_pager(): @pytest.mark.asyncio async def test_list_test_cases_async_pages(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -945,26 +1033,44 @@ async def test_list_test_cases_async_pages(): ], next_page_token="abc", ), - test_case.ListTestCasesResponse(test_cases=[], next_page_token="def",), test_case.ListTestCasesResponse( - test_cases=[test_case.TestCase(),], next_page_token="ghi", + test_cases=[], + next_page_token="def", ), test_case.ListTestCasesResponse( - test_cases=[test_case.TestCase(), test_case.TestCase(),], + test_cases=[ + test_case.TestCase(), + ], + next_page_token="ghi", + ), + test_case.ListTestCasesResponse( + test_cases=[ + test_case.TestCase(), + test_case.TestCase(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_test_cases(request={})).pages: + async for page_ in ( + await client.list_test_cases(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [test_case.BatchDeleteTestCasesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.BatchDeleteTestCasesRequest, + dict, + ], +) def test_batch_delete_test_cases(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -992,7 +1098,8 @@ def test_batch_delete_test_cases_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1010,7 +1117,8 @@ async def test_batch_delete_test_cases_async( transport: str = "grpc_asyncio", request_type=test_case.BatchDeleteTestCasesRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1040,13 +1148,15 @@ async def test_batch_delete_test_cases_async_from_dict(): def test_batch_delete_test_cases_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.BatchDeleteTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1062,18 +1172,23 @@ def test_batch_delete_test_cases_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_batch_delete_test_cases_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.BatchDeleteTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1089,11 +1204,16 @@ async def test_batch_delete_test_cases_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_batch_delete_test_cases_flattened(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1103,7 +1223,9 @@ def test_batch_delete_test_cases_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.batch_delete_test_cases(parent="parent_value",) + client.batch_delete_test_cases( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1115,19 +1237,24 @@ def test_batch_delete_test_cases_flattened(): def test_batch_delete_test_cases_flattened_error(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.batch_delete_test_cases( - test_case.BatchDeleteTestCasesRequest(), parent="parent_value", + test_case.BatchDeleteTestCasesRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_batch_delete_test_cases_flattened_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1139,7 +1266,9 @@ async def test_batch_delete_test_cases_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.batch_delete_test_cases(parent="parent_value",) + response = await client.batch_delete_test_cases( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1152,20 +1281,30 @@ async def test_batch_delete_test_cases_flattened_async(): @pytest.mark.asyncio async def test_batch_delete_test_cases_flattened_error_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.batch_delete_test_cases( - test_case.BatchDeleteTestCasesRequest(), parent="parent_value", + test_case.BatchDeleteTestCasesRequest(), + parent="parent_value", ) -@pytest.mark.parametrize("request_type", [test_case.GetTestCaseRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.GetTestCaseRequest, + dict, + ], +) def test_get_test_case(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1200,7 +1339,8 @@ def test_get_test_case_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1216,7 +1356,8 @@ async def test_get_test_case_async( transport: str = "grpc_asyncio", request_type=test_case.GetTestCaseRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1255,13 +1396,15 @@ async def test_get_test_case_async_from_dict(): def test_get_test_case_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.GetTestCaseRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_test_case), "__call__") as call: @@ -1275,18 +1418,23 @@ def test_get_test_case_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_test_case_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.GetTestCaseRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_test_case), "__call__") as call: @@ -1300,11 +1448,16 @@ async def test_get_test_case_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_test_case_flattened(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_test_case), "__call__") as call: @@ -1312,7 +1465,9 @@ def test_get_test_case_flattened(): call.return_value = test_case.TestCase() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_test_case(name="name_value",) + client.get_test_case( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1324,19 +1479,24 @@ def test_get_test_case_flattened(): def test_get_test_case_flattened_error(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_test_case( - test_case.GetTestCaseRequest(), name="name_value", + test_case.GetTestCaseRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_test_case_flattened_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_test_case), "__call__") as call: @@ -1346,7 +1506,9 @@ async def test_get_test_case_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(test_case.TestCase()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_test_case(name="name_value",) + response = await client.get_test_case( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1359,20 +1521,30 @@ async def test_get_test_case_flattened_async(): @pytest.mark.asyncio async def test_get_test_case_flattened_error_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_test_case( - test_case.GetTestCaseRequest(), name="name_value", + test_case.GetTestCaseRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [gcdc_test_case.CreateTestCaseRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_test_case.CreateTestCaseRequest, + dict, + ], +) def test_create_test_case(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1407,7 +1579,8 @@ def test_create_test_case_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1423,7 +1596,8 @@ async def test_create_test_case_async( transport: str = "grpc_asyncio", request_type=gcdc_test_case.CreateTestCaseRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1462,13 +1636,15 @@ async def test_create_test_case_async_from_dict(): def test_create_test_case_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_test_case.CreateTestCaseRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_test_case), "__call__") as call: @@ -1482,18 +1658,23 @@ def test_create_test_case_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_test_case_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_test_case.CreateTestCaseRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_test_case), "__call__") as call: @@ -1509,11 +1690,16 @@ async def test_create_test_case_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_test_case_flattened(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_test_case), "__call__") as call: @@ -1522,7 +1708,8 @@ def test_create_test_case_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_test_case( - parent="parent_value", test_case=gcdc_test_case.TestCase(name="name_value"), + parent="parent_value", + test_case=gcdc_test_case.TestCase(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1538,7 +1725,9 @@ def test_create_test_case_flattened(): def test_create_test_case_flattened_error(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1552,7 +1741,9 @@ def test_create_test_case_flattened_error(): @pytest.mark.asyncio async def test_create_test_case_flattened_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_test_case), "__call__") as call: @@ -1565,7 +1756,8 @@ async def test_create_test_case_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_test_case( - parent="parent_value", test_case=gcdc_test_case.TestCase(name="name_value"), + parent="parent_value", + test_case=gcdc_test_case.TestCase(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1582,7 +1774,9 @@ async def test_create_test_case_flattened_async(): @pytest.mark.asyncio async def test_create_test_case_flattened_error_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1594,10 +1788,17 @@ async def test_create_test_case_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [gcdc_test_case.UpdateTestCaseRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_test_case.UpdateTestCaseRequest, + dict, + ], +) def test_update_test_case(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1632,7 +1833,8 @@ def test_update_test_case_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1648,7 +1850,8 @@ async def test_update_test_case_async( transport: str = "grpc_asyncio", request_type=gcdc_test_case.UpdateTestCaseRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1687,13 +1890,15 @@ async def test_update_test_case_async_from_dict(): def test_update_test_case_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_test_case.UpdateTestCaseRequest() - request.test_case.name = "test_case.name/value" + request.test_case.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_test_case), "__call__") as call: @@ -1707,20 +1912,23 @@ def test_update_test_case_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "test_case.name=test_case.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "test_case.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_test_case_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_test_case.UpdateTestCaseRequest() - request.test_case.name = "test_case.name/value" + request.test_case.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_test_case), "__call__") as call: @@ -1736,13 +1944,16 @@ async def test_update_test_case_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "test_case.name=test_case.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "test_case.name=name_value", + ) in kw["metadata"] def test_update_test_case_flattened(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_test_case), "__call__") as call: @@ -1768,7 +1979,9 @@ def test_update_test_case_flattened(): def test_update_test_case_flattened_error(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1782,7 +1995,9 @@ def test_update_test_case_flattened_error(): @pytest.mark.asyncio async def test_update_test_case_flattened_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_test_case), "__call__") as call: @@ -1813,7 +2028,9 @@ async def test_update_test_case_flattened_async(): @pytest.mark.asyncio async def test_update_test_case_flattened_error_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1825,10 +2042,17 @@ async def test_update_test_case_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [test_case.RunTestCaseRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.RunTestCaseRequest, + dict, + ], +) def test_run_test_case(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1854,7 +2078,8 @@ def test_run_test_case_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1870,7 +2095,8 @@ async def test_run_test_case_async( transport: str = "grpc_asyncio", request_type=test_case.RunTestCaseRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1900,13 +2126,15 @@ async def test_run_test_case_async_from_dict(): def test_run_test_case_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.RunTestCaseRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.run_test_case), "__call__") as call: @@ -1920,18 +2148,23 @@ def test_run_test_case_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_run_test_case_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.RunTestCaseRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.run_test_case), "__call__") as call: @@ -1947,13 +2180,23 @@ async def test_run_test_case_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [test_case.BatchRunTestCasesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.BatchRunTestCasesRequest, + dict, + ], +) def test_batch_run_test_cases(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1981,7 +2224,8 @@ def test_batch_run_test_cases_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1999,7 +2243,8 @@ async def test_batch_run_test_cases_async( transport: str = "grpc_asyncio", request_type=test_case.BatchRunTestCasesRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2031,13 +2276,15 @@ async def test_batch_run_test_cases_async_from_dict(): def test_batch_run_test_cases_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.BatchRunTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2053,18 +2300,23 @@ def test_batch_run_test_cases_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_batch_run_test_cases_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.BatchRunTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2082,13 +2334,23 @@ async def test_batch_run_test_cases_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [test_case.CalculateCoverageRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.CalculateCoverageRequest, + dict, + ], +) def test_calculate_coverage(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2122,7 +2384,8 @@ def test_calculate_coverage_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2140,7 +2403,8 @@ async def test_calculate_coverage_async( transport: str = "grpc_asyncio", request_type=test_case.CalculateCoverageRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2153,7 +2417,9 @@ async def test_calculate_coverage_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - test_case.CalculateCoverageResponse(agent="agent_value",) + test_case.CalculateCoverageResponse( + agent="agent_value", + ) ) response = await client.calculate_coverage(request) @@ -2173,13 +2439,15 @@ async def test_calculate_coverage_async_from_dict(): def test_calculate_coverage_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.CalculateCoverageRequest() - request.agent = "agent/value" + request.agent = "agent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2195,18 +2463,23 @@ def test_calculate_coverage_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "agent=agent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "agent=agent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_calculate_coverage_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.CalculateCoverageRequest() - request.agent = "agent/value" + request.agent = "agent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2224,13 +2497,23 @@ async def test_calculate_coverage_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "agent=agent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "agent=agent_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [test_case.ImportTestCasesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.ImportTestCasesRequest, + dict, + ], +) def test_import_test_cases(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2258,7 +2541,8 @@ def test_import_test_cases_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2276,7 +2560,8 @@ async def test_import_test_cases_async( transport: str = "grpc_asyncio", request_type=test_case.ImportTestCasesRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2308,13 +2593,15 @@ async def test_import_test_cases_async_from_dict(): def test_import_test_cases_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.ImportTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2330,18 +2617,23 @@ def test_import_test_cases_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_import_test_cases_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.ImportTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2359,13 +2651,23 @@ async def test_import_test_cases_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [test_case.ExportTestCasesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.ExportTestCasesRequest, + dict, + ], +) def test_export_test_cases(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2393,7 +2695,8 @@ def test_export_test_cases_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2411,7 +2714,8 @@ async def test_export_test_cases_async( transport: str = "grpc_asyncio", request_type=test_case.ExportTestCasesRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2443,13 +2747,15 @@ async def test_export_test_cases_async_from_dict(): def test_export_test_cases_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.ExportTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2465,18 +2771,23 @@ def test_export_test_cases_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_export_test_cases_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.ExportTestCasesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2494,13 +2805,23 @@ async def test_export_test_cases_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] -@pytest.mark.parametrize("request_type", [test_case.ListTestCaseResultsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.ListTestCaseResultsRequest, + dict, + ], +) def test_list_test_case_results(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2531,7 +2852,8 @@ def test_list_test_case_results_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2549,7 +2871,8 @@ async def test_list_test_case_results_async( transport: str = "grpc_asyncio", request_type=test_case.ListTestCaseResultsRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2584,13 +2907,15 @@ async def test_list_test_case_results_async_from_dict(): def test_list_test_case_results_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.ListTestCaseResultsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2606,18 +2931,23 @@ def test_list_test_case_results_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_test_case_results_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.ListTestCaseResultsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2635,11 +2965,16 @@ async def test_list_test_case_results_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_test_case_results_flattened(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2649,7 +2984,9 @@ def test_list_test_case_results_flattened(): call.return_value = test_case.ListTestCaseResultsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_test_case_results(parent="parent_value",) + client.list_test_case_results( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2661,19 +2998,24 @@ def test_list_test_case_results_flattened(): def test_list_test_case_results_flattened_error(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_test_case_results( - test_case.ListTestCaseResultsRequest(), parent="parent_value", + test_case.ListTestCaseResultsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_test_case_results_flattened_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2687,7 +3029,9 @@ async def test_list_test_case_results_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_test_case_results(parent="parent_value",) + response = await client.list_test_case_results( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2700,19 +3044,23 @@ async def test_list_test_case_results_flattened_async(): @pytest.mark.asyncio async def test_list_test_case_results_flattened_error_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_test_case_results( - test_case.ListTestCaseResultsRequest(), parent="parent_value", + test_case.ListTestCaseResultsRequest(), + parent="parent_value", ) def test_list_test_case_results_pager(transport_name: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2730,10 +3078,14 @@ def test_list_test_case_results_pager(transport_name: str = "grpc"): next_page_token="abc", ), test_case.ListTestCaseResultsResponse( - test_case_results=[], next_page_token="def", + test_case_results=[], + next_page_token="def", ), test_case.ListTestCaseResultsResponse( - test_case_results=[test_case.TestCaseResult(),], next_page_token="ghi", + test_case_results=[ + test_case.TestCaseResult(), + ], + next_page_token="ghi", ), test_case.ListTestCaseResultsResponse( test_case_results=[ @@ -2752,14 +3104,15 @@ def test_list_test_case_results_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, test_case.TestCaseResult) for i in results) def test_list_test_case_results_pages(transport_name: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2777,10 +3130,14 @@ def test_list_test_case_results_pages(transport_name: str = "grpc"): next_page_token="abc", ), test_case.ListTestCaseResultsResponse( - test_case_results=[], next_page_token="def", + test_case_results=[], + next_page_token="def", ), test_case.ListTestCaseResultsResponse( - test_case_results=[test_case.TestCaseResult(),], next_page_token="ghi", + test_case_results=[ + test_case.TestCaseResult(), + ], + next_page_token="ghi", ), test_case.ListTestCaseResultsResponse( test_case_results=[ @@ -2797,7 +3154,9 @@ def test_list_test_case_results_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_test_case_results_async_pager(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2816,10 +3175,14 @@ async def test_list_test_case_results_async_pager(): next_page_token="abc", ), test_case.ListTestCaseResultsResponse( - test_case_results=[], next_page_token="def", + test_case_results=[], + next_page_token="def", ), test_case.ListTestCaseResultsResponse( - test_case_results=[test_case.TestCaseResult(),], next_page_token="ghi", + test_case_results=[ + test_case.TestCaseResult(), + ], + next_page_token="ghi", ), test_case.ListTestCaseResultsResponse( test_case_results=[ @@ -2829,10 +3192,12 @@ async def test_list_test_case_results_async_pager(): ), RuntimeError, ) - async_pager = await client.list_test_case_results(request={},) + async_pager = await client.list_test_case_results( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2841,7 +3206,9 @@ async def test_list_test_case_results_async_pager(): @pytest.mark.asyncio async def test_list_test_case_results_async_pages(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2860,10 +3227,14 @@ async def test_list_test_case_results_async_pages(): next_page_token="abc", ), test_case.ListTestCaseResultsResponse( - test_case_results=[], next_page_token="def", + test_case_results=[], + next_page_token="def", ), test_case.ListTestCaseResultsResponse( - test_case_results=[test_case.TestCaseResult(),], next_page_token="ghi", + test_case_results=[ + test_case.TestCaseResult(), + ], + next_page_token="ghi", ), test_case.ListTestCaseResultsResponse( test_case_results=[ @@ -2874,16 +3245,25 @@ async def test_list_test_case_results_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_test_case_results(request={})).pages: + async for page_ in ( + await client.list_test_case_results(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [test_case.GetTestCaseResultRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + test_case.GetTestCaseResultRequest, + dict, + ], +) def test_get_test_case_result(request_type, transport: str = "grpc"): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2918,7 +3298,8 @@ def test_get_test_case_result_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2936,7 +3317,8 @@ async def test_get_test_case_result_async( transport: str = "grpc_asyncio", request_type=test_case.GetTestCaseResultRequest ): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2975,13 +3357,15 @@ async def test_get_test_case_result_async_from_dict(): def test_get_test_case_result_field_headers(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.GetTestCaseResultRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2997,18 +3381,23 @@ def test_get_test_case_result_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_test_case_result_field_headers_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = test_case.GetTestCaseResultRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3026,11 +3415,16 @@ async def test_get_test_case_result_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_test_case_result_flattened(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3040,7 +3434,9 @@ def test_get_test_case_result_flattened(): call.return_value = test_case.TestCaseResult() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_test_case_result(name="name_value",) + client.get_test_case_result( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3052,19 +3448,24 @@ def test_get_test_case_result_flattened(): def test_get_test_case_result_flattened_error(): - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_test_case_result( - test_case.GetTestCaseResultRequest(), name="name_value", + test_case.GetTestCaseResultRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_test_case_result_flattened_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3078,7 +3479,9 @@ async def test_get_test_case_result_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_test_case_result(name="name_value",) + response = await client.get_test_case_result( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3091,13 +3494,16 @@ async def test_get_test_case_result_flattened_async(): @pytest.mark.asyncio async def test_get_test_case_result_flattened_error_async(): - client = TestCasesAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = TestCasesAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_test_case_result( - test_case.GetTestCaseResultRequest(), name="name_value", + test_case.GetTestCaseResultRequest(), + name="name_value", ) @@ -3108,7 +3514,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -3128,7 +3535,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = TestCasesClient(client_options=options, transport=transport,) + client = TestCasesClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -3144,7 +3554,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TestCasesClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -3174,7 +3585,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.TestCasesGrpcTransport, transports.TestCasesGrpcAsyncIOTransport,], + [ + transports.TestCasesGrpcTransport, + transports.TestCasesGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -3184,10 +3598,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = TestCasesClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = TestCasesClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.TestCasesGrpcTransport,) + client = TestCasesClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.TestCasesGrpcTransport, + ) def test_test_cases_base_transport_error(): @@ -3237,6 +3669,14 @@ def test_test_cases_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_test_cases_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -3248,7 +3688,8 @@ def test_test_cases_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TestCasesTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -3289,7 +3730,10 @@ def test_test_cases_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.TestCasesGrpcTransport, transports.TestCasesGrpcAsyncIOTransport,], + [ + transports.TestCasesGrpcTransport, + transports.TestCasesGrpcAsyncIOTransport, + ], ) def test_test_cases_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -3387,24 +3831,40 @@ def test_test_cases_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_test_cases_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_test_cases_host_no_port(transport_name): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_test_cases_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_test_cases_host_with_port(transport_name): client = TestCasesClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_test_cases_grpc_transport_channel(): @@ -3412,7 +3872,8 @@ def test_test_cases_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.TestCasesGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -3424,7 +3885,8 @@ def test_test_cases_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.TestCasesGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -3525,12 +3987,16 @@ def test_test_cases_transport_channel_mtls_with_adc(transport_class): def test_test_cases_grpc_lro_client(): client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -3538,12 +4004,16 @@ def test_test_cases_grpc_lro_client(): def test_test_cases_grpc_lro_async_client(): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -3554,7 +4024,9 @@ def test_agent_path(): location = "clam" agent = "whelk" expected = "projects/{project}/locations/{location}/agents/{agent}".format( - project=project, location=location, agent=agent, + project=project, + location=location, + agent=agent, ) actual = TestCasesClient.agent_path(project, location, agent) assert expected == actual @@ -3579,7 +4051,10 @@ def test_entity_type_path(): agent = "winkle" entity_type = "nautilus" expected = "projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}".format( - project=project, location=location, agent=agent, entity_type=entity_type, + project=project, + location=location, + agent=agent, + entity_type=entity_type, ) actual = TestCasesClient.entity_type_path(project, location, agent, entity_type) assert expected == actual @@ -3605,7 +4080,10 @@ def test_environment_path(): agent = "oyster" environment = "nudibranch" expected = "projects/{project}/locations/{location}/agents/{agent}/environments/{environment}".format( - project=project, location=location, agent=agent, environment=environment, + project=project, + location=location, + agent=agent, + environment=environment, ) actual = TestCasesClient.environment_path(project, location, agent, environment) assert expected == actual @@ -3630,8 +4108,13 @@ def test_flow_path(): location = "abalone" agent = "squid" flow = "clam" - expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + expected = ( + "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( + project=project, + location=location, + agent=agent, + flow=flow, + ) ) actual = TestCasesClient.flow_path(project, location, agent, flow) assert expected == actual @@ -3657,7 +4140,10 @@ def test_intent_path(): agent = "winkle" intent = "nautilus" expected = "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) actual = TestCasesClient.intent_path(project, location, agent, intent) assert expected == actual @@ -3684,7 +4170,11 @@ def test_page_path(): flow = "nudibranch" page = "cuttlefish" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) actual = TestCasesClient.page_path(project, location, agent, flow, page) assert expected == actual @@ -3711,7 +4201,10 @@ def test_test_case_path(): agent = "whelk" test_case = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}".format( - project=project, location=location, agent=agent, test_case=test_case, + project=project, + location=location, + agent=agent, + test_case=test_case, ) actual = TestCasesClient.test_case_path(project, location, agent, test_case) assert expected == actual @@ -3805,7 +4298,10 @@ def test_webhook_path(): agent = "cuttlefish" webhook = "mussel" expected = "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) actual = TestCasesClient.webhook_path(project, location, agent, webhook) assert expected == actual @@ -3847,7 +4343,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = TestCasesClient.common_folder_path(folder) assert expected == actual @@ -3865,7 +4363,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = TestCasesClient.common_organization_path(organization) assert expected == actual @@ -3883,7 +4383,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = TestCasesClient.common_project_path(project) assert expected == actual @@ -3903,7 +4405,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = TestCasesClient.common_location_path(project, location) assert expected == actual @@ -3928,7 +4431,8 @@ def test_client_with_default_client_info(): transports.TestCasesTransport, "_prep_wrapped_messages" ) as prep: client = TestCasesClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3937,7 +4441,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = TestCasesClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -3945,7 +4450,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = TestCasesAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_transition_route_groups.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_transition_route_groups.py index c18d56c0..5255ef2c 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_transition_route_groups.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_transition_route_groups.py @@ -100,20 +100,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [TransitionRouteGroupsClient, TransitionRouteGroupsAsyncClient,] + "client_class,transport_name", + [ + (TransitionRouteGroupsClient, "grpc"), + (TransitionRouteGroupsAsyncClient, "grpc_asyncio"), + ], ) -def test_transition_route_groups_client_from_service_account_info(client_class): +def test_transition_route_groups_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -142,23 +148,33 @@ def test_transition_route_groups_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [TransitionRouteGroupsClient, TransitionRouteGroupsAsyncClient,] + "client_class,transport_name", + [ + (TransitionRouteGroupsClient, "grpc"), + (TransitionRouteGroupsAsyncClient, "grpc_asyncio"), + ], ) -def test_transition_route_groups_client_from_service_account_file(client_class): +def test_transition_route_groups_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_transition_route_groups_client_get_transport_class(): @@ -524,7 +540,9 @@ def test_transition_route_groups_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -668,11 +686,16 @@ def test_transition_route_groups_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [transition_route_group.ListTransitionRouteGroupsRequest, dict,] + "request_type", + [ + transition_route_group.ListTransitionRouteGroupsRequest, + dict, + ], ) def test_list_transition_route_groups(request_type, transport: str = "grpc"): client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -703,7 +726,8 @@ def test_list_transition_route_groups_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -722,7 +746,8 @@ async def test_list_transition_route_groups_async( request_type=transition_route_group.ListTransitionRouteGroupsRequest, ): client = TransitionRouteGroupsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -765,7 +790,7 @@ def test_list_transition_route_groups_field_headers(): # a field header. Set these to a non-empty value. request = transition_route_group.ListTransitionRouteGroupsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -781,7 +806,10 @@ def test_list_transition_route_groups_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -794,7 +822,7 @@ async def test_list_transition_route_groups_field_headers_async(): # a field header. Set these to a non-empty value. request = transition_route_group.ListTransitionRouteGroupsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -812,7 +840,10 @@ async def test_list_transition_route_groups_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_transition_route_groups_flattened(): @@ -828,7 +859,9 @@ def test_list_transition_route_groups_flattened(): call.return_value = transition_route_group.ListTransitionRouteGroupsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_transition_route_groups(parent="parent_value",) + client.list_transition_route_groups( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -871,7 +904,9 @@ async def test_list_transition_route_groups_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_transition_route_groups(parent="parent_value",) + response = await client.list_transition_route_groups( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -899,7 +934,8 @@ async def test_list_transition_route_groups_flattened_error_async(): def test_list_transition_route_groups_pager(transport_name: str = "grpc"): client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -917,7 +953,8 @@ def test_list_transition_route_groups_pager(transport_name: str = "grpc"): next_page_token="abc", ), transition_route_group.ListTransitionRouteGroupsResponse( - transition_route_groups=[], next_page_token="def", + transition_route_groups=[], + next_page_token="def", ), transition_route_group.ListTransitionRouteGroupsResponse( transition_route_groups=[ @@ -942,7 +979,7 @@ def test_list_transition_route_groups_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all( isinstance(i, transition_route_group.TransitionRouteGroup) for i in results @@ -951,7 +988,8 @@ def test_list_transition_route_groups_pager(transport_name: str = "grpc"): def test_list_transition_route_groups_pages(transport_name: str = "grpc"): client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -969,7 +1007,8 @@ def test_list_transition_route_groups_pages(transport_name: str = "grpc"): next_page_token="abc", ), transition_route_group.ListTransitionRouteGroupsResponse( - transition_route_groups=[], next_page_token="def", + transition_route_groups=[], + next_page_token="def", ), transition_route_group.ListTransitionRouteGroupsResponse( transition_route_groups=[ @@ -1013,7 +1052,8 @@ async def test_list_transition_route_groups_async_pager(): next_page_token="abc", ), transition_route_group.ListTransitionRouteGroupsResponse( - transition_route_groups=[], next_page_token="def", + transition_route_groups=[], + next_page_token="def", ), transition_route_group.ListTransitionRouteGroupsResponse( transition_route_groups=[ @@ -1029,10 +1069,12 @@ async def test_list_transition_route_groups_async_pager(): ), RuntimeError, ) - async_pager = await client.list_transition_route_groups(request={},) + async_pager = await client.list_transition_route_groups( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1065,7 +1107,8 @@ async def test_list_transition_route_groups_async_pages(): next_page_token="abc", ), transition_route_group.ListTransitionRouteGroupsResponse( - transition_route_groups=[], next_page_token="def", + transition_route_groups=[], + next_page_token="def", ), transition_route_group.ListTransitionRouteGroupsResponse( transition_route_groups=[ @@ -1084,18 +1127,23 @@ async def test_list_transition_route_groups_async_pages(): pages = [] async for page_ in ( await client.list_transition_route_groups(request={}) - ).pages: + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [transition_route_group.GetTransitionRouteGroupRequest, dict,] + "request_type", + [ + transition_route_group.GetTransitionRouteGroupRequest, + dict, + ], ) def test_get_transition_route_group(request_type, transport: str = "grpc"): client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1108,7 +1156,8 @@ def test_get_transition_route_group(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = transition_route_group.TransitionRouteGroup( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.get_transition_route_group(request) @@ -1127,7 +1176,8 @@ def test_get_transition_route_group_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1146,7 +1196,8 @@ async def test_get_transition_route_group_async( request_type=transition_route_group.GetTransitionRouteGroupRequest, ): client = TransitionRouteGroupsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1160,7 +1211,8 @@ async def test_get_transition_route_group_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( transition_route_group.TransitionRouteGroup( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.get_transition_route_group(request) @@ -1190,7 +1242,7 @@ def test_get_transition_route_group_field_headers(): # a field header. Set these to a non-empty value. request = transition_route_group.GetTransitionRouteGroupRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1206,7 +1258,10 @@ def test_get_transition_route_group_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1219,7 +1274,7 @@ async def test_get_transition_route_group_field_headers_async(): # a field header. Set these to a non-empty value. request = transition_route_group.GetTransitionRouteGroupRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1237,7 +1292,10 @@ async def test_get_transition_route_group_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_transition_route_group_flattened(): @@ -1253,7 +1311,9 @@ def test_get_transition_route_group_flattened(): call.return_value = transition_route_group.TransitionRouteGroup() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_transition_route_group(name="name_value",) + client.get_transition_route_group( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1273,7 +1333,8 @@ def test_get_transition_route_group_flattened_error(): # fields is an error. with pytest.raises(ValueError): client.get_transition_route_group( - transition_route_group.GetTransitionRouteGroupRequest(), name="name_value", + transition_route_group.GetTransitionRouteGroupRequest(), + name="name_value", ) @@ -1295,7 +1356,9 @@ async def test_get_transition_route_group_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_transition_route_group(name="name_value",) + response = await client.get_transition_route_group( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1316,17 +1379,22 @@ async def test_get_transition_route_group_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_transition_route_group( - transition_route_group.GetTransitionRouteGroupRequest(), name="name_value", + transition_route_group.GetTransitionRouteGroupRequest(), + name="name_value", ) @pytest.mark.parametrize( "request_type", - [gcdc_transition_route_group.CreateTransitionRouteGroupRequest, dict,], + [ + gcdc_transition_route_group.CreateTransitionRouteGroupRequest, + dict, + ], ) def test_create_transition_route_group(request_type, transport: str = "grpc"): client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1339,7 +1407,8 @@ def test_create_transition_route_group(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = gcdc_transition_route_group.TransitionRouteGroup( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.create_transition_route_group(request) @@ -1360,7 +1429,8 @@ def test_create_transition_route_group_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1381,7 +1451,8 @@ async def test_create_transition_route_group_async( request_type=gcdc_transition_route_group.CreateTransitionRouteGroupRequest, ): client = TransitionRouteGroupsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1395,7 +1466,8 @@ async def test_create_transition_route_group_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( gcdc_transition_route_group.TransitionRouteGroup( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.create_transition_route_group(request) @@ -1427,7 +1499,7 @@ def test_create_transition_route_group_field_headers(): # a field header. Set these to a non-empty value. request = gcdc_transition_route_group.CreateTransitionRouteGroupRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1443,7 +1515,10 @@ def test_create_transition_route_group_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1456,7 +1531,7 @@ async def test_create_transition_route_group_field_headers_async(): # a field header. Set these to a non-empty value. request = gcdc_transition_route_group.CreateTransitionRouteGroupRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1474,7 +1549,10 @@ async def test_create_transition_route_group_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_transition_route_group_flattened(): @@ -1583,11 +1661,15 @@ async def test_create_transition_route_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", - [gcdc_transition_route_group.UpdateTransitionRouteGroupRequest, dict,], + [ + gcdc_transition_route_group.UpdateTransitionRouteGroupRequest, + dict, + ], ) def test_update_transition_route_group(request_type, transport: str = "grpc"): client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1600,7 +1682,8 @@ def test_update_transition_route_group(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = gcdc_transition_route_group.TransitionRouteGroup( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.update_transition_route_group(request) @@ -1621,7 +1704,8 @@ def test_update_transition_route_group_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1642,7 +1726,8 @@ async def test_update_transition_route_group_async( request_type=gcdc_transition_route_group.UpdateTransitionRouteGroupRequest, ): client = TransitionRouteGroupsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1656,7 +1741,8 @@ async def test_update_transition_route_group_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( gcdc_transition_route_group.TransitionRouteGroup( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.update_transition_route_group(request) @@ -1688,7 +1774,7 @@ def test_update_transition_route_group_field_headers(): # a field header. Set these to a non-empty value. request = gcdc_transition_route_group.UpdateTransitionRouteGroupRequest() - request.transition_route_group.name = "transition_route_group.name/value" + request.transition_route_group.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1706,7 +1792,7 @@ def test_update_transition_route_group_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "transition_route_group.name=transition_route_group.name/value", + "transition_route_group.name=name_value", ) in kw["metadata"] @@ -1720,7 +1806,7 @@ async def test_update_transition_route_group_field_headers_async(): # a field header. Set these to a non-empty value. request = gcdc_transition_route_group.UpdateTransitionRouteGroupRequest() - request.transition_route_group.name = "transition_route_group.name/value" + request.transition_route_group.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1740,7 +1826,7 @@ async def test_update_transition_route_group_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "transition_route_group.name=transition_route_group.name/value", + "transition_route_group.name=name_value", ) in kw["metadata"] @@ -1849,11 +1935,16 @@ async def test_update_transition_route_group_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [transition_route_group.DeleteTransitionRouteGroupRequest, dict,] + "request_type", + [ + transition_route_group.DeleteTransitionRouteGroupRequest, + dict, + ], ) def test_delete_transition_route_group(request_type, transport: str = "grpc"): client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1881,7 +1972,8 @@ def test_delete_transition_route_group_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1900,7 +1992,8 @@ async def test_delete_transition_route_group_async( request_type=transition_route_group.DeleteTransitionRouteGroupRequest, ): client = TransitionRouteGroupsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1938,7 +2031,7 @@ def test_delete_transition_route_group_field_headers(): # a field header. Set these to a non-empty value. request = transition_route_group.DeleteTransitionRouteGroupRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1954,7 +2047,10 @@ def test_delete_transition_route_group_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1967,7 +2063,7 @@ async def test_delete_transition_route_group_field_headers_async(): # a field header. Set these to a non-empty value. request = transition_route_group.DeleteTransitionRouteGroupRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1983,7 +2079,10 @@ async def test_delete_transition_route_group_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_transition_route_group_flattened(): @@ -1999,7 +2098,9 @@ def test_delete_transition_route_group_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_transition_route_group(name="name_value",) + client.delete_transition_route_group( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2040,7 +2141,9 @@ async def test_delete_transition_route_group_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_transition_route_group(name="name_value",) + response = await client.delete_transition_route_group( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2073,7 +2176,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2094,7 +2198,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = TransitionRouteGroupsClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -2111,7 +2216,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = TransitionRouteGroupsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2154,12 +2260,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = TransitionRouteGroupsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = TransitionRouteGroupsClient( credentials=ga_credentials.AnonymousCredentials(), ) - assert isinstance(client.transport, transports.TransitionRouteGroupsGrpcTransport,) + assert isinstance( + client.transport, + transports.TransitionRouteGroupsGrpcTransport, + ) def test_transition_route_groups_base_transport_error(): @@ -2197,6 +2319,14 @@ def test_transition_route_groups_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_transition_route_groups_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2208,7 +2338,8 @@ def test_transition_route_groups_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.TransitionRouteGroupsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2357,24 +2488,40 @@ def test_transition_route_groups_grpc_transport_client_cert_source_for_mtls( ) -def test_transition_route_groups_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_transition_route_groups_host_no_port(transport_name): client = TransitionRouteGroupsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_transition_route_groups_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_transition_route_groups_host_with_port(transport_name): client = TransitionRouteGroupsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_transition_route_groups_grpc_transport_channel(): @@ -2382,7 +2529,8 @@ def test_transition_route_groups_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.TransitionRouteGroupsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2394,7 +2542,8 @@ def test_transition_route_groups_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.TransitionRouteGroupsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2506,8 +2655,13 @@ def test_flow_path(): location = "clam" agent = "whelk" flow = "octopus" - expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( - project=project, location=location, agent=agent, flow=flow, + expected = ( + "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}".format( + project=project, + location=location, + agent=agent, + flow=flow, + ) ) actual = TransitionRouteGroupsClient.flow_path(project, location, agent, flow) assert expected == actual @@ -2533,7 +2687,10 @@ def test_intent_path(): agent = "scallop" intent = "abalone" expected = "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}".format( - project=project, location=location, agent=agent, intent=intent, + project=project, + location=location, + agent=agent, + intent=intent, ) actual = TransitionRouteGroupsClient.intent_path(project, location, agent, intent) assert expected == actual @@ -2560,7 +2717,11 @@ def test_page_path(): flow = "mussel" page = "winkle" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}".format( - project=project, location=location, agent=agent, flow=flow, page=page, + project=project, + location=location, + agent=agent, + flow=flow, + page=page, ) actual = TransitionRouteGroupsClient.page_path(project, location, agent, flow, page) assert expected == actual @@ -2621,7 +2782,10 @@ def test_webhook_path(): agent = "whelk" webhook = "octopus" expected = "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) actual = TransitionRouteGroupsClient.webhook_path(project, location, agent, webhook) assert expected == actual @@ -2663,7 +2827,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = TransitionRouteGroupsClient.common_folder_path(folder) assert expected == actual @@ -2681,7 +2847,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = TransitionRouteGroupsClient.common_organization_path(organization) assert expected == actual @@ -2699,7 +2867,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = TransitionRouteGroupsClient.common_project_path(project) assert expected == actual @@ -2719,7 +2889,8 @@ def test_common_location_path(): project = "oyster" location = "nudibranch" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = TransitionRouteGroupsClient.common_location_path(project, location) assert expected == actual @@ -2744,7 +2915,8 @@ def test_client_with_default_client_info(): transports.TransitionRouteGroupsTransport, "_prep_wrapped_messages" ) as prep: client = TransitionRouteGroupsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2753,7 +2925,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = TransitionRouteGroupsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2761,7 +2934,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = TransitionRouteGroupsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_versions.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_versions.py index 9c04069c..de2a668b 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_versions.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_versions.py @@ -89,19 +89,25 @@ def test__get_default_mtls_endpoint(): assert VersionsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [VersionsClient, VersionsAsyncClient,]) -def test_versions_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (VersionsClient, "grpc"), + (VersionsAsyncClient, "grpc_asyncio"), + ], +) +def test_versions_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -129,22 +135,32 @@ def test_versions_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [VersionsClient, VersionsAsyncClient,]) -def test_versions_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (VersionsClient, "grpc"), + (VersionsAsyncClient, "grpc_asyncio"), + ], +) +def test_versions_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_versions_client_get_transport_class(): @@ -474,7 +490,9 @@ def test_versions_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -605,10 +623,17 @@ def test_versions_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [version.ListVersionsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + version.ListVersionsRequest, + dict, + ], +) def test_list_versions(request_type, transport: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -637,7 +662,8 @@ def test_list_versions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -653,7 +679,8 @@ async def test_list_versions_async( transport: str = "grpc_asyncio", request_type=version.ListVersionsRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -664,7 +691,9 @@ async def test_list_versions_async( with mock.patch.object(type(client.transport.list_versions), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - version.ListVersionsResponse(next_page_token="next_page_token_value",) + version.ListVersionsResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_versions(request) @@ -684,13 +713,15 @@ async def test_list_versions_async_from_dict(): def test_list_versions_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.ListVersionsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_versions), "__call__") as call: @@ -704,18 +735,23 @@ def test_list_versions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_versions_field_headers_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.ListVersionsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_versions), "__call__") as call: @@ -731,11 +767,16 @@ async def test_list_versions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_versions_flattened(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_versions), "__call__") as call: @@ -743,7 +784,9 @@ def test_list_versions_flattened(): call.return_value = version.ListVersionsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_versions(parent="parent_value",) + client.list_versions( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -755,19 +798,24 @@ def test_list_versions_flattened(): def test_list_versions_flattened_error(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_versions( - version.ListVersionsRequest(), parent="parent_value", + version.ListVersionsRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_versions_flattened_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_versions), "__call__") as call: @@ -779,7 +827,9 @@ async def test_list_versions_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_versions(parent="parent_value",) + response = await client.list_versions( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -792,19 +842,23 @@ async def test_list_versions_flattened_async(): @pytest.mark.asyncio async def test_list_versions_flattened_error_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_versions( - version.ListVersionsRequest(), parent="parent_value", + version.ListVersionsRequest(), + parent="parent_value", ) def test_list_versions_pager(transport_name: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -812,15 +866,28 @@ def test_list_versions_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( version.ListVersionsResponse( - versions=[version.Version(), version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], next_page_token="abc", ), - version.ListVersionsResponse(versions=[], next_page_token="def",), version.ListVersionsResponse( - versions=[version.Version(),], next_page_token="ghi", + versions=[], + next_page_token="def", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + ], + next_page_token="ghi", ), version.ListVersionsResponse( - versions=[version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + ], ), RuntimeError, ) @@ -833,14 +900,15 @@ def test_list_versions_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, version.Version) for i in results) def test_list_versions_pages(transport_name: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -848,15 +916,28 @@ def test_list_versions_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( version.ListVersionsResponse( - versions=[version.Version(), version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], next_page_token="abc", ), - version.ListVersionsResponse(versions=[], next_page_token="def",), version.ListVersionsResponse( - versions=[version.Version(),], next_page_token="ghi", + versions=[], + next_page_token="def", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + ], + next_page_token="ghi", ), version.ListVersionsResponse( - versions=[version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + ], ), RuntimeError, ) @@ -867,7 +948,9 @@ def test_list_versions_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_versions_async_pager(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -876,22 +959,37 @@ async def test_list_versions_async_pager(): # Set the response to a series of pages. call.side_effect = ( version.ListVersionsResponse( - versions=[version.Version(), version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], next_page_token="abc", ), - version.ListVersionsResponse(versions=[], next_page_token="def",), version.ListVersionsResponse( - versions=[version.Version(),], next_page_token="ghi", + versions=[], + next_page_token="def", ), version.ListVersionsResponse( - versions=[version.Version(), version.Version(),], + versions=[ + version.Version(), + ], + next_page_token="ghi", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + version.Version(), + ], ), RuntimeError, ) - async_pager = await client.list_versions(request={},) + async_pager = await client.list_versions( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -900,7 +998,9 @@ async def test_list_versions_async_pager(): @pytest.mark.asyncio async def test_list_versions_async_pages(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -909,29 +1009,51 @@ async def test_list_versions_async_pages(): # Set the response to a series of pages. call.side_effect = ( version.ListVersionsResponse( - versions=[version.Version(), version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + version.Version(), + ], next_page_token="abc", ), - version.ListVersionsResponse(versions=[], next_page_token="def",), version.ListVersionsResponse( - versions=[version.Version(),], next_page_token="ghi", + versions=[], + next_page_token="def", + ), + version.ListVersionsResponse( + versions=[ + version.Version(), + ], + next_page_token="ghi", ), version.ListVersionsResponse( - versions=[version.Version(), version.Version(),], + versions=[ + version.Version(), + version.Version(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_versions(request={})).pages: + async for page_ in ( + await client.list_versions(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [version.GetVersionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + version.GetVersionRequest, + dict, + ], +) def test_get_version(request_type, transport: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -966,7 +1088,8 @@ def test_get_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -982,7 +1105,8 @@ async def test_get_version_async( transport: str = "grpc_asyncio", request_type=version.GetVersionRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1021,13 +1145,15 @@ async def test_get_version_async_from_dict(): def test_get_version_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.GetVersionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_version), "__call__") as call: @@ -1041,18 +1167,23 @@ def test_get_version_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_version_field_headers_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.GetVersionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_version), "__call__") as call: @@ -1066,11 +1197,16 @@ async def test_get_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_version_flattened(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_version), "__call__") as call: @@ -1078,7 +1214,9 @@ def test_get_version_flattened(): call.return_value = version.Version() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_version(name="name_value",) + client.get_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1090,19 +1228,24 @@ def test_get_version_flattened(): def test_get_version_flattened_error(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_version( - version.GetVersionRequest(), name="name_value", + version.GetVersionRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_version_flattened_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_version), "__call__") as call: @@ -1112,7 +1255,9 @@ async def test_get_version_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(version.Version()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_version(name="name_value",) + response = await client.get_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1125,20 +1270,30 @@ async def test_get_version_flattened_async(): @pytest.mark.asyncio async def test_get_version_flattened_error_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_version( - version.GetVersionRequest(), name="name_value", + version.GetVersionRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [gcdc_version.CreateVersionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_version.CreateVersionRequest, + dict, + ], +) def test_create_version(request_type, transport: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1164,7 +1319,8 @@ def test_create_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1180,7 +1336,8 @@ async def test_create_version_async( transport: str = "grpc_asyncio", request_type=gcdc_version.CreateVersionRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1210,13 +1367,15 @@ async def test_create_version_async_from_dict(): def test_create_version_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_version.CreateVersionRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_version), "__call__") as call: @@ -1230,18 +1389,23 @@ def test_create_version_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_version_field_headers_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_version.CreateVersionRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_version), "__call__") as call: @@ -1257,11 +1421,16 @@ async def test_create_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_version_flattened(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_version), "__call__") as call: @@ -1270,7 +1439,8 @@ def test_create_version_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_version( - parent="parent_value", version=gcdc_version.Version(name="name_value"), + parent="parent_value", + version=gcdc_version.Version(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1286,7 +1456,9 @@ def test_create_version_flattened(): def test_create_version_flattened_error(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1300,7 +1472,9 @@ def test_create_version_flattened_error(): @pytest.mark.asyncio async def test_create_version_flattened_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_version), "__call__") as call: @@ -1313,7 +1487,8 @@ async def test_create_version_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_version( - parent="parent_value", version=gcdc_version.Version(name="name_value"), + parent="parent_value", + version=gcdc_version.Version(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1330,7 +1505,9 @@ async def test_create_version_flattened_async(): @pytest.mark.asyncio async def test_create_version_flattened_error_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1342,10 +1519,17 @@ async def test_create_version_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [gcdc_version.UpdateVersionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_version.UpdateVersionRequest, + dict, + ], +) def test_update_version(request_type, transport: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1380,7 +1564,8 @@ def test_update_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1396,7 +1581,8 @@ async def test_update_version_async( transport: str = "grpc_asyncio", request_type=gcdc_version.UpdateVersionRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1435,13 +1621,15 @@ async def test_update_version_async_from_dict(): def test_update_version_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_version.UpdateVersionRequest() - request.version.name = "version.name/value" + request.version.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_version), "__call__") as call: @@ -1455,20 +1643,23 @@ def test_update_version_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "version.name=version.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "version.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_version_field_headers_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_version.UpdateVersionRequest() - request.version.name = "version.name/value" + request.version.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_version), "__call__") as call: @@ -1484,13 +1675,16 @@ async def test_update_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "version.name=version.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "version.name=name_value", + ) in kw["metadata"] def test_update_version_flattened(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_version), "__call__") as call: @@ -1516,7 +1710,9 @@ def test_update_version_flattened(): def test_update_version_flattened_error(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1530,7 +1726,9 @@ def test_update_version_flattened_error(): @pytest.mark.asyncio async def test_update_version_flattened_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_version), "__call__") as call: @@ -1561,7 +1759,9 @@ async def test_update_version_flattened_async(): @pytest.mark.asyncio async def test_update_version_flattened_error_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1573,10 +1773,17 @@ async def test_update_version_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [version.DeleteVersionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + version.DeleteVersionRequest, + dict, + ], +) def test_delete_version(request_type, transport: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1602,7 +1809,8 @@ def test_delete_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1618,7 +1826,8 @@ async def test_delete_version_async( transport: str = "grpc_asyncio", request_type=version.DeleteVersionRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1646,13 +1855,15 @@ async def test_delete_version_async_from_dict(): def test_delete_version_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.DeleteVersionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_version), "__call__") as call: @@ -1666,18 +1877,23 @@ def test_delete_version_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_version_field_headers_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.DeleteVersionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_version), "__call__") as call: @@ -1691,11 +1907,16 @@ async def test_delete_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_version_flattened(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_version), "__call__") as call: @@ -1703,7 +1924,9 @@ def test_delete_version_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_version(name="name_value",) + client.delete_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1715,19 +1938,24 @@ def test_delete_version_flattened(): def test_delete_version_flattened_error(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_version( - version.DeleteVersionRequest(), name="name_value", + version.DeleteVersionRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_version_flattened_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_version), "__call__") as call: @@ -1737,7 +1965,9 @@ async def test_delete_version_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_version(name="name_value",) + response = await client.delete_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1750,20 +1980,30 @@ async def test_delete_version_flattened_async(): @pytest.mark.asyncio async def test_delete_version_flattened_error_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_version( - version.DeleteVersionRequest(), name="name_value", + version.DeleteVersionRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [version.LoadVersionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + version.LoadVersionRequest, + dict, + ], +) def test_load_version(request_type, transport: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1789,7 +2029,8 @@ def test_load_version_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1805,7 +2046,8 @@ async def test_load_version_async( transport: str = "grpc_asyncio", request_type=version.LoadVersionRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1835,13 +2077,15 @@ async def test_load_version_async_from_dict(): def test_load_version_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.LoadVersionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.load_version), "__call__") as call: @@ -1855,18 +2099,23 @@ def test_load_version_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_load_version_field_headers_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.LoadVersionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.load_version), "__call__") as call: @@ -1882,11 +2131,16 @@ async def test_load_version_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_load_version_flattened(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.load_version), "__call__") as call: @@ -1894,7 +2148,9 @@ def test_load_version_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.load_version(name="name_value",) + client.load_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1906,19 +2162,24 @@ def test_load_version_flattened(): def test_load_version_flattened_error(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.load_version( - version.LoadVersionRequest(), name="name_value", + version.LoadVersionRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_load_version_flattened_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.load_version), "__call__") as call: @@ -1930,7 +2191,9 @@ async def test_load_version_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.load_version(name="name_value",) + response = await client.load_version( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1943,20 +2206,30 @@ async def test_load_version_flattened_async(): @pytest.mark.asyncio async def test_load_version_flattened_error_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.load_version( - version.LoadVersionRequest(), name="name_value", + version.LoadVersionRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [version.CompareVersionsRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + version.CompareVersionsRequest, + dict, + ], +) def test_compare_versions(request_type, transport: str = "grpc"): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1987,7 +2260,8 @@ def test_compare_versions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2003,7 +2277,8 @@ async def test_compare_versions_async( transport: str = "grpc_asyncio", request_type=version.CompareVersionsRequest ): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2038,13 +2313,15 @@ async def test_compare_versions_async_from_dict(): def test_compare_versions_field_headers(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.CompareVersionsRequest() - request.base_version = "base_version/value" + request.base_version = "base_version_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.compare_versions), "__call__") as call: @@ -2058,20 +2335,23 @@ def test_compare_versions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "base_version=base_version/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "base_version=base_version_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_compare_versions_field_headers_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = version.CompareVersionsRequest() - request.base_version = "base_version/value" + request.base_version = "base_version_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.compare_versions), "__call__") as call: @@ -2087,13 +2367,16 @@ async def test_compare_versions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "base_version=base_version/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "base_version=base_version_value", + ) in kw["metadata"] def test_compare_versions_flattened(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.compare_versions), "__call__") as call: @@ -2101,7 +2384,9 @@ def test_compare_versions_flattened(): call.return_value = version.CompareVersionsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.compare_versions(base_version="base_version_value",) + client.compare_versions( + base_version="base_version_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2113,19 +2398,24 @@ def test_compare_versions_flattened(): def test_compare_versions_flattened_error(): - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.compare_versions( - version.CompareVersionsRequest(), base_version="base_version_value", + version.CompareVersionsRequest(), + base_version="base_version_value", ) @pytest.mark.asyncio async def test_compare_versions_flattened_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.compare_versions), "__call__") as call: @@ -2137,7 +2427,9 @@ async def test_compare_versions_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.compare_versions(base_version="base_version_value",) + response = await client.compare_versions( + base_version="base_version_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2150,13 +2442,16 @@ async def test_compare_versions_flattened_async(): @pytest.mark.asyncio async def test_compare_versions_flattened_error_async(): - client = VersionsAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = VersionsAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.compare_versions( - version.CompareVersionsRequest(), base_version="base_version_value", + version.CompareVersionsRequest(), + base_version="base_version_value", ) @@ -2167,7 +2462,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -2187,7 +2483,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = VersionsClient(client_options=options, transport=transport,) + client = VersionsClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -2203,7 +2502,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = VersionsClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -2233,7 +2533,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.VersionsGrpcTransport, transports.VersionsGrpcAsyncIOTransport,], + [ + transports.VersionsGrpcTransport, + transports.VersionsGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2243,10 +2546,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = VersionsClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = VersionsClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.VersionsGrpcTransport,) + client = VersionsClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.VersionsGrpcTransport, + ) def test_versions_base_transport_error(): @@ -2291,6 +2612,14 @@ def test_versions_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_versions_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -2302,7 +2631,8 @@ def test_versions_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.VersionsTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2343,7 +2673,10 @@ def test_versions_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.VersionsGrpcTransport, transports.VersionsGrpcAsyncIOTransport,], + [ + transports.VersionsGrpcTransport, + transports.VersionsGrpcAsyncIOTransport, + ], ) def test_versions_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2441,24 +2774,40 @@ def test_versions_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_versions_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_versions_host_no_port(transport_name): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_versions_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_versions_host_with_port(transport_name): client = VersionsClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_versions_grpc_transport_channel(): @@ -2466,7 +2815,8 @@ def test_versions_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.VersionsGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2478,7 +2828,8 @@ def test_versions_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.VersionsGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2579,12 +2930,16 @@ def test_versions_transport_channel_mtls_with_adc(transport_class): def test_versions_grpc_lro_client(): client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2592,12 +2947,16 @@ def test_versions_grpc_lro_client(): def test_versions_grpc_lro_async_client(): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -2610,7 +2969,11 @@ def test_version_path(): flow = "octopus" version = "oyster" expected = "projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}".format( - project=project, location=location, agent=agent, flow=flow, version=version, + project=project, + location=location, + agent=agent, + flow=flow, + version=version, ) actual = VersionsClient.version_path(project, location, agent, flow, version) assert expected == actual @@ -2653,7 +3016,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "squid" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = VersionsClient.common_folder_path(folder) assert expected == actual @@ -2671,7 +3036,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "whelk" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = VersionsClient.common_organization_path(organization) assert expected == actual @@ -2689,7 +3056,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "oyster" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = VersionsClient.common_project_path(project) assert expected == actual @@ -2709,7 +3078,8 @@ def test_common_location_path(): project = "cuttlefish" location = "mussel" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = VersionsClient.common_location_path(project, location) assert expected == actual @@ -2734,7 +3104,8 @@ def test_client_with_default_client_info(): transports.VersionsTransport, "_prep_wrapped_messages" ) as prep: client = VersionsClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2743,7 +3114,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = VersionsClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2751,7 +3123,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = VersionsAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dialogflowcx_v3beta1/test_webhooks.py b/tests/unit/gapic/dialogflowcx_v3beta1/test_webhooks.py index 25d94094..b263e238 100644 --- a/tests/unit/gapic/dialogflowcx_v3beta1/test_webhooks.py +++ b/tests/unit/gapic/dialogflowcx_v3beta1/test_webhooks.py @@ -82,19 +82,25 @@ def test__get_default_mtls_endpoint(): assert WebhooksClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [WebhooksClient, WebhooksAsyncClient,]) -def test_webhooks_client_from_service_account_info(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (WebhooksClient, "grpc"), + (WebhooksAsyncClient, "grpc_asyncio"), + ], +) +def test_webhooks_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") @pytest.mark.parametrize( @@ -122,22 +128,32 @@ def test_webhooks_client_service_account_always_use_jwt( use_jwt.assert_not_called() -@pytest.mark.parametrize("client_class", [WebhooksClient, WebhooksAsyncClient,]) -def test_webhooks_client_from_service_account_file(client_class): +@pytest.mark.parametrize( + "client_class,transport_name", + [ + (WebhooksClient, "grpc"), + (WebhooksAsyncClient, "grpc_asyncio"), + ], +) +def test_webhooks_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") def test_webhooks_client_get_transport_class(): @@ -467,7 +483,9 @@ def test_webhooks_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -598,10 +616,17 @@ def test_webhooks_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [webhook.ListWebhooksRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + webhook.ListWebhooksRequest, + dict, + ], +) def test_list_webhooks(request_type, transport: str = "grpc"): client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -630,7 +655,8 @@ def test_list_webhooks_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -646,7 +672,8 @@ async def test_list_webhooks_async( transport: str = "grpc_asyncio", request_type=webhook.ListWebhooksRequest ): client = WebhooksAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -657,7 +684,9 @@ async def test_list_webhooks_async( with mock.patch.object(type(client.transport.list_webhooks), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - webhook.ListWebhooksResponse(next_page_token="next_page_token_value",) + webhook.ListWebhooksResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_webhooks(request) @@ -677,13 +706,15 @@ async def test_list_webhooks_async_from_dict(): def test_list_webhooks_field_headers(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = webhook.ListWebhooksRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_webhooks), "__call__") as call: @@ -697,18 +728,23 @@ def test_list_webhooks_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_list_webhooks_field_headers_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = webhook.ListWebhooksRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_webhooks), "__call__") as call: @@ -724,11 +760,16 @@ async def test_list_webhooks_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_webhooks_flattened(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_webhooks), "__call__") as call: @@ -736,7 +777,9 @@ def test_list_webhooks_flattened(): call.return_value = webhook.ListWebhooksResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_webhooks(parent="parent_value",) + client.list_webhooks( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -748,19 +791,24 @@ def test_list_webhooks_flattened(): def test_list_webhooks_flattened_error(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_webhooks( - webhook.ListWebhooksRequest(), parent="parent_value", + webhook.ListWebhooksRequest(), + parent="parent_value", ) @pytest.mark.asyncio async def test_list_webhooks_flattened_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_webhooks), "__call__") as call: @@ -772,7 +820,9 @@ async def test_list_webhooks_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_webhooks(parent="parent_value",) + response = await client.list_webhooks( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -785,19 +835,23 @@ async def test_list_webhooks_flattened_async(): @pytest.mark.asyncio async def test_list_webhooks_flattened_error_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.list_webhooks( - webhook.ListWebhooksRequest(), parent="parent_value", + webhook.ListWebhooksRequest(), + parent="parent_value", ) def test_list_webhooks_pager(transport_name: str = "grpc"): client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -805,15 +859,28 @@ def test_list_webhooks_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(), webhook.Webhook(), webhook.Webhook(),], + webhooks=[ + webhook.Webhook(), + webhook.Webhook(), + webhook.Webhook(), + ], next_page_token="abc", ), - webhook.ListWebhooksResponse(webhooks=[], next_page_token="def",), webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(),], next_page_token="ghi", + webhooks=[], + next_page_token="def", + ), + webhook.ListWebhooksResponse( + webhooks=[ + webhook.Webhook(), + ], + next_page_token="ghi", ), webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(), webhook.Webhook(),], + webhooks=[ + webhook.Webhook(), + webhook.Webhook(), + ], ), RuntimeError, ) @@ -826,14 +893,15 @@ def test_list_webhooks_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, webhook.Webhook) for i in results) def test_list_webhooks_pages(transport_name: str = "grpc"): client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -841,15 +909,28 @@ def test_list_webhooks_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(), webhook.Webhook(), webhook.Webhook(),], + webhooks=[ + webhook.Webhook(), + webhook.Webhook(), + webhook.Webhook(), + ], next_page_token="abc", ), - webhook.ListWebhooksResponse(webhooks=[], next_page_token="def",), webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(),], next_page_token="ghi", + webhooks=[], + next_page_token="def", ), webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(), webhook.Webhook(),], + webhooks=[ + webhook.Webhook(), + ], + next_page_token="ghi", + ), + webhook.ListWebhooksResponse( + webhooks=[ + webhook.Webhook(), + webhook.Webhook(), + ], ), RuntimeError, ) @@ -860,7 +941,9 @@ def test_list_webhooks_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_webhooks_async_pager(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -869,22 +952,37 @@ async def test_list_webhooks_async_pager(): # Set the response to a series of pages. call.side_effect = ( webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(), webhook.Webhook(), webhook.Webhook(),], + webhooks=[ + webhook.Webhook(), + webhook.Webhook(), + webhook.Webhook(), + ], next_page_token="abc", ), - webhook.ListWebhooksResponse(webhooks=[], next_page_token="def",), webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(),], next_page_token="ghi", + webhooks=[], + next_page_token="def", + ), + webhook.ListWebhooksResponse( + webhooks=[ + webhook.Webhook(), + ], + next_page_token="ghi", ), webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(), webhook.Webhook(),], + webhooks=[ + webhook.Webhook(), + webhook.Webhook(), + ], ), RuntimeError, ) - async_pager = await client.list_webhooks(request={},) + async_pager = await client.list_webhooks( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -893,7 +991,9 @@ async def test_list_webhooks_async_pager(): @pytest.mark.asyncio async def test_list_webhooks_async_pages(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -902,29 +1002,51 @@ async def test_list_webhooks_async_pages(): # Set the response to a series of pages. call.side_effect = ( webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(), webhook.Webhook(), webhook.Webhook(),], + webhooks=[ + webhook.Webhook(), + webhook.Webhook(), + webhook.Webhook(), + ], next_page_token="abc", ), - webhook.ListWebhooksResponse(webhooks=[], next_page_token="def",), webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(),], next_page_token="ghi", + webhooks=[], + next_page_token="def", + ), + webhook.ListWebhooksResponse( + webhooks=[ + webhook.Webhook(), + ], + next_page_token="ghi", ), webhook.ListWebhooksResponse( - webhooks=[webhook.Webhook(), webhook.Webhook(),], + webhooks=[ + webhook.Webhook(), + webhook.Webhook(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_webhooks(request={})).pages: + async for page_ in ( + await client.list_webhooks(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [webhook.GetWebhookRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + webhook.GetWebhookRequest, + dict, + ], +) def test_get_webhook(request_type, transport: str = "grpc"): client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -958,7 +1080,8 @@ def test_get_webhook_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -974,7 +1097,8 @@ async def test_get_webhook_async( transport: str = "grpc_asyncio", request_type=webhook.GetWebhookRequest ): client = WebhooksAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -986,7 +1110,9 @@ async def test_get_webhook_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( webhook.Webhook( - name="name_value", display_name="display_name_value", disabled=True, + name="name_value", + display_name="display_name_value", + disabled=True, ) ) response = await client.get_webhook(request) @@ -1009,13 +1135,15 @@ async def test_get_webhook_async_from_dict(): def test_get_webhook_field_headers(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = webhook.GetWebhookRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_webhook), "__call__") as call: @@ -1029,18 +1157,23 @@ def test_get_webhook_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_get_webhook_field_headers_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = webhook.GetWebhookRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_webhook), "__call__") as call: @@ -1054,11 +1187,16 @@ async def test_get_webhook_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_webhook_flattened(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_webhook), "__call__") as call: @@ -1066,7 +1204,9 @@ def test_get_webhook_flattened(): call.return_value = webhook.Webhook() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_webhook(name="name_value",) + client.get_webhook( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1078,19 +1218,24 @@ def test_get_webhook_flattened(): def test_get_webhook_flattened_error(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_webhook( - webhook.GetWebhookRequest(), name="name_value", + webhook.GetWebhookRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_get_webhook_flattened_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_webhook), "__call__") as call: @@ -1100,7 +1245,9 @@ async def test_get_webhook_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(webhook.Webhook()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_webhook(name="name_value",) + response = await client.get_webhook( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1113,20 +1260,30 @@ async def test_get_webhook_flattened_async(): @pytest.mark.asyncio async def test_get_webhook_flattened_error_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.get_webhook( - webhook.GetWebhookRequest(), name="name_value", + webhook.GetWebhookRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [gcdc_webhook.CreateWebhookRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_webhook.CreateWebhookRequest, + dict, + ], +) def test_create_webhook(request_type, transport: str = "grpc"): client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1160,7 +1317,8 @@ def test_create_webhook_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1176,7 +1334,8 @@ async def test_create_webhook_async( transport: str = "grpc_asyncio", request_type=gcdc_webhook.CreateWebhookRequest ): client = WebhooksAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1188,7 +1347,9 @@ async def test_create_webhook_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( gcdc_webhook.Webhook( - name="name_value", display_name="display_name_value", disabled=True, + name="name_value", + display_name="display_name_value", + disabled=True, ) ) response = await client.create_webhook(request) @@ -1211,13 +1372,15 @@ async def test_create_webhook_async_from_dict(): def test_create_webhook_field_headers(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_webhook.CreateWebhookRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_webhook), "__call__") as call: @@ -1231,18 +1394,23 @@ def test_create_webhook_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_create_webhook_field_headers_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_webhook.CreateWebhookRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_webhook), "__call__") as call: @@ -1258,11 +1426,16 @@ async def test_create_webhook_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_webhook_flattened(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_webhook), "__call__") as call: @@ -1271,7 +1444,8 @@ def test_create_webhook_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_webhook( - parent="parent_value", webhook=gcdc_webhook.Webhook(name="name_value"), + parent="parent_value", + webhook=gcdc_webhook.Webhook(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1287,7 +1461,9 @@ def test_create_webhook_flattened(): def test_create_webhook_flattened_error(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1301,7 +1477,9 @@ def test_create_webhook_flattened_error(): @pytest.mark.asyncio async def test_create_webhook_flattened_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_webhook), "__call__") as call: @@ -1314,7 +1492,8 @@ async def test_create_webhook_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_webhook( - parent="parent_value", webhook=gcdc_webhook.Webhook(name="name_value"), + parent="parent_value", + webhook=gcdc_webhook.Webhook(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1331,7 +1510,9 @@ async def test_create_webhook_flattened_async(): @pytest.mark.asyncio async def test_create_webhook_flattened_error_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1343,10 +1524,17 @@ async def test_create_webhook_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [gcdc_webhook.UpdateWebhookRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + gcdc_webhook.UpdateWebhookRequest, + dict, + ], +) def test_update_webhook(request_type, transport: str = "grpc"): client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1380,7 +1568,8 @@ def test_update_webhook_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1396,7 +1585,8 @@ async def test_update_webhook_async( transport: str = "grpc_asyncio", request_type=gcdc_webhook.UpdateWebhookRequest ): client = WebhooksAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1408,7 +1598,9 @@ async def test_update_webhook_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( gcdc_webhook.Webhook( - name="name_value", display_name="display_name_value", disabled=True, + name="name_value", + display_name="display_name_value", + disabled=True, ) ) response = await client.update_webhook(request) @@ -1431,13 +1623,15 @@ async def test_update_webhook_async_from_dict(): def test_update_webhook_field_headers(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_webhook.UpdateWebhookRequest() - request.webhook.name = "webhook.name/value" + request.webhook.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_webhook), "__call__") as call: @@ -1451,20 +1645,23 @@ def test_update_webhook_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "webhook.name=webhook.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "webhook.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_update_webhook_field_headers_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcdc_webhook.UpdateWebhookRequest() - request.webhook.name = "webhook.name/value" + request.webhook.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_webhook), "__call__") as call: @@ -1480,13 +1677,16 @@ async def test_update_webhook_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "webhook.name=webhook.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "webhook.name=name_value", + ) in kw["metadata"] def test_update_webhook_flattened(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_webhook), "__call__") as call: @@ -1512,7 +1712,9 @@ def test_update_webhook_flattened(): def test_update_webhook_flattened_error(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1526,7 +1728,9 @@ def test_update_webhook_flattened_error(): @pytest.mark.asyncio async def test_update_webhook_flattened_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_webhook), "__call__") as call: @@ -1557,7 +1761,9 @@ async def test_update_webhook_flattened_async(): @pytest.mark.asyncio async def test_update_webhook_flattened_error_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1569,10 +1775,17 @@ async def test_update_webhook_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [webhook.DeleteWebhookRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + webhook.DeleteWebhookRequest, + dict, + ], +) def test_delete_webhook(request_type, transport: str = "grpc"): client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1598,7 +1811,8 @@ def test_delete_webhook_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1614,7 +1828,8 @@ async def test_delete_webhook_async( transport: str = "grpc_asyncio", request_type=webhook.DeleteWebhookRequest ): client = WebhooksAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1642,13 +1857,15 @@ async def test_delete_webhook_async_from_dict(): def test_delete_webhook_field_headers(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = webhook.DeleteWebhookRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_webhook), "__call__") as call: @@ -1662,18 +1879,23 @@ def test_delete_webhook_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio async def test_delete_webhook_field_headers_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = webhook.DeleteWebhookRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_webhook), "__call__") as call: @@ -1687,11 +1909,16 @@ async def test_delete_webhook_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_webhook_flattened(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_webhook), "__call__") as call: @@ -1699,7 +1926,9 @@ def test_delete_webhook_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_webhook(name="name_value",) + client.delete_webhook( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1711,19 +1940,24 @@ def test_delete_webhook_flattened(): def test_delete_webhook_flattened_error(): - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_webhook( - webhook.DeleteWebhookRequest(), name="name_value", + webhook.DeleteWebhookRequest(), + name="name_value", ) @pytest.mark.asyncio async def test_delete_webhook_flattened_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_webhook), "__call__") as call: @@ -1733,7 +1967,9 @@ async def test_delete_webhook_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_webhook(name="name_value",) + response = await client.delete_webhook( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1746,13 +1982,16 @@ async def test_delete_webhook_flattened_async(): @pytest.mark.asyncio async def test_delete_webhook_flattened_error_async(): - client = WebhooksAsyncClient(credentials=ga_credentials.AnonymousCredentials(),) + client = WebhooksAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): await client.delete_webhook( - webhook.DeleteWebhookRequest(), name="name_value", + webhook.DeleteWebhookRequest(), + name="name_value", ) @@ -1763,7 +2002,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1783,7 +2023,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = WebhooksClient(client_options=options, transport=transport,) + client = WebhooksClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1799,7 +2042,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = WebhooksClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1829,7 +2073,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.WebhooksGrpcTransport, transports.WebhooksGrpcAsyncIOTransport,], + [ + transports.WebhooksGrpcTransport, + transports.WebhooksGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1839,10 +2086,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = WebhooksClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = WebhooksClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.WebhooksGrpcTransport,) + client = WebhooksClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.WebhooksGrpcTransport, + ) def test_webhooks_base_transport_error(): @@ -1880,6 +2145,14 @@ def test_webhooks_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_webhooks_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1891,7 +2164,8 @@ def test_webhooks_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.WebhooksTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1932,7 +2206,10 @@ def test_webhooks_auth_adc(): @pytest.mark.parametrize( "transport_class", - [transports.WebhooksGrpcTransport, transports.WebhooksGrpcAsyncIOTransport,], + [ + transports.WebhooksGrpcTransport, + transports.WebhooksGrpcAsyncIOTransport, + ], ) def test_webhooks_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use @@ -2030,24 +2307,40 @@ def test_webhooks_grpc_transport_client_cert_source_for_mtls(transport_class): ) -def test_webhooks_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_webhooks_host_no_port(transport_name): client = WebhooksClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:443" + assert client.transport._host == ("dialogflow.googleapis.com:443") -def test_webhooks_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_webhooks_host_with_port(transport_name): client = WebhooksClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dialogflow.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dialogflow.googleapis.com:8000" + assert client.transport._host == ("dialogflow.googleapis.com:8000") def test_webhooks_grpc_transport_channel(): @@ -2055,7 +2348,8 @@ def test_webhooks_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.WebhooksGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2067,7 +2361,8 @@ def test_webhooks_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.WebhooksGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2172,7 +2467,10 @@ def test_service_path(): namespace = "whelk" service = "octopus" expected = "projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}".format( - project=project, location=location, namespace=namespace, service=service, + project=project, + location=location, + namespace=namespace, + service=service, ) actual = WebhooksClient.service_path(project, location, namespace, service) assert expected == actual @@ -2198,7 +2496,10 @@ def test_webhook_path(): agent = "scallop" webhook = "abalone" expected = "projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}".format( - project=project, location=location, agent=agent, webhook=webhook, + project=project, + location=location, + agent=agent, + webhook=webhook, ) actual = WebhooksClient.webhook_path(project, location, agent, webhook) assert expected == actual @@ -2240,7 +2541,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "cuttlefish" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = WebhooksClient.common_folder_path(folder) assert expected == actual @@ -2258,7 +2561,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "winkle" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = WebhooksClient.common_organization_path(organization) assert expected == actual @@ -2276,7 +2581,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "scallop" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = WebhooksClient.common_project_path(project) assert expected == actual @@ -2296,7 +2603,8 @@ def test_common_location_path(): project = "squid" location = "clam" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = WebhooksClient.common_location_path(project, location) assert expected == actual @@ -2321,7 +2629,8 @@ def test_client_with_default_client_info(): transports.WebhooksTransport, "_prep_wrapped_messages" ) as prep: client = WebhooksClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2330,7 +2639,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = WebhooksClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2338,7 +2648,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = WebhooksAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close"